Interactive 2D wave optics simulator. Turn any image into a refractive scene, add sources, watch waves refract, diffract and interfere. Probes, intensity maps, video export.
C#
Rebrand, first step: the old sources go, the new icon and LICENSE.md come
Alexander Graefe4f272c31fba
diff --git a/2D_wave_sim_V01/2D_wave_sim_V01.vbproj b/2D_wave_sim_V01/2D_wave_sim_V01.vbprojdeleted file mode 100644index b4d8b65..0000000--- a/2D_wave_sim_V01/2D_wave_sim_V01.vbproj+++ /dev/null@@ -1,258 +0,0 @@-<?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>{BF62C6CF-8723-482A-A1E9-784946CFD426}</ProjectGuid>- <OutputType>WinExe</OutputType>- <StartupObject>_2D_wave_sim_V01.My.MyApplication</StartupObject>- <RootNamespace>_2D_wave_sim_V01</RootNamespace>- <AssemblyName>Wave_Dude_2D</AssemblyName>- <FileAlignment>512</FileAlignment>- <MyType>WindowsForms</MyType>- <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>- <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>- <Deterministic>true</Deterministic>- <ApplicationIcon>AppIcon.ico</ApplicationIcon>- <IsWebBootstrapper>false</IsWebBootstrapper>- <PublishUrl>C:\Users\jeroen\Desktop\2D_wave_sim_install_V0.29\</PublishUrl>- <Install>true</Install>- <InstallFrom>Disk</InstallFrom>- <UpdateEnabled>false</UpdateEnabled>- <UpdateMode>Foreground</UpdateMode>- <UpdateInterval>7</UpdateInterval>- <UpdateIntervalUnits>Days</UpdateIntervalUnits>- <UpdatePeriodically>false</UpdatePeriodically>- <UpdateRequired>false</UpdateRequired>- <MapFileExtensions>true</MapFileExtensions>- <ApplicationRevision>18</ApplicationRevision>- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>- <UseApplicationTrust>false</UseApplicationTrust>- <PublishWizardCompleted>true</PublishWizardCompleted>- <BootstrapperEnabled>true</BootstrapperEnabled>- </PropertyGroup>- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">- <PlatformTarget>AnyCPU</PlatformTarget>- <DebugSymbols>true</DebugSymbols>- <DebugType>full</DebugType>- <DefineDebug>true</DefineDebug>- <DefineTrace>true</DefineTrace>- <OutputPath>bin\Debug\</OutputPath>- <DocumentationFile>2D_wave_sim_V01.xml</DocumentationFile>- <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>- </PropertyGroup>- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">- <PlatformTarget>AnyCPU</PlatformTarget>- <DebugType>pdbonly</DebugType>- <DefineDebug>false</DefineDebug>- <DefineTrace>true</DefineTrace>- <Optimize>true</Optimize>- <OutputPath>bin\Release\</OutputPath>- <DocumentationFile>2D_wave_sim_V01.xml</DocumentationFile>- <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>- </PropertyGroup>- <PropertyGroup>- <OptionExplicit>On</OptionExplicit>- </PropertyGroup>- <PropertyGroup>- <OptionCompare>Binary</OptionCompare>- </PropertyGroup>- <PropertyGroup>- <OptionStrict>Off</OptionStrict>- </PropertyGroup>- <PropertyGroup>- <OptionInfer>On</OptionInfer>- </PropertyGroup>- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">- <DebugSymbols>true</DebugSymbols>- <DefineDebug>true</DefineDebug>- <DefineTrace>true</DefineTrace>- <OutputPath>bin\x64\Debug\</OutputPath>- <DocumentationFile>2D_wave_sim_V01.xml</DocumentationFile>- <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>- <DebugType>full</DebugType>- <PlatformTarget>x64</PlatformTarget>- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>- <Prefer32Bit>true</Prefer32Bit>- </PropertyGroup>- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">- <DefineTrace>true</DefineTrace>- <OutputPath>bin\x64\Release\</OutputPath>- <DocumentationFile>2D_wave_sim_V01.xml</DocumentationFile>- <Optimize>true</Optimize>- <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>- <DebugType>pdbonly</DebugType>- <PlatformTarget>x64</PlatformTarget>- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>- <Prefer32Bit>true</Prefer32Bit>- </PropertyGroup>- <PropertyGroup>- <ManifestCertificateThumbprint>6634F0CF201CA929A2D7FF58A91110314D7C750F</ManifestCertificateThumbprint>- </PropertyGroup>- <PropertyGroup>- <ManifestKeyFile>2D_wave_sim_V01_TemporaryKey.pfx</ManifestKeyFile>- </PropertyGroup>- <PropertyGroup>- <GenerateManifests>true</GenerateManifests>- </PropertyGroup>- <PropertyGroup>- <SignManifests>true</SignManifests>- </PropertyGroup>- <ItemGroup>- <Reference Include="System" />- <Reference Include="System.Data" />- <Reference Include="System.Deployment" />- <Reference Include="System.Drawing" />- <Reference Include="System.Windows.Forms" />- <Reference Include="System.Xml" />- <Reference Include="System.Core" />- <Reference Include="System.Xml.Linq" />- <Reference Include="System.Data.DataSetExtensions" />- <Reference Include="System.Net.Http" />- <Reference Include="System.Web.Extensions" />- </ItemGroup>- <ItemGroup>- <Import Include="Microsoft.VisualBasic" />- <Import Include="System" />- <Import Include="System.Collections" />- <Import Include="System.Collections.Generic" />- <Import Include="System.Data" />- <Import Include="System.Drawing" />- <Import Include="System.Diagnostics" />- <Import Include="System.Windows.Forms" />- <Import Include="System.Linq" />- <Import Include="System.Xml.Linq" />- <Import Include="System.Threading.Tasks" />- </ItemGroup>- <ItemGroup>- <Compile Include="Form1.vb">- <SubType>Form</SubType>- </Compile>- <Compile Include="Form1.Designer.vb">- <DependentUpon>Form1.vb</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="Form1.Probes.vb">- <DependentUpon>Form1.vb</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="Form1.Source.vb">- <DependentUpon>Form1.vb</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="HelpForm.vb">- <SubType>Form</SubType>- </Compile>- <Compile Include="HelpForm.Designer.vb">- <DependentUpon>HelpForm.vb</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="AboutForm.vb">- <SubType>Form</SubType>- </Compile>- <Compile Include="AboutForm.Designer.vb">- <DependentUpon>AboutForm.vb</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="ColorSchemes\ColorScheme.vb" />- <Compile Include="ColorSchemes\ColorSchemeStore.vb" />- <Compile Include="ColorSchemes\ColorLut.vb" />- <Compile Include="ColorSchemes\ColorPickerControl.vb" />- <Compile Include="Projects\AppSettings.vb" />- <Compile Include="frmDescription.Designer.vb">- <DependentUpon>frmDescription.vb</DependentUpon>- </Compile>- <Compile Include="frmDescription.vb">- <SubType>Form</SubType>- </Compile>- <Compile Include="Projects\Project.vb" />- <Compile Include="Projects\ProjectConfig.vb" />- <Compile Include="Projects\ProjectStore.vb" />- <Compile Include="Projects\SceneSettings.vb" />- <Compile Include="Simulation\SimulationSettings.vb" />- <Compile Include="Simulation\SceneData.vb" />- <Compile Include="Simulation\IWaveEngine.vb" />- <Compile Include="Simulation\WaveSimulator.vb" />- <Compile Include="Simulation\OpenClApi.vb" />- <Compile Include="Simulation\GpuWaveSimulator.vb" />- <Compile Include="Simulation\FrameRenderer.vb" />- <Compile Include="Simulation\AviMjpegWriter.vb" />- <Compile Include="Simulation\FrameSink.vb" />- <Compile Include="Simulation\MfVideoWriter.vb" />- <Compile Include="Simulation\ProbeSettings.vb" />- <Compile Include="Simulation\ProbeSampling.vb" />- <Compile Include="Simulation\ProbeGraphPainter.vb" />- <Compile Include="Simulation\SourceSettings.vb" />- <Compile Include="Simulation\SimulationRunner.vb" />- <Compile Include="My Project\AssemblyInfo.vb" />- <Compile Include="My Project\Application.Designer.vb">- <AutoGen>True</AutoGen>- <DependentUpon>Application.myapp</DependentUpon>- </Compile>- <Compile Include="My Project\Resources.Designer.vb">- <AutoGen>True</AutoGen>- <DesignTime>True</DesignTime>- <DependentUpon>Resources.resx</DependentUpon>- </Compile>- <Compile Include="My Project\Settings.Designer.vb">- <AutoGen>True</AutoGen>- <DependentUpon>Settings.settings</DependentUpon>- <DesignTimeSharedInput>True</DesignTimeSharedInput>- </Compile>- </ItemGroup>- <ItemGroup>- <EmbeddedResource Include="AboutForm.resx">- <DependentUpon>AboutForm.vb</DependentUpon>- </EmbeddedResource>- <EmbeddedResource Include="Form1.resx">- <DependentUpon>Form1.vb</DependentUpon>- </EmbeddedResource>- <EmbeddedResource Include="frmDescription.resx">- <DependentUpon>frmDescription.vb</DependentUpon>- </EmbeddedResource>- <EmbeddedResource Include="HelpForm.resx">- <DependentUpon>HelpForm.vb</DependentUpon>- </EmbeddedResource>- <EmbeddedResource Include="My Project\Resources.resx">- <Generator>VbMyResourcesResXFileCodeGenerator</Generator>- <LastGenOutput>Resources.Designer.vb</LastGenOutput>- <CustomToolNamespace>My.Resources</CustomToolNamespace>- <SubType>Designer</SubType>- </EmbeddedResource>- </ItemGroup>- <ItemGroup>- <None Include="AppIcon.ico" />- <None Include="2D_wave_sim_V01_TemporaryKey.pfx" />- <None Include="My Project\Application.myapp">- <Generator>MyApplicationCodeGenerator</Generator>- <LastGenOutput>Application.Designer.vb</LastGenOutput>- </None>- <None Include="My Project\Settings.settings">- <Generator>SettingsSingleFileGenerator</Generator>- <CustomToolNamespace>My</CustomToolNamespace>- <LastGenOutput>Settings.Designer.vb</LastGenOutput>- </None>- <None Include="App.config" />- </ItemGroup>- <ItemGroup>- <BootstrapperPackage Include=".NETFramework,Version=v4.6.1">- <Visible>False</Visible>- <ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>- <Install>true</Install>- </BootstrapperPackage>- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">- <Visible>False</Visible>- <ProductName>.NET Framework 3.5 SP1</ProductName>- <Install>false</Install>- </BootstrapperPackage>- </ItemGroup>- <ItemGroup>- <Content Include="ColorSchemeList\*.json">- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>- </Content>- <Content Include="Projects\inages\QR-code.png" />- <None Include="Resources\QR-code.png" />- </ItemGroup>- <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />-</Project>\ No newline at end of filediff --git a/2D_wave_sim_V01/2D_wave_sim_V01_TemporaryKey.pfx b/2D_wave_sim_V01/2D_wave_sim_V01_TemporaryKey.pfxdeleted file mode 100644index 9cb213c..0000000Binary files a/2D_wave_sim_V01/2D_wave_sim_V01_TemporaryKey.pfx and /dev/null differdiff --git a/2D_wave_sim_V01/AboutForm.Designer.vb b/2D_wave_sim_V01/AboutForm.Designer.vbdeleted file mode 100644index 319a49b..0000000--- a/2D_wave_sim_V01/AboutForm.Designer.vb+++ /dev/null@@ -1,201 +0,0 @@-<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _-Partial Class AboutForm- Inherits System.Windows.Forms.Form-- 'Form overrides dispose to clean up the component list.- <System.Diagnostics.DebuggerNonUserCode()> _- Protected Overrides Sub Dispose(ByVal disposing As Boolean)- Try- If disposing AndAlso components IsNot Nothing Then- components.Dispose()- End If- Finally- MyBase.Dispose(disposing)- End Try- End Sub-- 'Required by the Windows Form Designer- Private components As System.ComponentModel.IContainer-- 'NOTE: The following procedure is required by the Windows Form Designer- 'It can be modified using the Windows Form Designer.- 'Do not modify it using the code editor.- <System.Diagnostics.DebuggerStepThrough()> _- Private Sub InitializeComponent()- Me.picIcon = New System.Windows.Forms.PictureBox()- Me.lblTitle = New System.Windows.Forms.Label()- Me.lblVersion = New System.Windows.Forms.Label()- Me.lblDescription = New System.Windows.Forms.Label()- Me.lblCopyright = New System.Windows.Forms.Label()- Me.btnClose = New System.Windows.Forms.Button()- Me.Label1 = New System.Windows.Forms.Label()- Me.Label2 = New System.Windows.Forms.Label()- Me.Label3 = New System.Windows.Forms.Label()- Me.Label4 = New System.Windows.Forms.Label()- Me.picPaypallQR = New System.Windows.Forms.PictureBox()- Me.Label5 = New System.Windows.Forms.Label()- CType(Me.picIcon, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.picPaypallQR, System.ComponentModel.ISupportInitialize).BeginInit()- Me.SuspendLayout()- '- 'picIcon- '- Me.picIcon.Location = New System.Drawing.Point(20, 20)- Me.picIcon.Name = "picIcon"- Me.picIcon.Size = New System.Drawing.Size(48, 48)- Me.picIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom- Me.picIcon.TabIndex = 0- Me.picIcon.TabStop = False- '- 'lblTitle- '- Me.lblTitle.AutoSize = True- Me.lblTitle.Font = New System.Drawing.Font("Segoe UI", 14.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblTitle.Location = New System.Drawing.Point(82, 18)- Me.lblTitle.Name = "lblTitle"- Me.lblTitle.Size = New System.Drawing.Size(143, 25)- Me.lblTitle.TabIndex = 1- Me.lblTitle.Text = "Wave Dude 2D"- '- 'lblVersion- '- Me.lblVersion.AutoSize = True- Me.lblVersion.Location = New System.Drawing.Point(84, 54)- Me.lblVersion.Name = "lblVersion"- Me.lblVersion.Size = New System.Drawing.Size(90, 18)- Me.lblVersion.TabIndex = 2- Me.lblVersion.Text = "Version 0.29"- '- 'lblDescription- '- Me.lblDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblDescription.Location = New System.Drawing.Point(15, 90)- Me.lblDescription.Name = "lblDescription"- Me.lblDescription.Size = New System.Drawing.Size(461, 28)- Me.lblDescription.TabIndex = 3- Me.lblDescription.Text = "Build a scene and watch waves do their thing!"- '- 'lblCopyright- '- Me.lblCopyright.AutoSize = True- Me.lblCopyright.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblCopyright.Location = New System.Drawing.Point(15, 507)- Me.lblCopyright.Name = "lblCopyright"- Me.lblCopyright.Size = New System.Drawing.Size(71, 18)- Me.lblCopyright.TabIndex = 4- Me.lblCopyright.Text = "Copyright"- '- 'btnClose- '- Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)- Me.btnClose.DialogResult = System.Windows.Forms.DialogResult.OK- Me.btnClose.Location = New System.Drawing.Point(319, 495)- Me.btnClose.Name = "btnClose"- Me.btnClose.Size = New System.Drawing.Size(90, 30)- Me.btnClose.TabIndex = 5- Me.btnClose.Text = "OK"- Me.btnClose.UseVisualStyleBackColor = True- '- 'Label1- '- Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label1.Location = New System.Drawing.Point(13, 254)- Me.Label1.Name = "Label1"- Me.Label1.Size = New System.Drawing.Size(392, 68)- Me.Label1.TabIndex = 3- Me.Label1.Text = "If you use this software and found it useful, consider making a donation to suppo" &- "rt future projects." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10)- '- 'Label2- '- Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label2.Location = New System.Drawing.Point(15, 128)- Me.Label2.Name = "Label2"- Me.Label2.Size = New System.Drawing.Size(394, 58)- Me.Label2.TabIndex = 3- Me.Label2.Text = "Developed by Huygens Optics / JJM Vleggaar with support of Claude Sonnet 5 (meani" &- "ng Claude did most of the heavy lifting and I get the credits). "- '- 'Label3- '- Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label3.Location = New System.Drawing.Point(12, 301)- Me.Label3.Name = "Label3"- Me.Label3.Size = New System.Drawing.Size(387, 46)- Me.Label3.TabIndex = 3- Me.Label3.Text = "Patreon: www.patreon.com/c/huygens_optics"- '- 'Label4- '- Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label4.Location = New System.Drawing.Point(16, 341)- Me.Label4.Name = "Label4"- Me.Label4.Size = New System.Drawing.Size(81, 46)- Me.Label4.TabIndex = 3- Me.Label4.Text = "Paypal:"- '- 'picPaypallQR- '- Me.picPaypallQR.Image = Global._2D_wave_sim_V01.My.Resources.Resources.QR_code- Me.picPaypallQR.Location = New System.Drawing.Point(121, 341)- Me.picPaypallQR.Name = "picPaypallQR"- Me.picPaypallQR.Size = New System.Drawing.Size(139, 135)- Me.picPaypallQR.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom- Me.picPaypallQR.TabIndex = 6- Me.picPaypallQR.TabStop = False- '- 'Label5- '- Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label5.Location = New System.Drawing.Point(15, 199)- Me.Label5.Name = "Label5"- Me.Label5.Size = New System.Drawing.Size(392, 42)- Me.Label5.TabIndex = 3- Me.Label5.Text = "Send bugs or suggestions for improvement to : [email protected]"- '- 'AboutForm- '- Me.AcceptButton = Me.btnClose- Me.CancelButton = Me.btnClose- Me.ClientSize = New System.Drawing.Size(429, 545)- Me.Controls.Add(Me.picPaypallQR)- Me.Controls.Add(Me.btnClose)- Me.Controls.Add(Me.lblCopyright)- Me.Controls.Add(Me.Label2)- Me.Controls.Add(Me.Label4)- Me.Controls.Add(Me.Label3)- Me.Controls.Add(Me.Label5)- Me.Controls.Add(Me.Label1)- Me.Controls.Add(Me.lblDescription)- Me.Controls.Add(Me.lblVersion)- Me.Controls.Add(Me.lblTitle)- Me.Controls.Add(Me.picIcon)- Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog- Me.MaximizeBox = False- Me.MinimizeBox = False- Me.Name = "AboutForm"- Me.ShowIcon = False- Me.ShowInTaskbar = False- Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent- Me.Text = "About 2D Wave Dude "- CType(Me.picIcon, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.picPaypallQR, System.ComponentModel.ISupportInitialize).EndInit()- Me.ResumeLayout(False)- Me.PerformLayout()-- End Sub-- Friend WithEvents picIcon As System.Windows.Forms.PictureBox- Friend WithEvents lblTitle As System.Windows.Forms.Label- Friend WithEvents lblVersion As System.Windows.Forms.Label- Friend WithEvents lblDescription As System.Windows.Forms.Label- Friend WithEvents lblCopyright As System.Windows.Forms.Label- Friend WithEvents btnClose As System.Windows.Forms.Button- Friend WithEvents Label1 As Label- Friend WithEvents Label2 As Label- Friend WithEvents Label3 As Label- Friend WithEvents Label4 As Label- Friend WithEvents picPaypallQR As PictureBox- Friend WithEvents Label5 As Label-End Classdiff --git a/2D_wave_sim_V01/AboutForm.resx b/2D_wave_sim_V01/AboutForm.resxdeleted file mode 100644index 1af7de1..0000000--- a/2D_wave_sim_V01/AboutForm.resx+++ /dev/null@@ -1,120 +0,0 @@-<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />- <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" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </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" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>-</root>\ No newline at end of filediff --git a/2D_wave_sim_V01/AboutForm.vb b/2D_wave_sim_V01/AboutForm.vbdeleted file mode 100644index 12a67e6..0000000--- a/2D_wave_sim_V01/AboutForm.vb+++ /dev/null@@ -1,57 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Drawing--''' <summary>-''' The Info > About window: program name, version and a one-paragraph description. Designer-editable - the-''' layout lives in AboutForm.Designer.vb, open with the Windows Forms Designer to move/resize things. This file-''' only fills in the two pieces of text that aren't fixed at design time (the copyright string, read from the-''' assembly) and loads the application icon. Opened from Form1's AboutToolStripMenuItem_Click.-''' </summary>-Public Class AboutForm-- ''' <summary>Shown as the version - kept in sync by hand with Form1's title bar ("Wave Maker 2D V0.25"),- ''' since AssemblyInfo.vb's AssemblyVersion is left at the generic "1.0.0.0" and does not track it.</summary>- Private Const DisplayVersion As String = "0.27"-- Public Sub New()- InitializeComponent()-- lblVersion.Text = "Version " & DisplayVersion- lblCopyright.Text = My.Application.Info.Copyright-- Try- Using ic As Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath)- If ic IsNot Nothing Then picIcon.Image = ic.ToBitmap()- End Using- Catch- ' no icon available (e.g. running outside a normal exe) - the picture box just stays empty- End Try- End Sub-- Private Sub AboutForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load-- End Sub---End Classdiff --git a/2D_wave_sim_V01/App.config b/2D_wave_sim_V01/App.configdeleted file mode 100644index 5534e28..0000000--- a/2D_wave_sim_V01/App.config+++ /dev/null@@ -1,6 +0,0 @@-<?xml version="1.0" encoding="utf-8" ?>-<configuration>- <startup>- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />- </startup>-</configuration>\ No newline at end of filediff --git a/2D_wave_sim_V01/AppIcon.ico b/2D_wave_sim_V01/AppIcon.icodeleted file mode 100644index daf72c8..0000000Binary files a/2D_wave_sim_V01/AppIcon.ico and /dev/null differdiff --git a/2D_wave_sim_V01/ColorSchemeList/Blue_to_yellow_GNU.json b/2D_wave_sim_V01/ColorSchemeList/Blue_to_yellow_GNU.jsondeleted file mode 100644index 01d6d8a..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Blue_to_yellow_GNU.json+++ /dev/null@@ -1,42 +0,0 @@-{- "name": "Blue_to_yellow_GNU",- "origin": "matplotlib colormap gnuplot2, sampled at 255 points",- "category": "sequential",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [0,0,0], [0,0,4], [0,0,8], [0,0,12], [0,0,16], [0,0,20], [0,0,24], [0,0,28],- [0,0,32], [0,0,36], [0,0,40], [0,0,44], [0,0,48], [0,0,52], [0,0,56], [0,0,60],- [0,0,64], [0,0,68], [0,0,72], [0,0,76], [0,0,80], [0,0,84], [0,0,88], [0,0,92],- [0,0,96], [0,0,100], [0,0,104], [0,0,108], [0,0,112], [0,0,116], [0,0,120], [0,0,124],- [0,0,128], [0,0,131], [0,0,136], [0,0,140], [0,0,144], [0,0,147], [0,0,152], [0,0,156],- [0,0,160], [0,0,163], [0,0,168], [0,0,172], [0,0,176], [0,0,179], [0,0,184], [0,0,188],- [0,0,192], [0,0,195], [0,0,200], [0,0,204], [0,0,208], [0,0,211], [0,0,216], [0,0,220],- [0,0,224], [0,0,227], [0,0,232], [0,0,236], [0,0,240], [0,0,243], [0,0,248], [0,0,252],- [0,0,255], [3,0,255], [7,0,255], [10,0,255], [13,0,255], [16,0,255], [19,0,255], [22,0,255],- [25,0,255], [28,0,255], [32,0,255], [35,0,255], [38,0,255], [41,0,255], [44,0,255], [47,0,255],- [50,0,255], [53,0,255], [57,0,255], [60,0,255], [63,0,255], [66,0,255], [69,0,255], [72,0,255],- [75,0,255], [78,0,255], [82,0,255], [85,0,255], [88,0,255], [91,0,255], [94,0,255], [97,0,255],- [100,0,255], [103,0,255], [107,0,255], [110,0,255], [113,0,255], [116,0,255], [119,0,255], [122,0,255],- [125,0,255], [128,0,255], [132,0,255], [135,0,255], [138,1,253], [141,3,251], [144,5,249], [147,7,247],- [150,9,245], [153,11,243], [157,13,241], [160,15,239], [163,17,237], [166,19,235], [169,21,233], [172,23,231],- [175,25,229], [178,27,227], [182,29,225], [185,31,223], [188,33,221], [191,35,219], [194,37,217], [200,41,213],- [203,43,211], [207,45,209], [210,47,207], [213,49,205], [216,51,203], [219,53,201], [222,55,199], [225,57,197],- [228,59,195], [232,61,193], [235,63,191], [238,65,189], [241,67,187], [244,69,185], [247,71,183], [250,73,181],- [253,75,179], [255,77,177], [255,79,175], [255,81,173], [255,83,171], [255,85,169], [255,87,167], [255,89,165],- [255,91,163], [255,93,161], [255,95,159], [255,97,157], [255,99,155], [255,101,153], [255,103,151], [255,105,149],- [255,107,147], [255,109,145], [255,111,143], [255,113,141], [255,115,139], [255,117,137], [255,119,135], [255,121,133],- [255,123,131], [255,125,129], [255,127,127], [255,129,125], [255,131,123], [255,133,121], [255,135,119], [255,137,117],- [255,139,115], [255,141,113], [255,143,111], [255,145,109], [255,147,107], [255,149,105], [255,151,103], [255,153,101],- [255,155,99], [255,157,97], [255,159,95], [255,161,93], [255,163,91], [255,165,89], [255,167,87], [255,169,85],- [255,171,83], [255,173,81], [255,175,79], [255,177,77], [255,179,75], [255,181,73], [255,183,71], [255,185,69],- [255,187,67], [255,189,65], [255,191,63], [255,193,61], [255,195,59], [255,197,57], [255,199,55], [255,201,53],- [255,203,51], [255,205,49], [255,207,47], [255,209,45], [255,211,43], [255,213,41], [255,215,39], [255,217,37],- [255,219,35], [255,221,33], [255,223,31], [255,225,29], [255,227,27], [255,229,25], [255,231,23], [255,233,21],- [255,235,19], [255,237,17], [255,239,15], [255,241,13], [255,243,11], [255,245,9], [255,247,7], [255,249,5],- [255,251,3], [255,253,1], [255,255,4], [255,255,17], [255,255,29], [255,255,42], [255,255,54], [255,255,67],- [255,255,79], [255,255,92], [255,255,104], [255,255,117], [255,255,130], [255,255,142], [255,255,154], [255,255,167],- [255,255,179], [255,255,192], [255,255,204], [255,255,217], [255,255,230], [255,255,242], [255,255,255]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Bright_rainbow.json b/2D_wave_sim_V01/ColorSchemeList/Bright_rainbow.jsondeleted file mode 100644index a745ae2..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Bright_rainbow.json+++ /dev/null@@ -1,43 +0,0 @@-{- "name": "Bright_rainbow",- "origin": "9-stop copy of scheme 'Bright_rainbow'",- "category": "custom",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[0,0,0], [128,5,182], [50,18,224], [32,164,224], [64,249,191], [96,240,109], [207,234,72], [252,168,29], [255,0,0]],- "colors": [- [0,0,0], [4,0,6], [8,0,11], [12,0,17], [16,1,23], [20,1,29], [24,1,34], [28,1,40],- [32,1,46], [36,1,52], [40,2,57], [44,2,63], [48,2,69], [52,2,75], [56,2,80], [60,2,86],- [65,3,92], [69,3,97], [73,3,103], [77,3,109], [81,3,115], [85,3,120], [89,3,126], [93,4,132],- [97,4,138], [101,4,143], [105,4,149], [109,4,155], [113,4,161], [117,5,166], [121,5,172], [125,5,178],- [127,5,182], [125,6,184], [122,6,185], [120,6,186], [118,7,188], [115,7,189], [113,8,190], [110,8,192],- [108,8,193], [105,9,194], [103,9,196], [100,10,197], [98,10,198], [95,10,200], [93,11,201], [91,11,202],- [88,12,203], [86,12,205], [83,12,206], [81,13,207], [78,13,209], [76,14,210], [73,14,211], [71,15,213],- [68,15,214], [66,15,215], [64,16,217], [61,16,218], [59,17,219], [56,17,221], [54,17,222], [51,18,223],- [50,20,224], [49,25,224], [49,29,224], [48,34,224], [47,39,224], [47,43,224], [46,48,224], [46,52,224],- [45,57,224], [45,62,224], [44,66,224], [43,71,224], [43,75,224], [42,80,224], [42,85,224], [41,89,224],- [41,94,224], [40,98,224], [40,103,224], [39,108,224], [38,112,224], [38,117,224], [37,121,224], [37,126,224],- [36,131,224], [36,135,224], [35,140,224], [34,144,224], [34,149,224], [33,154,224], [33,158,224], [32,163,224],- [33,166,223], [34,169,222], [35,171,221], [36,174,220], [37,177,219], [38,179,218], [39,182,217], [40,185,216],- [41,187,215], [42,190,214], [43,193,213], [44,195,212], [45,198,211], [46,201,210], [47,203,209], [48,206,208],- [49,209,207], [50,212,206], [51,214,205], [52,217,203], [53,220,202], [54,222,201], [55,225,200], [56,228,199],- [57,230,198], [58,233,197], [59,236,196], [60,238,195], [61,241,194], [62,244,193], [63,246,192], [64,249,191],- [65,249,188], [66,248,186], [67,248,183], [68,248,181], [69,248,178], [70,247,176], [71,247,173], [72,247,170],- [73,246,168], [74,246,165], [75,246,163], [76,246,160], [77,245,157], [78,245,155], [79,245,152], [80,244,150],- [81,244,147], [82,244,145], [83,244,142], [84,243,139], [85,243,137], [86,243,134], [87,242,132], [88,242,129],- [89,242,126], [90,242,124], [91,241,121], [92,241,119], [93,241,116], [94,240,114], [95,240,111], [97,240,109],- [100,240,108], [104,240,106], [107,239,105], [111,239,104], [114,239,103], [118,239,102], [121,239,101], [125,238,99],- [128,238,98], [132,238,97], [135,238,96], [139,238,95], [142,237,94], [146,237,92], [149,237,91], [153,237,90],- [156,237,89], [160,237,88], [163,236,87], [167,236,85], [170,236,84], [174,236,83], [177,236,82], [181,235,81],- [184,235,80], [188,235,78], [191,235,77], [195,235,76], [198,234,75], [202,234,74], [205,234,73], [208,233,71],- [209,231,70], [211,229,69], [212,227,67], [213,225,66], [215,223,65], [216,220,63], [218,218,62], [219,216,60],- [220,214,59], [222,212,58], [223,210,56], [225,208,55], [226,206,54], [228,204,52], [229,202,51], [230,200,50],- [232,198,48], [233,196,47], [235,193,46], [236,191,44], [237,189,43], [239,187,42], [240,185,40], [242,183,39],- [243,181,37], [245,179,36], [246,177,35], [247,175,33], [249,173,32], [250,171,31], [252,169,29], [252,164,28],- [252,159,27], [252,153,26], [252,148,26], [252,143,25], [253,138,24], [253,132,23], [253,127,22], [253,122,21],- [253,116,20], [253,111,19], [253,106,18], [253,101,17], [253,95,16], [253,90,16], [253,85,15], [254,79,14],- [254,74,13], [254,69,12], [254,63,11], [254,58,10], [254,53,9], [254,48,8], [254,42,7], [254,37,6],- [254,32,5], [255,26,5], [255,21,4], [255,16,3], [255,11,2], [255,5,1], [255,0,0]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Copper.json b/2D_wave_sim_V01/ColorSchemeList/Copper.jsondeleted file mode 100644index ed36f93..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Copper.json+++ /dev/null@@ -1,42 +0,0 @@-{- "name": "Copper",- "origin": "matplotlib colormap copper, sampled at 255 points",- "category": "sequential",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [0,0,0], [1,0,0], [2,1,0], [3,2,1], [4,3,1], [6,3,2], [7,4,2], [8,5,3],- [9,6,3], [11,7,4], [12,7,4], [13,8,5], [14,9,5], [16,10,6], [17,10,6], [18,11,7],- [19,12,7], [20,13,8], [22,14,8], [23,14,9], [24,15,9], [25,16,10], [27,17,10], [28,17,11],- [29,18,11], [30,19,12], [32,20,12], [33,21,13], [34,21,13], [35,22,14], [37,23,14], [38,24,15],- [39,24,15], [40,25,16], [41,26,16], [43,27,17], [44,28,17], [45,28,18], [46,29,18], [48,30,19],- [49,31,19], [50,32,20], [51,32,20], [53,33,21], [54,34,21], [55,35,22], [56,35,22], [58,36,23],- [59,37,23], [60,38,24], [61,39,24], [62,39,25], [64,40,25], [65,41,26], [66,42,26], [67,42,27],- [69,43,27], [70,44,28], [71,45,28], [72,46,29], [74,46,29], [75,47,30], [76,48,30], [77,49,31],- [79,49,31], [80,50,32], [81,51,32], [82,52,33], [83,53,33], [85,53,34], [86,54,34], [87,55,35],- [88,56,35], [90,57,36], [91,57,36], [92,58,37], [93,59,37], [95,60,38], [96,60,38], [97,61,39],- [98,62,39], [100,63,40], [101,64,40], [102,64,41], [103,65,41], [104,66,42], [106,67,42], [107,67,43],- [108,68,43], [109,69,44], [111,70,44], [112,71,45], [113,71,45], [114,72,46], [116,73,46], [117,74,47],- [118,74,47], [119,75,48], [121,76,48], [122,77,49], [123,78,49], [124,78,50], [125,79,50], [127,80,51],- [128,81,51], [129,82,52], [130,82,52], [132,83,53], [133,84,53], [134,85,54], [135,85,54], [137,86,55],- [138,87,55], [139,88,56], [140,89,56], [142,89,57], [143,90,57], [144,91,58], [145,92,58], [146,92,59],- [148,93,59], [149,94,60], [150,95,60], [151,96,61], [153,96,61], [154,97,62], [155,98,62], [158,99,63],- [159,100,64], [160,101,64], [161,102,65], [163,103,65], [164,103,66], [165,104,66], [166,105,67], [167,106,67],- [169,107,68], [170,107,68], [171,108,69], [172,109,69], [174,110,70], [175,110,70], [176,111,71], [177,112,71],- [179,113,72], [180,114,72], [181,114,73], [182,115,73], [184,116,74], [185,117,74], [186,117,75], [187,118,75],- [188,119,76], [190,120,76], [191,121,77], [192,121,77], [193,122,78], [195,123,78], [196,124,79], [197,124,79],- [198,125,80], [200,126,80], [201,127,81], [202,128,81], [203,128,82], [205,129,82], [206,130,83], [207,131,83],- [208,132,84], [209,132,84], [211,133,85], [212,134,85], [213,135,86], [214,135,86], [216,136,87], [217,137,87],- [218,138,88], [219,139,88], [221,139,89], [222,140,89], [223,141,90], [224,142,90], [226,142,91], [227,143,91],- [228,144,92], [229,145,92], [230,146,93], [232,146,93], [233,147,94], [234,148,94], [235,149,95], [237,149,95],- [238,150,96], [239,151,96], [240,152,97], [242,153,97], [243,153,98], [244,154,98], [245,155,99], [247,156,99],- [248,157,99], [249,157,100], [250,158,100], [251,159,101], [253,160,101], [254,160,102], [255,161,102], [255,162,103],- [255,163,103], [255,164,104], [255,164,104], [255,165,105], [255,166,105], [255,167,106], [255,167,106], [255,168,107],- [255,169,107], [255,170,108], [255,171,108], [255,171,109], [255,172,109], [255,173,110], [255,174,110], [255,174,111],- [255,175,111], [255,176,112], [255,177,112], [255,178,113], [255,178,113], [255,179,114], [255,180,114], [255,181,115],- [255,182,115], [255,182,116], [255,183,116], [255,184,117], [255,185,117], [255,185,118], [255,186,118], [255,187,119],- [255,188,119], [255,189,120], [255,189,120], [255,190,121], [255,191,121], [255,192,122], [255,192,122], [255,193,123],- [255,194,123], [255,195,124], [255,196,124], [255,196,125], [255,197,125], [255,198,126], [255,199,126]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Default_Field.json b/2D_wave_sim_V01/ColorSchemeList/Default_Field.jsondeleted file mode 100644index a204ce4..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Default_Field.json+++ /dev/null@@ -1,43 +0,0 @@-{- "name": "Default_Field",- "origin": "9-stop copy of scheme 'Default_Field'",- "category": "custom",- "scheme_type": "field",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[253,253,253], [48,32,244], [22,11,210], [26,24,170], [0,0,0], [119,2,2], [191,21,21], [251,59,59], [255,255,255]],- "colors": [- [253,253,253], [247,246,253], [240,239,252], [234,232,252], [227,225,252], [221,218,252], [214,211,251], [208,204,251],- [201,197,251], [195,190,250], [188,183,250], [182,176,250], [176,169,250], [169,163,249], [163,156,249], [156,149,249],- [150,142,248], [143,135,248], [137,128,248], [130,121,248], [124,114,247], [117,107,247], [111,100,247], [104,93,246],- [98,86,246], [92,79,246], [85,72,246], [79,65,245], [72,58,245], [66,51,245], [59,44,244], [53,37,244],- [48,32,244], [47,31,243], [46,31,242], [45,30,241], [45,29,239], [44,29,238], [43,28,237], [42,27,236],- [41,27,235], [40,26,234], [40,25,233], [39,25,232], [38,24,231], [37,23,230], [36,23,229], [36,22,228],- [35,21,227], [34,21,226], [33,20,224], [32,19,223], [31,19,222], [31,18,221], [30,17,220], [29,17,219],- [28,16,218], [27,15,217], [27,15,216], [26,14,215], [25,13,214], [24,13,213], [23,12,212], [22,11,211],- [22,11,209], [22,12,208], [22,12,207], [22,12,206], [23,13,204], [23,13,203], [23,14,202], [23,14,201],- [23,14,199], [23,15,198], [23,15,197], [23,16,196], [24,16,194], [24,17,193], [24,17,192], [24,17,190],- [24,18,189], [24,18,188], [24,19,187], [24,19,185], [25,19,184], [25,20,183], [25,20,182], [25,21,180],- [25,21,179], [25,21,178], [25,22,177], [25,22,175], [26,23,174], [26,23,173], [26,23,172], [26,24,170],- [25,23,166], [25,23,161], [24,22,155], [23,21,150], [22,20,145], [21,20,139], [20,19,134], [20,18,129],- [19,17,123], [18,17,118], [17,16,112], [16,15,107], [16,14,102], [15,14,96], [14,13,91], [13,12,86],- [12,11,80], [11,11,75], [11,10,70], [10,9,64], [9,8,59], [8,8,54], [7,7,48], [7,6,43],- [6,5,37], [5,5,32], [4,4,27], [3,3,21], [2,2,16], [2,2,11], [1,1,5], [0,0,0],- [4,0,0], [7,0,0], [11,0,0], [15,0,0], [19,0,0], [22,0,0], [26,0,0], [30,1,1],- [34,1,1], [37,1,1], [41,1,1], [45,1,1], [49,1,1], [52,1,1], [56,1,1], [60,1,1],- [64,1,1], [67,1,1], [71,1,1], [75,1,1], [79,1,1], [82,1,1], [86,1,1], [90,2,2],- [94,2,2], [97,2,2], [101,2,2], [105,2,2], [109,2,2], [112,2,2], [116,2,2], [120,2,2],- [122,3,3], [124,3,3], [126,4,4], [129,5,5], [131,5,5], [133,6,6], [135,6,6], [138,7,7],- [140,8,8], [142,8,8], [145,9,9], [147,9,9], [149,10,10], [151,11,11], [154,11,11], [156,12,12],- [158,12,12], [160,13,13], [163,14,14], [165,14,14], [167,15,15], [169,15,15], [172,16,16], [174,17,17],- [176,17,17], [179,18,18], [181,18,18], [183,19,19], [185,20,20], [188,20,20], [190,21,21], [192,22,22],- [194,23,23], [196,24,24], [198,25,25], [200,26,26], [201,28,28], [203,29,29], [205,30,30], [207,31,31],- [209,32,32], [211,34,34], [213,35,35], [215,36,36], [217,37,37], [218,38,38], [220,40,40], [222,41,41],- [224,42,42], [226,43,43], [228,44,44], [230,46,46], [232,47,47], [234,48,48], [235,49,49], [237,50,50],- [239,52,52], [241,53,53], [243,54,54], [245,55,55], [247,56,56], [249,58,58], [251,59,59], [251,64,64],- [251,70,70], [251,76,76], [251,82,82], [252,88,88], [252,94,94], [252,101,101], [252,107,107], [252,113,113],- [252,119,119], [252,125,125], [252,132,132], [253,138,138], [253,144,144], [253,150,150], [253,156,156], [253,162,162],- [253,169,169], [253,175,175], [253,181,181], [254,187,187], [254,193,193], [254,199,199], [254,206,206], [254,212,212],- [254,218,218], [254,224,224], [254,230,230], [255,236,236], [255,243,243], [255,249,249], [255,255,255]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Default_Intensity.json b/2D_wave_sim_V01/ColorSchemeList/Default_Intensity.jsondeleted file mode 100644index d492198..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Default_Intensity.json+++ /dev/null@@ -1,43 +0,0 @@-{- "name": "Default_Intensity",- "origin": "9-stop copy of scheme 'rainbow_JV'",- "category": "custom",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[0,0,0], [14,68,148], [33,172,222], [32,224,211], [33,246,61], [242,249,77], [234,179,72], [240,77,29], [255,0,0]],- "colors": [- [0,0,0], [0,2,5], [1,4,9], [1,6,14], [2,9,19], [2,11,23], [3,13,28], [3,15,33],- [4,17,37], [4,19,42], [4,21,47], [5,24,51], [5,26,56], [6,28,61], [6,30,65], [7,32,70],- [7,34,75], [7,36,79], [8,39,84], [8,41,89], [9,43,93], [9,45,98], [10,47,103], [10,49,107],- [11,51,112], [11,54,117], [11,56,121], [12,58,126], [12,60,131], [13,62,135], [13,64,140], [14,66,145],- [14,69,149], [15,72,151], [15,75,153], [16,79,156], [17,82,158], [17,85,160], [18,88,163], [18,92,165],- [19,95,167], [20,98,170], [20,102,172], [21,105,174], [21,108,177], [22,111,179], [23,115,181], [23,118,184],- [24,121,186], [24,125,188], [25,128,191], [26,131,193], [26,134,195], [27,138,198], [27,141,200], [28,144,202],- [29,147,205], [29,151,207], [30,154,209], [30,157,212], [31,161,214], [32,164,216], [32,167,219], [33,170,221],- [33,173,222], [33,174,221], [33,176,221], [33,178,221], [33,179,220], [33,181,220], [33,183,220], [33,184,219],- [33,186,219], [33,188,219], [33,189,218], [33,191,218], [33,192,218], [33,194,217], [33,196,217], [33,197,217],- [32,199,216], [32,201,216], [32,202,216], [32,204,215], [32,206,215], [32,207,215], [32,209,214], [32,210,214],- [32,212,214], [32,214,213], [32,215,213], [32,217,212], [32,219,212], [32,220,212], [32,222,211], [32,224,211],- [32,225,207], [32,225,203], [32,226,198], [32,227,193], [32,227,189], [32,228,184], [32,229,179], [32,229,174],- [32,230,170], [32,231,165], [32,231,160], [32,232,155], [32,233,151], [32,234,146], [32,234,141], [32,235,137],- [33,236,132], [33,236,127], [33,237,122], [33,238,118], [33,238,113], [33,239,108], [33,240,104], [33,240,99],- [33,241,94], [33,242,89], [33,243,85], [33,243,80], [33,244,75], [33,245,70], [33,245,66], [33,246,61],- [40,246,62], [46,246,62], [53,246,63], [59,246,63], [66,246,64], [72,247,64], [79,247,65], [86,247,65],- [92,247,66], [99,247,66], [105,247,67], [112,247,67], [119,247,68], [125,247,68], [132,247,69], [138,248,69],- [145,248,70], [151,248,70], [158,248,71], [165,248,71], [171,248,72], [178,248,72], [184,248,73], [191,248,73],- [198,248,74], [204,248,74], [211,249,75], [217,249,75], [224,249,76], [230,249,76], [237,249,77], [242,248,77],- [242,246,77], [241,244,77], [241,242,76], [241,240,76], [241,237,76], [240,235,76], [240,233,76], [240,231,76],- [240,229,76], [239,226,75], [239,224,75], [239,222,75], [239,220,75], [238,218,75], [238,215,75], [238,213,74],- [238,211,74], [237,209,74], [237,207,74], [237,204,74], [237,202,74], [236,200,73], [236,198,73], [236,196,73],- [236,193,73], [235,191,73], [235,189,73], [235,187,73], [235,185,72], [234,182,72], [234,180,72], [234,177,71],- [234,174,70], [234,171,69], [235,168,67], [235,165,66], [235,161,65], [235,158,63], [235,155,62], [236,152,60],- [236,148,59], [236,145,58], [236,142,56], [236,139,55], [237,136,54], [237,132,52], [237,129,51], [237,126,50],- [237,123,48], [237,120,47], [238,116,46], [238,113,44], [238,110,43], [238,107,42], [238,104,40], [239,100,39],- [239,97,37], [239,94,36], [239,91,35], [239,87,33], [240,84,32], [240,81,31], [240,78,29], [240,75,28],- [241,73,27], [241,70,26], [242,68,26], [242,65,25], [243,63,24], [243,61,23], [244,58,22], [244,56,21],- [245,53,20], [245,51,19], [246,49,18], [246,46,17], [246,44,16], [247,41,16], [247,39,15], [248,36,14],- [248,34,13], [249,32,12], [249,29,11], [250,27,10], [250,24,9], [251,22,8], [251,19,7], [252,17,6],- [252,15,5], [253,12,5], [253,10,4], [254,7,3], [254,5,2], [255,2,1], [255,0,0]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Flare_inv.json b/2D_wave_sim_V01/ColorSchemeList/Flare_inv.jsondeleted file mode 100644index 5a592c2..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Flare_inv.json+++ /dev/null@@ -1,42 +0,0 @@-{- "name": "Flare_inv",- "origin": "matplotlib colormap flare, sampled at 255 points",- "category": "sequential",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [236,175,128], [236,174,127], [236,173,127], [236,172,126], [236,171,126], [236,170,125], [236,169,124], [236,168,124],- [236,167,123], [236,166,123], [236,166,122], [236,165,121], [235,164,121], [235,163,120], [235,162,120], [235,161,119],- [235,160,118], [235,159,118], [235,158,117], [235,157,117], [235,156,116], [235,155,116], [235,154,115], [234,153,114],- [234,152,114], [234,151,113], [234,150,113], [234,149,112], [234,148,111], [234,147,111], [234,146,110], [234,145,110],- [233,144,109], [233,143,109], [233,142,108], [233,141,107], [233,140,107], [233,139,106], [233,138,106], [233,137,105],- [232,136,105], [232,135,104], [232,134,103], [232,133,103], [232,132,102], [232,131,102], [232,130,101], [232,129,101],- [231,128,100], [231,127,100], [231,126,99], [231,125,99], [231,124,98], [231,123,98], [230,122,98], [230,121,97],- [230,120,97], [230,119,96], [230,118,96], [229,118,96], [229,117,95], [229,116,95], [229,115,95], [229,114,94],- [228,113,94], [228,112,94], [228,111,93], [228,110,93], [227,109,93], [227,108,93], [227,107,92], [227,106,92],- [226,105,92], [226,104,92], [226,103,92], [225,102,92], [225,101,91], [225,100,91], [224,99,91], [224,98,91],- [224,97,91], [223,96,91], [223,95,91], [223,94,91], [222,93,91], [222,92,91], [221,91,91], [221,90,91],- [221,89,91], [220,89,92], [220,88,92], [219,87,92], [219,86,92], [218,85,92], [218,84,92], [217,83,93],- [217,83,93], [216,82,93], [215,81,93], [215,80,94], [214,79,94], [214,79,94], [213,78,94], [212,77,95],- [212,77,95], [211,76,95], [211,75,96], [210,75,96], [209,74,96], [208,73,97], [208,73,97], [207,72,97],- [206,71,98], [206,71,98], [205,70,98], [204,70,99], [203,69,99], [202,69,99], [202,68,100], [201,68,100],- [200,67,101], [199,67,101], [198,66,101], [197,66,102], [197,66,102], [196,65,102], [195,65,103], [193,64,103],- [192,64,104], [191,63,104], [190,63,104], [189,63,104], [188,63,105], [187,62,105], [186,62,105], [186,62,105],- [185,61,106], [184,61,106], [183,61,106], [182,61,106], [181,60,107], [180,60,107], [179,60,107], [178,60,107],- [177,59,108], [176,59,108], [175,59,108], [174,59,108], [173,58,108], [172,58,109], [171,58,109], [170,58,109],- [169,57,109], [168,57,109], [168,57,110], [167,57,110], [166,56,110], [165,56,110], [164,56,110], [163,56,110],- [162,55,110], [161,55,111], [160,55,111], [159,55,111], [158,54,111], [157,54,111], [156,54,111], [155,54,111],- [154,53,111], [154,53,111], [153,53,112], [152,53,112], [151,52,112], [150,52,112], [149,52,112], [148,52,112],- [147,51,112], [146,51,112], [145,51,112], [144,51,112], [143,50,112], [142,50,112], [141,50,112], [141,50,112],- [140,49,112], [139,49,112], [138,49,112], [137,49,112], [136,48,112], [135,48,112], [134,48,112], [133,48,112],- [132,48,112], [131,47,112], [130,47,112], [129,47,112], [128,47,112], [127,47,112], [126,46,112], [126,46,112],- [125,46,111], [124,46,111], [123,46,111], [122,45,111], [121,45,111], [120,45,111], [119,45,111], [118,45,110],- [117,44,110], [116,44,110], [115,44,110], [114,44,110], [113,44,109], [112,44,109], [111,43,109], [110,43,109],- [109,43,109], [108,43,108], [108,43,108], [107,43,108], [106,42,108], [105,42,107], [104,42,107], [103,42,107],- [102,42,107], [101,41,106], [100,41,106], [99,41,106], [98,41,105], [97,41,105], [96,40,105], [95,40,104],- [94,40,104], [93,40,104], [93,40,104], [92,39,103], [91,39,103], [90,39,103], [89,39,102], [88,38,102],- [87,38,102], [86,38,101], [85,38,101], [84,38,101], [83,37,100], [82,37,100], [82,37,100], [81,36,100],- [80,36,99], [79,36,99], [78,36,99], [77,35,98], [76,35,98], [75,35,98], [74,34,98]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Gray_scales.json b/2D_wave_sim_V01/ColorSchemeList/Gray_scales.jsondeleted file mode 100644index 73e8ba1..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Gray_scales.json+++ /dev/null@@ -1,43 +0,0 @@-{- "name": "Gray_scales",- "origin": "9-stop copy of scheme 'Gray scales'",- "category": "custom",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[0,0,0], [35,35,35], [98,98,98], [135,134,134], [159,159,159], [185,185,185], [210,210,210], [235,235,235], [255,255,255]],- "colors": [- [0,0,0], [1,1,1], [2,2,2], [3,3,3], [4,4,4], [6,6,6], [7,7,7], [8,8,8],- [9,9,9], [10,10,10], [11,11,11], [12,12,12], [13,13,13], [14,14,14], [15,15,15], [17,17,17],- [18,18,18], [19,19,19], [20,20,20], [21,21,21], [22,22,22], [23,23,23], [24,24,24], [25,25,25],- [26,26,26], [28,28,28], [29,29,29], [30,30,30], [31,31,31], [32,32,32], [33,33,33], [34,34,34],- [35,35,35], [37,37,37], [39,39,39], [41,41,41], [43,43,43], [45,45,45], [47,47,47], [49,49,49],- [51,51,51], [53,53,53], [55,55,55], [57,57,57], [59,59,59], [61,61,61], [63,63,63], [65,65,65],- [67,67,67], [69,69,69], [71,71,71], [73,73,73], [75,75,75], [77,77,77], [79,79,79], [81,81,81],- [83,83,83], [85,85,85], [87,87,87], [89,89,89], [91,91,91], [93,93,93], [95,95,95], [97,97,97],- [99,99,99], [100,100,100], [101,101,101], [102,102,102], [103,103,103], [104,104,104], [106,105,105], [107,107,107],- [108,108,108], [109,109,109], [110,110,110], [111,111,111], [113,112,112], [114,113,113], [115,114,114], [116,116,116],- [117,117,117], [118,118,118], [120,119,119], [121,120,120], [122,121,121], [123,122,122], [124,124,124], [125,125,125],- [127,126,126], [128,127,127], [129,128,128], [130,129,129], [131,130,130], [132,131,131], [134,133,133], [135,134,134],- [136,135,135], [136,135,135], [137,136,136], [138,137,137], [139,138,138], [139,139,139], [140,139,139], [141,140,140],- [142,141,141], [142,142,142], [143,142,142], [144,143,143], [145,144,144], [145,145,145], [146,146,146], [147,146,146],- [148,147,147], [148,148,148], [149,149,149], [150,150,150], [151,150,150], [151,151,151], [152,152,152], [153,153,153],- [154,153,153], [154,154,154], [155,155,155], [156,156,156], [157,157,157], [157,157,157], [158,158,158], [159,159,159],- [160,160,160], [161,161,161], [161,161,161], [162,162,162], [163,163,163], [164,164,164], [165,165,165], [166,166,166],- [166,166,166], [167,167,167], [168,168,168], [169,169,169], [170,170,170], [170,170,170], [171,171,171], [172,172,172],- [173,173,173], [174,174,174], [175,175,175], [175,175,175], [176,176,176], [177,177,177], [178,178,178], [179,179,179],- [179,179,179], [180,180,180], [181,181,181], [182,182,182], [183,183,183], [184,184,184], [184,184,184], [185,185,185],- [186,186,186], [187,187,187], [188,188,188], [188,188,188], [189,189,189], [190,190,190], [191,191,191], [191,191,191],- [192,192,192], [193,193,193], [194,194,194], [195,195,195], [195,195,195], [196,196,196], [197,197,197], [198,198,198],- [199,199,199], [199,199,199], [200,200,200], [201,201,201], [202,202,202], [203,203,203], [203,203,203], [204,204,204],- [205,205,205], [206,206,206], [206,206,206], [207,207,207], [208,208,208], [209,209,209], [210,210,210], [210,210,210],- [211,211,211], [212,212,212], [213,213,213], [214,214,214], [214,214,214], [215,215,215], [216,216,216], [217,217,217],- [217,217,217], [218,218,218], [219,219,219], [220,220,220], [221,221,221], [221,221,221], [222,222,222], [223,223,223],- [224,224,224], [225,225,225], [225,225,225], [226,226,226], [227,227,227], [228,228,228], [229,229,229], [229,229,229],- [230,230,230], [231,231,231], [232,232,232], [232,232,232], [233,233,233], [234,234,234], [235,235,235], [235,235,235],- [236,236,236], [237,237,237], [237,237,237], [238,238,238], [239,239,239], [239,239,239], [240,240,240], [241,241,241],- [241,241,241], [242,242,242], [242,242,242], [243,243,243], [244,244,244], [244,244,244], [245,245,245], [246,246,246],- [246,246,246], [247,247,247], [247,247,247], [248,248,248], [249,249,249], [249,249,249], [250,250,250], [251,251,251],- [251,251,251], [252,252,252], [252,252,252], [253,253,253], [254,254,254], [254,254,254], [255,255,255]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Gray_scales_inv.json b/2D_wave_sim_V01/ColorSchemeList/Gray_scales_inv.jsondeleted file mode 100644index 80793be..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Gray_scales_inv.json+++ /dev/null@@ -1,43 +0,0 @@-{- "name": "Gray_scales_inv",- "origin": "9-stop copy of scheme 'Gray scales'",- "category": "custom",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[252,251,251], [226,223,223], [200,198,198], [171,170,170], [136,135,135], [101,101,101], [71,70,70], [29,29,29], [0,0,0]],- "colors": [- [252,251,251], [251,250,250], [250,249,249], [250,248,248], [249,247,247], [248,247,247], [247,246,246], [246,245,245],- [245,244,244], [245,243,243], [244,242,242], [243,241,241], [242,240,240], [241,240,240], [241,239,239], [240,238,238],- [239,237,237], [238,236,236], [237,235,235], [236,234,234], [236,233,233], [235,232,232], [234,232,232], [233,231,231],- [232,230,230], [232,229,229], [231,228,228], [230,227,227], [229,226,226], [228,225,225], [227,225,225], [227,224,224],- [226,223,223], [225,222,222], [224,221,221], [223,220,220], [223,220,220], [222,219,219], [221,218,218], [220,217,217],- [219,217,217], [218,216,216], [218,215,215], [217,214,214], [216,213,213], [215,213,213], [214,212,212], [214,211,211],- [213,210,210], [212,209,209], [211,209,209], [210,208,208], [209,207,207], [209,206,206], [208,205,205], [207,205,205],- [206,204,204], [205,203,203], [205,202,202], [204,202,202], [203,201,201], [202,200,200], [201,199,199], [200,198,198],- [200,198,198], [199,197,197], [198,196,196], [197,195,195], [196,194,194], [195,193,193], [194,192,192], [193,191,191],- [192,191,191], [191,190,190], [190,189,189], [189,188,188], [189,187,187], [188,186,186], [187,185,185], [186,184,184],- [185,183,183], [184,183,183], [183,182,182], [182,181,181], [181,180,180], [180,179,179], [179,178,178], [179,177,177],- [178,176,176], [177,176,176], [176,175,175], [175,174,174], [174,173,173], [173,172,172], [172,171,171], [171,170,170],- [170,169,169], [169,168,168], [168,167,167], [167,166,166], [166,165,165], [165,164,164], [164,163,163], [162,161,161],- [161,160,160], [160,159,159], [159,158,158], [158,157,157], [157,156,156], [156,155,155], [155,154,154], [154,153,153],- [153,152,152], [151,150,150], [150,149,149], [149,148,148], [148,147,147], [147,146,146], [146,145,145], [145,144,144],- [144,143,143], [143,142,142], [142,141,141], [140,139,139], [139,138,138], [138,137,137], [137,136,136], [136,135,135],- [135,134,134], [134,133,133], [133,132,132], [132,131,131], [130,130,130], [129,129,129], [128,128,128], [127,126,126],- [126,125,125], [125,124,124], [124,123,123], [123,122,122], [122,121,121], [121,120,120], [119,119,119], [118,118,118],- [117,117,117], [116,116,116], [115,115,115], [114,114,114], [113,113,113], [112,111,111], [111,110,110], [110,109,109],- [108,108,108], [107,107,107], [106,106,106], [105,105,105], [104,104,104], [103,103,103], [102,102,102], [101,101,101],- [100,100,100], [99,99,99], [98,98,98], [97,97,97], [96,96,96], [95,95,95], [94,94,94], [93,93,93],- [92,92,92], [91,91,91], [90,90,90], [89,89,89], [88,88,88], [88,87,87], [87,86,86], [86,85,85],- [85,84,84], [84,83,83], [83,82,82], [82,81,81], [81,80,80], [80,79,79], [79,78,78], [78,77,77],- [77,76,76], [76,75,75], [75,74,74], [74,73,73], [73,72,72], [72,71,71], [71,70,70], [70,69,69],- [69,68,68], [68,67,67], [66,65,65], [65,64,64], [64,63,63], [62,62,62], [61,60,60], [60,59,59],- [58,58,58], [57,56,56], [56,55,55], [54,54,54], [53,53,53], [52,51,51], [50,50,50], [49,49,49],- [48,47,47], [47,46,46], [45,45,45], [44,44,44], [43,42,42], [41,41,41], [40,40,40], [39,38,38],- [37,37,37], [36,36,36], [35,34,34], [33,33,33], [32,32,32], [31,31,31], [29,29,29], [28,28,28],- [27,27,27], [26,26,26], [26,26,26], [25,25,25], [24,24,24], [23,23,23], [22,22,22], [21,21,21],- [20,20,20], [19,19,19], [18,18,18], [17,17,17], [16,16,16], [16,16,16], [15,15,15], [14,14,14],- [13,13,13], [12,12,12], [11,11,11], [10,10,10], [9,9,9], [8,8,8], [7,7,7], [6,6,6],- [5,5,5], [5,5,5], [4,4,4], [3,3,3], [2,2,2], [1,1,1], [0,0,0]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Green_blue.json b/2D_wave_sim_V01/ColorSchemeList/Green_blue.jsondeleted file mode 100644index 444c5b0..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Green_blue.json+++ /dev/null@@ -1,43 +0,0 @@-{- "name": "Green_blue",- "origin": "9-stop copy of scheme 'afmhot (5-stop)'",- "category": "custom",- "scheme_type": "field",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[255,250,250], [89,96,246], [35,49,220], [3,27,164], [0,0,0], [2,127,6], [27,197,42], [78,245,86], [255,255,255]],- "colors": [- [255,250,250], [250,245,250], [245,240,250], [239,235,250], [234,231,249], [229,226,249], [224,221,249], [218,216,249],- [213,211,249], [208,206,249], [203,201,249], [197,197,249], [192,192,248], [187,187,248], [182,182,248], [177,177,248],- [171,172,248], [166,168,248], [161,163,248], [156,158,248], [150,153,247], [145,148,247], [140,143,247], [135,138,247],- [130,134,247], [124,129,247], [119,124,247], [114,119,247], [109,114,246], [103,109,246], [98,104,246], [93,100,246],- [89,96,246], [87,94,245], [85,93,244], [83,91,243], [82,90,243], [80,88,242], [78,87,241], [77,85,240],- [75,84,239], [73,82,238], [72,81,238], [70,79,237], [68,78,236], [66,76,235], [65,75,234], [63,73,234],- [61,72,233], [60,70,232], [58,69,231], [56,68,230], [55,66,229], [53,65,229], [51,63,228], [49,62,227],- [48,60,226], [46,59,225], [44,57,225], [43,56,224], [41,54,223], [39,53,222], [38,51,221], [36,50,220],- [34,49,219], [33,48,217], [32,47,216], [31,47,214], [30,46,212], [29,45,210], [28,44,209], [27,44,207],- [26,43,205], [25,42,203], [24,42,201], [23,41,200], [22,40,198], [21,40,196], [20,39,194], [19,38,193],- [18,38,191], [17,37,189], [16,36,187], [15,35,186], [14,35,184], [13,34,182], [12,33,180], [11,33,179],- [10,32,177], [9,31,175], [8,31,173], [7,30,171], [6,29,170], [5,29,168], [4,28,166], [3,27,164],- [3,26,160], [3,26,155], [3,25,150], [3,24,145], [3,23,139], [2,22,134], [2,21,129], [2,20,124],- [2,20,119], [2,19,114], [2,18,108], [2,17,103], [2,16,98], [2,15,93], [2,14,88], [2,14,83],- [1,13,77], [1,12,72], [1,11,67], [1,10,62], [1,9,57], [1,9,52], [1,8,46], [1,7,41],- [1,6,36], [1,5,31], [0,4,26], [0,3,21], [0,3,15], [0,2,10], [0,1,5], [0,0,0],- [0,4,0], [0,8,0], [0,12,1], [0,16,1], [0,20,1], [0,24,1], [0,28,1], [1,32,2],- [1,36,2], [1,40,2], [1,44,2], [1,48,2], [1,52,2], [1,56,3], [1,60,3], [1,64,3],- [1,68,3], [1,72,3], [1,76,4], [1,80,4], [1,84,4], [1,88,4], [1,92,4], [2,96,5],- [2,100,5], [2,104,5], [2,108,5], [2,112,5], [2,116,5], [2,120,6], [2,124,6], [2,128,6],- [3,130,7], [4,132,9], [5,134,10], [5,136,11], [6,139,12], [7,141,13], [8,143,14], [8,145,15],- [9,147,16], [10,150,18], [11,152,19], [12,154,20], [12,156,21], [13,158,22], [14,161,23], [15,163,24],- [16,165,26], [16,167,27], [17,169,28], [18,172,29], [19,174,30], [20,176,31], [20,178,32], [21,180,33],- [22,183,35], [23,185,36], [23,187,37], [24,189,38], [25,191,39], [26,194,40], [27,196,41], [28,198,43],- [29,199,44], [31,201,45], [33,202,47], [34,204,48], [36,205,50], [37,207,51], [39,208,52], [41,210,54],- [42,211,55], [44,213,57], [45,214,58], [47,216,59], [49,217,61], [50,219,62], [52,220,63], [54,222,65],- [55,223,66], [57,225,68], [58,226,69], [60,228,70], [62,230,72], [63,231,73], [65,233,75], [66,234,76],- [68,236,77], [70,237,79], [71,239,80], [73,240,81], [74,242,83], [76,243,84], [78,245,86], [82,245,90],- [88,246,95], [93,246,101], [99,246,106], [104,246,111], [110,247,117], [116,247,122], [121,247,127], [127,248,133],- [132,248,138], [138,248,143], [144,249,149], [149,249,154], [155,249,159], [160,250,165], [166,250,170], [171,250,175],- [177,251,180], [183,251,186], [188,251,191], [194,252,196], [199,252,202], [205,252,207], [210,252,212], [216,253,218],- [222,253,223], [227,253,228], [233,254,234], [238,254,239], [244,254,244], [249,255,250], [255,255,255]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Green_pink.json b/2D_wave_sim_V01/ColorSchemeList/Green_pink.jsondeleted file mode 100644index edd9f1a..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Green_pink.json+++ /dev/null@@ -1,42 +0,0 @@-{- "name": "Green_pink",- "origin": "9-stop copy of scheme 'vanimo'",- "category": "custom",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[255,204,252], [205,120,189], [147,63,128], [65,27,56], [25,21,18], [41,55,21], [82,113,38], [126,173,69], [189,252,165]],- "colors": [- [255,204,252], [253,201,250], [252,199,248], [250,196,246], [249,193,244], [247,191,242], [246,188,240], [244,185,238],- [242,183,236], [241,180,234], [239,178,232], [238,175,230], [236,172,228], [235,170,226], [233,167,224], [231,164,222],- [230,162,220], [228,159,218], [227,156,216], [225,154,214], [224,151,212], [222,148,210], [220,146,208], [219,143,206],- [217,141,204], [216,138,202], [214,135,200], [212,133,198], [211,130,196], [209,127,194], [208,125,192], [206,122,190],- [205,120,189], [203,118,187], [201,116,185], [199,114,183], [197,112,181], [195,111,179], [194,109,177], [192,107,175],- [190,105,173], [188,103,171], [186,102,169], [184,100,167], [183,98,165], [181,96,164], [179,94,162], [177,93,160],- [175,91,158], [173,89,156], [172,87,154], [170,85,152], [168,84,150], [166,82,148], [164,80,146], [163,78,144],- [161,76,142], [159,75,140], [157,73,139], [155,71,137], [153,69,135], [152,67,133], [150,66,131], [148,64,129],- [146,62,127], [143,61,125], [141,60,122], [138,59,120], [135,58,118], [133,57,116], [130,56,113], [128,54,111],- [125,53,109], [122,52,106], [120,51,104], [117,50,102], [115,49,100], [112,48,97], [110,47,95], [107,45,93],- [104,44,91], [102,43,88], [99,42,86], [97,41,84], [94,40,82], [91,39,79], [89,37,77], [86,36,75],- [84,35,72], [81,34,70], [79,33,68], [76,32,66], [73,31,63], [71,30,61], [68,28,59], [66,27,57],- [64,27,55], [63,27,54], [62,26,53], [60,26,52], [59,26,50], [58,26,49], [56,26,48], [55,26,47],- [54,25,46], [53,25,44], [51,25,43], [50,25,42], [49,25,41], [48,24,40], [46,24,38], [45,24,37],- [44,24,36], [43,24,35], [41,23,34], [40,23,32], [39,23,31], [38,23,30], [36,23,29], [35,23,28],- [34,22,26], [33,22,25], [31,22,24], [30,22,23], [29,22,22], [28,21,20], [26,21,19], [25,21,18],- [26,22,18], [26,23,18], [27,24,18], [27,25,18], [28,26,18], [28,27,19], [29,28,19], [29,30,19],- [30,31,19], [30,32,19], [31,33,19], [31,34,19], [32,35,19], [32,36,19], [33,37,19], [33,38,20],- [34,39,20], [34,40,20], [35,41,20], [35,42,20], [36,43,20], [36,45,20], [37,46,20], [37,47,20],- [38,48,20], [38,49,20], [39,50,21], [39,51,21], [40,52,21], [40,53,21], [41,54,21], [41,55,21],- [43,57,22], [44,59,22], [45,61,23], [46,63,23], [48,65,24], [49,66,24], [50,68,25], [52,70,25],- [53,72,26], [54,74,26], [56,76,27], [57,77,28], [58,79,28], [59,81,29], [61,83,29], [62,85,30],- [63,87,30], [65,88,31], [66,90,31], [67,92,32], [68,94,32], [70,96,33], [71,97,33], [72,99,34],- [74,101,35], [75,103,35], [76,105,36], [77,107,36], [79,108,37], [80,110,37], [81,112,38], [83,114,38],- [84,116,39], [85,118,40], [87,120,41], [88,122,42], [90,123,43], [91,125,44], [92,127,45], [94,129,46],- [95,131,47], [97,133,48], [98,135,49], [99,137,50], [101,139,51], [102,140,52], [103,142,53], [105,144,54],- [106,146,55], [108,148,56], [109,150,57], [110,152,58], [112,154,59], [113,156,60], [115,157,61], [116,159,62],- [117,161,63], [119,163,64], [120,165,65], [121,167,66], [123,169,67], [124,171,68], [126,173,69], [127,175,71],- [129,177,74], [131,180,77], [133,182,80], [135,185,83], [137,187,86], [139,190,89], [141,192,92], [143,195,95],- [145,197,98], [147,200,102], [149,202,105], [151,205,108], [153,207,111], [155,210,114], [157,212,117], [159,215,120],- [161,217,123], [163,220,126], [165,222,129], [167,225,132], [169,227,135], [171,230,138], [173,232,141], [175,235,144],- [177,237,147], [179,240,150], [181,242,153], [183,245,156], [185,247,159], [187,250,162], [189,252,165]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Greens.json b/2D_wave_sim_V01/ColorSchemeList/Greens.jsondeleted file mode 100644index ee4e9b3..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Greens.json+++ /dev/null@@ -1,42 +0,0 @@-{- "name": "Greens",- "origin": "matplotlib colormap Greens, sampled at 255 points",- "category": "sequential",- "scheme_type": "field",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [247,252,245], [246,251,244], [245,251,243], [245,251,243], [244,251,242], [244,250,241], [243,250,241], [243,250,240],- [242,250,239], [241,250,239], [241,249,238], [240,249,237], [240,249,237], [239,249,236], [239,248,235], [238,248,235],- [237,248,234], [237,248,233], [236,248,233], [236,247,232], [235,247,231], [235,247,231], [234,247,230], [234,246,229],- [233,246,229], [232,246,228], [232,246,227], [231,246,227], [231,245,226], [230,245,225], [230,245,225], [229,245,224],- [228,244,223], [227,244,222], [227,244,221], [226,243,220], [225,243,219], [224,243,218], [223,242,217], [222,242,216],- [221,241,215], [220,241,214], [219,241,213], [218,240,212], [217,240,211], [216,240,210], [215,239,209], [214,239,208],- [213,238,207], [212,238,206], [211,238,205], [211,237,204], [210,237,203], [209,237,202], [208,236,201], [207,236,200],- [206,235,199], [205,235,198], [204,235,197], [203,234,196], [202,234,195], [201,234,194], [200,233,193], [199,233,192],- [198,232,191], [197,232,190], [196,231,189], [195,231,188], [193,230,187], [192,230,185], [191,229,184], [190,229,183],- [189,228,182], [187,228,181], [186,227,180], [185,227,178], [184,226,177], [183,226,176], [182,225,175], [180,225,174],- [179,224,173], [178,224,171], [177,223,170], [176,223,169], [174,222,168], [173,222,167], [172,221,166], [171,221,165],- [170,220,163], [168,220,162], [167,219,161], [166,219,160], [165,218,159], [164,218,158], [162,217,156], [161,217,155],- [160,216,154], [159,216,153], [157,215,152], [156,214,151], [154,214,149], [153,213,148], [152,212,147], [150,212,146],- [149,211,145], [147,210,144], [146,210,142], [144,209,141], [143,208,140], [142,208,139], [140,207,138], [139,206,137],- [137,206,135], [136,205,134], [135,204,133], [133,204,132], [132,203,131], [130,202,130], [129,202,129], [128,201,127],- [126,200,126], [125,200,125], [123,199,124], [122,198,123], [120,198,122], [119,197,120], [118,196,119], [115,195,117],- [113,194,116], [112,194,116], [110,193,115], [108,192,114], [107,191,113], [105,190,112], [104,190,112], [102,189,111],- [100,188,110], [99,187,109], [97,186,108], [96,186,108], [94,185,107], [92,184,106], [91,183,105], [89,183,105],- [88,182,104], [86,181,103], [84,180,102], [83,179,101], [81,179,101], [80,178,100], [78,177,99], [76,176,98],- [75,176,97], [73,175,97], [72,174,96], [70,173,95], [68,172,94], [67,172,94], [65,171,93], [64,170,92],- [63,169,91], [62,168,91], [61,167,90], [60,166,89], [59,165,88], [58,164,88], [57,163,87], [56,162,86],- [55,161,85], [55,160,85], [54,159,84], [53,158,83], [52,157,82], [51,156,81], [50,155,81], [49,154,80],- [48,153,79], [47,152,78], [46,151,78], [45,150,77], [44,149,76], [43,148,75], [42,147,75], [41,146,74],- [40,145,73], [39,144,72], [39,143,72], [38,142,71], [37,141,70], [36,140,69], [35,139,69], [34,138,68],- [33,137,67], [31,136,66], [30,135,66], [29,134,65], [28,133,64], [27,132,63], [26,131,62], [25,130,62],- [24,129,61], [23,128,60], [22,127,59], [21,126,58], [19,126,58], [18,125,57], [17,124,56], [16,123,55],- [15,122,55], [14,121,54], [13,120,53], [12,119,52], [11,118,51], [10,117,51], [8,116,50], [7,115,49],- [6,114,48], [5,113,48], [4,112,47], [3,111,46], [2,111,45], [1,110,44], [0,109,44], [0,107,43],- [0,106,43], [0,105,42], [0,104,41], [0,102,41], [0,101,40], [0,100,40], [0,98,39], [0,97,39],- [0,96,38], [0,95,38], [0,93,37], [0,92,37], [0,91,36], [0,89,36], [0,88,35], [0,87,35],- [0,86,34], [0,84,33], [0,83,33], [0,82,32], [0,80,32], [0,79,31], [0,78,31], [0,77,30],- [0,75,30], [0,74,29], [0,73,29], [0,71,28], [0,70,28], [0,69,27], [0,68,27]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Hot_orange.json b/2D_wave_sim_V01/ColorSchemeList/Hot_orange.jsondeleted file mode 100644index 45a3f98..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Hot_orange.json+++ /dev/null@@ -1,41 +0,0 @@-{- "name": "Hot_orange",- "origin": "matplotlib colormap afmhot, sampled at 255 points",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [0,0,0], [2,0,0], [4,0,0], [6,0,0], [8,0,0], [10,0,0], [12,0,0], [14,0,0],- [16,0,0], [18,0,0], [20,0,0], [22,0,0], [24,0,0], [26,0,0], [28,0,0], [30,0,0],- [32,0,0], [34,0,0], [36,0,0], [38,0,0], [40,0,0], [42,0,0], [44,0,0], [46,0,0],- [48,0,0], [50,0,0], [52,0,0], [54,0,0], [56,0,0], [58,0,0], [60,0,0], [62,0,0],- [64,0,0], [65,0,0], [68,0,0], [70,0,0], [72,0,0], [73,0,0], [76,0,0], [78,0,0],- [80,0,0], [81,0,0], [84,0,0], [86,0,0], [88,0,0], [89,0,0], [92,0,0], [94,0,0],- [96,0,0], [97,0,0], [100,0,0], [102,0,0], [104,0,0], [105,0,0], [108,0,0], [110,0,0],- [112,0,0], [113,0,0], [116,0,0], [118,0,0], [120,0,0], [121,0,0], [124,0,0], [126,0,0],- [128,0,0], [130,2,0], [131,4,0], [134,6,0], [136,8,0], [138,10,0], [140,12,0], [142,14,0],- [144,16,0], [146,18,0], [147,20,0], [150,22,0], [152,24,0], [154,26,0], [156,28,0], [158,30,0],- [160,32,0], [162,34,0], [163,36,0], [166,38,0], [168,40,0], [170,42,0], [172,44,0], [174,46,0],- [176,48,0], [178,50,0], [179,52,0], [182,54,0], [184,56,0], [186,58,0], [188,60,0], [190,62,0],- [192,64,0], [194,66,0], [195,68,0], [198,70,0], [200,72,0], [202,74,0], [204,76,0], [206,78,0],- [208,80,0], [210,82,0], [211,84,0], [214,86,0], [216,88,0], [218,90,0], [220,92,0], [222,94,0],- [224,96,0], [226,98,0], [227,100,0], [230,102,0], [232,104,0], [234,106,0], [236,108,0], [238,110,0],- [240,112,0], [242,114,0], [243,116,0], [246,118,0], [248,120,0], [250,122,0], [252,124,0], [255,128,0],- [255,130,2], [255,132,4], [255,134,6], [255,136,8], [255,138,11], [255,140,13], [255,142,15], [255,144,16],- [255,146,18], [255,148,20], [255,150,22], [255,152,25], [255,154,27], [255,156,29], [255,158,31], [255,160,32],- [255,162,34], [255,164,36], [255,166,38], [255,168,40], [255,170,43], [255,172,45], [255,174,47], [255,176,48],- [255,178,50], [255,180,52], [255,182,54], [255,184,57], [255,186,59], [255,188,61], [255,190,63], [255,192,65],- [255,194,66], [255,196,68], [255,198,70], [255,200,72], [255,202,75], [255,204,77], [255,206,79], [255,208,81],- [255,210,82], [255,212,84], [255,214,86], [255,216,89], [255,218,91], [255,220,93], [255,222,95], [255,224,97],- [255,226,98], [255,228,100], [255,230,102], [255,232,104], [255,234,107], [255,236,109], [255,238,111], [255,240,113],- [255,242,114], [255,244,116], [255,246,118], [255,248,121], [255,250,123], [255,252,125], [255,254,127], [255,255,129],- [255,255,131], [255,255,132], [255,255,134], [255,255,136], [255,255,139], [255,255,141], [255,255,143], [255,255,145],- [255,255,147], [255,255,148], [255,255,150], [255,255,153], [255,255,155], [255,255,157], [255,255,159], [255,255,161],- [255,255,163], [255,255,164], [255,255,166], [255,255,168], [255,255,171], [255,255,173], [255,255,175], [255,255,177],- [255,255,179], [255,255,180], [255,255,182], [255,255,185], [255,255,187], [255,255,189], [255,255,191], [255,255,193],- [255,255,195], [255,255,196], [255,255,198], [255,255,200], [255,255,203], [255,255,205], [255,255,207], [255,255,209],- [255,255,211], [255,255,212], [255,255,214], [255,255,217], [255,255,219], [255,255,221], [255,255,223], [255,255,225],- [255,255,227], [255,255,228], [255,255,230], [255,255,232], [255,255,235], [255,255,237], [255,255,239], [255,255,241],- [255,255,243], [255,255,244], [255,255,246], [255,255,249], [255,255,251], [255,255,253], [255,255,255]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Ice_and_fire.json b/2D_wave_sim_V01/ColorSchemeList/Ice_and_fire.jsondeleted file mode 100644index fe75dee..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Ice_and_fire.json+++ /dev/null@@ -1,41 +0,0 @@-{- "name": "Ice_and_fire",- "origin": "embedded table in wave_visualizer.py",- "scheme_type": "field",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [179,224,216], [178,223,216], [176,222,215], [175,221,215], [173,219,214], [171,218,214], [169,217,214], [167,215,213],- [165,214,213], [162,212,212], [160,210,212], [157,209,211], [154,207,211], [151,205,210], [148,203,210], [146,201,209],- [143,199,209], [140,198,208], [137,196,208], [134,194,208], [131,192,207], [128,190,207], [125,188,207], [122,187,207],- [119,185,206], [116,183,206], [113,181,206], [110,179,206], [108,177,206], [105,176,205], [102,174,205], [99,172,205],- [97,170,205], [94,168,205], [91,166,205], [89,164,205], [86,162,205], [84,161,205], [82,159,205], [79,157,205],- [77,155,205], [75,153,206], [73,151,206], [71,149,206], [69,147,206], [68,145,206], [66,143,206], [65,140,206],- [64,138,206], [63,136,206], [62,134,206], [61,132,206], [61,130,205], [61,127,205], [60,125,205], [60,123,204],- [60,121,203], [60,118,203], [61,116,202], [61,114,201], [61,112,200], [62,109,198], [62,107,197], [63,105,195],- [64,103,194], [65,100,192], [65,98,190], [66,96,187], [67,94,185], [67,92,183], [68,90,180], [68,88,177],- [69,86,174], [69,85,171], [69,83,168], [70,81,165], [70,79,162], [70,78,158], [69,76,155], [69,75,151],- [69,73,148], [68,72,144], [68,70,141], [67,69,137], [66,67,134], [66,66,130], [65,65,127], [64,63,123],- [63,62,120], [62,61,116], [61,60,113], [60,59,109], [59,57,106], [58,56,103], [57,55,99], [55,54,96],- [54,53,93], [53,52,90], [52,50,87], [51,49,84], [50,48,81], [48,47,78], [47,46,75], [46,45,72],- [45,44,70], [44,43,67], [43,42,65], [42,41,62], [41,40,60], [40,39,57], [39,38,55], [38,37,53],- [37,37,51], [37,36,49], [36,35,47], [35,35,45], [35,34,44], [34,33,42], [34,33,41], [33,32,39],- [33,32,38], [33,32,37], [33,31,36], [33,31,35], [33,31,35], [34,30,34], [34,30,33], [34,30,33],- [35,30,32], [36,30,32], [36,30,32], [37,30,32], [38,30,32], [39,30,32], [40,30,32], [41,30,32],- [42,30,33], [44,31,33], [46,31,34], [47,31,34], [49,31,35], [51,32,35], [53,32,36], [55,32,37],- [57,33,38], [59,33,38], [61,33,39], [63,34,40], [65,34,41], [67,35,42], [70,35,43], [72,36,44],- [74,36,45], [77,37,46], [79,37,47], [82,38,48], [84,38,49], [87,39,50], [90,39,51], [92,40,52],- [95,40,53], [98,40,54], [100,41,55], [103,41,56], [106,42,57], [109,42,58], [111,42,59], [114,43,60],- [117,43,60], [120,43,61], [123,44,62], [126,44,63], [129,44,63], [131,44,64], [134,45,64], [137,45,65],- [140,45,65], [143,46,65], [146,46,65], [149,46,66], [152,47,66], [155,47,66], [158,48,66], [160,48,66],- [163,49,65], [166,49,65], [169,50,65], [172,51,64], [174,52,64], [177,53,63], [180,54,63], [182,55,62],- [185,56,62], [187,57,61], [190,58,61], [192,60,60], [195,61,59], [197,63,59], [199,65,58], [201,66,57],- [203,68,57], [206,70,56], [208,72,55], [209,74,55], [211,76,54], [213,78,54], [215,81,54], [217,83,53],- [218,85,53], [220,88,53], [221,90,53], [223,93,54], [224,95,54], [225,98,55], [227,101,55], [228,103,56],- [229,106,57], [230,109,58], [231,111,60], [232,114,61], [233,117,62], [234,120,64], [235,123,66], [236,125,68],- [237,128,70], [237,131,73], [238,134,75], [239,137,78], [240,139,80], [240,142,83], [241,145,86], [242,148,89],- [242,151,93], [243,153,96], [243,156,99], [244,159,103], [245,162,106], [245,165,110], [246,167,113], [246,170,117],- [247,173,120], [247,176,124], [248,178,127], [248,181,131], [249,184,134], [249,186,138], [250,188,141], [250,190,144],- [251,192,147], [251,194,149], [251,196,152], [252,198,154], [252,200,156], [252,201,158], [253,203,160]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Orange_hot.json b/2D_wave_sim_V01/ColorSchemeList/Orange_hot.jsondeleted file mode 100644index 0b4ccc0..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Orange_hot.json+++ /dev/null@@ -1,42 +0,0 @@-{- "name": "Orange_hot",- "origin": "matplotlib colormap hot, sampled at 255 points",- "category": "sequential",- "scheme_type": "field",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [10,0,0], [13,0,0], [15,0,0], [18,0,0], [21,0,0], [23,0,0], [26,0,0], [28,0,0],- [31,0,0], [34,0,0], [36,0,0], [39,0,0], [42,0,0], [44,0,0], [47,0,0], [49,0,0],- [52,0,0], [55,0,0], [57,0,0], [60,0,0], [63,0,0], [65,0,0], [68,0,0], [70,0,0],- [73,0,0], [76,0,0], [78,0,0], [81,0,0], [84,0,0], [86,0,0], [89,0,0], [91,0,0],- [94,0,0], [97,0,0], [99,0,0], [102,0,0], [105,0,0], [107,0,0], [110,0,0], [112,0,0],- [115,0,0], [118,0,0], [120,0,0], [123,0,0], [126,0,0], [128,0,0], [131,0,0], [133,0,0],- [136,0,0], [139,0,0], [141,0,0], [144,0,0], [147,0,0], [149,0,0], [152,0,0], [154,0,0],- [157,0,0], [160,0,0], [162,0,0], [165,0,0], [168,0,0], [170,0,0], [173,0,0], [175,0,0],- [178,0,0], [181,0,0], [183,0,0], [186,0,0], [189,0,0], [191,0,0], [194,0,0], [196,0,0],- [199,0,0], [202,0,0], [204,0,0], [207,0,0], [210,0,0], [212,0,0], [215,0,0], [217,0,0],- [220,0,0], [223,0,0], [225,0,0], [228,0,0], [231,0,0], [233,0,0], [236,0,0], [238,0,0],- [241,0,0], [244,0,0], [246,0,0], [249,0,0], [252,0,0], [254,0,0], [255,2,0], [255,5,0],- [255,7,0], [255,10,0], [255,12,0], [255,15,0], [255,18,0], [255,20,0], [255,23,0], [255,26,0],- [255,28,0], [255,31,0], [255,33,0], [255,36,0], [255,39,0], [255,41,0], [255,44,0], [255,47,0],- [255,49,0], [255,52,0], [255,54,0], [255,57,0], [255,60,0], [255,62,0], [255,65,0], [255,68,0],- [255,70,0], [255,73,0], [255,75,0], [255,78,0], [255,81,0], [255,83,0], [255,86,0], [255,91,0],- [255,94,0], [255,96,0], [255,99,0], [255,102,0], [255,104,0], [255,107,0], [255,110,0], [255,112,0],- [255,115,0], [255,117,0], [255,120,0], [255,123,0], [255,125,0], [255,128,0], [255,131,0], [255,133,0],- [255,136,0], [255,138,0], [255,141,0], [255,144,0], [255,146,0], [255,149,0], [255,151,0], [255,154,0],- [255,157,0], [255,159,0], [255,162,0], [255,165,0], [255,167,0], [255,170,0], [255,172,0], [255,175,0],- [255,178,0], [255,180,0], [255,183,0], [255,186,0], [255,188,0], [255,191,0], [255,193,0], [255,196,0],- [255,199,0], [255,201,0], [255,204,0], [255,207,0], [255,209,0], [255,212,0], [255,214,0], [255,217,0],- [255,220,0], [255,222,0], [255,225,0], [255,228,0], [255,230,0], [255,233,0], [255,235,0], [255,238,0],- [255,241,0], [255,243,0], [255,246,0], [255,249,0], [255,251,0], [255,254,0], [255,255,2], [255,255,6],- [255,255,10], [255,255,14], [255,255,18], [255,255,22], [255,255,26], [255,255,30], [255,255,34], [255,255,38],- [255,255,42], [255,255,46], [255,255,50], [255,255,54], [255,255,58], [255,255,62], [255,255,65], [255,255,69],- [255,255,73], [255,255,77], [255,255,81], [255,255,85], [255,255,89], [255,255,93], [255,255,97], [255,255,101],- [255,255,105], [255,255,109], [255,255,113], [255,255,117], [255,255,121], [255,255,125], [255,255,128], [255,255,132],- [255,255,136], [255,255,140], [255,255,144], [255,255,148], [255,255,152], [255,255,156], [255,255,160], [255,255,164],- [255,255,168], [255,255,172], [255,255,176], [255,255,180], [255,255,184], [255,255,188], [255,255,191], [255,255,195],- [255,255,199], [255,255,203], [255,255,207], [255,255,211], [255,255,215], [255,255,219], [255,255,223], [255,255,227],- [255,255,231], [255,255,235], [255,255,239], [255,255,243], [255,255,247], [255,255,251], [255,255,255]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Orange_symmetry.json b/2D_wave_sim_V01/ColorSchemeList/Orange_symmetry.jsondeleted file mode 100644index 49a9582..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Orange_symmetry.json+++ /dev/null@@ -1,41 +0,0 @@-{- "name": "Orange_symmetry",- "origin": "embedded table in wave_visualizer.py",- "scheme_type": "field",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [253,203,160], [252,201,158], [252,200,156], [252,198,154], [251,196,152], [251,194,149], [251,192,147], [250,190,145],- [250,189,142], [249,187,139], [249,185,135], [248,182,132], [248,179,129], [247,177,125], [247,175,122], [247,172,119],- [246,168,115], [246,166,112], [245,164,108], [245,161,105], [244,158,102], [243,155,98], [243,152,95], [242,150,92],- [242,147,88], [241,145,86], [240,142,83], [240,139,80], [239,137,78], [238,134,75], [237,131,73], [237,129,70],- [236,126,68], [235,124,67], [234,121,65], [233,118,63], [232,115,61], [231,112,61], [230,110,59], [229,107,57],- [228,104,56], [228,102,55], [226,100,55], [224,97,55], [224,94,54], [222,92,54], [221,89,53], [219,87,53],- [218,84,53], [217,83,53], [215,80,54], [213,78,54], [211,76,54], [209,74,55], [208,72,55], [206,70,56],- [203,68,57], [201,66,57], [199,65,58], [198,64,59], [196,62,59], [193,60,60], [191,59,61], [188,57,61],- [186,56,62], [183,55,62], [181,55,63], [179,54,63], [176,53,63], [173,52,64], [171,51,64], [168,50,65],- [165,49,65], [162,49,65], [159,48,66], [157,48,66], [155,47,66], [152,47,66], [149,46,66], [146,46,65],- [143,46,65], [140,45,65], [138,45,65], [135,45,64], [132,44,64], [130,44,63], [127,44,63], [124,44,62],- [121,43,61], [118,43,60], [115,43,60], [112,42,60], [110,42,59], [108,42,58], [105,42,57], [102,41,56],- [99,41,55], [97,40,54], [94,40,53], [91,40,52], [89,39,51], [86,39,50], [84,38,49], [82,38,48],- [79,37,47], [77,37,46], [74,36,45], [72,36,44], [70,35,43], [68,35,42], [65,34,41], [64,34,40],- [62,33,39], [60,33,38], [58,33,38], [56,32,38], [54,32,36], [52,32,35], [50,32,35], [48,31,35],- [47,31,34], [45,31,34], [43,31,33], [42,30,33], [41,30,32], [40,30,32], [39,30,32], [38,30,32],- [37,30,32], [36,30,32], [36,30,32], [37,30,32], [38,30,32], [39,30,32], [40,30,32], [41,30,32],- [42,30,33], [44,31,33], [46,31,34], [47,31,34], [49,31,35], [51,32,35], [53,32,36], [55,32,37],- [57,33,38], [59,33,38], [61,33,39], [63,34,40], [65,34,41], [67,35,42], [70,35,43], [72,36,44],- [74,36,45], [77,37,46], [79,37,47], [82,38,48], [84,38,49], [87,39,50], [90,39,51], [92,40,52],- [95,40,53], [98,40,54], [100,41,55], [103,41,56], [106,42,57], [109,42,58], [111,42,59], [114,43,60],- [117,43,60], [120,43,61], [123,44,62], [126,44,63], [129,44,63], [131,44,64], [134,45,64], [137,45,65],- [140,45,65], [143,46,65], [146,46,65], [149,46,66], [152,47,66], [155,47,66], [158,48,66], [160,48,66],- [163,49,65], [166,49,65], [169,50,65], [172,51,64], [174,52,64], [177,53,63], [180,54,63], [182,55,62],- [185,56,62], [187,57,61], [190,58,61], [192,60,60], [195,61,59], [197,63,59], [199,65,58], [201,66,57],- [203,68,57], [206,70,56], [208,72,55], [209,74,55], [211,76,54], [213,78,54], [215,81,54], [217,83,53],- [218,85,53], [220,88,53], [221,90,53], [223,93,54], [224,95,54], [225,98,55], [227,101,55], [228,103,56],- [229,106,57], [230,109,58], [231,111,60], [232,114,61], [233,117,62], [234,120,64], [235,123,66], [236,125,68],- [237,128,70], [237,131,73], [238,134,75], [239,137,78], [240,139,80], [240,142,83], [241,145,86], [242,148,89],- [242,151,93], [243,153,96], [243,156,99], [244,159,103], [245,162,106], [245,165,110], [246,167,113], [246,170,117],- [247,173,120], [247,176,124], [248,178,127], [248,181,131], [249,184,134], [249,186,138], [250,188,141], [250,190,144],- [251,192,147], [251,194,149], [251,196,152], [252,198,154], [252,200,156], [252,201,158], [253,203,160]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Purple_rain.json b/2D_wave_sim_V01/ColorSchemeList/Purple_rain.jsondeleted file mode 100644index 12a28c1..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Purple_rain.json+++ /dev/null@@ -1,43 +0,0 @@-{- "name": "Purple_rain",- "origin": "9-stop copy of scheme 'Gray scales'",- "category": "custom",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[0,0,0], [29,1,47], [50,1,81], [65,2,104], [107,2,128], [132,2,158], [167,5,198], [201,21,236], [228,105,252]],- "colors": [- [0,0,0], [1,0,1], [2,0,3], [3,0,4], [4,0,6], [5,0,7], [5,0,9], [6,0,10],- [7,0,12], [8,0,13], [9,0,15], [10,0,16], [11,0,18], [12,0,19], [13,0,21], [14,0,22],- [15,1,24], [16,1,25], [16,1,27], [17,1,28], [18,1,30], [19,1,31], [20,1,33], [21,1,34],- [22,1,36], [23,1,37], [24,1,38], [25,1,40], [26,1,41], [26,1,43], [27,1,44], [28,1,46],- [29,1,47], [30,1,48], [30,1,49], [31,1,50], [32,1,52], [32,1,53], [33,1,54], [34,1,55],- [34,1,56], [35,1,57], [36,1,58], [36,1,59], [37,1,60], [38,1,61], [38,1,62], [39,1,63],- [40,1,64], [40,1,65], [41,1,67], [42,1,68], [42,1,69], [43,1,70], [44,1,71], [44,1,72],- [45,1,73], [46,1,74], [46,1,75], [47,1,76], [48,1,77], [48,1,78], [49,1,79], [50,1,80],- [50,1,81], [51,1,82], [51,1,83], [52,1,84], [52,1,84], [53,1,85], [53,1,86], [54,1,86],- [54,1,87], [54,1,88], [55,1,89], [55,1,89], [56,1,90], [56,1,91], [57,1,92], [57,1,92],- [58,2,93], [58,2,94], [59,2,94], [59,2,95], [60,2,96], [60,2,97], [61,2,97], [61,2,98],- [62,2,99], [62,2,99], [63,2,100], [63,2,101], [63,2,102], [64,2,102], [64,2,103], [65,2,104],- [66,2,105], [67,2,105], [69,2,106], [70,2,107], [71,2,108], [73,2,108], [74,2,109], [75,2,110],- [77,2,111], [78,2,111], [79,2,112], [81,2,113], [82,2,114], [83,2,114], [85,2,115], [86,2,116],- [87,2,117], [88,2,117], [90,2,118], [91,2,119], [92,2,120], [94,2,120], [95,2,121], [96,2,122],- [98,2,123], [99,2,123], [100,2,124], [102,2,125], [103,2,126], [104,2,126], [106,2,127], [107,2,128],- [108,2,129], [109,2,130], [109,2,131], [110,2,132], [111,2,133], [112,2,134], [113,2,135], [113,2,136],- [114,2,137], [115,2,137], [116,2,138], [116,2,139], [117,2,140], [118,2,141], [119,2,142], [120,2,143],- [120,2,144], [121,2,145], [122,2,146], [123,2,147], [124,2,148], [124,2,149], [125,2,150], [126,2,151],- [127,2,152], [127,2,153], [128,2,154], [129,2,154], [130,2,155], [131,2,156], [131,2,157], [132,2,158],- [133,2,160], [134,2,161], [136,2,162], [137,2,163], [138,2,165], [139,3,166], [140,3,167], [141,3,168],- [142,3,170], [143,3,171], [144,3,172], [146,3,173], [147,3,175], [148,3,176], [149,3,177], [150,4,178],- [151,4,180], [152,4,181], [153,4,182], [154,4,184], [155,4,185], [157,4,186], [158,4,187], [159,4,189],- [160,4,190], [161,4,191], [162,5,192], [163,5,194], [164,5,195], [165,5,196], [166,5,197], [168,5,199],- [169,6,200], [170,6,201], [171,7,202], [172,7,203], [173,8,205], [174,8,206], [175,9,207], [176,9,208],- [177,10,209], [178,10,211], [179,11,212], [180,11,213], [181,12,214], [183,12,215], [184,13,217], [185,13,218],- [186,14,219], [187,14,220], [188,15,221], [189,15,223], [190,16,224], [191,16,225], [192,17,226], [193,17,227],- [194,18,229], [195,18,230], [196,19,231], [198,19,232], [199,20,233], [200,20,235], [201,21,236], [202,23,236],- [202,26,237], [203,28,237], [204,31,238], [205,34,238], [206,36,239], [207,39,239], [208,42,240], [208,44,240],- [209,47,241], [210,49,241], [211,52,242], [212,55,242], [213,57,243], [214,60,243], [214,63,244], [215,65,244],- [216,68,245], [217,71,245], [218,73,246], [219,76,246], [219,79,247], [220,81,247], [221,84,248], [222,86,248],- [223,89,249], [224,92,249], [225,94,250], [225,97,250], [226,100,251], [227,102,251], [228,105,252]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Simply_red.json b/2D_wave_sim_V01/ColorSchemeList/Simply_red.jsondeleted file mode 100644index 255f243..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Simply_red.json+++ /dev/null@@ -1,42 +0,0 @@-{- "name": "Simply_red",- "origin": "7-stop copy of scheme 'afmhot'",- "category": "custom",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [0,0,0], [3,0,0], [6,0,0], [9,0,0], [12,0,0], [15,0,0], [18,0,0], [21,0,0],- [24,0,0], [27,0,0], [30,0,0], [33,0,0], [36,0,0], [39,0,0], [42,0,0], [45,0,0],- [48,0,0], [51,0,0], [54,0,0], [57,0,0], [60,0,0], [63,0,0], [65,1,1], [68,1,1],- [71,1,1], [74,1,1], [77,1,1], [80,1,1], [83,1,1], [86,1,1], [89,1,1], [92,1,1],- [95,1,1], [98,1,1], [101,1,1], [104,1,1], [107,1,1], [110,1,1], [113,1,1], [116,1,1],- [119,1,1], [122,1,1], [125,1,1], [127,1,1], [128,1,1], [129,1,1], [130,1,1], [131,1,1],- [132,1,1], [133,1,1], [134,1,1], [135,1,1], [136,1,1], [137,1,1], [138,1,1], [139,1,1],- [140,1,1], [141,1,1], [142,1,1], [143,1,1], [144,1,1], [145,1,1], [146,1,1], [147,1,1],- [148,0,0], [149,0,0], [150,0,0], [151,0,0], [152,0,0], [153,0,0], [154,0,0], [155,0,0],- [156,0,0], [157,0,0], [158,0,0], [159,0,0], [160,0,0], [161,0,0], [162,0,0], [163,0,0],- [164,0,0], [165,0,0], [166,0,0], [167,0,0], [168,0,0], [170,0,0], [171,1,1], [173,1,1],- [174,1,1], [176,2,2], [177,2,2], [179,3,3], [180,3,3], [182,3,3], [184,4,4], [185,4,4],- [187,5,5], [188,5,5], [190,5,5], [191,6,6], [193,6,6], [194,7,7], [196,7,7], [198,7,7],- [199,8,8], [201,8,8], [202,9,9], [204,9,9], [205,9,9], [207,10,10], [208,10,10], [210,11,11],- [212,11,11], [213,11,11], [215,12,12], [216,12,12], [218,13,13], [219,13,13], [221,13,13], [223,14,14],- [224,14,14], [226,15,15], [227,15,15], [229,15,15], [230,16,16], [232,16,16], [233,17,17], [235,17,17],- [235,19,19], [236,20,20], [236,22,22], [236,23,23], [236,25,25], [237,26,26], [237,28,28], [237,29,29],- [237,31,31], [238,32,32], [238,34,34], [238,35,35], [238,37,37], [239,38,38], [239,40,40], [239,41,41],- [239,43,43], [240,44,44], [240,46,46], [240,47,47], [240,49,49], [241,50,50], [241,52,52], [241,53,53],- [241,55,55], [242,56,56], [242,58,58], [242,59,59], [243,61,61], [243,62,62], [243,64,64], [243,65,65],- [244,67,67], [244,68,68], [244,70,70], [244,71,71], [245,73,73], [245,74,74], [245,76,76], [245,77,77],- [246,79,79], [246,80,80], [246,82,82], [246,84,84], [246,85,85], [246,87,87], [246,88,88], [246,90,90],- [246,91,91], [246,93,93], [246,94,94], [246,96,96], [246,97,97], [246,99,99], [246,100,100], [246,102,102],- [246,103,103], [246,105,105], [246,106,106], [246,108,108], [246,109,109], [246,111,111], [246,112,112], [247,114,114],- [247,115,115], [247,117,117], [247,118,118], [247,120,120], [247,121,121], [247,123,123], [247,124,124], [247,126,126],- [247,127,127], [247,129,129], [247,130,130], [247,132,132], [247,133,133], [247,135,135], [247,136,136], [247,138,138],- [247,139,139], [247,141,141], [247,142,142], [247,144,144], [247,146,146], [247,148,148], [247,150,150], [247,152,152],- [248,154,154], [248,157,157], [248,159,159], [248,161,161], [248,163,163], [248,165,165], [248,167,167], [248,170,170],- [248,172,172], [249,174,174], [249,176,176], [249,178,178], [249,180,180], [249,183,183], [249,185,185], [249,187,187],- [249,189,189], [250,191,191], [250,194,194], [250,196,196], [250,198,198], [250,200,200], [250,202,202], [250,204,204],- [250,207,207], [250,209,209], [251,211,211], [251,213,213], [251,215,215], [251,217,217], [251,220,220], [251,222,222],- [251,224,224], [251,226,226], [252,228,228], [252,230,230], [252,233,233], [252,235,235], [252,237,237]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Turky_brown.json b/2D_wave_sim_V01/ColorSchemeList/Turky_brown.jsondeleted file mode 100644index 35d8bd5..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Turky_brown.json+++ /dev/null@@ -1,43 +0,0 @@-{- "name": "Turky_brown",- "origin": "9-stop copy of scheme 'Green_blown'",- "category": "custom",- "scheme_type": "field",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[62,34,1], [153,93,18], [207,161,84], [239,222,176], [255,255,255], [180,226,219], [90,177,167], [14,114,106], [0,9,8]],- "colors": [- [62,34,1], [65,36,2], [68,38,2], [71,40,3], [73,41,3], [76,43,4], [79,45,4], [82,47,5],- [85,49,5], [88,51,6], [91,53,6], [94,54,7], [96,56,7], [99,58,8], [102,60,8], [105,62,9],- [108,64,10], [111,66,10], [114,67,11], [116,69,11], [119,71,12], [122,73,12], [125,75,13], [128,77,13],- [131,79,14], [134,80,14], [137,82,15], [139,84,15], [142,86,16], [145,88,17], [148,90,17], [151,92,18],- [153,94,19], [155,96,21], [157,98,23], [159,100,25], [160,102,27], [162,104,29], [164,106,31], [165,109,33],- [167,111,35], [169,113,37], [170,115,39], [172,117,41], [174,119,43], [176,121,46], [177,124,48], [179,126,50],- [181,128,52], [182,130,54], [184,132,56], [186,134,58], [187,136,60], [189,139,62], [191,141,64], [193,143,66],- [194,145,68], [196,147,70], [198,149,73], [199,151,75], [201,154,77], [203,156,79], [204,158,81], [206,160,83],- [208,162,85], [209,164,88], [210,166,91], [211,168,94], [212,170,97], [213,172,100], [214,173,103], [215,175,106],- [216,177,109], [217,179,112], [218,181,114], [219,183,117], [220,185,120], [221,187,123], [222,189,126], [223,191,129],- [224,193,132], [225,195,135], [226,197,138], [227,198,141], [228,200,143], [229,202,146], [230,204,149], [231,206,152],- [232,208,155], [233,210,158], [234,212,161], [235,214,164], [236,216,167], [237,218,169], [238,220,172], [239,222,175],- [239,223,178], [240,224,180], [240,225,183], [241,226,185], [241,227,188], [242,228,190], [242,229,193], [243,230,195],- [243,231,198], [244,232,200], [244,233,203], [245,234,205], [245,235,208], [246,236,210], [246,237,213], [247,238,215],- [247,239,218], [248,240,220], [248,241,223], [249,243,225], [249,244,228], [250,245,230], [250,246,233], [251,247,235],- [251,248,238], [252,249,240], [252,250,243], [253,251,245], [253,252,248], [254,253,250], [254,254,253], [255,255,255],- [253,254,254], [250,253,253], [248,252,252], [246,251,250], [243,250,249], [241,250,248], [238,249,247], [236,248,246],- [234,247,245], [231,246,244], [229,245,243], [227,244,241], [224,243,240], [222,242,239], [220,241,238], [217,240,237],- [215,239,236], [212,239,235], [210,238,233], [208,237,232], [205,236,231], [203,235,230], [201,234,229], [198,233,228],- [196,232,227], [194,231,226], [191,230,224], [189,229,223], [186,229,222], [184,228,221], [182,227,220], [179,226,219],- [176,224,217], [174,223,215], [171,221,214], [168,219,212], [165,218,210], [162,216,209], [159,215,207], [157,213,205],- [154,212,204], [151,210,202], [148,209,201], [145,207,199], [142,206,197], [140,204,196], [137,202,194], [134,201,192],- [131,199,191], [128,198,189], [125,196,187], [123,195,186], [120,193,184], [117,192,183], [114,190,181], [111,189,179],- [108,187,178], [106,185,176], [103,184,174], [100,182,173], [97,181,171], [94,179,169], [91,178,168], [89,176,166],- [86,174,164], [84,172,162], [82,170,160], [79,168,158], [77,166,156], [74,164,155], [72,162,153], [70,160,151],- [67,158,149], [65,156,147], [62,154,145], [60,152,143], [58,150,141], [55,148,139], [53,146,137], [51,144,135],- [48,142,133], [46,140,131], [43,138,130], [41,136,128], [39,134,126], [36,132,124], [34,130,122], [31,128,120],- [29,126,118], [27,124,116], [24,122,114], [22,120,112], [19,118,110], [17,116,108], [15,114,106], [14,112,104],- [13,108,101], [13,105,98], [12,102,94], [12,98,91], [11,95,88], [11,92,85], [11,88,82], [10,85,79],- [10,82,76], [9,78,73], [9,75,70], [8,72,67], [8,69,64], [7,65,60], [7,62,57], [7,59,54],- [6,55,51], [6,52,48], [5,49,45], [5,45,42], [4,42,39], [4,39,36], [4,35,33], [3,32,30],- [3,29,27], [2,26,23], [2,22,20], [1,19,17], [1,16,14], [0,12,11], [0,9,8]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/Yellow_purple.json b/2D_wave_sim_V01/ColorSchemeList/Yellow_purple.jsondeleted file mode 100644index 148ad37..0000000--- a/2D_wave_sim_V01/ColorSchemeList/Yellow_purple.json+++ /dev/null@@ -1,43 +0,0 @@-{- "name": "Yellow_purple",- "origin": "9-stop copy of scheme 'gist_earth'",- "category": "custom",- "scheme_type": "field",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[247,110,252], [190,2,190], [128,2,134], [77,2,79], [0,0,0], [111,105,2], [193,194,3], [250,246,15], [253,248,115]],- "colors": [- [247,110,252], [245,107,250], [243,103,248], [242,100,246], [240,96,244], [238,93,242], [236,90,240], [234,86,238],- [233,83,236], [231,79,234], [229,76,232], [227,73,231], [225,69,229], [224,66,227], [222,62,225], [220,59,223],- [218,56,221], [216,52,219], [215,49,217], [213,45,215], [211,42,213], [209,39,211], [208,35,209], [206,32,207],- [204,28,205], [202,25,203], [200,22,201], [199,18,199], [197,15,197], [195,11,195], [193,8,193], [191,5,191],- [190,2,190], [188,2,188], [186,2,186], [184,2,184], [182,2,183], [180,2,181], [178,2,179], [176,2,177],- [174,2,175], [172,2,174], [170,2,172], [168,2,170], [166,2,168], [164,2,167], [162,2,165], [160,2,163],- [158,2,161], [156,2,160], [154,2,158], [152,2,156], [150,2,154], [149,2,153], [147,2,151], [145,2,149],- [143,2,147], [141,2,145], [139,2,144], [137,2,142], [135,2,140], [133,2,138], [131,2,137], [129,2,135],- [127,2,133], [126,2,131], [124,2,130], [122,2,128], [121,2,126], [119,2,124], [118,2,123], [116,2,121],- [114,2,119], [113,2,118], [111,2,116], [110,2,114], [108,2,112], [106,2,111], [105,2,109], [103,2,107],- [101,2,105], [100,2,104], [98,2,102], [97,2,100], [95,2,98], [93,2,97], [92,2,95], [90,2,93],- [89,2,92], [87,2,90], [85,2,88], [84,2,86], [82,2,85], [81,2,83], [79,2,81], [77,2,79],- [75,2,77], [73,2,75], [70,2,72], [68,2,70], [65,2,67], [63,2,65], [61,2,62], [58,2,60],- [56,1,57], [53,1,55], [51,1,52], [49,1,50], [46,1,47], [44,1,45], [41,1,42], [39,1,40],- [36,1,37], [34,1,35], [32,1,32], [29,1,30], [27,1,27], [24,1,25], [22,1,22], [19,1,20],- [17,0,17], [15,0,15], [12,0,12], [10,0,10], [7,0,7], [5,0,5], [2,0,2], [0,0,0],- [3,3,0], [7,7,0], [10,10,0], [14,13,0], [17,17,0], [21,20,0], [24,23,0], [28,26,1],- [31,30,1], [35,33,1], [38,36,1], [42,40,1], [45,43,1], [49,46,1], [52,50,1], [56,53,1],- [59,56,1], [63,60,1], [66,63,1], [70,66,1], [73,69,1], [77,73,1], [80,76,1], [84,79,2],- [87,83,2], [91,86,2], [94,89,2], [98,93,2], [101,96,2], [105,99,2], [108,103,2], [112,106,2],- [114,109,2], [117,111,2], [119,114,2], [122,117,2], [125,120,2], [127,123,2], [130,125,2], [132,128,2],- [135,131,2], [137,134,2], [140,137,2], [143,139,2], [145,142,2], [148,145,2], [150,148,2], [153,151,3],- [156,153,3], [158,156,3], [161,159,3], [163,162,3], [166,165,3], [168,167,3], [171,170,3], [174,173,3],- [176,176,3], [179,179,3], [181,181,3], [184,184,3], [187,187,3], [189,190,3], [192,193,3], [194,195,3],- [196,196,4], [197,198,4], [199,200,4], [201,201,5], [203,203,5], [205,205,5], [206,206,6], [208,208,6],- [210,210,7], [212,211,7], [214,213,7], [215,214,8], [217,216,8], [219,218,8], [221,219,9], [223,221,9],- [224,223,10], [226,224,10], [228,226,10], [230,228,11], [232,229,11], [233,231,12], [235,232,12], [237,234,12],- [239,236,13], [241,237,13], [242,239,13], [244,241,14], [246,242,14], [248,244,15], [250,246,15], [250,246,17],- [250,246,21], [250,246,24], [250,246,27], [250,246,30], [251,246,33], [251,246,36], [251,246,39], [251,247,43],- [251,247,46], [251,247,49], [251,247,52], [251,247,55], [251,247,58], [251,247,61], [251,247,65], [252,247,68],- [252,247,71], [252,247,74], [252,247,77], [252,247,80], [252,247,84], [252,247,87], [252,247,90], [252,248,93],- [252,248,96], [253,248,99], [253,248,102], [253,248,106], [253,248,109], [253,248,112], [253,248,115]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/inferno.json b/2D_wave_sim_V01/ColorSchemeList/inferno.jsondeleted file mode 100644index 155f031..0000000--- a/2D_wave_sim_V01/ColorSchemeList/inferno.json+++ /dev/null@@ -1,42 +0,0 @@-{- "name": "inferno",- "origin": "matplotlib colormap inferno, sampled at 255 points",- "category": "sequential",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [0,0,3], [0,0,4], [0,0,6], [1,0,7], [1,1,9], [1,1,11], [2,1,14], [2,2,16],- [3,2,18], [4,3,20], [4,3,22], [5,4,24], [6,4,27], [7,5,29], [8,6,31], [9,6,33],- [10,7,35], [11,7,38], [13,8,40], [14,8,42], [15,9,45], [16,9,47], [18,10,50], [19,10,52],- [20,11,54], [22,11,57], [23,11,59], [25,11,62], [26,11,64], [28,12,67], [29,12,69], [31,12,71],- [32,12,74], [34,11,76], [36,11,78], [38,11,80], [39,11,82], [41,11,84], [43,10,86], [45,10,88],- [46,10,90], [48,10,92], [50,9,93], [52,9,95], [53,9,96], [55,9,97], [57,9,98], [59,9,100],- [60,9,101], [62,9,102], [64,9,102], [65,9,103], [67,10,104], [69,10,105], [70,10,105], [72,11,106],- [74,11,106], [75,12,107], [77,12,107], [79,13,108], [80,13,108], [82,14,108], [83,14,109], [85,15,109],- [87,15,109], [88,16,109], [90,17,109], [91,17,110], [93,18,110], [95,18,110], [96,19,110], [98,20,110],- [99,20,110], [101,21,110], [102,21,110], [104,22,110], [106,23,110], [107,23,110], [109,24,110], [110,24,110],- [112,25,110], [114,25,109], [115,26,109], [117,27,109], [118,27,109], [120,28,109], [122,28,109], [123,29,108],- [125,29,108], [126,30,108], [128,31,107], [129,31,107], [131,32,107], [133,32,106], [134,33,106], [136,33,106],- [137,34,105], [139,34,105], [141,35,105], [142,36,104], [144,36,104], [145,37,103], [147,37,103], [149,38,102],- [150,38,102], [152,39,101], [153,40,100], [155,40,100], [156,41,99], [158,41,99], [160,42,98], [161,43,97],- [163,43,97], [164,44,96], [166,44,95], [167,45,95], [169,46,94], [171,46,93], [172,47,92], [174,48,91],- [175,49,91], [177,49,90], [178,50,89], [180,51,88], [181,51,87], [183,52,86], [184,53,86], [187,55,84],- [189,55,83], [190,56,82], [191,57,81], [193,58,80], [194,59,79], [196,60,78], [197,61,77], [199,62,76],- [200,62,75], [201,63,74], [203,64,73], [204,65,72], [205,66,71], [207,68,70], [208,69,68], [209,70,67],- [210,71,66], [212,72,65], [213,73,64], [214,74,63], [215,75,62], [217,77,61], [218,78,59], [219,79,58],- [220,80,57], [221,82,56], [222,83,55], [223,84,54], [224,86,52], [226,87,51], [227,88,50], [228,90,49],- [229,91,48], [230,92,46], [230,94,45], [231,95,44], [232,97,43], [233,98,42], [234,100,40], [235,101,39],- [236,103,38], [237,104,37], [237,106,35], [238,108,34], [239,109,33], [240,111,31], [240,112,30], [241,114,29],- [242,116,28], [242,117,26], [243,119,25], [243,121,24], [244,122,22], [245,124,21], [245,126,20], [246,128,18],- [246,129,17], [247,131,16], [247,133,14], [248,135,13], [248,136,12], [248,138,11], [249,140,9], [249,142,8],- [249,144,8], [250,145,7], [250,147,6], [250,149,6], [250,151,6], [251,153,6], [251,155,6], [251,157,6],- [251,158,7], [251,160,7], [251,162,8], [251,164,10], [251,166,11], [251,168,13], [251,170,14], [251,172,16],- [251,174,18], [251,176,20], [251,177,22], [251,179,24], [251,181,26], [251,183,28], [251,185,30], [250,187,33],- [250,189,35], [250,191,37], [250,193,40], [249,195,42], [249,197,44], [249,199,47], [248,201,49], [248,203,52],- [248,205,55], [247,207,58], [247,209,60], [246,211,63], [246,213,66], [245,215,69], [245,217,72], [244,219,75],- [244,220,79], [243,222,82], [243,224,86], [243,226,89], [242,228,93], [242,230,96], [241,232,100], [241,233,104],- [241,235,108], [241,237,112], [241,238,116], [241,240,121], [241,242,125], [242,243,129], [242,244,133], [243,246,137],- [244,247,141], [245,248,145], [246,250,149], [247,251,153], [249,252,157], [250,253,160], [252,254,164]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/magma.json b/2D_wave_sim_V01/ColorSchemeList/magma.jsondeleted file mode 100644index 35f03bb..0000000--- a/2D_wave_sim_V01/ColorSchemeList/magma.json+++ /dev/null@@ -1,42 +0,0 @@-{- "name": "magma",- "origin": "matplotlib colormap magma, sampled at 255 points",- "category": "sequential",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [0,0,3], [0,0,4], [0,0,6], [1,0,7], [1,1,9], [1,1,11], [2,2,13], [2,2,15],- [3,3,17], [4,3,19], [4,4,21], [5,4,23], [6,5,25], [7,5,27], [8,6,29], [9,7,31],- [10,7,34], [11,8,36], [12,9,38], [13,10,40], [14,10,42], [15,11,44], [16,12,47], [17,12,49],- [18,13,51], [20,13,53], [21,14,56], [22,14,58], [23,15,60], [24,15,63], [26,16,65], [27,16,68],- [28,16,70], [30,16,73], [31,17,75], [32,17,77], [34,17,80], [35,17,82], [37,17,85], [38,17,87],- [40,17,89], [42,17,92], [43,17,94], [45,16,96], [47,16,98], [48,16,101], [50,16,103], [52,16,104],- [53,15,106], [55,15,108], [57,15,110], [59,15,111], [60,15,113], [62,15,114], [64,15,115], [66,15,116],- [67,15,117], [69,15,118], [71,15,119], [72,16,120], [74,16,121], [75,16,121], [77,17,122], [79,17,123],- [80,18,123], [82,18,124], [83,19,124], [85,19,125], [87,20,125], [88,21,126], [90,21,126], [91,22,126],- [93,23,126], [94,23,127], [96,24,127], [97,24,127], [99,25,127], [101,26,128], [102,26,128], [104,27,128],- [105,28,128], [107,28,128], [108,29,128], [110,30,129], [111,30,129], [113,31,129], [115,31,129], [116,32,129],- [118,33,129], [119,33,129], [121,34,129], [122,34,129], [124,35,129], [126,36,129], [127,36,129], [129,37,129],- [130,37,129], [132,38,129], [133,38,129], [135,39,129], [137,40,129], [138,40,129], [140,41,128], [141,41,128],- [143,42,128], [145,42,128], [146,43,128], [148,43,128], [149,44,128], [151,44,127], [153,45,127], [154,45,127],- [156,46,127], [158,46,126], [159,47,126], [161,47,126], [163,48,126], [164,48,125], [166,49,125], [167,49,125],- [169,50,124], [171,51,124], [172,51,123], [174,52,123], [176,52,123], [177,53,122], [179,53,122], [182,54,121],- [184,55,120], [185,55,120], [187,56,119], [189,57,119], [190,57,118], [192,58,117], [194,58,117], [195,59,116],- [197,60,116], [198,60,115], [200,61,114], [202,62,114], [203,62,113], [205,63,112], [206,64,112], [208,65,111],- [209,66,110], [211,66,109], [212,67,109], [214,68,108], [215,69,107], [217,70,106], [218,71,105], [220,72,105],- [221,73,104], [222,74,103], [224,75,102], [225,76,102], [226,77,101], [228,78,100], [229,80,99], [230,81,98],- [231,82,98], [232,84,97], [234,85,96], [235,86,96], [236,88,95], [237,89,95], [238,91,94], [238,93,93],- [239,94,93], [240,96,93], [241,97,92], [242,99,92], [243,101,92], [243,103,91], [244,104,91], [245,106,91],- [245,108,91], [246,110,91], [246,112,91], [247,113,91], [247,115,92], [248,117,92], [248,119,92], [249,121,92],- [249,123,93], [249,125,93], [250,127,94], [250,128,94], [250,130,95], [251,132,96], [251,134,96], [251,136,97],- [251,138,98], [252,140,99], [252,142,99], [252,144,100], [252,146,101], [252,147,102], [253,149,103], [253,151,104],- [253,153,105], [253,155,106], [253,157,107], [253,159,108], [253,161,110], [253,162,111], [253,164,112], [254,166,113],- [254,168,115], [254,170,116], [254,172,117], [254,174,118], [254,175,120], [254,177,121], [254,179,123], [254,181,124],- [254,183,125], [254,185,127], [254,187,128], [254,188,130], [254,190,131], [254,192,133], [254,194,134], [254,196,136],- [254,198,137], [254,199,139], [254,201,141], [254,203,142], [253,205,144], [253,207,146], [253,209,147], [253,210,149],- [253,212,151], [253,214,152], [253,216,154], [253,218,156], [253,220,157], [253,221,159], [253,223,161], [253,225,163],- [252,227,165], [252,229,166], [252,230,168], [252,232,170], [252,234,172], [252,236,174], [252,238,176], [252,240,177],- [252,241,179], [252,243,181], [252,245,183], [251,247,185], [251,249,187], [251,250,189], [251,252,191]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/plasma.json b/2D_wave_sim_V01/ColorSchemeList/plasma.jsondeleted file mode 100644index 768aacb..0000000--- a/2D_wave_sim_V01/ColorSchemeList/plasma.json+++ /dev/null@@ -1,43 +0,0 @@-{- "name": "plasma",- "origin": "9-stop copy of scheme 'plasma'",- "category": "custom",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "stops": [[12,7,134], [76,2,161], [125,3,167], [168,34,150], [203,71,119], [229,108,91], [248,148,65], [253,195,40], [239,248,33]],- "colors": [- [12,7,134], [14,7,135], [16,7,136], [18,7,137], [20,6,137], [22,6,138], [24,6,139], [26,6,140],- [28,6,141], [30,6,142], [32,5,143], [34,5,143], [36,5,144], [38,5,145], [40,5,146], [42,5,147],- [44,4,148], [46,4,148], [48,4,149], [50,4,150], [52,4,151], [54,4,152], [56,4,153], [58,3,154],- [60,3,154], [62,3,155], [64,3,156], [66,3,157], [68,3,158], [70,2,159], [72,2,160], [74,2,160],- [76,2,161], [78,2,161], [79,2,161], [81,2,162], [83,2,162], [84,2,162], [86,2,162], [87,2,162],- [89,2,163], [90,2,163], [92,2,163], [93,2,163], [95,2,163], [96,2,164], [98,2,164], [100,2,164],- [101,3,164], [103,3,164], [104,3,164], [106,3,165], [107,3,165], [109,3,165], [110,3,165], [112,3,165],- [113,3,166], [115,3,166], [117,3,166], [118,3,166], [120,3,166], [121,3,167], [123,3,167], [124,3,167],- [126,3,167], [127,4,166], [128,5,166], [130,6,165], [131,7,165], [132,8,164], [134,9,164], [135,10,163],- [137,11,162], [138,12,162], [139,13,161], [141,14,161], [142,15,160], [143,16,160], [145,17,159], [146,18,159],- [147,19,158], [149,20,158], [150,21,157], [151,22,157], [153,23,156], [154,24,155], [155,25,155], [157,26,154],- [158,27,154], [160,28,153], [161,29,153], [162,30,152], [164,31,152], [165,32,151], [166,33,151], [168,34,150],- [169,35,149], [170,36,148], [171,37,147], [172,38,146], [173,40,145], [174,41,144], [175,42,143], [177,43,142],- [178,44,141], [179,45,140], [180,47,140], [181,48,139], [182,49,138], [183,50,137], [184,51,136], [185,52,135],- [186,54,134], [188,55,133], [189,56,132], [190,57,131], [191,58,130], [192,59,129], [193,61,128], [194,62,127],- [195,63,126], [196,64,125], [197,65,124], [199,66,123], [200,68,122], [201,69,121], [202,70,120], [203,71,119],- [204,72,118], [205,73,117], [205,74,116], [206,76,115], [207,77,115], [208,78,114], [209,79,113], [210,80,112],- [210,81,111], [211,83,110], [212,84,109], [213,85,108], [214,86,108], [214,87,107], [215,88,106], [216,90,105],- [217,91,104], [218,92,103], [219,93,102], [219,94,101], [220,95,100], [221,97,100], [222,98,99], [223,99,98],- [223,100,97], [224,101,96], [225,102,95], [226,104,94], [227,105,93], [228,106,93], [228,107,92], [229,108,91],- [230,110,90], [230,111,89], [231,112,88], [232,113,88], [232,115,87], [233,116,86], [233,117,85], [234,118,84],- [235,120,83], [235,121,83], [236,122,82], [236,123,81], [237,125,80], [238,126,79], [238,127,79], [239,128,78],- [239,130,77], [240,131,76], [241,132,75], [241,134,74], [242,135,74], [242,136,73], [243,137,72], [244,139,71],- [244,140,70], [245,141,70], [245,142,69], [246,144,68], [247,145,67], [247,146,66], [248,147,65], [248,149,65],- [248,150,64], [248,152,63], [249,153,62], [249,155,61], [249,156,61], [249,158,60], [249,159,59], [249,161,58],- [249,162,58], [250,164,57], [250,165,56], [250,167,55], [250,168,54], [250,169,54], [250,171,53], [251,172,52],- [251,174,51], [251,175,50], [251,177,50], [251,178,49], [251,180,48], [252,181,47], [252,183,46], [252,184,46],- [252,186,45], [252,187,44], [252,189,43], [252,190,43], [253,192,42], [253,193,41], [253,195,40], [253,196,40],- [252,198,40], [252,200,39], [251,201,39], [251,203,39], [250,205,39], [250,206,39], [250,208,38], [249,210,38],- [249,211,38], [248,213,38], [248,215,37], [247,216,37], [247,218,37], [246,220,37], [246,221,37], [246,223,36],- [245,225,36], [245,226,36], [244,228,36], [244,230,35], [243,231,35], [243,233,35], [243,235,35], [242,236,35],- [242,238,34], [241,240,34], [241,241,34], [240,243,34], [240,245,33], [239,246,33], [239,248,33]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemeList/rainbow.json b/2D_wave_sim_V01/ColorSchemeList/rainbow.jsondeleted file mode 100644index e865ade..0000000--- a/2D_wave_sim_V01/ColorSchemeList/rainbow.json+++ /dev/null@@ -1,42 +0,0 @@-{- "name": "rainbow",- "origin": "matplotlib colormap rainbow, sampled at 255 points",- "category": "other",- "scheme_type": "intensity",- "bits_per_channel": 8,- "entry_count": 255,- "colors": [- [127,0,255], [125,3,254], [123,6,254], [121,9,254], [119,12,254], [117,15,254], [115,18,254], [113,21,254],- [111,25,254], [109,28,254], [107,31,254], [105,34,254], [103,37,254], [101,40,254], [99,43,254], [97,46,253],- [95,49,253], [93,53,253], [91,56,253], [89,59,253], [87,62,253], [85,65,252], [83,68,252], [81,71,252],- [79,74,252], [77,77,251], [75,80,251], [73,83,251], [71,86,251], [69,89,250], [67,92,250], [65,95,250],- [63,97,250], [61,100,249], [59,103,249], [57,106,249], [55,109,248], [53,112,248], [51,115,248], [49,117,247],- [47,120,247], [45,123,246], [43,126,246], [41,128,246], [39,131,245], [37,134,245], [35,136,244], [33,139,244],- [31,142,243], [29,144,243], [27,147,243], [25,149,242], [23,152,242], [21,154,241], [19,157,241], [17,159,240],- [15,162,239], [13,164,239], [11,167,238], [9,169,238], [7,171,237], [5,174,237], [3,176,236], [1,178,236],- [0,180,235], [2,183,234], [4,185,234], [6,187,233], [8,189,232], [10,191,232], [12,193,231], [14,195,230],- [16,197,230], [18,199,229], [20,201,228], [22,203,228], [24,205,227], [26,207,226], [28,209,226], [30,210,225],- [32,212,224], [34,214,223], [36,215,223], [38,217,222], [40,219,221], [42,220,220], [44,222,220], [46,223,219],- [48,225,218], [50,226,217], [52,228,216], [54,229,215], [56,230,215], [58,232,214], [60,233,213], [62,234,212],- [64,236,211], [66,237,210], [68,238,209], [70,239,209], [72,240,208], [74,241,207], [76,242,206], [78,243,205],- [80,244,204], [82,245,203], [84,246,202], [86,246,201], [88,247,200], [90,248,199], [92,249,198], [94,249,197],- [96,250,196], [98,250,195], [100,251,194], [102,251,193], [104,252,192], [106,252,191], [108,253,190], [110,253,189],- [112,253,188], [114,254,187], [116,254,186], [118,254,185], [120,254,184], [122,254,183], [124,254,181], [128,254,179],- [130,254,178], [132,254,177], [134,254,176], [136,254,175], [138,254,174], [140,254,172], [142,253,171], [144,253,170],- [146,253,169], [148,252,168], [150,252,167], [152,251,165], [154,251,164], [156,250,163], [158,250,162], [160,249,161],- [162,249,159], [164,248,158], [166,247,157], [168,246,156], [170,246,154], [172,245,153], [174,244,152], [176,243,151],- [178,242,149], [180,241,148], [182,240,147], [184,239,146], [186,238,144], [188,237,143], [190,236,142], [192,234,140],- [194,233,139], [196,232,138], [198,230,136], [200,229,135], [202,228,134], [204,226,132], [206,225,131], [208,223,130],- [210,222,128], [212,220,127], [214,219,126], [216,217,124], [218,215,123], [220,214,122], [222,212,120], [224,210,119],- [226,209,117], [228,207,116], [230,205,115], [232,203,113], [234,201,112], [236,199,110], [238,197,109], [240,195,108],- [242,193,106], [244,191,105], [246,189,103], [248,187,102], [250,185,100], [252,183,99], [254,180,97], [255,178,96],- [255,176,95], [255,174,93], [255,171,92], [255,169,90], [255,167,89], [255,164,87], [255,162,86], [255,159,84],- [255,157,83], [255,154,81], [255,152,80], [255,149,78], [255,147,77], [255,144,75], [255,142,74], [255,139,72],- [255,136,71], [255,134,69], [255,131,68], [255,128,66], [255,126,65], [255,123,63], [255,120,62], [255,117,60],- [255,115,59], [255,112,57], [255,109,56], [255,106,54], [255,103,53], [255,100,51], [255,97,49], [255,95,48],- [255,92,46], [255,89,45], [255,86,43], [255,83,42], [255,80,40], [255,77,39], [255,74,37], [255,71,36],- [255,68,34], [255,65,32], [255,62,31], [255,59,29], [255,56,28], [255,53,26], [255,49,25], [255,46,23],- [255,43,21], [255,40,20], [255,37,18], [255,34,17], [255,31,15], [255,28,14], [255,25,12], [255,21,10],- [255,18,9], [255,15,7], [255,12,6], [255,9,4], [255,6,3], [255,3,1], [255,0,0]- ]-}diff --git a/2D_wave_sim_V01/ColorSchemes/ColorLut.vb b/2D_wave_sim_V01/ColorSchemes/ColorLut.vbdeleted file mode 100644index 98456f8..0000000--- a/2D_wave_sim_V01/ColorSchemes/ColorLut.vb+++ /dev/null@@ -1,141 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.-'-' Portions of this file are based on WaveSimulator2D by 0x23-' <https://github.com/0x23/WaveSimulator2D>.--Option Strict On-Option Explicit On--Imports System.Drawing--''' <summary>-''' A ready-to-use lookup table (255 colors) made from a color scheme plus the display options of the-''' Python function get_colormap_lut: invert, black level and make symmetric. Also converts field and-''' intensity values to table indices exactly like WaveVisualizer.render_field / render_intensity.-'''-''' The options belong to how a scheme is used in a simulation (field or intensity), not to the scheme-''' itself, so they are not saved in the scheme file.-''' </summary>-Public NotInheritable Class ColorLut-- ''' <summary>Number of entries (255).</summary>- Public Const Size As Integer = ColorScheme.EntryCount-- Private ReadOnly _argb As Integer()-- Private Sub New(argb As Integer())- _argb = argb- End Sub-- ''' <summary>- ''' Packed 32-bit ARGB values (alpha 255), ready to be copied into a Format32bppArgb bitmap.- ''' Treat as read-only.- ''' </summary>- Public ReadOnly Property Argb As Integer()- Get- Return _argb- End Get- End Property-- Public Function ColorAt(index As Integer) As Color- Return Color.FromArgb(_argb(index))- End Function-- ''' <summary>- ''' Builds the table. Order of operations, as in Python: reverse (new, optional), invert (1 - color),- ''' make symmetric, black level (c * (1 - b) + b). Values are limited to 0..1 and converted to 8 bit- ''' by truncation, like the Python code.- ''' </summary>- ''' <param name="invert">Replaces every color by its complement (1 - color), like the Python option.</param>- ''' <param name="blackLevel">Lifts (positive) or lowers (negative) the darkest level. 0 = unchanged.</param>- ''' <param name="makeSymmetric">Squeezes the whole scheme into each half and mirrors it around the centre.</param>- ''' <param name="reverse">Reverses the order of the scheme (like matplotlib's _r maps).</param>- Public Shared Function Build(scheme As ColorScheme,- Optional invert As Boolean = False,- Optional blackLevel As Double = 0.0,- Optional makeSymmetric As Boolean = False,- Optional reverse As Boolean = False) As ColorLut- If scheme Is Nothing Then Throw New ArgumentNullException("scheme")- Dim n As Integer = Size-- ' source values 0..1- Dim src(n - 1, 2) As Double- For i As Integer = 0 To n - 1- Dim c As Color = scheme.GetEntry(If(reverse, n - 1 - i, i))- src(i, 0) = c.R / 255.0- src(i, 1) = c.G / 255.0- src(i, 2) = c.B / 255.0- Next-- If invert Then- For i As Integer = 0 To n - 1- For k As Integer = 0 To 2- src(i, k) = 1.0 - src(i, k)- Next- Next- End If-- Dim argb(n - 1) As Integer- For i As Integer = 0 To n - 1- ' Python: entries 0..127 = src[0::2] and entries 127..254 = the same list mirrored,- ' which is entry i = src(2 * min(i, 254 - i))- Dim s As Integer = i- If makeSymmetric Then s = 2 * Math.Min(i, n - 1 - i)-- Dim rgb(2) As Integer- For k As Integer = 0 To 2- Dim v As Double = src(s, k) * (1.0 - blackLevel) + blackLevel- If v < 0.0 Then v = 0.0- If v > 1.0 Then v = 1.0- Dim b As Integer = CInt(Math.Truncate(v * 255.0))- If b > 255 Then b = 255- rgb(k) = b- Next- argb(i) = Color.FromArgb(255, rgb(0), rgb(1), rgb(2)).ToArgb()- Next-- Return New ColorLut(argb)- End Function-- ''' <summary>- ''' Table index for a field value, like render_field: clip(value * brightness, -1, 1) * 127 + 127.- ''' Zero field gives index 127 (the centre color); result is 0..254.- ''' </summary>- Public Shared Function FieldIndex(value As Single, brightness As Single) As Integer- Dim x As Single = value * brightness- If Single.IsNaN(x) Then Return 127- If x > 1.0F Then x = 1.0F- If x < -1.0F Then x = -1.0F- Return CInt(Math.Truncate(x * 127.0F + 127.0F))- End Function-- ''' <summary>- ''' Table index for an intensity value, like render_intensity:- ''' clip(intensity ^ exponent * brightness, 0, 1) * 254. The Python default exponent is 0.5.- ''' </summary>- Public Shared Function IntensityIndex(intensity As Single, brightness As Single, Optional exponent As Single = 0.5F) As Integer- If Single.IsNaN(intensity) OrElse intensity <= 0.0F Then Return 0- Dim x As Double = Math.Pow(intensity, exponent) * brightness- If Double.IsNaN(x) OrElse x < 0.0 Then Return 0- If x > 1.0 Then x = 1.0- Return CInt(Math.Truncate(x * 254.0))- End Function--End Classdiff --git a/2D_wave_sim_V01/ColorSchemes/ColorPickerControl.vb b/2D_wave_sim_V01/ColorSchemes/ColorPickerControl.vbdeleted file mode 100644index 59e642f..0000000--- a/2D_wave_sim_V01/ColorSchemes/ColorPickerControl.vb+++ /dev/null@@ -1,403 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.ComponentModel-Imports System.Drawing-Imports System.Drawing.Drawing2D-Imports System.Drawing.Imaging-Imports System.Globalization-Imports System.Runtime.InteropServices-Imports System.Windows.Forms--''' <summary>-''' A small color picker: a saturation/brightness square, a hue bar, a new/old swatch, a hex box and a-''' button that opens the standard Windows color dialog. Raises ColorChanged while the user picks.-''' It is built completely in code, so it has no designer file.-''' </summary>-<DesignerCategory("Code")>-Public Class ColorPickerControl- Inherits UserControl-- ''' <summary>Raised whenever the user changes the color (dragging, typing a hex code, dialog, old swatch).</summary>- Public Event ColorChanged As EventHandler-- Private Const SvResolution As Integer = 150-- Private ReadOnly _svRect As New Rectangle(10, 10, 300, 300)- Private ReadOnly _hueRect As New Rectangle(326, 10, 28, 300)- Private ReadOnly _newRect As New Rectangle(10, 324, 150, 36)- Private ReadOnly _oldRect As New Rectangle(160, 324, 150, 36)-- Private ReadOnly _lblHex As New Label()- Private ReadOnly _txtHex As New TextBox()- Private ReadOnly _lblRgb As New Label()- Private ReadOnly _btnDialog As New Button()-- Private _h As Double ' hue 0..360- Private _s As Double ' saturation 0..1- Private _v As Double ' brightness 0..1- Private _color As Color = Color.Red- Private _original As Color = Color.Gray-- Private _svBitmap As Bitmap- Private _svHue As Double = -1.0- Private _hueBitmap As Bitmap- Private _drag As Integer ' 0 = none, 1 = square, 2 = hue bar- Private _updatingText As Boolean-- Public Sub New()- MyBase.New()- SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or- ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw, True)- Me.Size = New Size(423, 411)-- _lblHex.Text = "Hex"- _lblHex.AutoSize = True- _lblHex.Location = New Point(10, 377)-- _txtHex.Location = New Point(48, 373)- _txtHex.Width = 90- _txtHex.MaxLength = 7-- _lblRgb.AutoSize = True- _lblRgb.Location = New Point(152, 377)-- _btnDialog.Text = "More..."- _btnDialog.Location = New Point(326, 324)- _btnDialog.Size = New Size(90, 36)-- Me.Controls.Add(_lblHex)- Me.Controls.Add(_txtHex)- Me.Controls.Add(_lblRgb)- Me.Controls.Add(_btnDialog)-- AddHandler _txtHex.TextChanged, AddressOf HexTextChanged- AddHandler _btnDialog.Click, AddressOf DialogButtonClick-- ApplyColor(Color.Red, False, False)- End Sub-- ' ---------------------------------------------------------------- public-- ''' <summary>The current color. Setting it does not raise ColorChanged.</summary>- Public Property SelectedColor As Color- Get- Return _color- End Get- Set(value As Color)- ApplyColor(value, False, False)- End Set- End Property-- ''' <summary>The color shown in the "Old" swatch; clicking that swatch restores it.</summary>- Public Property OriginalColor As Color- Get- Return _original- End Get- Set(value As Color)- _original = Color.FromArgb(value.R, value.G, value.B)- Invalidate()- End Set- End Property-- ' ---------------------------------------------------------------- color logic-- Private Sub ApplyColor(c As Color, raiseChanged As Boolean, fromHexBox As Boolean)- _color = Color.FromArgb(c.R, c.G, c.B)-- Dim hh, ss, vv As Double- RgbToHsv(_color, hh, ss, vv)- If ss > 0.0 AndAlso vv > 0.0 Then _h = hh ' keep the old hue for grays and black- _s = ss- _v = vv-- UpdateTexts(fromHexBox)- Invalidate()- If raiseChanged Then RaiseEvent ColorChanged(Me, EventArgs.Empty)- End Sub-- Private Sub SyncFromHsv()- _color = HsvToColor(_h, _s, _v)- UpdateTexts(False)- Invalidate()- RaiseEvent ColorChanged(Me, EventArgs.Empty)- End Sub-- Private Sub UpdateTexts(skipHexBox As Boolean)- _updatingText = True- Try- If Not skipHexBox Then- _txtHex.Text = "#" & _color.R.ToString("X2", CultureInfo.InvariantCulture) &- _color.G.ToString("X2", CultureInfo.InvariantCulture) &- _color.B.ToString("X2", CultureInfo.InvariantCulture)- End If- _lblRgb.Text = String.Format(CultureInfo.InvariantCulture, "R {0} G {1} B {2}", _color.R, _color.G, _color.B)- Finally- _updatingText = False- End Try- End Sub-- Private Sub HexTextChanged(sender As Object, e As EventArgs)- If _updatingText Then Return- Dim t As String = _txtHex.Text.Trim().TrimStart("#"c)- If t.Length <> 6 Then Return- Dim rgb As Integer- If Integer.TryParse(t, NumberStyles.HexNumber, CultureInfo.InvariantCulture, rgb) Then- ApplyColor(Color.FromArgb((rgb >> 16) And &HFF, (rgb >> 8) And &HFF, rgb And &HFF), True, True)- End If- End Sub-- Private Sub DialogButtonClick(sender As Object, e As EventArgs)- Using dlg As New ColorDialog()- dlg.FullOpen = True- dlg.Color = _color- If dlg.ShowDialog(Me) = DialogResult.OK Then- ApplyColor(dlg.Color, True, False)- End If- End Using- End Sub-- ' ---------------------------------------------------------------- mouse-- Protected Overrides Sub OnMouseDown(e As MouseEventArgs)- MyBase.OnMouseDown(e)- If e.Button <> MouseButtons.Left Then Return- If _svRect.Contains(e.Location) Then- _drag = 1- UpdateFromMouse(e.Location)- ElseIf _hueRect.Contains(e.Location) Then- _drag = 2- UpdateFromMouse(e.Location)- ElseIf _oldRect.Contains(e.Location) Then- ApplyColor(_original, True, False)- End If- End Sub-- Protected Overrides Sub OnMouseMove(e As MouseEventArgs)- MyBase.OnMouseMove(e)- If _drag <> 0 Then UpdateFromMouse(e.Location)- End Sub-- Protected Overrides Sub OnMouseUp(e As MouseEventArgs)- MyBase.OnMouseUp(e)- _drag = 0- End Sub-- Private Sub UpdateFromMouse(p As Point)- If _drag = 1 Then- _s = Clamp01((p.X - _svRect.X) / CDbl(_svRect.Width - 1))- _v = 1.0 - Clamp01((p.Y - _svRect.Y) / CDbl(_svRect.Height - 1))- ElseIf _drag = 2 Then- _h = Clamp01((p.Y - _hueRect.Y) / CDbl(_hueRect.Height - 1)) * 360.0- Else- Return- End If- SyncFromHsv()- End Sub-- ' ---------------------------------------------------------------- painting-- Protected Overrides Sub OnPaint(e As PaintEventArgs)- MyBase.OnPaint(e)- Dim g As Graphics = e.Graphics- g.Clear(Me.BackColor)-- ' saturation / brightness square- EnsureSvBitmap()- g.InterpolationMode = InterpolationMode.HighQualityBilinear- g.PixelOffsetMode = PixelOffsetMode.Half- g.DrawImage(_svBitmap, _svRect)- g.DrawRectangle(Pens.Black, _svRect.X - 1, _svRect.Y - 1, _svRect.Width + 1, _svRect.Height + 1)-- ' hue bar- EnsureHueBitmap()- g.InterpolationMode = InterpolationMode.NearestNeighbor- g.DrawImage(_hueBitmap, _hueRect)- g.DrawRectangle(Pens.Black, _hueRect.X - 1, _hueRect.Y - 1, _hueRect.Width + 1, _hueRect.Height + 1)-- g.SmoothingMode = SmoothingMode.AntiAlias-- ' marker in the square- Dim mx As Single = CSng(_svRect.X + _s * (_svRect.Width - 1))- Dim my As Single = CSng(_svRect.Y + (1.0 - _v) * (_svRect.Height - 1))- g.DrawEllipse(Pens.Black, mx - 7.0F, my - 7.0F, 14.0F, 14.0F)- g.DrawEllipse(Pens.White, mx - 6.0F, my - 6.0F, 12.0F, 12.0F)-- ' marker on the hue bar- Dim hy As Single = CSng(_hueRect.Y + (_h / 360.0) * (_hueRect.Height - 1))- g.DrawRectangle(Pens.Black, _hueRect.X - 3, hy - 3.0F, _hueRect.Width + 5, 6.0F)- g.DrawRectangle(Pens.White, _hueRect.X - 2, hy - 2.0F, _hueRect.Width + 3, 4.0F)-- g.SmoothingMode = SmoothingMode.Default-- ' swatches- Using br As New SolidBrush(_color)- g.FillRectangle(br, _newRect)- End Using- Using br As New SolidBrush(_original)- g.FillRectangle(br, _oldRect)- End Using- g.DrawRectangle(Pens.Black, _newRect.X, _newRect.Y, _newRect.Width - 1, _newRect.Height - 1)- g.DrawRectangle(Pens.Black, _oldRect.X, _oldRect.Y, _oldRect.Width - 1, _oldRect.Height - 1)- TextRenderer.DrawText(g, "New", Me.Font, _newRect, ContrastColor(_color),- TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter)- TextRenderer.DrawText(g, "Old (click to restore)", Me.Font, _oldRect, ContrastColor(_original),- TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter)-- If Not Me.Enabled Then- Using veil As New SolidBrush(Color.FromArgb(150, Me.BackColor))- g.FillRectangle(veil, Me.ClientRectangle)- End Using- End If- End Sub-- Protected Overrides Sub OnEnabledChanged(e As EventArgs)- MyBase.OnEnabledChanged(e)- Invalidate()- End Sub-- Private Sub EnsureSvBitmap()- If _svBitmap IsNot Nothing AndAlso Math.Abs(_svHue - _h) < 0.0001 Then Return- If _svBitmap Is Nothing Then- _svBitmap = New Bitmap(SvResolution, SvResolution, PixelFormat.Format32bppArgb)- End If-- Dim baseColor As Color = HsvToColor(_h, 1.0, 1.0)- Dim br As Double = baseColor.R / 255.0- Dim bg As Double = baseColor.G / 255.0- Dim bb As Double = baseColor.B / 255.0-- Dim pixels(SvResolution * SvResolution - 1) As Integer- For y As Integer = 0 To SvResolution - 1- Dim v As Double = 1.0 - y / CDbl(SvResolution - 1)- For x As Integer = 0 To SvResolution - 1- Dim s As Double = x / CDbl(SvResolution - 1)- Dim r As Integer = CInt(Math.Round(255.0 * v * ((1.0 - s) + s * br)))- Dim gg As Integer = CInt(Math.Round(255.0 * v * ((1.0 - s) + s * bg)))- Dim b As Integer = CInt(Math.Round(255.0 * v * ((1.0 - s) + s * bb)))- pixels(y * SvResolution + x) = Color.FromArgb(255, r, gg, b).ToArgb()- Next- Next-- Dim data As BitmapData = _svBitmap.LockBits(New Rectangle(0, 0, SvResolution, SvResolution),- ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb)- Try- Marshal.Copy(pixels, 0, data.Scan0, pixels.Length)- Finally- _svBitmap.UnlockBits(data)- End Try- _svHue = _h- End Sub-- Private Sub EnsureHueBitmap()- If _hueBitmap IsNot Nothing Then Return- _hueBitmap = New Bitmap(1, _hueRect.Height, PixelFormat.Format32bppArgb)- For y As Integer = 0 To _hueRect.Height - 1- _hueBitmap.SetPixel(0, y, HsvToColor(y / CDbl(_hueRect.Height - 1) * 360.0, 1.0, 1.0))- Next- End Sub-- Protected Overrides Sub Dispose(disposing As Boolean)- If disposing Then- If _svBitmap IsNot Nothing Then _svBitmap.Dispose()- If _hueBitmap IsNot Nothing Then _hueBitmap.Dispose()- End If- MyBase.Dispose(disposing)- End Sub-- ' ---------------------------------------------------------------- helpers-- Private Shared Function Clamp01(x As Double) As Double- If x < 0.0 Then Return 0.0- If x > 1.0 Then Return 1.0- Return x- End Function-- Private Shared Function ContrastColor(c As Color) As Color- Dim lum As Double = 0.299 * c.R + 0.587 * c.G + 0.114 * c.B- If lum > 140.0 Then Return Color.Black- Return Color.White- End Function-- ''' <summary>Converts hue (0..360), saturation and value (0..1) to an RGB color.</summary>- Public Shared Function HsvToColor(h As Double, s As Double, v As Double) As Color- Dim hue As Double = h Mod 360.0- If hue < 0.0 Then hue += 360.0- Dim c As Double = v * s- Dim hp As Double = hue / 60.0- Dim x As Double = c * (1.0 - Math.Abs((hp Mod 2.0) - 1.0))-- Dim r1, g1, b1 As Double- Select Case CInt(Math.Floor(hp))- Case 0- r1 = c : g1 = x : b1 = 0.0- Case 1- r1 = x : g1 = c : b1 = 0.0- Case 2- r1 = 0.0 : g1 = c : b1 = x- Case 3- r1 = 0.0 : g1 = x : b1 = c- Case 4- r1 = x : g1 = 0.0 : b1 = c- Case Else- r1 = c : g1 = 0.0 : b1 = x- End Select-- Dim m As Double = v - c- Return Color.FromArgb(ToByte(r1 + m), ToByte(g1 + m), ToByte(b1 + m))- End Function-- Private Shared Function ToByte(v As Double) As Integer- Dim n As Integer = CInt(Math.Round(v * 255.0))- If n < 0 Then n = 0- If n > 255 Then n = 255- Return n- End Function-- Private Shared Sub RgbToHsv(c As Color, ByRef h As Double, ByRef s As Double, ByRef v As Double)- Dim r As Double = c.R / 255.0- Dim g As Double = c.G / 255.0- Dim b As Double = c.B / 255.0- Dim mx As Double = Math.Max(r, Math.Max(g, b))- Dim mn As Double = Math.Min(r, Math.Min(g, b))- Dim d As Double = mx - mn-- v = mx- If mx <= 0.0 Then- s = 0.0- Else- s = d / mx- End If-- If d <= 0.0 Then- h = 0.0- ElseIf mx = r Then- h = 60.0 * (((g - b) / d) Mod 6.0)- ElseIf mx = g Then- h = 60.0 * (((b - r) / d) + 2.0)- Else- h = 60.0 * (((r - g) / d) + 4.0)- End If- If h < 0.0 Then h += 360.0- End Sub--End Classdiff --git a/2D_wave_sim_V01/ColorSchemes/ColorScheme.vb b/2D_wave_sim_V01/ColorSchemes/ColorScheme.vbdeleted file mode 100644index baeaa2e..0000000--- a/2D_wave_sim_V01/ColorSchemes/ColorScheme.vb+++ /dev/null@@ -1,232 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Drawing--''' <summary>-''' A color scheme: a lookup table of exactly 255 RGB colors, the same table size the Python-''' simulator uses. A scheme can be used for the field view or for the intensity view.-'''-''' Schemes made in the stop editor also keep their anchor colors ("stops", StopCount of them) so they can be-''' edited again. The stops sit at fixed, equally spaced positions on the scale: stop 1 is the first entry,-''' the last stop is the last entry and, with an odd number of stops, the middle stop is exactly the centre-''' entry 127 (the zero-field color). With 9 stops that is Color 5.-''' All other entries are interpolated linearly in RGB between neighbouring stops.-''' Imported schemes (matplotlib, seaborn, Python tables) have no stops and are used as they are.-''' </summary>-Public Class ColorScheme-- ''' <summary>Number of entries in every scheme.</summary>- Public Const EntryCount As Integer = 255-- ''' <summary>Number of fixed anchor colors in the stop editor (one Color button each) - 9 since the Color 8/9- ''' buttons were added to the Designer (previously upgraded from 5 to 7 the same way).</summary>- Public Const StopCount As Integer = 9-- Private _entries As Color()- Private _stops As Color()-- ''' <summary>Scheme type "field" (signed values, centre = zero field) as stored in the file.</summary>- Public Const SchemeTypeField As String = "field"-- ''' <summary>Scheme type "intensity" (values from zero upwards) as stored in the file.</summary>- Public Const SchemeTypeIntensity As String = "intensity"-- Public Property Name As String- Public Property Origin As String- Public Property Category As String-- ''' <summary>- ''' What the scheme is meant for: "field", "intensity" or an empty string when not specified.- ''' This is only a label saved in the file; any scheme can technically be used for either.- ''' </summary>- Public Property SchemeType As String-- ''' <summary>Full path of the JSON file this scheme was loaded from or saved to (empty if never saved).</summary>- Public Property FilePath As String-- Public Sub New(schemeName As String, colors As IList(Of Color))- If colors Is Nothing Then Throw New ArgumentNullException("colors")- Me.Name = schemeName- Me.Origin = ""- Me.Category = ""- Me.SchemeType = ""- Me.FilePath = ""- _entries = Resample(colors, EntryCount)- End Sub-- ' ---------------------------------------------------------------- reading-- ''' <summary>A copy of the 255 entries.</summary>- Public ReadOnly Property Entries As Color()- Get- Return CType(_entries.Clone(), Color())- End Get- End Property-- ''' <summary>One entry, index 0 to 254.</summary>- Public Function GetEntry(index As Integer) As Color- Return _entries(index)- End Function-- ''' <summary>True when the scheme has StopCount editable stops.</summary>- Public ReadOnly Property HasStops As Boolean- Get- Return _stops IsNot Nothing- End Get- End Property-- ''' <summary>A copy of the stops, or Nothing when the scheme has none.</summary>- Public ReadOnly Property Stops As Color()- Get- If _stops Is Nothing Then Return Nothing- Return CType(_stops.Clone(), Color())- End Get- End Property-- ''' <summary>The color at a fractional position (0 to 254) on the scale, interpolated between entries.</summary>- Public Function SampleAt(position As Double) As Color- If position <= 0.0 Then Return _entries(0)- If position >= EntryCount - 1 Then Return _entries(EntryCount - 1)- Dim lo As Integer = CInt(Math.Floor(position))- Return Lerp(_entries(lo), _entries(lo + 1), position - lo)- End Function-- Public Overrides Function ToString() As String- Return Name- End Function-- ' ---------------------------------------------------------------- stops-- ''' <summary>- ''' Creates a stop-based scheme. The stops must be given in scale order- ''' (stop 1 first, the middle stop in the centre, the last stop last).- ''' </summary>- Public Shared Function FromStops(schemeName As String, stops As IList(Of Color)) As ColorScheme- Dim scheme As New ColorScheme(schemeName, InterpolateStops(stops))- scheme.AttachStops(stops)- scheme.Origin = StopCount.ToString() & "-stop gradient made in the color scheme editor"- scheme.Category = "custom"- Return scheme- End Function-- ''' <summary>Sets the stops of this scheme without recomputing the entries (used when loading a file).</summary>- Friend Sub AttachStops(stops As IList(Of Color))- If stops Is Nothing OrElse stops.Count <> StopCount Then- Throw New ArgumentException("Exactly " & StopCount.ToString() & " stops are required.")- End If- Dim copy(StopCount - 1) As Color- stops.CopyTo(copy, 0)- _stops = copy- End Sub-- ''' <summary>Changes one stop (0 to StopCount - 1) and recomputes all 255 entries. Only for schemes with stops.</summary>- Public Sub SetStop(stopIndex As Integer, value As Color)- If _stops Is Nothing Then- Throw New InvalidOperationException("This scheme has no editable stops. Use ToStopScheme first.")- End If- If stopIndex < 0 OrElse stopIndex >= StopCount Then- Throw New ArgumentOutOfRangeException("stopIndex")- End If- _stops(stopIndex) = Color.FromArgb(value.R, value.G, value.B)- _entries = InterpolateStops(_stops)- End Sub-- ''' <summary>- ''' Makes an editable stop scheme from any scheme by sampling it at the stop positions.- ''' This is lossy: the copy is a smooth approximation of the original.- ''' </summary>- Public Function ToStopScheme(newName As String) As ColorScheme- Dim picked(StopCount - 1) As Color- For k As Integer = 0 To StopCount - 1- picked(k) = SampleAt(k * (EntryCount - 1) / CDbl(StopCount - 1))- Next- Dim scheme As ColorScheme = FromStops(newName, picked)- scheme.Origin = StopCount.ToString() & "-stop copy of scheme '" & Name & "'"- scheme.SchemeType = SchemeType- Return scheme- End Function-- ''' <summary>An independent copy under a new name (FilePath is not copied).</summary>- Public Function Clone(newName As String) As ColorScheme- Dim scheme As New ColorScheme(newName, _entries)- scheme.Origin = Origin- scheme.Category = Category- scheme.SchemeType = SchemeType- If _stops IsNot Nothing Then scheme.AttachStops(_stops)- Return scheme- End Function-- ''' <summary>Builds the 255 entries from the stops at fixed, equally spaced positions (linear in RGB).</summary>- Public Shared Function InterpolateStops(stops As IList(Of Color)) As Color()- If stops Is Nothing OrElse stops.Count <> StopCount Then- Throw New ArgumentException("Exactly " & StopCount.ToString() & " stops are required.")- End If- Dim result(EntryCount - 1) As Color- For i As Integer = 0 To EntryCount - 1- ' position on the stop scale: 0.0 (first stop) to StopCount - 1 (last stop);- ' with 9 stops entry 127 is exactly 4.0, the middle stop- Dim pos As Double = i * (StopCount - 1) / CDbl(EntryCount - 1)- Dim seg As Integer = CInt(Math.Floor(pos))- If seg > StopCount - 2 Then seg = StopCount - 2- result(i) = Lerp(stops(seg), stops(seg + 1), pos - seg)- Next- Return result- End Function-- ' ---------------------------------------------------------------- helpers-- ''' <summary>Resamples a list of colors to the requested number of entries (linear in RGB).</summary>- Public Shared Function Resample(source As IList(Of Color), count As Integer) As Color()- If source Is Nothing OrElse source.Count < 2 Then- Throw New ArgumentException("A color scheme needs at least 2 colors.")- End If- Dim result(count - 1) As Color- If source.Count = count Then- source.CopyTo(result, 0)- Return result- End If- For i As Integer = 0 To count - 1- Dim pos As Double = i * (source.Count - 1) / CDbl(count - 1)- Dim lo As Integer = CInt(Math.Floor(pos))- If lo >= source.Count - 1 Then- result(i) = source(source.Count - 1)- Else- result(i) = Lerp(source(lo), source(lo + 1), pos - lo)- End If- Next- Return result- End Function-- Private Shared Function Lerp(a As Color, b As Color, t As Double) As Color- Return Color.FromArgb(LerpChannel(a.R, b.R, t), LerpChannel(a.G, b.G, t), LerpChannel(a.B, b.B, t))- End Function-- Private Shared Function LerpChannel(a As Integer, b As Integer, t As Double) As Integer- Dim v As Integer = CInt(Math.Round(a + (b - a) * t, MidpointRounding.AwayFromZero))- If v < 0 Then v = 0- If v > 255 Then v = 255- Return v- End Function--End Classdiff --git a/2D_wave_sim_V01/ColorSchemes/ColorSchemeStore.vb b/2D_wave_sim_V01/ColorSchemes/ColorSchemeStore.vbdeleted file mode 100644index a250a55..0000000--- a/2D_wave_sim_V01/ColorSchemes/ColorSchemeStore.vb+++ /dev/null@@ -1,289 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections-Imports System.Collections.Generic-Imports System.Drawing-Imports System.Globalization-Imports System.IO-Imports System.Text-Imports System.Web.Script.Serialization--''' <summary>-''' Reads and writes color schemes as JSON files (one file per scheme, e.g. in the color_schemes folder).-'''-''' File format (the same as the files exported from Python):-''' name, origin, category (optional), scheme_type (optional: "field" or "intensity"),-''' bits_per_channel, entry_count, colors = 255 x [r,g,b]-''' and, only for schemes made in the stop editor:-''' stops = 9 x [r,g,b] (ColorScheme.StopCount)-''' </summary>-Public NotInheritable Class ColorSchemeStore-- ''' <summary>Name of the folder with the color schemes that belongs to the program.</summary>- Public Const SchemeFolderName As String = "ColorSchemeList"-- Private Sub New()- End Sub-- ''' <summary>- ''' The program's own color scheme folder. While developing (the exe runs from bin\Debug inside the- ''' Visual Studio project) this is the ColorSchemeList folder of the project itself, so edits end up- ''' in the project. In a deployed program it is the ColorSchemeList folder next to the exe.- ''' The folder is created when it does not exist.- ''' </summary>- Public Shared Function FindDefaultFolder() As String- Dim exeFolder As String = AppDomain.CurrentDomain.BaseDirectory- Dim result As String = Path.Combine(exeFolder, SchemeFolderName)-- Try- Dim probe As DirectoryInfo = New DirectoryInfo(exeFolder)- For level As Integer = 0 To 4- If probe Is Nothing Then Exit For- If probe.GetFiles("*.vbproj").Length > 0 Then- Dim candidate As String = Path.Combine(probe.FullName, SchemeFolderName)- If Directory.Exists(candidate) Then result = candidate- Exit For- End If- probe = probe.Parent- Next-- If Not Directory.Exists(result) Then Directory.CreateDirectory(result)- Catch- ' the caller checks whether the folder exists- End Try- Return result- End Function-- ''' <summary>Loads one scheme file. Throws when the file cannot be read or is not a color scheme.</summary>- Public Shared Function Load(filePath As String) As ColorScheme- Dim text As String = File.ReadAllText(filePath, Encoding.UTF8)-- Dim serializer As New JavaScriptSerializer()- serializer.MaxJsonLength = Integer.MaxValue- Dim root As Dictionary(Of String, Object) = TryCast(serializer.DeserializeObject(text), Dictionary(Of String, Object))- If root Is Nothing Then- Throw New InvalidDataException("Not a color scheme file (a JSON object was expected).")- End If-- Dim schemeName As String = GetString(root, "name", Path.GetFileNameWithoutExtension(filePath))-- Dim colors As List(Of Color) = Nothing- If root.ContainsKey("colors") Then colors = ParseColorList(root("colors"))-- Dim stops As List(Of Color) = Nothing- If root.ContainsKey("stops") Then stops = ParseColorList(root("stops"))- If stops IsNot Nothing AndAlso stops.Count <> ColorScheme.StopCount Then stops = Nothing-- Dim scheme As ColorScheme- If colors IsNot Nothing AndAlso colors.Count >= 2 Then- scheme = New ColorScheme(schemeName, colors)- ElseIf stops IsNot Nothing Then- scheme = ColorScheme.FromStops(schemeName, stops)- Else- Throw New InvalidDataException("The file contains no usable 'colors' list.")- End If-- If stops IsNot Nothing Then scheme.AttachStops(stops)- scheme.Origin = GetString(root, "origin", scheme.Origin)- scheme.Category = GetString(root, "category", scheme.Category)- scheme.SchemeType = NormalizeSchemeType(GetString(root, "scheme_type", scheme.SchemeType))- scheme.FilePath = filePath- Return scheme- End Function-- ''' <summary>- ''' Loads every *.json file in a folder. Files that cannot be read are skipped and described in errors- ''' (errors may be Nothing).- ''' </summary>- Public Shared Function LoadFolder(folder As String, errors As List(Of String)) As List(Of ColorScheme)- Dim result As New List(Of ColorScheme)()- If String.IsNullOrEmpty(folder) OrElse Not Directory.Exists(folder) Then Return result-- Dim files As New List(Of String)(Directory.GetFiles(folder, "*.json"))- files.Sort(StringComparer.OrdinalIgnoreCase)-- For Each f As String In files- Try- result.Add(Load(f))- Catch ex As Exception- If errors IsNot Nothing Then errors.Add(Path.GetFileName(f) & ": " & ex.Message)- End Try- Next- Return result- End Function-- ''' <summary>Writes a scheme to a JSON file (overwriting an existing file) and sets scheme.FilePath.</summary>- Public Shared Sub Save(scheme As ColorScheme, filePath As String)- If scheme Is Nothing Then Throw New ArgumentNullException("scheme")-- Dim sb As New StringBuilder()- sb.AppendLine("{")- sb.AppendLine(" ""name"": " & Quote(scheme.Name) & ",")- sb.AppendLine(" ""origin"": " & Quote(scheme.Origin) & ",")- If Not String.IsNullOrEmpty(scheme.Category) Then- sb.AppendLine(" ""category"": " & Quote(scheme.Category) & ",")- End If- If Not String.IsNullOrEmpty(scheme.SchemeType) Then- sb.AppendLine(" ""scheme_type"": " & Quote(scheme.SchemeType) & ",")- End If- sb.AppendLine(" ""bits_per_channel"": 8,")- sb.AppendLine(" ""entry_count"": " & ColorScheme.EntryCount.ToString(CultureInfo.InvariantCulture) & ",")-- If scheme.HasStops Then- Dim stopParts As New List(Of String)()- For Each c As Color In scheme.Stops- stopParts.Add(FormatRgb(c))- Next- sb.AppendLine(" ""stops"": [" & String.Join(", ", stopParts) & "],")- End If-- Dim entries As Color() = scheme.Entries- sb.AppendLine(" ""colors"": [")- For i As Integer = 0 To entries.Length - 1 Step 8- Dim last As Integer = Math.Min(i + 7, entries.Length - 1)- Dim parts As New List(Of String)()- For j As Integer = i To last- parts.Add(FormatRgb(entries(j)))- Next- sb.Append(" ")- sb.Append(String.Join(", ", parts))- If last < entries.Length - 1 Then sb.Append(",")- sb.AppendLine()- Next- sb.AppendLine(" ]")- sb.AppendLine("}")-- Dim folderPath As String = Path.GetDirectoryName(filePath)- If Not String.IsNullOrEmpty(folderPath) Then Directory.CreateDirectory(folderPath)-- ' write to a temporary file first so a failed save never leaves a half-written scheme behind- Dim tmp As String = filePath & ".tmp"- File.WriteAllText(tmp, sb.ToString(), New UTF8Encoding(False))- If File.Exists(filePath) Then File.Delete(filePath)- File.Move(tmp, filePath)-- scheme.FilePath = filePath- End Sub-- ''' <summary>A file name (without extension) that is safe on Windows for the given scheme name.</summary>- Public Shared Function SafeFileName(schemeName As String) As String- If String.IsNullOrEmpty(schemeName) Then Return "color_scheme"- Dim invalid As Char() = Path.GetInvalidFileNameChars()- Dim sb As New StringBuilder()- For Each ch As Char In schemeName.Trim()- If Array.IndexOf(invalid, ch) >= 0 Then- sb.Append("_"c)- Else- sb.Append(ch)- End If- Next- Dim s As String = sb.ToString().Trim().TrimEnd("."c)- If s.Length = 0 Then s = "color_scheme"- Return s- End Function-- ''' <summary>Full path of the JSON file for a scheme name inside a folder.</summary>- Public Shared Function PathFor(folder As String, schemeName As String) As String- Return Path.Combine(folder, SafeFileName(schemeName) & ".json")- End Function-- ' ---------------------------------------------------------------- helpers-- Private Shared Function NormalizeSchemeType(value As String) As String- If value Is Nothing Then Return ""- Dim v As String = value.Trim().ToLowerInvariant()- If v = ColorScheme.SchemeTypeField OrElse v = ColorScheme.SchemeTypeIntensity Then Return v- Return ""- End Function-- Private Shared Function GetString(root As Dictionary(Of String, Object), key As String, fallback As String) As String- Dim v As Object = Nothing- If root.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Return Convert.ToString(v, CultureInfo.InvariantCulture)- End If- Return fallback- End Function-- Private Shared Function ParseColorList(node As Object) As List(Of Color)- Dim outer As IEnumerable = TryCast(node, IEnumerable)- If outer Is Nothing OrElse TypeOf node Is String Then- Throw New InvalidDataException("Expected a list of [r,g,b] triplets.")- End If-- Dim result As New List(Of Color)()- For Each item As Object In outer- Dim inner As IEnumerable = TryCast(item, IEnumerable)- If inner Is Nothing OrElse TypeOf item Is String Then- Throw New InvalidDataException("Expected a list of [r,g,b] triplets.")- End If- Dim rgb As New List(Of Integer)()- For Each v As Object In inner- rgb.Add(Convert.ToInt32(v, CultureInfo.InvariantCulture))- Next- If rgb.Count < 3 Then- Throw New InvalidDataException("A color needs three values [r,g,b].")- End If- result.Add(Color.FromArgb(Clamp255(rgb(0)), Clamp255(rgb(1)), Clamp255(rgb(2))))- Next- Return result- End Function-- Private Shared Function Clamp255(v As Integer) As Integer- If v < 0 Then Return 0- If v > 255 Then Return 255- Return v- End Function-- Private Shared Function FormatRgb(c As Color) As String- Return String.Format(CultureInfo.InvariantCulture, "[{0},{1},{2}]", c.R, c.G, c.B)- End Function-- Private Shared Function Quote(text As String) As String- If text Is Nothing Then Return """"""- Dim sb As New StringBuilder()- sb.Append(""""c)- For Each ch As Char In text- Select Case ch- Case """"c- sb.Append("\""")- Case "\"c- sb.Append("\\")- Case ChrW(10)- sb.Append("\n")- Case ChrW(13)- sb.Append("\r")- Case ChrW(9)- sb.Append("\t")- Case Else- If AscW(ch) < 32 Then- sb.Append("\u").Append(AscW(ch).ToString("x4", CultureInfo.InvariantCulture))- Else- sb.Append(ch)- End If- End Select- Next- sb.Append(""""c)- Return sb.ToString()- End Function--End Classdiff --git a/2D_wave_sim_V01/Form1.Designer.vb b/2D_wave_sim_V01/Form1.Designer.vbdeleted file mode 100644index a8f79d8..0000000--- a/2D_wave_sim_V01/Form1.Designer.vb+++ /dev/null@@ -1,4164 +0,0 @@-<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _-Partial Class Form1- Inherits System.Windows.Forms.Form-- 'Form overrides dispose to clean up the component list.- <System.Diagnostics.DebuggerNonUserCode()> _- Protected Overrides Sub Dispose(ByVal disposing As Boolean)- Try- If disposing AndAlso components IsNot Nothing Then- components.Dispose()- End If- Finally- MyBase.Dispose(disposing)- End Try- End Sub-- 'Required by the Windows Form Designer- Private components As System.ComponentModel.IContainer-- 'NOTE: The following procedure is required by the Windows Form Designer- 'It can be modified using the Windows Form Designer.- 'Do not modify it using the code editor.- <System.Diagnostics.DebuggerStepThrough()> _- Private Sub InitializeComponent()- Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))- Me.tabMainFunctions = New System.Windows.Forms.TabControl()- Me.tabConfiguration = New System.Windows.Forms.TabPage()- Me.grpProjects = New System.Windows.Forms.GroupBox()- Me.btnPickRoot = New System.Windows.Forms.Button()- Me.btnSaveConfiguration2 = New System.Windows.Forms.Button()- Me.lstAllProjects = New System.Windows.Forms.ListView()- Me.colProjectName = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)- Me.colLastEdit = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)- Me.btnNewProject = New System.Windows.Forms.Button()- Me.btnRenameProject = New System.Windows.Forms.Button()- Me.btnLoadProject = New System.Windows.Forms.Button()- Me.btnDeleteProject = New System.Windows.Forms.Button()- Me.btnSaveAs = New System.Windows.Forms.Button()- Me.grpSimulationSettings = New System.Windows.Forms.GroupBox()- Me.Label61 = New System.Windows.Forms.Label()- Me.numTimeDecayFactor = New System.Windows.Forms.NumericUpDown()- Me.numSimulationSteps = New System.Windows.Forms.NumericUpDown()- Me.lblInfo = New System.Windows.Forms.Label()- Me.chkUse4thOrderLaplacian = New System.Windows.Forms.CheckBox()- Me.chkUseGPU = New System.Windows.Forms.CheckBox()- Me.numQuality = New System.Windows.Forms.NumericUpDown()- Me.lblVideoQuality = New System.Windows.Forms.Label()- Me.numIntensityScaling = New System.Windows.Forms.NumericUpDown()- Me.numOffsetIntensity = New System.Windows.Forms.NumericUpDown()- Me.numOffsetField = New System.Windows.Forms.NumericUpDown()- Me.numFieldScaling = New System.Windows.Forms.NumericUpDown()- Me.Label3 = New System.Windows.Forms.Label()- Me.numScaleIntensityValues = New System.Windows.Forms.Label()- Me.Label6 = New System.Windows.Forms.Label()- Me.lblOffsetField = New System.Windows.Forms.Label()- Me.Label5 = New System.Windows.Forms.Label()- Me.Label2 = New System.Windows.Forms.Label()- Me.cmbIntensityColorScheme = New System.Windows.Forms.ComboBox()- Me.cmbFieldColorScheme = New System.Windows.Forms.ComboBox()- Me.chkPreviewVideoIntensity = New System.Windows.Forms.CheckBox()- Me.chkExportVideoIntensity = New System.Windows.Forms.CheckBox()- Me.chkPreviewVideoField = New System.Windows.Forms.CheckBox()- Me.chkExportVideoField = New System.Windows.Forms.CheckBox()- Me.lblPreviewVideo = New System.Windows.Forms.Label()- Me.lblExportVideo = New System.Windows.Forms.Label()- Me.numVisualizeEvery = New System.Windows.Forms.NumericUpDown()- Me.Label4 = New System.Windows.Forms.Label()- Me.lblVisualizeEvery = New System.Windows.Forms.Label()- Me.Label7 = New System.Windows.Forms.Label()- Me.lblSimulationSteps = New System.Windows.Forms.Label()- Me.grpSceneProperties = New System.Windows.Forms.GroupBox()- Me.Label20 = New System.Windows.Forms.Label()- Me.numRefractiveIndex = New System.Windows.Forms.NumericUpDown()- Me.picImagePreview = New System.Windows.Forms.PictureBox()- Me.lblScaleImgSourceIntensity = New System.Windows.Forms.Label()- Me.numScaleImageSource = New System.Windows.Forms.NumericUpDown()- Me.btnEditObjectSourceList = New System.Windows.Forms.Button()- Me.txtDampingEdgeSize = New System.Windows.Forms.TextBox()- Me.chkUseObjectSources = New System.Windows.Forms.CheckBox()- Me.chkUseImageSources = New System.Windows.Forms.CheckBox()- Me.chkDampingEdge = New System.Windows.Forms.CheckBox()- Me.btnLoadSceneImage = New System.Windows.Forms.Button()- Me.Label1 = New System.Windows.Forms.Label()- Me.lblPix = New System.Windows.Forms.Label()- Me.lblX = New System.Windows.Forms.Label()- Me.txtYsize = New System.Windows.Forms.TextBox()- Me.txtXSize = New System.Windows.Forms.TextBox()- Me.radUserDefinedScene = New System.Windows.Forms.RadioButton()- Me.radUseSceneImage = New System.Windows.Forms.RadioButton()- Me.lblImageNameAndSize = New System.Windows.Forms.Label()- Me.tabSourceList = New System.Windows.Forms.TabPage()- Me.Label62 = New System.Windows.Forms.Label()- Me.Label60 = New System.Windows.Forms.Label()- Me.chkAutoRescaleSourceOn = New System.Windows.Forms.CheckBox()- Me.picPreviewSource = New System.Windows.Forms.PictureBox()- Me.grpPlaceSource = New System.Windows.Forms.GroupBox()- Me.pnlPosition = New System.Windows.Forms.Panel()- Me.numSourcePositionX = New System.Windows.Forms.NumericUpDown()- Me.Label36 = New System.Windows.Forms.Label()- Me.lblPosition = New System.Windows.Forms.Label()- Me.btnPickSourcePosition = New System.Windows.Forms.Button()- Me.numSourcePositionY = New System.Windows.Forms.NumericUpDown()- Me.Label35 = New System.Windows.Forms.Label()- Me.btnDelete = New System.Windows.Forms.Button()- Me.btnNew = New System.Windows.Forms.Button()- Me.btnCopy = New System.Windows.Forms.Button()- Me.lstSources = New System.Windows.Forms.ListBox()- Me.pnlSourceImage = New System.Windows.Forms.Panel()- Me.grpSourceDetails = New System.Windows.Forms.GroupBox()- Me.txtDetachAfterSteps = New System.Windows.Forms.TextBox()- Me.btnSaveSource = New System.Windows.Forms.Button()- Me.Label47 = New System.Windows.Forms.Label()- Me.chkDetachSource = New System.Windows.Forms.CheckBox()- Me.lblLambdaIs = New System.Windows.Forms.Label()- Me.chkSourceOn = New System.Windows.Forms.CheckBox()- Me.grpComposite = New System.Windows.Forms.GroupBox()- Me.Label59 = New System.Windows.Forms.Label()- Me.Label58 = New System.Windows.Forms.Label()- Me.numRandomizeOffWidth = New System.Windows.Forms.NumericUpDown()- Me.numRandomizePosition = New System.Windows.Forms.NumericUpDown()- Me.NumRandomizePhase = New System.Windows.Forms.NumericUpDown()- Me.numRandomizeFrequency = New System.Windows.Forms.NumericUpDown()- Me.chkRandomizePhase = New System.Windows.Forms.CheckBox()- Me.chkRandomizePosition = New System.Windows.Forms.CheckBox()- Me.chkOffWidth = New System.Windows.Forms.CheckBox()- Me.chkRandomizeFrequency = New System.Windows.Forms.CheckBox()- Me.numSpacingSizeY = New System.Windows.Forms.NumericUpDown()- Me.numSpacingSizeX = New System.Windows.Forms.NumericUpDown()- Me.numArraySizeY = New System.Windows.Forms.NumericUpDown()- Me.numArraySizeX = New System.Windows.Forms.NumericUpDown()- Me.Label50 = New System.Windows.Forms.Label()- Me.Label51 = New System.Windows.Forms.Label()- Me.Label52 = New System.Windows.Forms.Label()- Me.Label53 = New System.Windows.Forms.Label()- Me.cmbCompositeProperties = New System.Windows.Forms.ComboBox()- Me.grpSingleSource = New System.Windows.Forms.GroupBox()- Me.numOffStateCycles = New System.Windows.Forms.NumericUpDown()- Me.numPhase = New System.Windows.Forms.NumericUpDown()- Me.numAmplitude = New System.Windows.Forms.NumericUpDown()- Me.numFrequency = New System.Windows.Forms.NumericUpDown()- Me.numPulseWidthCycles = New System.Windows.Forms.NumericUpDown()- Me.Label44 = New System.Windows.Forms.Label()- Me.Label46 = New System.Windows.Forms.Label()- Me.Label45 = New System.Windows.Forms.Label()- Me.Label43 = New System.Windows.Forms.Label()- Me.Label42 = New System.Windows.Forms.Label()- Me.Label54 = New System.Windows.Forms.Label()- Me.Label41 = New System.Windows.Forms.Label()- Me.Label40 = New System.Windows.Forms.Label()- Me.cmbPulseShape = New System.Windows.Forms.ComboBox()- Me.radModePulsed = New System.Windows.Forms.RadioButton()- Me.radModeContinuous = New System.Windows.Forms.RadioButton()- Me.txtName = New System.Windows.Forms.TextBox()- Me.cmbMainType = New System.Windows.Forms.ComboBox()- Me.Label39 = New System.Windows.Forms.Label()- Me.lblName = New System.Windows.Forms.Label()- Me.Label38 = New System.Windows.Forms.Label()- Me.tabProbeList = New System.Windows.Forms.TabPage()- Me.GroupBox2 = New System.Windows.Forms.GroupBox()- Me.Label49 = New System.Windows.Forms.Label()- Me.Label48 = New System.Windows.Forms.Label()- Me.Label37 = New System.Windows.Forms.Label()- Me.grpProbe2 = New System.Windows.Forms.GroupBox()- Me.Label22 = New System.Windows.Forms.Label()- Me.numRunningWindow2 = New System.Windows.Forms.NumericUpDown()- Me.chkProbeOn2 = New System.Windows.Forms.CheckBox()- Me.txtStartAfterStep2 = New System.Windows.Forms.TextBox()- Me.chkStartAfterStep2 = New System.Windows.Forms.CheckBox()- Me.Label23 = New System.Windows.Forms.Label()- Me.Label24 = New System.Windows.Forms.Label()- Me.txtMaxScaleY2 = New System.Windows.Forms.TextBox()- Me.txtMinScaleY2 = New System.Windows.Forms.TextBox()- Me.radFullScale2 = New System.Windows.Forms.RadioButton()- Me.radRunningScale2 = New System.Windows.Forms.RadioButton()- Me.chkAutoScaleY2 = New System.Windows.Forms.CheckBox()- Me.chkAutoScaleX2 = New System.Windows.Forms.CheckBox()- Me.numBPosY2 = New System.Windows.Forms.NumericUpDown()- Me.numAPosY2 = New System.Windows.Forms.NumericUpDown()- Me.numBPosX2 = New System.Windows.Forms.NumericUpDown()- Me.numAPosX2 = New System.Windows.Forms.NumericUpDown()- Me.butPicPositions2 = New System.Windows.Forms.Button()- Me.Label25 = New System.Windows.Forms.Label()- Me.cmbPlaceOn2 = New System.Windows.Forms.ComboBox()- Me.cmbMeasurement2 = New System.Windows.Forms.ComboBox()- Me.Label26 = New System.Windows.Forms.Label()- Me.Label27 = New System.Windows.Forms.Label()- Me.cmbBoxSize2 = New System.Windows.Forms.ComboBox()- Me.cmbProbeType2 = New System.Windows.Forms.ComboBox()- Me.Label28 = New System.Windows.Forms.Label()- Me.Label29 = New System.Windows.Forms.Label()- Me.Label30 = New System.Windows.Forms.Label()- Me.Label31 = New System.Windows.Forms.Label()- Me.Label32 = New System.Windows.Forms.Label()- Me.Label33 = New System.Windows.Forms.Label()- Me.Label34 = New System.Windows.Forms.Label()- Me.grpProbe1 = New System.Windows.Forms.GroupBox()- Me.Label21 = New System.Windows.Forms.Label()- Me.numRunningWindow = New System.Windows.Forms.NumericUpDown()- Me.chkProbeOn1 = New System.Windows.Forms.CheckBox()- Me.txtStartAfterStep = New System.Windows.Forms.TextBox()- Me.chkStartAfterStep = New System.Windows.Forms.CheckBox()- Me.Label19 = New System.Windows.Forms.Label()- Me.Label18 = New System.Windows.Forms.Label()- Me.txtMaxScaleY = New System.Windows.Forms.TextBox()- Me.txtMinScaleY = New System.Windows.Forms.TextBox()- Me.radFullScale = New System.Windows.Forms.RadioButton()- Me.radRunningScale = New System.Windows.Forms.RadioButton()- Me.chkAutoScaleY = New System.Windows.Forms.CheckBox()- Me.chkAutoScaleX = New System.Windows.Forms.CheckBox()- Me.numBPosY = New System.Windows.Forms.NumericUpDown()- Me.numAPosY = New System.Windows.Forms.NumericUpDown()- Me.numBPosX = New System.Windows.Forms.NumericUpDown()- Me.numAPosX = New System.Windows.Forms.NumericUpDown()- Me.butPicPositions = New System.Windows.Forms.Button()- Me.Label16 = New System.Windows.Forms.Label()- Me.cmbPlaceOn = New System.Windows.Forms.ComboBox()- Me.cmbMeasurement = New System.Windows.Forms.ComboBox()- Me.Label13 = New System.Windows.Forms.Label()- Me.Label15 = New System.Windows.Forms.Label()- Me.cmbBoxSize = New System.Windows.Forms.ComboBox()- Me.cmbProbeType = New System.Windows.Forms.ComboBox()- Me.Label14 = New System.Windows.Forms.Label()- Me.Label12 = New System.Windows.Forms.Label()- Me.Label11 = New System.Windows.Forms.Label()- Me.Label17 = New System.Windows.Forms.Label()- Me.Label10 = New System.Windows.Forms.Label()- Me.Label9 = New System.Windows.Forms.Label()- Me.Label8 = New System.Windows.Forms.Label()- Me.pnlProbeImage = New System.Windows.Forms.Panel()- Me.tabViewer = New System.Windows.Forms.TabPage()- Me.pnlPreviewIntensityProps = New System.Windows.Forms.Panel()- Me.chkExportVideoIntensity2 = New System.Windows.Forms.CheckBox()- Me.Label64 = New System.Windows.Forms.Label()- Me.numBrightnessIntensityOverlay = New System.Windows.Forms.NumericUpDown()- Me.numIntensityScaling2 = New System.Windows.Forms.NumericUpDown()- Me.chkDiplayOverlayInIntensity = New System.Windows.Forms.CheckBox()- Me.Label66 = New System.Windows.Forms.Label()- Me.Panel3 = New System.Windows.Forms.Panel()- Me.Label63 = New System.Windows.Forms.Label()- Me.chkExportVideoField2 = New System.Windows.Forms.CheckBox()- Me.numFieldScaling2 = New System.Windows.Forms.NumericUpDown()- Me.Label65 = New System.Windows.Forms.Label()- Me.numBrightnessFieldOverlay = New System.Windows.Forms.NumericUpDown()- Me.chkDiplayOverlayInField = New System.Windows.Forms.CheckBox()- Me.Label56 = New System.Windows.Forms.Label()- Me.Label55 = New System.Windows.Forms.Label()- Me.lblWarningIntensity = New System.Windows.Forms.Label()- Me.lblWarningField = New System.Windows.Forms.Label()- Me.btnExportIntensityFrame = New System.Windows.Forms.Button()- Me.btnExportFieldFrame = New System.Windows.Forms.Button()- Me.btnOpenImageFolder = New System.Windows.Forms.Button()- Me.btnOpenVideoFolder = New System.Windows.Forms.Button()- Me.btnViewIntensityVideo = New System.Windows.Forms.Button()- Me.btnViewFieldVideo = New System.Windows.Forms.Button()- Me.pnlPreviewIntensity = New System.Windows.Forms.Panel()- Me.pnlPreviewField = New System.Windows.Forms.Panel()- Me.tabOutput = New System.Windows.Forms.TabPage()- Me.btnRenameVideo = New System.Windows.Forms.Button()- Me.btnShareWithEditors = New System.Windows.Forms.Button()- Me.btnCopyToClipboard = New System.Windows.Forms.Button()- Me.btnOpenImageFolder2 = New System.Windows.Forms.Button()- Me.btnViewVIdeoInPlayer2 = New System.Windows.Forms.Button()- Me.btnOpenVIdeoFolder2 = New System.Windows.Forms.Button()- Me.lblPreview = New System.Windows.Forms.Label()- Me.btnDeleteVideos = New System.Windows.Forms.Button()- Me.btnDeleteImages = New System.Windows.Forms.Button()- Me.btnDeleteScene = New System.Windows.Forms.Button()- Me.btnLoadExternal = New System.Windows.Forms.Button()- Me.pnlPreview = New System.Windows.Forms.Panel()- Me.Label57 = New System.Windows.Forms.Label()- Me.lstScenes = New System.Windows.Forms.ListView()- Me.colSceneName = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)- Me.colSceneCreated = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)- Me.lstImages = New System.Windows.Forms.ListView()- Me.colImageName = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)- Me.colCreatedOn = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)- Me.lstVideo = New System.Windows.Forms.ListView()- Me.colVideoName = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)- Me.colCreatedOn2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)- Me.lstAllProjects3 = New System.Windows.Forms.ListView()- Me.colProjectName2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)- Me.colLastEdited2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)- Me.tabColorScheme = New System.Windows.Forms.TabPage()- Me.lblType = New System.Windows.Forms.Label()- Me.radSchemeTypeIntensity = New System.Windows.Forms.RadioButton()- Me.radSchemeTypeField = New System.Windows.Forms.RadioButton()- Me.btnLoadScheme = New System.Windows.Forms.Button()- Me.btbChooseFFolder = New System.Windows.Forms.Button()- Me.lblSchemeFolder = New System.Windows.Forms.Label()- Me.ListView1 = New System.Windows.Forms.ListView()- Me.txtSchemeFolder = New System.Windows.Forms.TextBox()- Me.txtCurrentColorScheme = New System.Windows.Forms.TextBox()- Me.lblCurrentCOlorScheme = New System.Windows.Forms.Label()- Me.lblColorSchemeEditor = New System.Windows.Forms.Label()- Me.btnColor9 = New System.Windows.Forms.Button()- Me.btnColor8 = New System.Windows.Forms.Button()- Me.btnColor7 = New System.Windows.Forms.Button()- Me.btnColor6 = New System.Windows.Forms.Button()- Me.btnColor5 = New System.Windows.Forms.Button()- Me.btnColor4 = New System.Windows.Forms.Button()- Me.btnColor3 = New System.Windows.Forms.Button()- Me.btnCOlor2 = New System.Windows.Forms.Button()- Me.btnColor1 = New System.Windows.Forms.Button()- Me.lblColorPicker = New System.Windows.Forms.Label()- Me.Panel2 = New System.Windows.Forms.Panel()- Me.pnlScheme = New System.Windows.Forms.Panel()- Me.btnDeleteColorScheme = New System.Windows.Forms.Button()- Me.btnRenameColorScheme = New System.Windows.Forms.Button()- Me.btnSaveAsColorScheme = New System.Windows.Forms.Button()- Me.btnSaveCurrentScheme = New System.Windows.Forms.Button()- Me.btnSaveConfiguration = New System.Windows.Forms.Button()- Me.btnStartSimulation = New System.Windows.Forms.Button()- Me.btnPauzeResume = New System.Windows.Forms.Button()- Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()- Me.itemFile = New System.Windows.Forms.ToolStripMenuItem()- Me.NewToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()- Me.OpenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()- Me.ChooseProjectRootToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()- Me.SetCValueToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()- Me.SaveToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()- Me.ExitToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()- Me.InfoToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()- Me.HelpToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()- Me.AboutToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()- Me.lblProjectName = New System.Windows.Forms.Label()- Me.txtProjectName = New System.Windows.Forms.TextBox()- Me.txtRootFolder = New System.Windows.Forms.TextBox()- Me.lblRootFolder = New System.Windows.Forms.Label()- Me.btnBrowseRoot = New System.Windows.Forms.Button()- Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()- Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel()- Me.grpNavigateTabs = New System.Windows.Forms.GroupBox()- Me.btnGotoPreview = New System.Windows.Forms.Button()- Me.btnGotoProbes = New System.Windows.Forms.Button()- Me.btnGotoSources = New System.Windows.Forms.Button()- Me.btnGotoConfiguration = New System.Windows.Forms.Button()- Me.grpSimulationControlButtons = New System.Windows.Forms.GroupBox()- Me.Panel1 = New System.Windows.Forms.Panel()- Me.btnDescription = New System.Windows.Forms.Button()- Me.grpShareImage = New System.Windows.Forms.GroupBox()- Me.btnShareIntensityImage = New System.Windows.Forms.Button()- Me.btnShareFieldImage = New System.Windows.Forms.Button()- Me.btnShareSceneImage = New System.Windows.Forms.Button()- Me.tabMainFunctions.SuspendLayout()- Me.tabConfiguration.SuspendLayout()- Me.grpProjects.SuspendLayout()- Me.grpSimulationSettings.SuspendLayout()- CType(Me.numTimeDecayFactor, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numSimulationSteps, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numQuality, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numIntensityScaling, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numOffsetIntensity, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numOffsetField, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numFieldScaling, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numVisualizeEvery, System.ComponentModel.ISupportInitialize).BeginInit()- Me.grpSceneProperties.SuspendLayout()- CType(Me.numRefractiveIndex, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.picImagePreview, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numScaleImageSource, System.ComponentModel.ISupportInitialize).BeginInit()- Me.tabSourceList.SuspendLayout()- CType(Me.picPreviewSource, System.ComponentModel.ISupportInitialize).BeginInit()- Me.grpPlaceSource.SuspendLayout()- Me.pnlPosition.SuspendLayout()- CType(Me.numSourcePositionX, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numSourcePositionY, System.ComponentModel.ISupportInitialize).BeginInit()- Me.grpSourceDetails.SuspendLayout()- Me.grpComposite.SuspendLayout()- CType(Me.numRandomizeOffWidth, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numRandomizePosition, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.NumRandomizePhase, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numRandomizeFrequency, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numSpacingSizeY, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numSpacingSizeX, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numArraySizeY, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numArraySizeX, System.ComponentModel.ISupportInitialize).BeginInit()- Me.grpSingleSource.SuspendLayout()- CType(Me.numOffStateCycles, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numPhase, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numAmplitude, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numFrequency, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numPulseWidthCycles, System.ComponentModel.ISupportInitialize).BeginInit()- Me.tabProbeList.SuspendLayout()- Me.GroupBox2.SuspendLayout()- Me.grpProbe2.SuspendLayout()- CType(Me.numRunningWindow2, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numBPosY2, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numAPosY2, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numBPosX2, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numAPosX2, System.ComponentModel.ISupportInitialize).BeginInit()- Me.grpProbe1.SuspendLayout()- CType(Me.numRunningWindow, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numBPosY, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numAPosY, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numBPosX, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numAPosX, System.ComponentModel.ISupportInitialize).BeginInit()- Me.tabViewer.SuspendLayout()- Me.pnlPreviewIntensityProps.SuspendLayout()- CType(Me.numBrightnessIntensityOverlay, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numIntensityScaling2, System.ComponentModel.ISupportInitialize).BeginInit()- Me.Panel3.SuspendLayout()- CType(Me.numFieldScaling2, System.ComponentModel.ISupportInitialize).BeginInit()- CType(Me.numBrightnessFieldOverlay, System.ComponentModel.ISupportInitialize).BeginInit()- Me.tabOutput.SuspendLayout()- Me.tabColorScheme.SuspendLayout()- Me.MenuStrip1.SuspendLayout()- Me.StatusStrip1.SuspendLayout()- Me.grpNavigateTabs.SuspendLayout()- Me.grpSimulationControlButtons.SuspendLayout()- Me.Panel1.SuspendLayout()- Me.grpShareImage.SuspendLayout()- Me.SuspendLayout()- '- 'tabMainFunctions- '- Me.tabMainFunctions.Controls.Add(Me.tabConfiguration)- Me.tabMainFunctions.Controls.Add(Me.tabSourceList)- Me.tabMainFunctions.Controls.Add(Me.tabProbeList)- Me.tabMainFunctions.Controls.Add(Me.tabViewer)- Me.tabMainFunctions.Controls.Add(Me.tabOutput)- Me.tabMainFunctions.Controls.Add(Me.tabColorScheme)- Me.tabMainFunctions.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.tabMainFunctions.Location = New System.Drawing.Point(16, 89)- Me.tabMainFunctions.Name = "tabMainFunctions"- Me.tabMainFunctions.Padding = New System.Drawing.Point(10, 3)- Me.tabMainFunctions.SelectedIndex = 0- Me.tabMainFunctions.Size = New System.Drawing.Size(1750, 731)- Me.tabMainFunctions.TabIndex = 0- '- 'tabConfiguration- '- Me.tabConfiguration.Controls.Add(Me.grpProjects)- Me.tabConfiguration.Controls.Add(Me.grpSimulationSettings)- Me.tabConfiguration.Controls.Add(Me.grpSceneProperties)- Me.tabConfiguration.Location = New System.Drawing.Point(4, 34)- Me.tabConfiguration.Name = "tabConfiguration"- Me.tabConfiguration.Padding = New System.Windows.Forms.Padding(3)- Me.tabConfiguration.Size = New System.Drawing.Size(1742, 693)- Me.tabConfiguration.TabIndex = 1- Me.tabConfiguration.Text = " Settings "- Me.tabConfiguration.UseVisualStyleBackColor = True- '- 'grpProjects- '- Me.grpProjects.Controls.Add(Me.btnPickRoot)- Me.grpProjects.Controls.Add(Me.btnSaveConfiguration2)- Me.grpProjects.Controls.Add(Me.lstAllProjects)- Me.grpProjects.Controls.Add(Me.btnNewProject)- Me.grpProjects.Controls.Add(Me.btnRenameProject)- Me.grpProjects.Controls.Add(Me.btnLoadProject)- Me.grpProjects.Controls.Add(Me.btnDeleteProject)- Me.grpProjects.Controls.Add(Me.btnSaveAs)- Me.grpProjects.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.grpProjects.Location = New System.Drawing.Point(23, 25)- Me.grpProjects.Name = "grpProjects"- Me.grpProjects.Size = New System.Drawing.Size(473, 641)- Me.grpProjects.TabIndex = 8- Me.grpProjects.TabStop = False- Me.grpProjects.Text = "Projects in current root"- '- 'btnPickRoot- '- Me.btnPickRoot.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnPickRoot.Location = New System.Drawing.Point(363, 506)- Me.btnPickRoot.Name = "btnPickRoot"- Me.btnPickRoot.Size = New System.Drawing.Size(88, 27)- Me.btnPickRoot.TabIndex = 10- Me.btnPickRoot.Text = "Pick root"- Me.btnPickRoot.UseVisualStyleBackColor = True- '- 'btnSaveConfiguration2- '- Me.btnSaveConfiguration2.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnSaveConfiguration2.Location = New System.Drawing.Point(252, 562)- Me.btnSaveConfiguration2.Name = "btnSaveConfiguration2"- Me.btnSaveConfiguration2.Size = New System.Drawing.Size(191, 49)- Me.btnSaveConfiguration2.TabIndex = 9- Me.btnSaveConfiguration2.Text = "Save"- Me.btnSaveConfiguration2.UseVisualStyleBackColor = True- '- 'lstAllProjects- '- Me.lstAllProjects.BackColor = System.Drawing.SystemColors.MenuBar- Me.lstAllProjects.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.colProjectName, Me.colLastEdit})- Me.lstAllProjects.FullRowSelect = True- Me.lstAllProjects.HideSelection = False- Me.lstAllProjects.Location = New System.Drawing.Point(16, 28)- Me.lstAllProjects.MultiSelect = False- Me.lstAllProjects.Name = "lstAllProjects"- Me.lstAllProjects.Size = New System.Drawing.Size(435, 472)- Me.lstAllProjects.TabIndex = 8- Me.lstAllProjects.UseCompatibleStateImageBehavior = False- Me.lstAllProjects.View = System.Windows.Forms.View.Details- '- 'colProjectName- '- Me.colProjectName.Text = "ProjectName"- Me.colProjectName.Width = 280- '- 'colLastEdit- '- Me.colLastEdit.Text = "Last edited"- Me.colLastEdit.Width = 150- '- 'btnNewProject- '- Me.btnNewProject.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnNewProject.Location = New System.Drawing.Point(16, 560)- Me.btnNewProject.Name = "btnNewProject"- Me.btnNewProject.Size = New System.Drawing.Size(191, 51)- Me.btnNewProject.TabIndex = 7- Me.btnNewProject.Text = "New project"- Me.btnNewProject.UseVisualStyleBackColor = True- '- 'btnRenameProject- '- Me.btnRenameProject.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnRenameProject.Location = New System.Drawing.Point(188, 505)- Me.btnRenameProject.Name = "btnRenameProject"- Me.btnRenameProject.Size = New System.Drawing.Size(78, 28)- Me.btnRenameProject.TabIndex = 6- Me.btnRenameProject.Text = "Rename"- Me.btnRenameProject.UseVisualStyleBackColor = True- '- 'btnLoadProject- '- Me.btnLoadProject.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnLoadProject.Location = New System.Drawing.Point(16, 507)- Me.btnLoadProject.Name = "btnLoadProject"- Me.btnLoadProject.Size = New System.Drawing.Size(77, 29)- Me.btnLoadProject.TabIndex = 6- Me.btnLoadProject.Text = "Load"- Me.btnLoadProject.UseVisualStyleBackColor = True- '- 'btnDeleteProject- '- Me.btnDeleteProject.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnDeleteProject.Location = New System.Drawing.Point(272, 506)- Me.btnDeleteProject.Name = "btnDeleteProject"- Me.btnDeleteProject.Size = New System.Drawing.Size(73, 27)- Me.btnDeleteProject.TabIndex = 6- Me.btnDeleteProject.Text = "Delete"- Me.btnDeleteProject.UseVisualStyleBackColor = True- '- 'btnSaveAs- '- Me.btnSaveAs.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnSaveAs.Location = New System.Drawing.Point(99, 507)- Me.btnSaveAs.Name = "btnSaveAs"- Me.btnSaveAs.Size = New System.Drawing.Size(83, 27)- Me.btnSaveAs.TabIndex = 4- Me.btnSaveAs.Text = "Save as"- Me.btnSaveAs.UseVisualStyleBackColor = True- '- 'grpSimulationSettings- '- Me.grpSimulationSettings.Controls.Add(Me.Label61)- Me.grpSimulationSettings.Controls.Add(Me.numTimeDecayFactor)- Me.grpSimulationSettings.Controls.Add(Me.numSimulationSteps)- Me.grpSimulationSettings.Controls.Add(Me.lblInfo)- Me.grpSimulationSettings.Controls.Add(Me.chkUse4thOrderLaplacian)- Me.grpSimulationSettings.Controls.Add(Me.chkUseGPU)- Me.grpSimulationSettings.Controls.Add(Me.numQuality)- Me.grpSimulationSettings.Controls.Add(Me.lblVideoQuality)- Me.grpSimulationSettings.Controls.Add(Me.numIntensityScaling)- Me.grpSimulationSettings.Controls.Add(Me.numOffsetIntensity)- Me.grpSimulationSettings.Controls.Add(Me.numOffsetField)- Me.grpSimulationSettings.Controls.Add(Me.numFieldScaling)- Me.grpSimulationSettings.Controls.Add(Me.Label3)- Me.grpSimulationSettings.Controls.Add(Me.numScaleIntensityValues)- Me.grpSimulationSettings.Controls.Add(Me.Label6)- Me.grpSimulationSettings.Controls.Add(Me.lblOffsetField)- Me.grpSimulationSettings.Controls.Add(Me.Label5)- Me.grpSimulationSettings.Controls.Add(Me.Label2)- Me.grpSimulationSettings.Controls.Add(Me.cmbIntensityColorScheme)- Me.grpSimulationSettings.Controls.Add(Me.cmbFieldColorScheme)- Me.grpSimulationSettings.Controls.Add(Me.chkPreviewVideoIntensity)- Me.grpSimulationSettings.Controls.Add(Me.chkExportVideoIntensity)- Me.grpSimulationSettings.Controls.Add(Me.chkPreviewVideoField)- Me.grpSimulationSettings.Controls.Add(Me.chkExportVideoField)- Me.grpSimulationSettings.Controls.Add(Me.lblPreviewVideo)- Me.grpSimulationSettings.Controls.Add(Me.lblExportVideo)- Me.grpSimulationSettings.Controls.Add(Me.numVisualizeEvery)- Me.grpSimulationSettings.Controls.Add(Me.Label4)- Me.grpSimulationSettings.Controls.Add(Me.lblVisualizeEvery)- Me.grpSimulationSettings.Controls.Add(Me.Label7)- Me.grpSimulationSettings.Controls.Add(Me.lblSimulationSteps)- Me.grpSimulationSettings.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.grpSimulationSettings.Location = New System.Drawing.Point(516, 432)- Me.grpSimulationSettings.Name = "grpSimulationSettings"- Me.grpSimulationSettings.Size = New System.Drawing.Size(1200, 234)- Me.grpSimulationSettings.TabIndex = 3- Me.grpSimulationSettings.TabStop = False- Me.grpSimulationSettings.Text = "Simulation Settings"- '- 'Label61- '- Me.Label61.AutoSize = True- Me.Label61.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label61.Location = New System.Drawing.Point(27, 152)- Me.Label61.Name = "Label61"- Me.Label61.Size = New System.Drawing.Size(133, 16)- Me.Label61.TabIndex = 16- Me.Label61.Text = "Intensity decay factor"- '- 'numTimeDecayFactor- '- Me.numTimeDecayFactor.Location = New System.Drawing.Point(179, 150)- Me.numTimeDecayFactor.Maximum = New Decimal(New Integer() {20, 0, 0, 0})- Me.numTimeDecayFactor.Minimum = New Decimal(New Integer() {1, 0, 0, 0})- Me.numTimeDecayFactor.Name = "numTimeDecayFactor"- Me.numTimeDecayFactor.Size = New System.Drawing.Size(80, 24)- Me.numTimeDecayFactor.TabIndex = 15- Me.numTimeDecayFactor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numTimeDecayFactor.Value = New Decimal(New Integer() {5, 0, 0, 0})- '- 'numSimulationSteps- '- Me.numSimulationSteps.Increment = New Decimal(New Integer() {500, 0, 0, 0})- Me.numSimulationSteps.Location = New System.Drawing.Point(179, 188)- Me.numSimulationSteps.Maximum = New Decimal(New Integer() {100000, 0, 0, 0})- Me.numSimulationSteps.Minimum = New Decimal(New Integer() {100, 0, 0, 0})- Me.numSimulationSteps.Name = "numSimulationSteps"- Me.numSimulationSteps.Size = New System.Drawing.Size(80, 24)- Me.numSimulationSteps.TabIndex = 14- Me.numSimulationSteps.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numSimulationSteps.Value = New Decimal(New Integer() {3000, 0, 0, 0})- '- 'lblInfo- '- Me.lblInfo.AutoSize = True- Me.lblInfo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblInfo.Location = New System.Drawing.Point(1051, 193)- Me.lblInfo.Name = "lblInfo"- Me.lblInfo.Size = New System.Drawing.Size(37, 16)- Me.lblInfo.TabIndex = 13- Me.lblInfo.Text = "(Info)"- '- 'chkUse4thOrderLaplacian- '- Me.chkUse4thOrderLaplacian.AutoSize = True- Me.chkUse4thOrderLaplacian.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkUse4thOrderLaplacian.Location = New System.Drawing.Point(786, 191)- Me.chkUse4thOrderLaplacian.Name = "chkUse4thOrderLaplacian"- Me.chkUse4thOrderLaplacian.Size = New System.Drawing.Size(266, 20)- Me.chkUse4thOrderLaplacian.TabIndex = 12- Me.chkUse4thOrderLaplacian.Text = "Use 4th order Laplacian + sub-sampling "- Me.chkUse4thOrderLaplacian.UseVisualStyleBackColor = True- '- 'chkUseGPU- '- Me.chkUseGPU.AutoSize = True- Me.chkUseGPU.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkUseGPU.Location = New System.Drawing.Point(787, 153)- Me.chkUseGPU.Name = "chkUseGPU"- Me.chkUseGPU.Size = New System.Drawing.Size(187, 20)- Me.chkUseGPU.TabIndex = 11- Me.chkUseGPU.Text = "Use GPU (generally faster)"- Me.chkUseGPU.UseVisualStyleBackColor = True- '- 'numQuality- '- Me.numQuality.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numQuality.Location = New System.Drawing.Point(491, 191)- Me.numQuality.Name = "numQuality"- Me.numQuality.Size = New System.Drawing.Size(61, 22)- Me.numQuality.TabIndex = 10- Me.numQuality.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numQuality.Value = New Decimal(New Integer() {70, 0, 0, 0})- '- 'lblVideoQuality- '- Me.lblVideoQuality.AutoSize = True- Me.lblVideoQuality.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblVideoQuality.Location = New System.Drawing.Point(377, 193)- Me.lblVideoQuality.Name = "lblVideoQuality"- Me.lblVideoQuality.Size = New System.Drawing.Size(109, 16)- Me.lblVideoQuality.TabIndex = 9- Me.lblVideoQuality.Text = "Video quality (%)"- '- 'numIntensityScaling- '- Me.numIntensityScaling.DecimalPlaces = 1- Me.numIntensityScaling.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numIntensityScaling.Increment = New Decimal(New Integer() {1, 0, 0, 65536})- Me.numIntensityScaling.Location = New System.Drawing.Point(904, 79)- Me.numIntensityScaling.Name = "numIntensityScaling"- Me.numIntensityScaling.Size = New System.Drawing.Size(74, 22)- Me.numIntensityScaling.TabIndex = 8- Me.numIntensityScaling.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numIntensityScaling.Value = New Decimal(New Integer() {30, 0, 0, 0})- '- 'numOffsetIntensity- '- Me.numOffsetIntensity.DecimalPlaces = 1- Me.numOffsetIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numOffsetIntensity.Increment = New Decimal(New Integer() {1, 0, 0, 131072})- Me.numOffsetIntensity.Location = New System.Drawing.Point(1044, 80)- Me.numOffsetIntensity.Maximum = New Decimal(New Integer() {1, 0, 0, 0})- Me.numOffsetIntensity.Minimum = New Decimal(New Integer() {1, 0, 0, -2147483648})- Me.numOffsetIntensity.Name = "numOffsetIntensity"- Me.numOffsetIntensity.Size = New System.Drawing.Size(82, 22)- Me.numOffsetIntensity.TabIndex = 8- Me.numOffsetIntensity.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numOffsetField- '- Me.numOffsetField.DecimalPlaces = 1- Me.numOffsetField.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numOffsetField.Increment = New Decimal(New Integer() {1, 0, 0, 131072})- Me.numOffsetField.Location = New System.Drawing.Point(1044, 40)- Me.numOffsetField.Maximum = New Decimal(New Integer() {1, 0, 0, 0})- Me.numOffsetField.Minimum = New Decimal(New Integer() {1, 0, 0, -2147483648})- Me.numOffsetField.Name = "numOffsetField"- Me.numOffsetField.Size = New System.Drawing.Size(82, 22)- Me.numOffsetField.TabIndex = 8- Me.numOffsetField.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numFieldScaling- '- Me.numFieldScaling.DecimalPlaces = 1- Me.numFieldScaling.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numFieldScaling.Increment = New Decimal(New Integer() {1, 0, 0, 65536})- Me.numFieldScaling.Location = New System.Drawing.Point(904, 40)- Me.numFieldScaling.Name = "numFieldScaling"- Me.numFieldScaling.Size = New System.Drawing.Size(74, 22)- Me.numFieldScaling.TabIndex = 8- Me.numFieldScaling.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numFieldScaling.Value = New Decimal(New Integer() {30, 0, 0, 0})- '- 'Label3- '- Me.Label3.AutoSize = True- Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label3.Location = New System.Drawing.Point(363, 83)- Me.Label3.Name = "Label3"- Me.Label3.Size = New System.Drawing.Size(140, 16)- Me.Label3.TabIndex = 6- Me.Label3.Text = "Intensity color scheme"- '- 'numScaleIntensityValues- '- Me.numScaleIntensityValues.AutoSize = True- Me.numScaleIntensityValues.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numScaleIntensityValues.Location = New System.Drawing.Point(785, 81)- Me.numScaleIntensityValues.Name = "numScaleIntensityValues"- Me.numScaleIntensityValues.Size = New System.Drawing.Size(105, 16)- Me.numScaleIntensityValues.TabIndex = 6- Me.numScaleIntensityValues.Text = "Scale Int. values"- '- 'Label6- '- Me.Label6.AutoSize = True- Me.Label6.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label6.Location = New System.Drawing.Point(997, 82)- Me.Label6.Name = "Label6"- Me.Label6.Size = New System.Drawing.Size(42, 16)- Me.Label6.TabIndex = 6- Me.Label6.Text = "Offset"- '- 'lblOffsetField- '- Me.lblOffsetField.AutoSize = True- Me.lblOffsetField.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblOffsetField.Location = New System.Drawing.Point(996, 42)- Me.lblOffsetField.Name = "lblOffsetField"- Me.lblOffsetField.Size = New System.Drawing.Size(42, 16)- Me.lblOffsetField.TabIndex = 6- Me.lblOffsetField.Text = "Offset"- '- 'Label5- '- Me.Label5.AutoSize = True- Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label5.Location = New System.Drawing.Point(783, 42)- Me.Label5.Name = "Label5"- Me.Label5.Size = New System.Drawing.Size(114, 16)- Me.Label5.TabIndex = 6- Me.Label5.Text = "Scale field values"- '- 'Label2- '- Me.Label2.AutoSize = True- Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label2.Location = New System.Drawing.Point(363, 44)- Me.Label2.Name = "Label2"- Me.Label2.Size = New System.Drawing.Size(122, 16)- Me.Label2.TabIndex = 6- Me.Label2.Text = "Field color scheme"- '- 'cmbIntensityColorScheme- '- Me.cmbIntensityColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.cmbIntensityColorScheme.FormattingEnabled = True- Me.cmbIntensityColorScheme.Location = New System.Drawing.Point(509, 79)- Me.cmbIntensityColorScheme.Name = "cmbIntensityColorScheme"- Me.cmbIntensityColorScheme.Size = New System.Drawing.Size(165, 24)- Me.cmbIntensityColorScheme.TabIndex = 5- '- 'cmbFieldColorScheme- '- Me.cmbFieldColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.cmbFieldColorScheme.FormattingEnabled = True- Me.cmbFieldColorScheme.Location = New System.Drawing.Point(509, 40)- Me.cmbFieldColorScheme.Name = "cmbFieldColorScheme"- Me.cmbFieldColorScheme.Size = New System.Drawing.Size(165, 24)- Me.cmbFieldColorScheme.TabIndex = 5- '- 'chkPreviewVideoIntensity- '- Me.chkPreviewVideoIntensity.AutoSize = True- Me.chkPreviewVideoIntensity.Checked = True- Me.chkPreviewVideoIntensity.CheckState = System.Windows.Forms.CheckState.Checked- Me.chkPreviewVideoIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkPreviewVideoIntensity.Location = New System.Drawing.Point(193, 80)- Me.chkPreviewVideoIntensity.Name = "chkPreviewVideoIntensity"- Me.chkPreviewVideoIntensity.Size = New System.Drawing.Size(75, 20)- Me.chkPreviewVideoIntensity.TabIndex = 4- Me.chkPreviewVideoIntensity.Text = "Intensity"- Me.chkPreviewVideoIntensity.UseVisualStyleBackColor = True- '- 'chkExportVideoIntensity- '- Me.chkExportVideoIntensity.AutoSize = True- Me.chkExportVideoIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkExportVideoIntensity.Location = New System.Drawing.Point(193, 41)- Me.chkExportVideoIntensity.Name = "chkExportVideoIntensity"- Me.chkExportVideoIntensity.Size = New System.Drawing.Size(75, 20)- Me.chkExportVideoIntensity.TabIndex = 4- Me.chkExportVideoIntensity.Text = "Intensity"- Me.chkExportVideoIntensity.UseVisualStyleBackColor = True- '- 'chkPreviewVideoField- '- Me.chkPreviewVideoField.AutoSize = True- Me.chkPreviewVideoField.Checked = True- Me.chkPreviewVideoField.CheckState = System.Windows.Forms.CheckState.Checked- Me.chkPreviewVideoField.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkPreviewVideoField.Location = New System.Drawing.Point(130, 81)- Me.chkPreviewVideoField.Name = "chkPreviewVideoField"- Me.chkPreviewVideoField.Size = New System.Drawing.Size(57, 20)- Me.chkPreviewVideoField.TabIndex = 4- Me.chkPreviewVideoField.Text = "Field"- Me.chkPreviewVideoField.UseVisualStyleBackColor = True- '- 'chkExportVideoField- '- Me.chkExportVideoField.AutoSize = True- Me.chkExportVideoField.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkExportVideoField.Location = New System.Drawing.Point(130, 42)- Me.chkExportVideoField.Name = "chkExportVideoField"- Me.chkExportVideoField.Size = New System.Drawing.Size(57, 20)- Me.chkExportVideoField.TabIndex = 4- Me.chkExportVideoField.Text = "Field"- Me.chkExportVideoField.UseVisualStyleBackColor = True- '- 'lblPreviewVideo- '- Me.lblPreviewVideo.AutoSize = True- Me.lblPreviewVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblPreviewVideo.Location = New System.Drawing.Point(24, 82)- Me.lblPreviewVideo.Name = "lblPreviewVideo"- Me.lblPreviewVideo.Size = New System.Drawing.Size(93, 16)- Me.lblPreviewVideo.TabIndex = 3- Me.lblPreviewVideo.Text = "Preview video"- '- 'lblExportVideo- '- Me.lblExportVideo.AutoSize = True- Me.lblExportVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblExportVideo.Location = New System.Drawing.Point(24, 43)- Me.lblExportVideo.Name = "lblExportVideo"- Me.lblExportVideo.Size = New System.Drawing.Size(100, 16)- Me.lblExportVideo.TabIndex = 3- Me.lblExportVideo.Text = "Export video of:"- '- 'numVisualizeEvery- '- Me.numVisualizeEvery.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numVisualizeEvery.Location = New System.Drawing.Point(491, 152)- Me.numVisualizeEvery.Maximum = New Decimal(New Integer() {6, 0, 0, 0})- Me.numVisualizeEvery.Name = "numVisualizeEvery"- Me.numVisualizeEvery.Size = New System.Drawing.Size(61, 22)- Me.numVisualizeEvery.TabIndex = 1- Me.numVisualizeEvery.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numVisualizeEvery.Value = New Decimal(New Integer() {2, 0, 0, 0})- '- 'Label4- '- Me.Label4.AutoSize = True- Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label4.Location = New System.Drawing.Point(558, 155)- Me.Label4.Name = "Label4"- Me.Label4.Size = New System.Drawing.Size(49, 16)- Me.Label4.TabIndex = 0- Me.Label4.Text = "frames"- '- 'lblVisualizeEvery- '- Me.lblVisualizeEvery.AutoSize = True- Me.lblVisualizeEvery.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblVisualizeEvery.Location = New System.Drawing.Point(377, 154)- Me.lblVisualizeEvery.Name = "lblVisualizeEvery"- Me.lblVisualizeEvery.Size = New System.Drawing.Size(99, 16)- Me.lblVisualizeEvery.TabIndex = 0- Me.lblVisualizeEvery.Text = "Visualize every"- '- 'Label7- '- Me.Label7.AutoSize = True- Me.Label7.Location = New System.Drawing.Point(386, 195)- Me.Label7.Name = "Label7"- Me.Label7.Size = New System.Drawing.Size(0, 18)- Me.Label7.TabIndex = 0- '- 'lblSimulationSteps- '- Me.lblSimulationSteps.AutoSize = True- Me.lblSimulationSteps.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblSimulationSteps.Location = New System.Drawing.Point(32, 193)- Me.lblSimulationSteps.Name = "lblSimulationSteps"- Me.lblSimulationSteps.Size = New System.Drawing.Size(106, 16)- Me.lblSimulationSteps.TabIndex = 0- Me.lblSimulationSteps.Text = "Simulation steps"- '- 'grpSceneProperties- '- Me.grpSceneProperties.Controls.Add(Me.Label20)- Me.grpSceneProperties.Controls.Add(Me.numRefractiveIndex)- Me.grpSceneProperties.Controls.Add(Me.picImagePreview)- Me.grpSceneProperties.Controls.Add(Me.lblScaleImgSourceIntensity)- Me.grpSceneProperties.Controls.Add(Me.numScaleImageSource)- Me.grpSceneProperties.Controls.Add(Me.btnEditObjectSourceList)- Me.grpSceneProperties.Controls.Add(Me.txtDampingEdgeSize)- Me.grpSceneProperties.Controls.Add(Me.chkUseObjectSources)- Me.grpSceneProperties.Controls.Add(Me.chkUseImageSources)- Me.grpSceneProperties.Controls.Add(Me.chkDampingEdge)- Me.grpSceneProperties.Controls.Add(Me.btnLoadSceneImage)- Me.grpSceneProperties.Controls.Add(Me.Label1)- Me.grpSceneProperties.Controls.Add(Me.lblPix)- Me.grpSceneProperties.Controls.Add(Me.lblX)- Me.grpSceneProperties.Controls.Add(Me.txtYsize)- Me.grpSceneProperties.Controls.Add(Me.txtXSize)- Me.grpSceneProperties.Controls.Add(Me.radUserDefinedScene)- Me.grpSceneProperties.Controls.Add(Me.radUseSceneImage)- Me.grpSceneProperties.Controls.Add(Me.lblImageNameAndSize)- Me.grpSceneProperties.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.grpSceneProperties.Location = New System.Drawing.Point(516, 25)- Me.grpSceneProperties.Name = "grpSceneProperties"- Me.grpSceneProperties.Size = New System.Drawing.Size(1200, 390)- Me.grpSceneProperties.TabIndex = 1- Me.grpSceneProperties.TabStop = False- Me.grpSceneProperties.Text = "Scene properties"- '- 'Label20- '- Me.Label20.AutoSize = True- Me.Label20.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label20.Location = New System.Drawing.Point(366, 80)- Me.Label20.Name = "Label20"- Me.Label20.Size = New System.Drawing.Size(104, 16)- Me.Label20.TabIndex = 12- Me.Label20.Text = "Refractive index"- '- 'numRefractiveIndex- '- Me.numRefractiveIndex.DecimalPlaces = 2- Me.numRefractiveIndex.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numRefractiveIndex.Increment = New Decimal(New Integer() {1, 0, 0, 131072})- Me.numRefractiveIndex.Location = New System.Drawing.Point(476, 78)- Me.numRefractiveIndex.Maximum = New Decimal(New Integer() {25, 0, 0, 65536})- Me.numRefractiveIndex.Minimum = New Decimal(New Integer() {10, 0, 0, 65536})- Me.numRefractiveIndex.Name = "numRefractiveIndex"- Me.numRefractiveIndex.Size = New System.Drawing.Size(60, 22)- Me.numRefractiveIndex.TabIndex = 11- Me.numRefractiveIndex.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numRefractiveIndex.Value = New Decimal(New Integer() {10, 0, 0, 65536})- '- 'picImagePreview- '- Me.picImagePreview.BackColor = System.Drawing.SystemColors.Control- Me.picImagePreview.Location = New System.Drawing.Point(587, 22)- Me.picImagePreview.Name = "picImagePreview"- Me.picImagePreview.Size = New System.Drawing.Size(600, 338)- Me.picImagePreview.TabIndex = 1- Me.picImagePreview.TabStop = False- '- 'lblScaleImgSourceIntensity- '- Me.lblScaleImgSourceIntensity.AutoSize = True- Me.lblScaleImgSourceIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblScaleImgSourceIntensity.Location = New System.Drawing.Point(179, 183)- Me.lblScaleImgSourceIntensity.Name = "lblScaleImgSourceIntensity"- Me.lblScaleImgSourceIntensity.Size = New System.Drawing.Size(155, 16)- Me.lblScaleImgSourceIntensity.TabIndex = 10- Me.lblScaleImgSourceIntensity.Text = "Scale intensity values by"- '- 'numScaleImageSource- '- Me.numScaleImageSource.DecimalPlaces = 1- Me.numScaleImageSource.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numScaleImageSource.Increment = New Decimal(New Integer() {1, 0, 0, 65536})- Me.numScaleImageSource.Location = New System.Drawing.Point(337, 181)- Me.numScaleImageSource.Name = "numScaleImageSource"- Me.numScaleImageSource.Size = New System.Drawing.Size(65, 22)- Me.numScaleImageSource.TabIndex = 9- Me.numScaleImageSource.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numScaleImageSource.Value = New Decimal(New Integer() {1, 0, 0, 0})- '- 'btnEditObjectSourceList- '- Me.btnEditObjectSourceList.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnEditObjectSourceList.Location = New System.Drawing.Point(201, 214)- Me.btnEditObjectSourceList.Name = "btnEditObjectSourceList"- Me.btnEditObjectSourceList.Size = New System.Drawing.Size(117, 23)- Me.btnEditObjectSourceList.TabIndex = 8- Me.btnEditObjectSourceList.Text = "Edit source list"- Me.btnEditObjectSourceList.UseVisualStyleBackColor = True- '- 'txtDampingEdgeSize- '- Me.txtDampingEdgeSize.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.txtDampingEdgeSize.Location = New System.Drawing.Point(152, 143)- Me.txtDampingEdgeSize.Name = "txtDampingEdgeSize"- Me.txtDampingEdgeSize.Size = New System.Drawing.Size(100, 22)- Me.txtDampingEdgeSize.TabIndex = 7- '- 'chkUseObjectSources- '- Me.chkUseObjectSources.AutoSize = True- Me.chkUseObjectSources.Checked = True- Me.chkUseObjectSources.CheckState = System.Windows.Forms.CheckState.Checked- Me.chkUseObjectSources.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkUseObjectSources.Location = New System.Drawing.Point(26, 218)- Me.chkUseObjectSources.Name = "chkUseObjectSources"- Me.chkUseObjectSources.Size = New System.Drawing.Size(143, 20)- Me.chkUseObjectSources.TabIndex = 6- Me.chkUseObjectSources.Text = "Use object sources"- Me.chkUseObjectSources.UseVisualStyleBackColor = True- '- 'chkUseImageSources- '- Me.chkUseImageSources.AutoSize = True- Me.chkUseImageSources.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkUseImageSources.Location = New System.Drawing.Point(26, 182)- Me.chkUseImageSources.Name = "chkUseImageSources"- Me.chkUseImageSources.Size = New System.Drawing.Size(157, 20)- Me.chkUseImageSources.TabIndex = 6- Me.chkUseImageSources.Text = "Use image sources -"- Me.chkUseImageSources.UseVisualStyleBackColor = True- '- 'chkDampingEdge- '- Me.chkDampingEdge.AutoSize = True- Me.chkDampingEdge.Checked = True- Me.chkDampingEdge.CheckState = System.Windows.Forms.CheckState.Checked- Me.chkDampingEdge.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkDampingEdge.Location = New System.Drawing.Point(26, 145)- Me.chkDampingEdge.Name = "chkDampingEdge"- Me.chkDampingEdge.Size = New System.Drawing.Size(120, 20)- Me.chkDampingEdge.TabIndex = 6- Me.chkDampingEdge.Text = "Damping edge "- Me.chkDampingEdge.UseVisualStyleBackColor = True- '- 'btnLoadSceneImage- '- Me.btnLoadSceneImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnLoadSceneImage.Location = New System.Drawing.Point(138, 39)- Me.btnLoadSceneImage.Name = "btnLoadSceneImage"- Me.btnLoadSceneImage.Size = New System.Drawing.Size(75, 23)- Me.btnLoadSceneImage.TabIndex = 5- Me.btnLoadSceneImage.Text = "load"- Me.btnLoadSceneImage.UseVisualStyleBackColor = True- '- 'Label1- '- Me.Label1.AutoSize = True- Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label1.Location = New System.Drawing.Point(258, 146)- Me.Label1.Name = "Label1"- Me.Label1.Size = New System.Drawing.Size(22, 16)- Me.Label1.TabIndex = 4- Me.Label1.Text = "px"- '- 'lblPix- '- Me.lblPix.AutoSize = True- Me.lblPix.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblPix.Location = New System.Drawing.Point(327, 80)- Me.lblPix.Name = "lblPix"- Me.lblPix.Size = New System.Drawing.Size(22, 16)- Me.lblPix.TabIndex = 4- Me.lblPix.Text = "px"- '- 'lblX- '- Me.lblX.AutoSize = True- Me.lblX.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblX.Location = New System.Drawing.Point(243, 80)- Me.lblX.Name = "lblX"- Me.lblX.Size = New System.Drawing.Size(12, 16)- Me.lblX.TabIndex = 4- Me.lblX.Text = "/"- '- 'txtYsize- '- Me.txtYsize.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.txtYsize.Location = New System.Drawing.Point(258, 77)- Me.txtYsize.Name = "txtYsize"- Me.txtYsize.Size = New System.Drawing.Size(64, 22)- Me.txtYsize.TabIndex = 3- '- 'txtXSize- '- Me.txtXSize.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.txtXSize.Location = New System.Drawing.Point(169, 76)- Me.txtXSize.Name = "txtXSize"- Me.txtXSize.Size = New System.Drawing.Size(72, 22)- Me.txtXSize.TabIndex = 3- '- 'radUserDefinedScene- '- Me.radUserDefinedScene.AutoSize = True- Me.radUserDefinedScene.Checked = True- Me.radUserDefinedScene.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.radUserDefinedScene.Location = New System.Drawing.Point(26, 77)- Me.radUserDefinedScene.Name = "radUserDefinedScene"- Me.radUserDefinedScene.Size = New System.Drawing.Size(141, 20)- Me.radUserDefinedScene.TabIndex = 2- Me.radUserDefinedScene.TabStop = True- Me.radUserDefinedScene.Text = "User defined (X /Y)"- Me.radUserDefinedScene.UseVisualStyleBackColor = True- '- 'radUseSceneImage- '- Me.radUseSceneImage.AutoSize = True- Me.radUseSceneImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.radUseSceneImage.Location = New System.Drawing.Point(26, 40)- Me.radUseSceneImage.Name = "radUseSceneImage"- Me.radUseSceneImage.Size = New System.Drawing.Size(106, 20)- Me.radUseSceneImage.TabIndex = 0- Me.radUseSceneImage.Text = "Scene image"- Me.radUseSceneImage.UseVisualStyleBackColor = True- '- 'lblImageNameAndSize- '- Me.lblImageNameAndSize.AutoSize = True- Me.lblImageNameAndSize.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblImageNameAndSize.Location = New System.Drawing.Point(228, 41)- Me.lblImageNameAndSize.Name = "lblImageNameAndSize"- Me.lblImageNameAndSize.Size = New System.Drawing.Size(103, 16)- Me.lblImageNameAndSize.TabIndex = 4- Me.lblImageNameAndSize.Text = "(name and size)"- '- 'tabSourceList- '- Me.tabSourceList.Controls.Add(Me.Label62)- Me.tabSourceList.Controls.Add(Me.Label60)- Me.tabSourceList.Controls.Add(Me.chkAutoRescaleSourceOn)- Me.tabSourceList.Controls.Add(Me.picPreviewSource)- Me.tabSourceList.Controls.Add(Me.grpPlaceSource)- Me.tabSourceList.Controls.Add(Me.btnDelete)- Me.tabSourceList.Controls.Add(Me.btnNew)- Me.tabSourceList.Controls.Add(Me.btnCopy)- Me.tabSourceList.Controls.Add(Me.lstSources)- Me.tabSourceList.Controls.Add(Me.pnlSourceImage)- Me.tabSourceList.Controls.Add(Me.grpSourceDetails)- Me.tabSourceList.Location = New System.Drawing.Point(4, 34)- Me.tabSourceList.Name = "tabSourceList"- Me.tabSourceList.Size = New System.Drawing.Size(1742, 693)- Me.tabSourceList.TabIndex = 6- Me.tabSourceList.Text = " Sources "- Me.tabSourceList.UseVisualStyleBackColor = True- '- 'Label62- '- Me.Label62.AutoSize = True- Me.Label62.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label62.Location = New System.Drawing.Point(1187, 18)- Me.Label62.Name = "Label62"- Me.Label62.Size = New System.Drawing.Size(121, 18)- Me.Label62.TabIndex = 8- Me.Label62.Text = "List of sources"- '- 'Label60- '- Me.Label60.AutoSize = True- Me.Label60.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label60.Location = New System.Drawing.Point(1185, 408)- Me.Label60.Name = "Label60"- Me.Label60.Size = New System.Drawing.Size(124, 18)- Me.Label60.TabIndex = 7- Me.Label60.Text = "Source preview"- '- 'chkAutoRescaleSourceOn- '- Me.chkAutoRescaleSourceOn.AutoSize = True- Me.chkAutoRescaleSourceOn.Checked = True- Me.chkAutoRescaleSourceOn.CheckState = System.Windows.Forms.CheckState.Checked- Me.chkAutoRescaleSourceOn.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkAutoRescaleSourceOn.Location = New System.Drawing.Point(1192, 651)- Me.chkAutoRescaleSourceOn.Name = "chkAutoRescaleSourceOn"- Me.chkAutoRescaleSourceOn.Size = New System.Drawing.Size(186, 20)- Me.chkAutoRescaleSourceOn.TabIndex = 6- Me.chkAutoRescaleSourceOn.Text = "Auto-rescale source layout"- Me.chkAutoRescaleSourceOn.UseVisualStyleBackColor = True- '- 'picPreviewSource- '- Me.picPreviewSource.Location = New System.Drawing.Point(1185, 430)- Me.picPreviewSource.Name = "picPreviewSource"- Me.picPreviewSource.Size = New System.Drawing.Size(273, 215)- Me.picPreviewSource.TabIndex = 5- Me.picPreviewSource.TabStop = False- '- 'grpPlaceSource- '- Me.grpPlaceSource.Controls.Add(Me.pnlPosition)- Me.grpPlaceSource.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.grpPlaceSource.Location = New System.Drawing.Point(1185, 285)- Me.grpPlaceSource.Name = "grpPlaceSource"- Me.grpPlaceSource.Size = New System.Drawing.Size(273, 117)- Me.grpPlaceSource.TabIndex = 4- Me.grpPlaceSource.TabStop = False- Me.grpPlaceSource.Text = "Place current source"- '- 'pnlPosition- '- Me.pnlPosition.BackColor = System.Drawing.Color.Azure- Me.pnlPosition.Controls.Add(Me.numSourcePositionX)- Me.pnlPosition.Controls.Add(Me.Label36)- Me.pnlPosition.Controls.Add(Me.lblPosition)- Me.pnlPosition.Controls.Add(Me.btnPickSourcePosition)- Me.pnlPosition.Controls.Add(Me.numSourcePositionY)- Me.pnlPosition.Controls.Add(Me.Label35)- Me.pnlPosition.Location = New System.Drawing.Point(22, 25)- Me.pnlPosition.Name = "pnlPosition"- Me.pnlPosition.Size = New System.Drawing.Size(228, 77)- Me.pnlPosition.TabIndex = 20- '- 'numSourcePositionX- '- Me.numSourcePositionX.Location = New System.Drawing.Point(146, 9)- Me.numSourcePositionX.Name = "numSourcePositionX"- Me.numSourcePositionX.Size = New System.Drawing.Size(65, 22)- Me.numSourcePositionX.TabIndex = 11- Me.numSourcePositionX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'Label36- '- Me.Label36.AutoSize = True- Me.Label36.Location = New System.Drawing.Point(123, 11)- Me.Label36.Name = "Label36"- Me.Label36.Size = New System.Drawing.Size(16, 16)- Me.Label36.TabIndex = 7- Me.Label36.Text = "X"- '- 'lblPosition- '- Me.lblPosition.AutoSize = True- Me.lblPosition.Location = New System.Drawing.Point(16, 6)- Me.lblPosition.Name = "lblPosition"- Me.lblPosition.Size = New System.Drawing.Size(97, 16)- Me.lblPosition.TabIndex = 12- Me.lblPosition.Text = "Center position"- '- 'btnPickSourcePosition- '- Me.btnPickSourcePosition.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnPickSourcePosition.Location = New System.Drawing.Point(15, 31)- Me.btnPickSourcePosition.Name = "btnPickSourcePosition"- Me.btnPickSourcePosition.Size = New System.Drawing.Size(102, 35)- Me.btnPickSourcePosition.TabIndex = 9- Me.btnPickSourcePosition.Text = "Pick "- Me.btnPickSourcePosition.UseVisualStyleBackColor = True- '- 'numSourcePositionY- '- Me.numSourcePositionY.Location = New System.Drawing.Point(146, 41)- Me.numSourcePositionY.Name = "numSourcePositionY"- Me.numSourcePositionY.Size = New System.Drawing.Size(65, 22)- Me.numSourcePositionY.TabIndex = 10- Me.numSourcePositionY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'Label35- '- Me.Label35.AutoSize = True- Me.Label35.Location = New System.Drawing.Point(123, 43)- Me.Label35.Name = "Label35"- Me.Label35.Size = New System.Drawing.Size(17, 16)- Me.Label35.TabIndex = 6- Me.Label35.Text = "Y"- '- 'btnDelete- '- Me.btnDelete.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnDelete.Location = New System.Drawing.Point(1389, 245)- Me.btnDelete.Name = "btnDelete"- Me.btnDelete.Size = New System.Drawing.Size(70, 29)- Me.btnDelete.TabIndex = 2- Me.btnDelete.Text = "Delete"- Me.btnDelete.UseVisualStyleBackColor = True- '- 'btnNew- '- Me.btnNew.BackColor = System.Drawing.Color.Azure- Me.btnNew.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnNew.Location = New System.Drawing.Point(1189, 245)- Me.btnNew.Name = "btnNew"- Me.btnNew.Size = New System.Drawing.Size(70, 28)- Me.btnNew.TabIndex = 2- Me.btnNew.Text = "New"- Me.btnNew.UseVisualStyleBackColor = False- '- 'btnCopy- '- Me.btnCopy.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnCopy.Location = New System.Drawing.Point(1314, 244)- Me.btnCopy.Name = "btnCopy"- Me.btnCopy.Size = New System.Drawing.Size(70, 29)- Me.btnCopy.TabIndex = 2- Me.btnCopy.Text = "Copy"- Me.btnCopy.UseVisualStyleBackColor = True- '- 'lstSources- '- Me.lstSources.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lstSources.FormattingEnabled = True- Me.lstSources.ItemHeight = 16- Me.lstSources.Location = New System.Drawing.Point(1187, 43)- Me.lstSources.Name = "lstSources"- Me.lstSources.Size = New System.Drawing.Size(273, 196)- Me.lstSources.TabIndex = 1- '- 'pnlSourceImage- '- Me.pnlSourceImage.Location = New System.Drawing.Point(16, 14)- Me.pnlSourceImage.Name = "pnlSourceImage"- Me.pnlSourceImage.Size = New System.Drawing.Size(1160, 653)- Me.pnlSourceImage.TabIndex = 0- '- 'grpSourceDetails- '- Me.grpSourceDetails.Controls.Add(Me.txtDetachAfterSteps)- Me.grpSourceDetails.Controls.Add(Me.btnSaveSource)- Me.grpSourceDetails.Controls.Add(Me.Label47)- Me.grpSourceDetails.Controls.Add(Me.chkDetachSource)- Me.grpSourceDetails.Controls.Add(Me.lblLambdaIs)- Me.grpSourceDetails.Controls.Add(Me.chkSourceOn)- Me.grpSourceDetails.Controls.Add(Me.grpComposite)- Me.grpSourceDetails.Controls.Add(Me.grpSingleSource)- Me.grpSourceDetails.Controls.Add(Me.radModePulsed)- Me.grpSourceDetails.Controls.Add(Me.radModeContinuous)- Me.grpSourceDetails.Controls.Add(Me.txtName)- Me.grpSourceDetails.Controls.Add(Me.cmbMainType)- Me.grpSourceDetails.Controls.Add(Me.Label39)- Me.grpSourceDetails.Controls.Add(Me.lblName)- Me.grpSourceDetails.Controls.Add(Me.Label38)- Me.grpSourceDetails.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.grpSourceDetails.Location = New System.Drawing.Point(1471, 15)- Me.grpSourceDetails.Name = "grpSourceDetails"- Me.grpSourceDetails.Size = New System.Drawing.Size(254, 666)- Me.grpSourceDetails.TabIndex = 3- Me.grpSourceDetails.TabStop = False- Me.grpSourceDetails.Text = "Source "- '- 'txtDetachAfterSteps- '- Me.txtDetachAfterSteps.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle- Me.txtDetachAfterSteps.Location = New System.Drawing.Point(128, 591)- Me.txtDetachAfterSteps.Name = "txtDetachAfterSteps"- Me.txtDetachAfterSteps.Size = New System.Drawing.Size(65, 22)- Me.txtDetachAfterSteps.TabIndex = 23- '- 'btnSaveSource- '- Me.btnSaveSource.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnSaveSource.Location = New System.Drawing.Point(12, 623)- Me.btnSaveSource.Name = "btnSaveSource"- Me.btnSaveSource.Size = New System.Drawing.Size(228, 30)- Me.btnSaveSource.TabIndex = 17- Me.btnSaveSource.Text = "Save source data"- Me.btnSaveSource.UseVisualStyleBackColor = True- '- 'Label47- '- Me.Label47.AutoSize = True- Me.Label47.Location = New System.Drawing.Point(199, 594)- Me.Label47.Name = "Label47"- Me.Label47.Size = New System.Drawing.Size(41, 16)- Me.Label47.TabIndex = 22- Me.Label47.Text = "steps"- '- 'chkDetachSource- '- Me.chkDetachSource.AutoSize = True- Me.chkDetachSource.Location = New System.Drawing.Point(23, 592)- Me.chkDetachSource.Name = "chkDetachSource"- Me.chkDetachSource.Size = New System.Drawing.Size(99, 20)- Me.chkDetachSource.TabIndex = 21- Me.chkDetachSource.Text = "Detach after"- Me.chkDetachSource.UseVisualStyleBackColor = True- '- 'lblLambdaIs- '- Me.lblLambdaIs.AutoSize = True- Me.lblLambdaIs.BackColor = System.Drawing.Color.White- Me.lblLambdaIs.Location = New System.Drawing.Point(162, 1)- Me.lblLambdaIs.Name = "lblLambdaIs"- Me.lblLambdaIs.Size = New System.Drawing.Size(52, 16)- Me.lblLambdaIs.TabIndex = 19- Me.lblLambdaIs.Text = "λ= px"- '- 'chkSourceOn- '- Me.chkSourceOn.AutoSize = True- Me.chkSourceOn.Location = New System.Drawing.Point(60, 0)- Me.chkSourceOn.Name = "chkSourceOn"- Me.chkSourceOn.Size = New System.Drawing.Size(42, 20)- Me.chkSourceOn.TabIndex = 18- Me.chkSourceOn.Text = "on"- Me.chkSourceOn.UseVisualStyleBackColor = True- '- 'grpComposite- '- Me.grpComposite.Controls.Add(Me.Label59)- Me.grpComposite.Controls.Add(Me.Label58)- Me.grpComposite.Controls.Add(Me.numRandomizeOffWidth)- Me.grpComposite.Controls.Add(Me.numRandomizePosition)- Me.grpComposite.Controls.Add(Me.NumRandomizePhase)- Me.grpComposite.Controls.Add(Me.numRandomizeFrequency)- Me.grpComposite.Controls.Add(Me.chkRandomizePhase)- Me.grpComposite.Controls.Add(Me.chkRandomizePosition)- Me.grpComposite.Controls.Add(Me.chkOffWidth)- Me.grpComposite.Controls.Add(Me.chkRandomizeFrequency)- Me.grpComposite.Controls.Add(Me.numSpacingSizeY)- Me.grpComposite.Controls.Add(Me.numSpacingSizeX)- Me.grpComposite.Controls.Add(Me.numArraySizeY)- Me.grpComposite.Controls.Add(Me.numArraySizeX)- Me.grpComposite.Controls.Add(Me.Label50)- Me.grpComposite.Controls.Add(Me.Label51)- Me.grpComposite.Controls.Add(Me.Label52)- Me.grpComposite.Controls.Add(Me.Label53)- Me.grpComposite.Controls.Add(Me.cmbCompositeProperties)- Me.grpComposite.Location = New System.Drawing.Point(12, 344)- Me.grpComposite.Name = "grpComposite"- Me.grpComposite.Size = New System.Drawing.Size(230, 241)- Me.grpComposite.TabIndex = 16- Me.grpComposite.TabStop = False- Me.grpComposite.Text = "Composite source"- '- 'Label59- '- Me.Label59.AutoSize = True- Me.Label59.Location = New System.Drawing.Point(181, 17)- Me.Label59.Name = "Label59"- Me.Label59.Size = New System.Drawing.Size(15, 16)- Me.Label59.TabIndex = 16- Me.Label59.Text = "y"- '- 'Label58- '- Me.Label58.AutoSize = True- Me.Label58.Location = New System.Drawing.Point(110, 17)- Me.Label58.Name = "Label58"- Me.Label58.Size = New System.Drawing.Size(14, 16)- Me.Label58.TabIndex = 16- Me.Label58.Text = "x"- '- 'numRandomizeOffWidth- '- Me.numRandomizeOffWidth.Location = New System.Drawing.Point(17, 208)- Me.numRandomizeOffWidth.Maximum = New Decimal(New Integer() {10000, 0, 0, 0})- Me.numRandomizeOffWidth.Name = "numRandomizeOffWidth"- Me.numRandomizeOffWidth.Size = New System.Drawing.Size(81, 22)- Me.numRandomizeOffWidth.TabIndex = 14- Me.numRandomizeOffWidth.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numRandomizePosition- '- Me.numRandomizePosition.Location = New System.Drawing.Point(129, 208)- Me.numRandomizePosition.Maximum = New Decimal(New Integer() {5, 0, 0, 0})- Me.numRandomizePosition.Name = "numRandomizePosition"- Me.numRandomizePosition.Size = New System.Drawing.Size(80, 22)- Me.numRandomizePosition.TabIndex = 14- Me.numRandomizePosition.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'NumRandomizePhase- '- Me.NumRandomizePhase.Location = New System.Drawing.Point(129, 162)- Me.NumRandomizePhase.Maximum = New Decimal(New Integer() {180, 0, 0, 0})- Me.NumRandomizePhase.Name = "NumRandomizePhase"- Me.NumRandomizePhase.Size = New System.Drawing.Size(80, 22)- Me.NumRandomizePhase.TabIndex = 14- Me.NumRandomizePhase.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numRandomizeFrequency- '- Me.numRandomizeFrequency.Location = New System.Drawing.Point(18, 163)- Me.numRandomizeFrequency.Maximum = New Decimal(New Integer() {50, 0, 0, 0})- Me.numRandomizeFrequency.Name = "numRandomizeFrequency"- Me.numRandomizeFrequency.Size = New System.Drawing.Size(80, 22)- Me.numRandomizeFrequency.TabIndex = 14- Me.numRandomizeFrequency.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'chkRandomizePhase- '- Me.chkRandomizePhase.AutoSize = True- Me.chkRandomizePhase.Location = New System.Drawing.Point(129, 144)- Me.chkRandomizePhase.Name = "chkRandomizePhase"- Me.chkRandomizePhase.Size = New System.Drawing.Size(66, 20)- Me.chkRandomizePhase.TabIndex = 15- Me.chkRandomizePhase.Text = "Phase"- Me.chkRandomizePhase.UseVisualStyleBackColor = True- '- 'chkRandomizePosition- '- Me.chkRandomizePosition.AutoSize = True- Me.chkRandomizePosition.Location = New System.Drawing.Point(129, 190)- Me.chkRandomizePosition.Name = "chkRandomizePosition"- Me.chkRandomizePosition.Size = New System.Drawing.Size(75, 20)- Me.chkRandomizePosition.TabIndex = 15- Me.chkRandomizePosition.Text = "Position"- Me.chkRandomizePosition.UseVisualStyleBackColor = True- '- 'chkOffWidth- '- Me.chkOffWidth.AutoSize = True- Me.chkOffWidth.Location = New System.Drawing.Point(17, 190)- Me.chkOffWidth.Name = "chkOffWidth"- Me.chkOffWidth.Size = New System.Drawing.Size(75, 20)- Me.chkOffWidth.TabIndex = 15- Me.chkOffWidth.Text = "Off state"- Me.chkOffWidth.UseVisualStyleBackColor = True- '- 'chkRandomizeFrequency- '- Me.chkRandomizeFrequency.AutoSize = True- Me.chkRandomizeFrequency.Location = New System.Drawing.Point(19, 145)- Me.chkRandomizeFrequency.Name = "chkRandomizeFrequency"- Me.chkRandomizeFrequency.Size = New System.Drawing.Size(91, 20)- Me.chkRandomizeFrequency.TabIndex = 15- Me.chkRandomizeFrequency.Text = "Frequency"- Me.chkRandomizeFrequency.UseVisualStyleBackColor = True- '- 'numSpacingSizeY- '- Me.numSpacingSizeY.Location = New System.Drawing.Point(161, 64)- Me.numSpacingSizeY.Name = "numSpacingSizeY"- Me.numSpacingSizeY.Size = New System.Drawing.Size(55, 22)- Me.numSpacingSizeY.TabIndex = 14- Me.numSpacingSizeY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numSpacingSizeX- '- Me.numSpacingSizeX.Location = New System.Drawing.Point(94, 64)- Me.numSpacingSizeX.Name = "numSpacingSizeX"- Me.numSpacingSizeX.Size = New System.Drawing.Size(55, 22)- Me.numSpacingSizeX.TabIndex = 14- Me.numSpacingSizeX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numArraySizeY- '- Me.numArraySizeY.Increment = New Decimal(New Integer() {2, 0, 0, 0})- Me.numArraySizeY.Location = New System.Drawing.Point(161, 36)- Me.numArraySizeY.Maximum = New Decimal(New Integer() {101, 0, 0, 0})- Me.numArraySizeY.Minimum = New Decimal(New Integer() {1, 0, 0, 0})- Me.numArraySizeY.Name = "numArraySizeY"- Me.numArraySizeY.Size = New System.Drawing.Size(55, 22)- Me.numArraySizeY.TabIndex = 14- Me.numArraySizeY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numArraySizeY.Value = New Decimal(New Integer() {1, 0, 0, 0})- '- 'numArraySizeX- '- Me.numArraySizeX.Increment = New Decimal(New Integer() {2, 0, 0, 0})- Me.numArraySizeX.Location = New System.Drawing.Point(93, 36)- Me.numArraySizeX.Maximum = New Decimal(New Integer() {101, 0, 0, 0})- Me.numArraySizeX.Minimum = New Decimal(New Integer() {1, 0, 0, 0})- Me.numArraySizeX.Name = "numArraySizeX"- Me.numArraySizeX.Size = New System.Drawing.Size(55, 22)- Me.numArraySizeX.TabIndex = 14- Me.numArraySizeX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numArraySizeX.Value = New Decimal(New Integer() {1, 0, 0, 0})- '- 'Label50- '- Me.Label50.AutoSize = True- Me.Label50.Location = New System.Drawing.Point(15, 124)- Me.Label50.Name = "Label50"- Me.Label50.Size = New System.Drawing.Size(77, 16)- Me.Label50.TabIndex = 0- Me.Label50.Text = "Randomize"- '- 'Label51- '- Me.Label51.AutoSize = True- Me.Label51.Location = New System.Drawing.Point(15, 96)- Me.Label51.Name = "Label51"- Me.Label51.Size = New System.Drawing.Size(70, 16)- Me.Label51.TabIndex = 0- Me.Label51.Text = "Properties"- '- 'Label52- '- Me.Label52.AutoSize = True- Me.Label52.Location = New System.Drawing.Point(15, 66)- Me.Label52.Name = "Label52"- Me.Label52.Size = New System.Drawing.Size(61, 16)- Me.Label52.TabIndex = 0- Me.Label52.Text = "Spacing "- '- 'Label53- '- Me.Label53.AutoSize = True- Me.Label53.Location = New System.Drawing.Point(15, 36)- Me.Label53.Name = "Label53"- Me.Label53.Size = New System.Drawing.Size(67, 16)- Me.Label53.TabIndex = 0- Me.Label53.Text = "Array size"- '- 'cmbCompositeProperties- '- Me.cmbCompositeProperties.Enabled = False- Me.cmbCompositeProperties.FormattingEnabled = True- Me.cmbCompositeProperties.Items.AddRange(New Object() {"Inherit from single", "Inherit + randomize"})- Me.cmbCompositeProperties.Location = New System.Drawing.Point(88, 93)- Me.cmbCompositeProperties.Name = "cmbCompositeProperties"- Me.cmbCompositeProperties.Size = New System.Drawing.Size(134, 24)- Me.cmbCompositeProperties.TabIndex = 13- '- 'grpSingleSource- '- Me.grpSingleSource.Controls.Add(Me.numOffStateCycles)- Me.grpSingleSource.Controls.Add(Me.numPhase)- Me.grpSingleSource.Controls.Add(Me.numAmplitude)- Me.grpSingleSource.Controls.Add(Me.numFrequency)- Me.grpSingleSource.Controls.Add(Me.numPulseWidthCycles)- Me.grpSingleSource.Controls.Add(Me.Label44)- Me.grpSingleSource.Controls.Add(Me.Label46)- Me.grpSingleSource.Controls.Add(Me.Label45)- Me.grpSingleSource.Controls.Add(Me.Label43)- Me.grpSingleSource.Controls.Add(Me.Label42)- Me.grpSingleSource.Controls.Add(Me.Label54)- Me.grpSingleSource.Controls.Add(Me.Label41)- Me.grpSingleSource.Controls.Add(Me.Label40)- Me.grpSingleSource.Controls.Add(Me.cmbPulseShape)- Me.grpSingleSource.Location = New System.Drawing.Point(12, 126)- Me.grpSingleSource.Name = "grpSingleSource"- Me.grpSingleSource.Size = New System.Drawing.Size(230, 213)- Me.grpSingleSource.TabIndex = 16- Me.grpSingleSource.TabStop = False- Me.grpSingleSource.Text = "Single source properties"- '- 'numOffStateCycles- '- Me.numOffStateCycles.Location = New System.Drawing.Point(106, 179)- Me.numOffStateCycles.Maximum = New Decimal(New Integer() {100000, 0, 0, 0})- Me.numOffStateCycles.Minimum = New Decimal(New Integer() {1, 0, 0, 0})- Me.numOffStateCycles.Name = "numOffStateCycles"- Me.numOffStateCycles.Size = New System.Drawing.Size(64, 22)- Me.numOffStateCycles.TabIndex = 14- Me.numOffStateCycles.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numOffStateCycles.Value = New Decimal(New Integer() {10, 0, 0, 0})- '- 'numPhase- '- Me.numPhase.Location = New System.Drawing.Point(106, 87)- Me.numPhase.Maximum = New Decimal(New Integer() {180, 0, 0, 0})- Me.numPhase.Minimum = New Decimal(New Integer() {180, 0, 0, -2147483648})- Me.numPhase.Name = "numPhase"- Me.numPhase.Size = New System.Drawing.Size(64, 22)- Me.numPhase.TabIndex = 14- Me.numPhase.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numAmplitude- '- Me.numAmplitude.Location = New System.Drawing.Point(106, 59)- Me.numAmplitude.Name = "numAmplitude"- Me.numAmplitude.Size = New System.Drawing.Size(64, 22)- Me.numAmplitude.TabIndex = 14- Me.numAmplitude.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numAmplitude.Value = New Decimal(New Integer() {100, 0, 0, 0})- '- 'numFrequency- '- Me.numFrequency.Location = New System.Drawing.Point(106, 31)- Me.numFrequency.Maximum = New Decimal(New Integer() {255, 0, 0, 0})- Me.numFrequency.Minimum = New Decimal(New Integer() {1, 0, 0, 0})- Me.numFrequency.Name = "numFrequency"- Me.numFrequency.Size = New System.Drawing.Size(64, 22)- Me.numFrequency.TabIndex = 14- Me.numFrequency.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numFrequency.Value = New Decimal(New Integer() {100, 0, 0, 0})- '- 'numPulseWidthCycles- '- Me.numPulseWidthCycles.Location = New System.Drawing.Point(106, 151)- Me.numPulseWidthCycles.Name = "numPulseWidthCycles"- Me.numPulseWidthCycles.Size = New System.Drawing.Size(64, 22)- Me.numPulseWidthCycles.TabIndex = 14- Me.numPulseWidthCycles.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numPulseWidthCycles.Value = New Decimal(New Integer() {10, 0, 0, 0})- '- 'Label44- '- Me.Label44.AutoSize = True- Me.Label44.Location = New System.Drawing.Point(15, 182)- Me.Label44.Name = "Label44"- Me.Label44.Size = New System.Drawing.Size(56, 16)- Me.Label44.TabIndex = 0- Me.Label44.Text = "Off state"- '- 'Label46- '- Me.Label46.AutoSize = True- Me.Label46.Location = New System.Drawing.Point(176, 181)- Me.Label46.Name = "Label46"- Me.Label46.Size = New System.Drawing.Size(47, 16)- Me.Label46.TabIndex = 0- Me.Label46.Text = "cycles"- '- 'Label45- '- Me.Label45.AutoSize = True- Me.Label45.Location = New System.Drawing.Point(176, 153)- Me.Label45.Name = "Label45"- Me.Label45.Size = New System.Drawing.Size(47, 16)- Me.Label45.TabIndex = 0- Me.Label45.Text = "cycles"- '- 'Label43- '- Me.Label43.AutoSize = True- Me.Label43.Location = New System.Drawing.Point(15, 153)- Me.Label43.Name = "Label43"- Me.Label43.Size = New System.Drawing.Size(75, 16)- Me.Label43.TabIndex = 0- Me.Label43.Text = "Pulse width"- '- 'Label42- '- Me.Label42.AutoSize = True- Me.Label42.Location = New System.Drawing.Point(15, 121)- Me.Label42.Name = "Label42"- Me.Label42.Size = New System.Drawing.Size(83, 16)- Me.Label42.TabIndex = 0- Me.Label42.Text = "Pulse shape"- '- 'Label54- '- Me.Label54.AutoSize = True- Me.Label54.Location = New System.Drawing.Point(14, 89)- Me.Label54.Name = "Label54"- Me.Label54.Size = New System.Drawing.Size(47, 16)- Me.Label54.TabIndex = 0- Me.Label54.Text = "Phase"- '- 'Label41- '- Me.Label41.AutoSize = True- Me.Label41.Location = New System.Drawing.Point(14, 61)- Me.Label41.Name = "Label41"- Me.Label41.Size = New System.Drawing.Size(68, 16)- Me.Label41.TabIndex = 0- Me.Label41.Text = "Amplitude"- '- 'Label40- '- Me.Label40.AutoSize = True- Me.Label40.Location = New System.Drawing.Point(14, 33)- Me.Label40.Name = "Label40"- Me.Label40.Size = New System.Drawing.Size(72, 16)- Me.Label40.TabIndex = 0- Me.Label40.Text = "Frequency"- '- 'cmbPulseShape- '- Me.cmbPulseShape.Enabled = False- Me.cmbPulseShape.FormattingEnabled = True- Me.cmbPulseShape.Items.AddRange(New Object() {"Gaussian", "Smoothed square"})- Me.cmbPulseShape.Location = New System.Drawing.Point(106, 118)- Me.cmbPulseShape.Name = "cmbPulseShape"- Me.cmbPulseShape.Size = New System.Drawing.Size(110, 24)- Me.cmbPulseShape.TabIndex = 13- '- 'radModePulsed- '- Me.radModePulsed.AutoSize = True- Me.radModePulsed.Location = New System.Drawing.Point(156, 97)- Me.radModePulsed.Name = "radModePulsed"- Me.radModePulsed.Size = New System.Drawing.Size(68, 20)- Me.radModePulsed.TabIndex = 15- Me.radModePulsed.TabStop = True- Me.radModePulsed.Text = "Pulsed"- Me.radModePulsed.UseVisualStyleBackColor = True- '- 'radModeContinuous- '- Me.radModeContinuous.AutoSize = True- Me.radModeContinuous.Location = New System.Drawing.Point(65, 97)- Me.radModeContinuous.Name = "radModeContinuous"- Me.radModeContinuous.Size = New System.Drawing.Size(92, 20)- Me.radModeContinuous.TabIndex = 15- Me.radModeContinuous.TabStop = True- Me.radModeContinuous.Text = "Continuous"- Me.radModeContinuous.UseVisualStyleBackColor = True- '- 'txtName- '- Me.txtName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle- Me.txtName.Location = New System.Drawing.Point(92, 30)- Me.txtName.Name = "txtName"- Me.txtName.Size = New System.Drawing.Size(142, 22)- Me.txtName.TabIndex = 14- '- 'cmbMainType- '- Me.cmbMainType.FormattingEnabled = True- Me.cmbMainType.Items.AddRange(New Object() {"Single point", "Composite"})- Me.cmbMainType.Location = New System.Drawing.Point(92, 61)- Me.cmbMainType.Name = "cmbMainType"- Me.cmbMainType.Size = New System.Drawing.Size(142, 24)- Me.cmbMainType.TabIndex = 13- '- 'Label39- '- Me.Label39.AutoSize = True- Me.Label39.Location = New System.Drawing.Point(20, 99)- Me.Label39.Name = "Label39"- Me.Label39.Size = New System.Drawing.Size(43, 16)- Me.Label39.TabIndex = 12- Me.Label39.Text = "Mode"- '- 'lblName- '- Me.lblName.AutoSize = True- Me.lblName.Location = New System.Drawing.Point(20, 33)- Me.lblName.Name = "lblName"- Me.lblName.Size = New System.Drawing.Size(45, 16)- Me.lblName.TabIndex = 12- Me.lblName.Text = "Name"- '- 'Label38- '- Me.Label38.AutoSize = True- Me.Label38.Location = New System.Drawing.Point(20, 64)- Me.Label38.Name = "Label38"- Me.Label38.Size = New System.Drawing.Size(66, 16)- Me.Label38.TabIndex = 12- Me.Label38.Text = "Main type"- '- 'tabProbeList- '- Me.tabProbeList.Controls.Add(Me.GroupBox2)- Me.tabProbeList.Controls.Add(Me.grpProbe2)- Me.tabProbeList.Controls.Add(Me.grpProbe1)- Me.tabProbeList.Controls.Add(Me.pnlProbeImage)- Me.tabProbeList.Location = New System.Drawing.Point(4, 34)- Me.tabProbeList.Name = "tabProbeList"- Me.tabProbeList.Size = New System.Drawing.Size(1742, 693)- Me.tabProbeList.TabIndex = 2- Me.tabProbeList.Text = " Probes "- Me.tabProbeList.UseVisualStyleBackColor = True- '- 'GroupBox2- '- Me.GroupBox2.Controls.Add(Me.Label49)- Me.GroupBox2.Controls.Add(Me.Label48)- Me.GroupBox2.Controls.Add(Me.Label37)- Me.GroupBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.GroupBox2.Location = New System.Drawing.Point(1201, 584)- Me.GroupBox2.Name = "GroupBox2"- Me.GroupBox2.Size = New System.Drawing.Size(504, 83)- Me.GroupBox2.TabIndex = 2- Me.GroupBox2.TabStop = False- Me.GroupBox2.Text = "How to use probes"- '- 'Label49- '- Me.Label49.AutoSize = True- Me.Label49.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label49.Location = New System.Drawing.Point(15, 60)- Me.Label49.Name = "Label49"- Me.Label49.Size = New System.Drawing.Size(430, 16)- Me.Label49.TabIndex = 0- Me.Label49.Text = "- Probe type ""Line"": Use 2 clicks to set line, then third click to place plot ."- '- 'Label48- '- Me.Label48.AutoSize = True- Me.Label48.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label48.Location = New System.Drawing.Point(14, 42)- Me.Label48.Name = "Label48"- Me.Label48.Size = New System.Drawing.Size(461, 16)- Me.Label48.TabIndex = 0- Me.Label48.Text = "- Probe type ""Point"": First click sets probe location, second sets data window"- '- 'Label37- '- Me.Label37.AutoSize = True- Me.Label37.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label37.Location = New System.Drawing.Point(15, 22)- Me.Label37.Name = "Label37"- Me.Label37.Size = New System.Drawing.Size(442, 16)- Me.Label37.TabIndex = 0- Me.Label37.Text = "Set all properties first and then use the ""Pick"" button to choose a location. "- '- 'grpProbe2- '- Me.grpProbe2.BackColor = System.Drawing.Color.Gainsboro- Me.grpProbe2.Controls.Add(Me.Label22)- Me.grpProbe2.Controls.Add(Me.numRunningWindow2)- Me.grpProbe2.Controls.Add(Me.chkProbeOn2)- Me.grpProbe2.Controls.Add(Me.txtStartAfterStep2)- Me.grpProbe2.Controls.Add(Me.chkStartAfterStep2)- Me.grpProbe2.Controls.Add(Me.Label23)- Me.grpProbe2.Controls.Add(Me.Label24)- Me.grpProbe2.Controls.Add(Me.txtMaxScaleY2)- Me.grpProbe2.Controls.Add(Me.txtMinScaleY2)- Me.grpProbe2.Controls.Add(Me.radFullScale2)- Me.grpProbe2.Controls.Add(Me.radRunningScale2)- Me.grpProbe2.Controls.Add(Me.chkAutoScaleY2)- Me.grpProbe2.Controls.Add(Me.chkAutoScaleX2)- Me.grpProbe2.Controls.Add(Me.numBPosY2)- Me.grpProbe2.Controls.Add(Me.numAPosY2)- Me.grpProbe2.Controls.Add(Me.numBPosX2)- Me.grpProbe2.Controls.Add(Me.numAPosX2)- Me.grpProbe2.Controls.Add(Me.butPicPositions2)- Me.grpProbe2.Controls.Add(Me.Label25)- Me.grpProbe2.Controls.Add(Me.cmbPlaceOn2)- Me.grpProbe2.Controls.Add(Me.cmbMeasurement2)- Me.grpProbe2.Controls.Add(Me.Label26)- Me.grpProbe2.Controls.Add(Me.Label27)- Me.grpProbe2.Controls.Add(Me.cmbBoxSize2)- Me.grpProbe2.Controls.Add(Me.cmbProbeType2)- Me.grpProbe2.Controls.Add(Me.Label28)- Me.grpProbe2.Controls.Add(Me.Label29)- Me.grpProbe2.Controls.Add(Me.Label30)- Me.grpProbe2.Controls.Add(Me.Label31)- Me.grpProbe2.Controls.Add(Me.Label32)- Me.grpProbe2.Controls.Add(Me.Label33)- Me.grpProbe2.Controls.Add(Me.Label34)- Me.grpProbe2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.grpProbe2.Location = New System.Drawing.Point(1202, 303)- Me.grpProbe2.Name = "grpProbe2"- Me.grpProbe2.Size = New System.Drawing.Size(506, 276)- Me.grpProbe2.TabIndex = 1- Me.grpProbe2.TabStop = False- Me.grpProbe2.Text = "Probe 2 "- '- 'Label22- '- Me.Label22.AutoSize = True- Me.Label22.Location = New System.Drawing.Point(259, 59)- Me.Label22.Name = "Label22"- Me.Label22.Size = New System.Drawing.Size(104, 16)- Me.Label22.TabIndex = 14- Me.Label22.Text = "Running window"- '- 'numRunningWindow2- '- Me.numRunningWindow2.Location = New System.Drawing.Point(371, 58)- Me.numRunningWindow2.Maximum = New Decimal(New Integer() {1000000, 0, 0, 0})- Me.numRunningWindow2.Minimum = New Decimal(New Integer() {10, 0, 0, 0})- Me.numRunningWindow2.Name = "numRunningWindow2"- Me.numRunningWindow2.Size = New System.Drawing.Size(83, 22)- Me.numRunningWindow2.TabIndex = 13- Me.numRunningWindow2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numRunningWindow2.Value = New Decimal(New Integer() {500, 0, 0, 0})- '- 'chkProbeOn2- '- Me.chkProbeOn2.AutoSize = True- Me.chkProbeOn2.Location = New System.Drawing.Point(66, -1)- Me.chkProbeOn2.Name = "chkProbeOn2"- Me.chkProbeOn2.Size = New System.Drawing.Size(44, 20)- Me.chkProbeOn2.TabIndex = 12- Me.chkProbeOn2.Text = "On"- Me.chkProbeOn2.UseVisualStyleBackColor = True- '- 'txtStartAfterStep2- '- Me.txtStartAfterStep2.Location = New System.Drawing.Point(179, 163)- Me.txtStartAfterStep2.Name = "txtStartAfterStep2"- Me.txtStartAfterStep2.Size = New System.Drawing.Size(57, 22)- Me.txtStartAfterStep2.TabIndex = 11- Me.txtStartAfterStep2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right- '- 'chkStartAfterStep2- '- Me.chkStartAfterStep2.AutoSize = True- Me.chkStartAfterStep2.Location = New System.Drawing.Point(17, 165)- Me.chkStartAfterStep2.Name = "chkStartAfterStep2"- Me.chkStartAfterStep2.Size = New System.Drawing.Size(167, 20)- Me.chkStartAfterStep2.TabIndex = 10- Me.chkStartAfterStep2.Text = "Start recording at step #"- Me.chkStartAfterStep2.UseVisualStyleBackColor = True- '- 'Label23- '- Me.Label23.AutoSize = True- Me.Label23.Location = New System.Drawing.Point(438, 111)- Me.Label23.Name = "Label23"- Me.Label23.Size = New System.Drawing.Size(33, 16)- Me.Label23.TabIndex = 2- Me.Label23.Text = "Max"- '- 'Label24- '- Me.Label24.AutoSize = True- Me.Label24.Location = New System.Drawing.Point(378, 111)- Me.Label24.Name = "Label24"- Me.Label24.Size = New System.Drawing.Size(29, 16)- Me.Label24.TabIndex = 2- Me.Label24.Text = "Min"- '- 'txtMaxScaleY2- '- Me.txtMaxScaleY2.Location = New System.Drawing.Point(431, 127)- Me.txtMaxScaleY2.Name = "txtMaxScaleY2"- Me.txtMaxScaleY2.Size = New System.Drawing.Size(52, 22)- Me.txtMaxScaleY2.TabIndex = 8- Me.txtMaxScaleY2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right- '- 'txtMinScaleY2- '- Me.txtMinScaleY2.Location = New System.Drawing.Point(371, 127)- Me.txtMinScaleY2.Name = "txtMinScaleY2"- Me.txtMinScaleY2.Size = New System.Drawing.Size(52, 22)- Me.txtMinScaleY2.TabIndex = 8- Me.txtMinScaleY2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right- '- 'radFullScale2- '- Me.radFullScale2.AutoSize = True- Me.radFullScale2.Location = New System.Drawing.Point(379, 24)- Me.radFullScale2.Name = "radFullScale2"- Me.radFullScale2.Size = New System.Drawing.Size(83, 20)- Me.radFullScale2.TabIndex = 7- Me.radFullScale2.TabStop = True- Me.radFullScale2.Text = "Full scale"- Me.radFullScale2.UseVisualStyleBackColor = True- '- 'radRunningScale2- '- Me.radRunningScale2.AutoSize = True- Me.radRunningScale2.Location = New System.Drawing.Point(262, 24)- Me.radRunningScale2.Name = "radRunningScale2"- Me.radRunningScale2.Size = New System.Drawing.Size(111, 20)- Me.radRunningScale2.TabIndex = 7- Me.radRunningScale2.TabStop = True- Me.radRunningScale2.Text = "Running scale"- Me.radRunningScale2.UseVisualStyleBackColor = True- '- 'chkAutoScaleY2- '- Me.chkAutoScaleY2.AutoSize = True- Me.chkAutoScaleY2.Location = New System.Drawing.Point(262, 127)- Me.chkAutoScaleY2.Name = "chkAutoScaleY2"- Me.chkAutoScaleY2.Size = New System.Drawing.Size(110, 20)- Me.chkAutoScaleY2.TabIndex = 6- Me.chkAutoScaleY2.Text = "Auto Scale Y"- Me.chkAutoScaleY2.UseVisualStyleBackColor = True- '- 'chkAutoScaleX2- '- Me.chkAutoScaleX2.AutoSize = True- Me.chkAutoScaleX2.Location = New System.Drawing.Point(262, 91)- Me.chkAutoScaleX2.Name = "chkAutoScaleX2"- Me.chkAutoScaleX2.Size = New System.Drawing.Size(101, 20)- Me.chkAutoScaleX2.TabIndex = 6- Me.chkAutoScaleX2.Text = "Auto scale X"- Me.chkAutoScaleX2.UseVisualStyleBackColor = True- '- 'numBPosY2- '- Me.numBPosY2.Location = New System.Drawing.Point(326, 234)- Me.numBPosY2.Name = "numBPosY2"- Me.numBPosY2.Size = New System.Drawing.Size(65, 22)- Me.numBPosY2.TabIndex = 5- Me.numBPosY2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numAPosY2- '- Me.numAPosY2.Location = New System.Drawing.Point(126, 234)- Me.numAPosY2.Name = "numAPosY2"- Me.numAPosY2.Size = New System.Drawing.Size(65, 22)- Me.numAPosY2.TabIndex = 5- Me.numAPosY2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numBPosX2- '- Me.numBPosX2.Location = New System.Drawing.Point(238, 234)- Me.numBPosX2.Name = "numBPosX2"- Me.numBPosX2.Size = New System.Drawing.Size(65, 22)- Me.numBPosX2.TabIndex = 5- Me.numBPosX2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numAPosX2- '- Me.numAPosX2.Location = New System.Drawing.Point(38, 234)- Me.numAPosX2.Name = "numAPosX2"- Me.numAPosX2.Size = New System.Drawing.Size(65, 22)- Me.numAPosX2.TabIndex = 5- Me.numAPosX2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'butPicPositions2- '- Me.butPicPositions2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.butPicPositions2.Location = New System.Drawing.Point(402, 226)- Me.butPicPositions2.Name = "butPicPositions2"- Me.butPicPositions2.Size = New System.Drawing.Size(90, 34)- Me.butPicPositions2.TabIndex = 4- Me.butPicPositions2.Text = "Pick "- Me.butPicPositions2.UseVisualStyleBackColor = True- '- 'Label25- '- Me.Label25.AutoSize = True- Me.Label25.Location = New System.Drawing.Point(311, 236)- Me.Label25.Name = "Label25"- Me.Label25.Size = New System.Drawing.Size(17, 16)- Me.Label25.TabIndex = 2- Me.Label25.Text = "Y"- '- 'cmbPlaceOn2- '- Me.cmbPlaceOn2.FormattingEnabled = True- Me.cmbPlaceOn2.Items.AddRange(New Object() {"Field", "Intensity"})- Me.cmbPlaceOn2.Location = New System.Drawing.Point(106, 24)- Me.cmbPlaceOn2.Name = "cmbPlaceOn2"- Me.cmbPlaceOn2.Size = New System.Drawing.Size(130, 24)- Me.cmbPlaceOn2.TabIndex = 3- '- 'cmbMeasurement2- '- Me.cmbMeasurement2.FormattingEnabled = True- Me.cmbMeasurement2.Items.AddRange(New Object() {"Amplitude", "Intensity", "Integrate Intensity"})- Me.cmbMeasurement2.Location = New System.Drawing.Point(106, 56)- Me.cmbMeasurement2.Name = "cmbMeasurement2"- Me.cmbMeasurement2.Size = New System.Drawing.Size(130, 24)- Me.cmbMeasurement2.TabIndex = 3- '- 'Label26- '- Me.Label26.AutoSize = True- Me.Label26.Location = New System.Drawing.Point(111, 236)- Me.Label26.Name = "Label26"- Me.Label26.Size = New System.Drawing.Size(17, 16)- Me.Label26.TabIndex = 2- Me.Label26.Text = "Y"- '- 'Label27- '- Me.Label27.AutoSize = True- Me.Label27.Location = New System.Drawing.Point(223, 236)- Me.Label27.Name = "Label27"- Me.Label27.Size = New System.Drawing.Size(16, 16)- Me.Label27.TabIndex = 2- Me.Label27.Text = "X"- '- 'cmbBoxSize2- '- Me.cmbBoxSize2.FormattingEnabled = True- Me.cmbBoxSize2.Items.AddRange(New Object() {"Tiny (200 x100)", "Small (300 x 150)", "Medium (400x200)", "Large (500x250)", "Extra Large (700x350)"})- Me.cmbBoxSize2.Location = New System.Drawing.Point(106, 124)- Me.cmbBoxSize2.Name = "cmbBoxSize2"- Me.cmbBoxSize2.Size = New System.Drawing.Size(130, 24)- Me.cmbBoxSize2.TabIndex = 3- '- 'cmbProbeType2- '- Me.cmbProbeType2.FormattingEnabled = True- Me.cmbProbeType2.Items.AddRange(New Object() {"Point (A)", "Line (A-B)"})- Me.cmbProbeType2.Location = New System.Drawing.Point(106, 89)- Me.cmbProbeType2.Name = "cmbProbeType2"- Me.cmbProbeType2.Size = New System.Drawing.Size(130, 24)- Me.cmbProbeType2.TabIndex = 3- '- 'Label28- '- Me.Label28.AutoSize = True- Me.Label28.Location = New System.Drawing.Point(277, 209)- Me.Label28.Name = "Label28"- Me.Label28.Size = New System.Drawing.Size(68, 16)- Me.Label28.TabIndex = 2- Me.Label28.Text = "Position B"- '- 'Label29- '- Me.Label29.AutoSize = True- Me.Label29.Location = New System.Drawing.Point(23, 236)- Me.Label29.Name = "Label29"- Me.Label29.Size = New System.Drawing.Size(16, 16)- Me.Label29.TabIndex = 2- Me.Label29.Text = "X"- '- 'Label30- '- Me.Label30.AutoSize = True- Me.Label30.Location = New System.Drawing.Point(76, 209)- Me.Label30.Name = "Label30"- Me.Label30.Size = New System.Drawing.Size(68, 16)- Me.Label30.TabIndex = 2- Me.Label30.Text = "Position A"- '- 'Label31- '- Me.Label31.AutoSize = True- Me.Label31.Location = New System.Drawing.Point(14, 127)- Me.Label31.Name = "Label31"- Me.Label31.Size = New System.Drawing.Size(60, 16)- Me.Label31.TabIndex = 2- Me.Label31.Text = "Box Size"- '- 'Label32- '- Me.Label32.AutoSize = True- Me.Label32.Location = New System.Drawing.Point(14, 92)- Me.Label32.Name = "Label32"- Me.Label32.Size = New System.Drawing.Size(74, 16)- Me.Label32.TabIndex = 2- Me.Label32.Text = "Probe type"- '- 'Label33- '- Me.Label33.AutoSize = True- Me.Label33.Location = New System.Drawing.Point(12, 59)- Me.Label33.Name = "Label33"- Me.Label33.Size = New System.Drawing.Size(90, 16)- Me.Label33.TabIndex = 2- Me.Label33.Text = "Measurement"- '- 'Label34- '- Me.Label34.AutoSize = True- Me.Label34.Location = New System.Drawing.Point(14, 29)- Me.Label34.Name = "Label34"- Me.Label34.Size = New System.Drawing.Size(64, 16)- Me.Label34.TabIndex = 1- Me.Label34.Text = "Place on:"- '- 'grpProbe1- '- Me.grpProbe1.BackColor = System.Drawing.Color.Gainsboro- Me.grpProbe1.Controls.Add(Me.Label21)- Me.grpProbe1.Controls.Add(Me.numRunningWindow)- Me.grpProbe1.Controls.Add(Me.chkProbeOn1)- Me.grpProbe1.Controls.Add(Me.txtStartAfterStep)- Me.grpProbe1.Controls.Add(Me.chkStartAfterStep)- Me.grpProbe1.Controls.Add(Me.Label19)- Me.grpProbe1.Controls.Add(Me.Label18)- Me.grpProbe1.Controls.Add(Me.txtMaxScaleY)- Me.grpProbe1.Controls.Add(Me.txtMinScaleY)- Me.grpProbe1.Controls.Add(Me.radFullScale)- Me.grpProbe1.Controls.Add(Me.radRunningScale)- Me.grpProbe1.Controls.Add(Me.chkAutoScaleY)- Me.grpProbe1.Controls.Add(Me.chkAutoScaleX)- Me.grpProbe1.Controls.Add(Me.numBPosY)- Me.grpProbe1.Controls.Add(Me.numAPosY)- Me.grpProbe1.Controls.Add(Me.numBPosX)- Me.grpProbe1.Controls.Add(Me.numAPosX)- Me.grpProbe1.Controls.Add(Me.butPicPositions)- Me.grpProbe1.Controls.Add(Me.Label16)- Me.grpProbe1.Controls.Add(Me.cmbPlaceOn)- Me.grpProbe1.Controls.Add(Me.cmbMeasurement)- Me.grpProbe1.Controls.Add(Me.Label13)- Me.grpProbe1.Controls.Add(Me.Label15)- Me.grpProbe1.Controls.Add(Me.cmbBoxSize)- Me.grpProbe1.Controls.Add(Me.cmbProbeType)- Me.grpProbe1.Controls.Add(Me.Label14)- Me.grpProbe1.Controls.Add(Me.Label12)- Me.grpProbe1.Controls.Add(Me.Label11)- Me.grpProbe1.Controls.Add(Me.Label17)- Me.grpProbe1.Controls.Add(Me.Label10)- Me.grpProbe1.Controls.Add(Me.Label9)- Me.grpProbe1.Controls.Add(Me.Label8)- Me.grpProbe1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.grpProbe1.Location = New System.Drawing.Point(1202, 14)- Me.grpProbe1.Name = "grpProbe1"- Me.grpProbe1.Size = New System.Drawing.Size(506, 276)- Me.grpProbe1.TabIndex = 1- Me.grpProbe1.TabStop = False- Me.grpProbe1.Text = "Probe 1 "- '- 'Label21- '- Me.Label21.AutoSize = True- Me.Label21.Location = New System.Drawing.Point(259, 59)- Me.Label21.Name = "Label21"- Me.Label21.Size = New System.Drawing.Size(104, 16)- Me.Label21.TabIndex = 14- Me.Label21.Text = "Running window"- '- 'numRunningWindow- '- Me.numRunningWindow.Location = New System.Drawing.Point(371, 58)- Me.numRunningWindow.Maximum = New Decimal(New Integer() {1000000, 0, 0, 0})- Me.numRunningWindow.Minimum = New Decimal(New Integer() {10, 0, 0, 0})- Me.numRunningWindow.Name = "numRunningWindow"- Me.numRunningWindow.Size = New System.Drawing.Size(83, 22)- Me.numRunningWindow.TabIndex = 13- Me.numRunningWindow.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numRunningWindow.Value = New Decimal(New Integer() {500, 0, 0, 0})- '- 'chkProbeOn1- '- Me.chkProbeOn1.AutoSize = True- Me.chkProbeOn1.Location = New System.Drawing.Point(66, -1)- Me.chkProbeOn1.Name = "chkProbeOn1"- Me.chkProbeOn1.Size = New System.Drawing.Size(44, 20)- Me.chkProbeOn1.TabIndex = 12- Me.chkProbeOn1.Text = "On"- Me.chkProbeOn1.UseVisualStyleBackColor = True- '- 'txtStartAfterStep- '- Me.txtStartAfterStep.Location = New System.Drawing.Point(179, 163)- Me.txtStartAfterStep.Name = "txtStartAfterStep"- Me.txtStartAfterStep.Size = New System.Drawing.Size(57, 22)- Me.txtStartAfterStep.TabIndex = 11- Me.txtStartAfterStep.TextAlign = System.Windows.Forms.HorizontalAlignment.Right- '- 'chkStartAfterStep- '- Me.chkStartAfterStep.AutoSize = True- Me.chkStartAfterStep.Location = New System.Drawing.Point(17, 165)- Me.chkStartAfterStep.Name = "chkStartAfterStep"- Me.chkStartAfterStep.Size = New System.Drawing.Size(167, 20)- Me.chkStartAfterStep.TabIndex = 10- Me.chkStartAfterStep.Text = "Start recording at step #"- Me.chkStartAfterStep.UseVisualStyleBackColor = True- '- 'Label19- '- Me.Label19.AutoSize = True- Me.Label19.Location = New System.Drawing.Point(438, 111)- Me.Label19.Name = "Label19"- Me.Label19.Size = New System.Drawing.Size(33, 16)- Me.Label19.TabIndex = 2- Me.Label19.Text = "Max"- '- 'Label18- '- Me.Label18.AutoSize = True- Me.Label18.Location = New System.Drawing.Point(378, 111)- Me.Label18.Name = "Label18"- Me.Label18.Size = New System.Drawing.Size(29, 16)- Me.Label18.TabIndex = 2- Me.Label18.Text = "Min"- '- 'txtMaxScaleY- '- Me.txtMaxScaleY.Location = New System.Drawing.Point(431, 127)- Me.txtMaxScaleY.Name = "txtMaxScaleY"- Me.txtMaxScaleY.Size = New System.Drawing.Size(52, 22)- Me.txtMaxScaleY.TabIndex = 8- Me.txtMaxScaleY.TextAlign = System.Windows.Forms.HorizontalAlignment.Right- '- 'txtMinScaleY- '- Me.txtMinScaleY.Location = New System.Drawing.Point(371, 127)- Me.txtMinScaleY.Name = "txtMinScaleY"- Me.txtMinScaleY.Size = New System.Drawing.Size(52, 22)- Me.txtMinScaleY.TabIndex = 8- Me.txtMinScaleY.TextAlign = System.Windows.Forms.HorizontalAlignment.Right- '- 'radFullScale- '- Me.radFullScale.AutoSize = True- Me.radFullScale.Location = New System.Drawing.Point(379, 24)- Me.radFullScale.Name = "radFullScale"- Me.radFullScale.Size = New System.Drawing.Size(83, 20)- Me.radFullScale.TabIndex = 7- Me.radFullScale.TabStop = True- Me.radFullScale.Text = "Full scale"- Me.radFullScale.UseVisualStyleBackColor = True- '- 'radRunningScale- '- Me.radRunningScale.AutoSize = True- Me.radRunningScale.Location = New System.Drawing.Point(262, 24)- Me.radRunningScale.Name = "radRunningScale"- Me.radRunningScale.Size = New System.Drawing.Size(111, 20)- Me.radRunningScale.TabIndex = 7- Me.radRunningScale.TabStop = True- Me.radRunningScale.Text = "Running scale"- Me.radRunningScale.UseVisualStyleBackColor = True- '- 'chkAutoScaleY- '- Me.chkAutoScaleY.AutoSize = True- Me.chkAutoScaleY.Location = New System.Drawing.Point(262, 127)- Me.chkAutoScaleY.Name = "chkAutoScaleY"- Me.chkAutoScaleY.Size = New System.Drawing.Size(110, 20)- Me.chkAutoScaleY.TabIndex = 6- Me.chkAutoScaleY.Text = "Auto Scale Y"- Me.chkAutoScaleY.UseVisualStyleBackColor = True- '- 'chkAutoScaleX- '- Me.chkAutoScaleX.AutoSize = True- Me.chkAutoScaleX.Location = New System.Drawing.Point(262, 91)- Me.chkAutoScaleX.Name = "chkAutoScaleX"- Me.chkAutoScaleX.Size = New System.Drawing.Size(101, 20)- Me.chkAutoScaleX.TabIndex = 6- Me.chkAutoScaleX.Text = "Auto scale X"- Me.chkAutoScaleX.UseVisualStyleBackColor = True- '- 'numBPosY- '- Me.numBPosY.Location = New System.Drawing.Point(326, 234)- Me.numBPosY.Name = "numBPosY"- Me.numBPosY.Size = New System.Drawing.Size(65, 22)- Me.numBPosY.TabIndex = 5- Me.numBPosY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numAPosY- '- Me.numAPosY.Location = New System.Drawing.Point(126, 234)- Me.numAPosY.Name = "numAPosY"- Me.numAPosY.Size = New System.Drawing.Size(65, 22)- Me.numAPosY.TabIndex = 5- Me.numAPosY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numBPosX- '- Me.numBPosX.Location = New System.Drawing.Point(238, 234)- Me.numBPosX.Name = "numBPosX"- Me.numBPosX.Size = New System.Drawing.Size(65, 22)- Me.numBPosX.TabIndex = 5- Me.numBPosX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'numAPosX- '- Me.numAPosX.Location = New System.Drawing.Point(38, 234)- Me.numAPosX.Name = "numAPosX"- Me.numAPosX.Size = New System.Drawing.Size(65, 22)- Me.numAPosX.TabIndex = 5- Me.numAPosX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'butPicPositions- '- Me.butPicPositions.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.butPicPositions.Location = New System.Drawing.Point(402, 226)- Me.butPicPositions.Name = "butPicPositions"- Me.butPicPositions.Size = New System.Drawing.Size(90, 34)- Me.butPicPositions.TabIndex = 4- Me.butPicPositions.Text = "Pick "- Me.butPicPositions.UseVisualStyleBackColor = True- '- 'Label16- '- Me.Label16.AutoSize = True- Me.Label16.Location = New System.Drawing.Point(311, 236)- Me.Label16.Name = "Label16"- Me.Label16.Size = New System.Drawing.Size(17, 16)- Me.Label16.TabIndex = 2- Me.Label16.Text = "Y"- '- 'cmbPlaceOn- '- Me.cmbPlaceOn.FormattingEnabled = True- Me.cmbPlaceOn.Items.AddRange(New Object() {"Field", "Intensity"})- Me.cmbPlaceOn.Location = New System.Drawing.Point(106, 24)- Me.cmbPlaceOn.Name = "cmbPlaceOn"- Me.cmbPlaceOn.Size = New System.Drawing.Size(130, 24)- Me.cmbPlaceOn.TabIndex = 3- '- 'cmbMeasurement- '- Me.cmbMeasurement.FormattingEnabled = True- Me.cmbMeasurement.Items.AddRange(New Object() {"Amplitude", "Intensity", "Integrate Intensity"})- Me.cmbMeasurement.Location = New System.Drawing.Point(106, 56)- Me.cmbMeasurement.Name = "cmbMeasurement"- Me.cmbMeasurement.Size = New System.Drawing.Size(130, 24)- Me.cmbMeasurement.TabIndex = 3- '- 'Label13- '- Me.Label13.AutoSize = True- Me.Label13.Location = New System.Drawing.Point(111, 236)- Me.Label13.Name = "Label13"- Me.Label13.Size = New System.Drawing.Size(17, 16)- Me.Label13.TabIndex = 2- Me.Label13.Text = "Y"- '- 'Label15- '- Me.Label15.AutoSize = True- Me.Label15.Location = New System.Drawing.Point(223, 236)- Me.Label15.Name = "Label15"- Me.Label15.Size = New System.Drawing.Size(16, 16)- Me.Label15.TabIndex = 2- Me.Label15.Text = "X"- '- 'cmbBoxSize- '- Me.cmbBoxSize.FormattingEnabled = True- Me.cmbBoxSize.Items.AddRange(New Object() {"Tiny (200 x100)", "Small (300 x 150)", "Medium (400x200)", "Large (500x250)", "Extra Large (700x350)"})- Me.cmbBoxSize.Location = New System.Drawing.Point(106, 124)- Me.cmbBoxSize.Name = "cmbBoxSize"- Me.cmbBoxSize.Size = New System.Drawing.Size(130, 24)- Me.cmbBoxSize.TabIndex = 3- '- 'cmbProbeType- '- Me.cmbProbeType.FormattingEnabled = True- Me.cmbProbeType.Items.AddRange(New Object() {"Point (A)", "Line (A-B)"})- Me.cmbProbeType.Location = New System.Drawing.Point(106, 89)- Me.cmbProbeType.Name = "cmbProbeType"- Me.cmbProbeType.Size = New System.Drawing.Size(130, 24)- Me.cmbProbeType.TabIndex = 3- '- 'Label14- '- Me.Label14.AutoSize = True- Me.Label14.Location = New System.Drawing.Point(277, 209)- Me.Label14.Name = "Label14"- Me.Label14.Size = New System.Drawing.Size(68, 16)- Me.Label14.TabIndex = 2- Me.Label14.Text = "Position B"- '- 'Label12- '- Me.Label12.AutoSize = True- Me.Label12.Location = New System.Drawing.Point(23, 236)- Me.Label12.Name = "Label12"- Me.Label12.Size = New System.Drawing.Size(16, 16)- Me.Label12.TabIndex = 2- Me.Label12.Text = "X"- '- 'Label11- '- Me.Label11.AutoSize = True- Me.Label11.Location = New System.Drawing.Point(76, 209)- Me.Label11.Name = "Label11"- Me.Label11.Size = New System.Drawing.Size(68, 16)- Me.Label11.TabIndex = 2- Me.Label11.Text = "Position A"- '- 'Label17- '- Me.Label17.AutoSize = True- Me.Label17.Location = New System.Drawing.Point(14, 127)- Me.Label17.Name = "Label17"- Me.Label17.Size = New System.Drawing.Size(60, 16)- Me.Label17.TabIndex = 2- Me.Label17.Text = "Box Size"- '- 'Label10- '- Me.Label10.AutoSize = True- Me.Label10.Location = New System.Drawing.Point(14, 92)- Me.Label10.Name = "Label10"- Me.Label10.Size = New System.Drawing.Size(74, 16)- Me.Label10.TabIndex = 2- Me.Label10.Text = "Probe type"- '- 'Label9- '- Me.Label9.AutoSize = True- Me.Label9.Location = New System.Drawing.Point(12, 59)- Me.Label9.Name = "Label9"- Me.Label9.Size = New System.Drawing.Size(90, 16)- Me.Label9.TabIndex = 2- Me.Label9.Text = "Measurement"- '- 'Label8- '- Me.Label8.AutoSize = True- Me.Label8.Location = New System.Drawing.Point(14, 29)- Me.Label8.Name = "Label8"- Me.Label8.Size = New System.Drawing.Size(64, 16)- Me.Label8.TabIndex = 1- Me.Label8.Text = "Place on:"- '- 'pnlProbeImage- '- Me.pnlProbeImage.Location = New System.Drawing.Point(16, 14)- Me.pnlProbeImage.Name = "pnlProbeImage"- Me.pnlProbeImage.Size = New System.Drawing.Size(1160, 653)- Me.pnlProbeImage.TabIndex = 0- '- 'tabViewer- '- Me.tabViewer.Controls.Add(Me.pnlPreviewIntensityProps)- Me.tabViewer.Controls.Add(Me.Panel3)- Me.tabViewer.Controls.Add(Me.Label56)- Me.tabViewer.Controls.Add(Me.Label55)- Me.tabViewer.Controls.Add(Me.lblWarningIntensity)- Me.tabViewer.Controls.Add(Me.lblWarningField)- Me.tabViewer.Controls.Add(Me.btnExportIntensityFrame)- Me.tabViewer.Controls.Add(Me.btnExportFieldFrame)- Me.tabViewer.Controls.Add(Me.btnOpenImageFolder)- Me.tabViewer.Controls.Add(Me.btnOpenVideoFolder)- Me.tabViewer.Controls.Add(Me.btnViewIntensityVideo)- Me.tabViewer.Controls.Add(Me.btnViewFieldVideo)- Me.tabViewer.Controls.Add(Me.pnlPreviewIntensity)- Me.tabViewer.Controls.Add(Me.pnlPreviewField)- Me.tabViewer.Location = New System.Drawing.Point(4, 34)- Me.tabViewer.Name = "tabViewer"- Me.tabViewer.Size = New System.Drawing.Size(1742, 693)- Me.tabViewer.TabIndex = 4- Me.tabViewer.Text = " Preview "- Me.tabViewer.UseVisualStyleBackColor = True- '- 'pnlPreviewIntensityProps- '- Me.pnlPreviewIntensityProps.BackColor = System.Drawing.SystemColors.ButtonFace- Me.pnlPreviewIntensityProps.Controls.Add(Me.chkExportVideoIntensity2)- Me.pnlPreviewIntensityProps.Controls.Add(Me.Label64)- Me.pnlPreviewIntensityProps.Controls.Add(Me.numBrightnessIntensityOverlay)- Me.pnlPreviewIntensityProps.Controls.Add(Me.numIntensityScaling2)- Me.pnlPreviewIntensityProps.Controls.Add(Me.chkDiplayOverlayInIntensity)- Me.pnlPreviewIntensityProps.Controls.Add(Me.Label66)- Me.pnlPreviewIntensityProps.Location = New System.Drawing.Point(1023, 12)- Me.pnlPreviewIntensityProps.Name = "pnlPreviewIntensityProps"- Me.pnlPreviewIntensityProps.Size = New System.Drawing.Size(700, 40)- Me.pnlPreviewIntensityProps.TabIndex = 14- '- 'chkExportVideoIntensity2- '- Me.chkExportVideoIntensity2.AutoSize = True- Me.chkExportVideoIntensity2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkExportVideoIntensity2.Location = New System.Drawing.Point(577, 8)- Me.chkExportVideoIntensity2.Name = "chkExportVideoIntensity2"- Me.chkExportVideoIntensity2.Size = New System.Drawing.Size(115, 24)- Me.chkExportVideoIntensity2.TabIndex = 12- Me.chkExportVideoIntensity2.Text = "Export video"- Me.chkExportVideoIntensity2.UseVisualStyleBackColor = True- '- 'Label64- '- Me.Label64.AutoSize = True- Me.Label64.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label64.Location = New System.Drawing.Point(13, 9)- Me.Label64.Name = "Label64"- Me.Label64.Size = New System.Drawing.Size(129, 20)- Me.Label64.TabIndex = 9- Me.Label64.Text = "Field scale factor"- '- 'numBrightnessIntensityOverlay- '- Me.numBrightnessIntensityOverlay.DecimalPlaces = 2- Me.numBrightnessIntensityOverlay.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numBrightnessIntensityOverlay.Increment = New Decimal(New Integer() {5, 0, 0, 131072})- Me.numBrightnessIntensityOverlay.Location = New System.Drawing.Point(473, 7)- Me.numBrightnessIntensityOverlay.Maximum = New Decimal(New Integer() {5, 0, 0, 0})- Me.numBrightnessIntensityOverlay.Name = "numBrightnessIntensityOverlay"- Me.numBrightnessIntensityOverlay.Size = New System.Drawing.Size(67, 26)- Me.numBrightnessIntensityOverlay.TabIndex = 11- Me.numBrightnessIntensityOverlay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numBrightnessIntensityOverlay.Value = New Decimal(New Integer() {1, 0, 0, 0})- '- 'numIntensityScaling2- '- Me.numIntensityScaling2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numIntensityScaling2.Location = New System.Drawing.Point(151, 7)- Me.numIntensityScaling2.Maximum = New Decimal(New Integer() {1000, 0, 0, 0})- Me.numIntensityScaling2.Name = "numIntensityScaling2"- Me.numIntensityScaling2.Size = New System.Drawing.Size(74, 26)- Me.numIntensityScaling2.TabIndex = 8- Me.numIntensityScaling2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'chkDiplayOverlayInIntensity- '- Me.chkDiplayOverlayInIntensity.AutoSize = True- Me.chkDiplayOverlayInIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkDiplayOverlayInIntensity.Location = New System.Drawing.Point(253, 9)- Me.chkDiplayOverlayInIntensity.Name = "chkDiplayOverlayInIntensity"- Me.chkDiplayOverlayInIntensity.Size = New System.Drawing.Size(132, 24)- Me.chkDiplayOverlayInIntensity.TabIndex = 10- Me.chkDiplayOverlayInIntensity.Text = "Display overlay"- Me.chkDiplayOverlayInIntensity.UseVisualStyleBackColor = True- '- 'Label66- '- Me.Label66.AutoSize = True- Me.Label66.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label66.Location = New System.Drawing.Point(382, 10)- Me.Label66.Name = "Label66"- Me.Label66.Size = New System.Drawing.Size(91, 20)- Me.Label66.TabIndex = 9- Me.Label66.Text = "/ brightness"- '- 'Panel3- '- Me.Panel3.BackColor = System.Drawing.SystemColors.ButtonFace- Me.Panel3.Controls.Add(Me.Label63)- Me.Panel3.Controls.Add(Me.chkExportVideoField2)- Me.Panel3.Controls.Add(Me.numFieldScaling2)- Me.Panel3.Controls.Add(Me.Label65)- Me.Panel3.Controls.Add(Me.numBrightnessFieldOverlay)- Me.Panel3.Controls.Add(Me.chkDiplayOverlayInField)- Me.Panel3.Location = New System.Drawing.Point(170, 11)- Me.Panel3.Name = "Panel3"- Me.Panel3.Size = New System.Drawing.Size(697, 40)- Me.Panel3.TabIndex = 13- '- 'Label63- '- Me.Label63.AutoSize = True- Me.Label63.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label63.Location = New System.Drawing.Point(9, 10)- Me.Label63.Name = "Label63"- Me.Label63.Size = New System.Drawing.Size(129, 20)- Me.Label63.TabIndex = 9- Me.Label63.Text = "Field scale factor"- '- 'chkExportVideoField2- '- Me.chkExportVideoField2.AutoSize = True- Me.chkExportVideoField2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkExportVideoField2.Location = New System.Drawing.Point(571, 9)- Me.chkExportVideoField2.Name = "chkExportVideoField2"- Me.chkExportVideoField2.Size = New System.Drawing.Size(115, 24)- Me.chkExportVideoField2.TabIndex = 12- Me.chkExportVideoField2.Text = "Export video"- Me.chkExportVideoField2.UseVisualStyleBackColor = True- '- 'numFieldScaling2- '- Me.numFieldScaling2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numFieldScaling2.Location = New System.Drawing.Point(144, 8)- Me.numFieldScaling2.Maximum = New Decimal(New Integer() {1000, 0, 0, 0})- Me.numFieldScaling2.Name = "numFieldScaling2"- Me.numFieldScaling2.Size = New System.Drawing.Size(75, 26)- Me.numFieldScaling2.TabIndex = 8- Me.numFieldScaling2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- '- 'Label65- '- Me.Label65.AutoSize = True- Me.Label65.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label65.Location = New System.Drawing.Point(380, 10)- Me.Label65.Name = "Label65"- Me.Label65.Size = New System.Drawing.Size(91, 20)- Me.Label65.TabIndex = 9- Me.Label65.Text = "/ brightness"- '- 'numBrightnessFieldOverlay- '- Me.numBrightnessFieldOverlay.DecimalPlaces = 2- Me.numBrightnessFieldOverlay.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.numBrightnessFieldOverlay.Increment = New Decimal(New Integer() {5, 0, 0, 131072})- Me.numBrightnessFieldOverlay.Location = New System.Drawing.Point(474, 8)- Me.numBrightnessFieldOverlay.Maximum = New Decimal(New Integer() {5, 0, 0, 0})- Me.numBrightnessFieldOverlay.Name = "numBrightnessFieldOverlay"- Me.numBrightnessFieldOverlay.Size = New System.Drawing.Size(67, 26)- Me.numBrightnessFieldOverlay.TabIndex = 11- Me.numBrightnessFieldOverlay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center- Me.numBrightnessFieldOverlay.Value = New Decimal(New Integer() {1, 0, 0, 0})- '- 'chkDiplayOverlayInField- '- Me.chkDiplayOverlayInField.AutoSize = True- Me.chkDiplayOverlayInField.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.chkDiplayOverlayInField.Location = New System.Drawing.Point(254, 9)- Me.chkDiplayOverlayInField.Name = "chkDiplayOverlayInField"- Me.chkDiplayOverlayInField.Size = New System.Drawing.Size(132, 24)- Me.chkDiplayOverlayInField.TabIndex = 10- Me.chkDiplayOverlayInField.Text = "Display overlay"- Me.chkDiplayOverlayInField.UseVisualStyleBackColor = True- '- 'Label56- '- Me.Label56.AutoSize = True- Me.Label56.Font = New System.Drawing.Font("Microsoft Sans Serif", 20.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label56.Location = New System.Drawing.Point(881, 16)- Me.Label56.Name = "Label56"- Me.Label56.Size = New System.Drawing.Size(126, 31)- Me.Label56.TabIndex = 7- Me.Label56.Text = "Intensity"- '- 'Label55- '- Me.Label55.AutoSize = True- Me.Label55.Font = New System.Drawing.Font("Microsoft Sans Serif", 20.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Label55.Location = New System.Drawing.Point(53, 16)- Me.Label55.Name = "Label55"- Me.Label55.Size = New System.Drawing.Size(78, 31)- Me.Label55.TabIndex = 7- Me.Label55.Text = "Field"- '- 'lblWarningIntensity- '- Me.lblWarningIntensity.AutoSize = True- Me.lblWarningIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblWarningIntensity.Location = New System.Drawing.Point(1201, 550)- Me.lblWarningIntensity.Name = "lblWarningIntensity"- Me.lblWarningIntensity.Size = New System.Drawing.Size(183, 20)- Me.lblWarningIntensity.TabIndex = 6- Me.lblWarningIntensity.Text = "Intensity video is created"- '- 'lblWarningField- '- Me.lblWarningField.AutoSize = True- Me.lblWarningField.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblWarningField.Location = New System.Drawing.Point(335, 551)- Me.lblWarningField.Name = "lblWarningField"- Me.lblWarningField.Size = New System.Drawing.Size(157, 20)- Me.lblWarningField.TabIndex = 6- Me.lblWarningField.Text = "Field video is created"- '- 'btnExportIntensityFrame- '- Me.btnExportIntensityFrame.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnExportIntensityFrame.Location = New System.Drawing.Point(1410, 545)- Me.btnExportIntensityFrame.Name = "btnExportIntensityFrame"- Me.btnExportIntensityFrame.Size = New System.Drawing.Size(247, 31)- Me.btnExportIntensityFrame.TabIndex = 5- Me.btnExportIntensityFrame.Text = "Export frame as image"- Me.btnExportIntensityFrame.UseVisualStyleBackColor = True- '- 'btnExportFieldFrame- '- Me.btnExportFieldFrame.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnExportFieldFrame.Location = New System.Drawing.Point(536, 547)- Me.btnExportFieldFrame.Name = "btnExportFieldFrame"- Me.btnExportFieldFrame.Size = New System.Drawing.Size(243, 29)- Me.btnExportFieldFrame.TabIndex = 4- Me.btnExportFieldFrame.Text = "Export frame as Image"- Me.btnExportFieldFrame.UseVisualStyleBackColor = True- '- 'btnOpenImageFolder- '- Me.btnOpenImageFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnOpenImageFolder.Location = New System.Drawing.Point(1524, 650)- Me.btnOpenImageFolder.Name = "btnOpenImageFolder"- Me.btnOpenImageFolder.Size = New System.Drawing.Size(207, 33)- Me.btnOpenImageFolder.TabIndex = 2- Me.btnOpenImageFolder.Text = "Open Image folder"- Me.btnOpenImageFolder.UseVisualStyleBackColor = True- '- 'btnOpenVideoFolder- '- Me.btnOpenVideoFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnOpenVideoFolder.Location = New System.Drawing.Point(1311, 650)- Me.btnOpenVideoFolder.Name = "btnOpenVideoFolder"- Me.btnOpenVideoFolder.Size = New System.Drawing.Size(207, 33)- Me.btnOpenVideoFolder.TabIndex = 2- Me.btnOpenVideoFolder.Text = "Open video folder"- Me.btnOpenVideoFolder.UseVisualStyleBackColor = True- '- 'btnViewIntensityVideo- '- Me.btnViewIntensityVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnViewIntensityVideo.Location = New System.Drawing.Point(929, 546)- Me.btnViewIntensityVideo.Name = "btnViewIntensityVideo"- Me.btnViewIntensityVideo.Size = New System.Drawing.Size(247, 29)- Me.btnViewIntensityVideo.TabIndex = 1- Me.btnViewIntensityVideo.Text = "View video in media player"- Me.btnViewIntensityVideo.UseVisualStyleBackColor = True- '- 'btnViewFieldVideo- '- Me.btnViewFieldVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnViewFieldVideo.Location = New System.Drawing.Point(79, 547)- Me.btnViewFieldVideo.Name = "btnViewFieldVideo"- Me.btnViewFieldVideo.Size = New System.Drawing.Size(216, 29)- Me.btnViewFieldVideo.TabIndex = 1- Me.btnViewFieldVideo.Text = "View video in media player"- Me.btnViewFieldVideo.UseVisualStyleBackColor = True- '- 'pnlPreviewIntensity- '- Me.pnlPreviewIntensity.Location = New System.Drawing.Point(873, 57)- Me.pnlPreviewIntensity.Name = "pnlPreviewIntensity"- Me.pnlPreviewIntensity.Size = New System.Drawing.Size(850, 478)- Me.pnlPreviewIntensity.TabIndex = 0- '- 'pnlPreviewField- '- Me.pnlPreviewField.Location = New System.Drawing.Point(17, 56)- Me.pnlPreviewField.Name = "pnlPreviewField"- Me.pnlPreviewField.Size = New System.Drawing.Size(850, 478)- Me.pnlPreviewField.TabIndex = 0- '- 'tabOutput- '- Me.tabOutput.Controls.Add(Me.btnRenameVideo)- Me.tabOutput.Controls.Add(Me.btnShareWithEditors)- Me.tabOutput.Controls.Add(Me.btnCopyToClipboard)- Me.tabOutput.Controls.Add(Me.btnOpenImageFolder2)- Me.tabOutput.Controls.Add(Me.btnViewVIdeoInPlayer2)- Me.tabOutput.Controls.Add(Me.btnOpenVIdeoFolder2)- Me.tabOutput.Controls.Add(Me.lblPreview)- Me.tabOutput.Controls.Add(Me.btnDeleteVideos)- Me.tabOutput.Controls.Add(Me.btnDeleteImages)- Me.tabOutput.Controls.Add(Me.btnDeleteScene)- Me.tabOutput.Controls.Add(Me.btnLoadExternal)- Me.tabOutput.Controls.Add(Me.pnlPreview)- Me.tabOutput.Controls.Add(Me.Label57)- Me.tabOutput.Controls.Add(Me.lstScenes)- Me.tabOutput.Controls.Add(Me.lstImages)- Me.tabOutput.Controls.Add(Me.lstVideo)- Me.tabOutput.Controls.Add(Me.lstAllProjects3)- Me.tabOutput.Location = New System.Drawing.Point(4, 34)- Me.tabOutput.Name = "tabOutput"- Me.tabOutput.Size = New System.Drawing.Size(1742, 693)- Me.tabOutput.TabIndex = 3- Me.tabOutput.Text = " Manage output "- Me.tabOutput.UseVisualStyleBackColor = True- '- 'btnRenameVideo- '- Me.btnRenameVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnRenameVideo.Location = New System.Drawing.Point(566, 631)- Me.btnRenameVideo.Name = "btnRenameVideo"- Me.btnRenameVideo.Size = New System.Drawing.Size(75, 31)- Me.btnRenameVideo.TabIndex = 20- Me.btnRenameVideo.Text = "Rename"- Me.btnRenameVideo.UseVisualStyleBackColor = True- '- 'btnShareWithEditors- '- Me.btnShareWithEditors.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnShareWithEditors.Location = New System.Drawing.Point(1517, 635)- Me.btnShareWithEditors.Name = "btnShareWithEditors"- Me.btnShareWithEditors.Size = New System.Drawing.Size(193, 27)- Me.btnShareWithEditors.TabIndex = 19- Me.btnShareWithEditors.Text = "Share this image with tabs"- Me.btnShareWithEditors.UseVisualStyleBackColor = True- '- 'btnCopyToClipboard- '- Me.btnCopyToClipboard.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnCopyToClipboard.Location = New System.Drawing.Point(594, 407)- Me.btnCopyToClipboard.Name = "btnCopyToClipboard"- Me.btnCopyToClipboard.Size = New System.Drawing.Size(129, 30)- Me.btnCopyToClipboard.TabIndex = 18- Me.btnCopyToClipboard.Text = "Copy to clipboard"- Me.btnCopyToClipboard.UseVisualStyleBackColor = True- '- 'btnOpenImageFolder2- '- Me.btnOpenImageFolder2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnOpenImageFolder2.Location = New System.Drawing.Point(759, 407)- Me.btnOpenImageFolder2.Name = "btnOpenImageFolder2"- Me.btnOpenImageFolder2.Size = New System.Drawing.Size(132, 30)- Me.btnOpenImageFolder2.TabIndex = 17- Me.btnOpenImageFolder2.Text = "Open image folder"- Me.btnOpenImageFolder2.UseVisualStyleBackColor = True- '- 'btnViewVIdeoInPlayer2- '- Me.btnViewVIdeoInPlayer2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnViewVIdeoInPlayer2.Location = New System.Drawing.Point(677, 630)- Me.btnViewVIdeoInPlayer2.Name = "btnViewVIdeoInPlayer2"- Me.btnViewVIdeoInPlayer2.Size = New System.Drawing.Size(114, 33)- Me.btnViewVIdeoInPlayer2.TabIndex = 16- Me.btnViewVIdeoInPlayer2.Text = "View in player"- Me.btnViewVIdeoInPlayer2.UseVisualStyleBackColor = True- '- 'btnOpenVIdeoFolder2- '- Me.btnOpenVIdeoFolder2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnOpenVIdeoFolder2.Location = New System.Drawing.Point(799, 630)- Me.btnOpenVIdeoFolder2.Name = "btnOpenVIdeoFolder2"- Me.btnOpenVIdeoFolder2.Size = New System.Drawing.Size(93, 34)- Me.btnOpenVIdeoFolder2.TabIndex = 15- Me.btnOpenVIdeoFolder2.Text = "Open folder"- Me.btnOpenVIdeoFolder2.UseVisualStyleBackColor = True- '- 'lblPreview- '- Me.lblPreview.AutoSize = True- Me.lblPreview.Location = New System.Drawing.Point(911, 25)- Me.lblPreview.Name = "lblPreview"- Me.lblPreview.Size = New System.Drawing.Size(88, 25)- Me.lblPreview.TabIndex = 14- Me.lblPreview.Text = "Preview"- '- 'btnDeleteVideos- '- Me.btnDeleteVideos.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnDeleteVideos.Location = New System.Drawing.Point(456, 631)- Me.btnDeleteVideos.Name = "btnDeleteVideos"- Me.btnDeleteVideos.Size = New System.Drawing.Size(101, 31)- Me.btnDeleteVideos.TabIndex = 13- Me.btnDeleteVideos.Text = "Delete video"- Me.btnDeleteVideos.UseVisualStyleBackColor = True- '- 'btnDeleteImages- '- Me.btnDeleteImages.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnDeleteImages.Location = New System.Drawing.Point(458, 405)- Me.btnDeleteImages.Name = "btnDeleteImages"- Me.btnDeleteImages.Size = New System.Drawing.Size(99, 32)- Me.btnDeleteImages.TabIndex = 13- Me.btnDeleteImages.Text = "Delete image"- Me.btnDeleteImages.UseVisualStyleBackColor = True- '- 'btnDeleteScene- '- Me.btnDeleteScene.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnDeleteScene.Location = New System.Drawing.Point(459, 177)- Me.btnDeleteScene.Name = "btnDeleteScene"- Me.btnDeleteScene.Size = New System.Drawing.Size(111, 32)- Me.btnDeleteScene.TabIndex = 13- Me.btnDeleteScene.Text = "Delete scene"- Me.btnDeleteScene.UseVisualStyleBackColor = True- '- 'btnLoadExternal- '- Me.btnLoadExternal.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnLoadExternal.Location = New System.Drawing.Point(785, 177)- Me.btnLoadExternal.Name = "btnLoadExternal"- Me.btnLoadExternal.Size = New System.Drawing.Size(104, 32)- Me.btnLoadExternal.TabIndex = 13- Me.btnLoadExternal.Text = "Load external"- Me.btnLoadExternal.UseVisualStyleBackColor = True- '- 'pnlPreview- '- Me.pnlPreview.BackColor = System.Drawing.Color.Gainsboro- Me.pnlPreview.Location = New System.Drawing.Point(908, 52)- Me.pnlPreview.Name = "pnlPreview"- Me.pnlPreview.Size = New System.Drawing.Size(806, 573)- Me.pnlPreview.TabIndex = 12- '- 'Label57- '- Me.Label57.AutoSize = True- Me.Label57.Location = New System.Drawing.Point(20, 16)- Me.Label57.Name = "Label57"- Me.Label57.Size = New System.Drawing.Size(227, 25)- Me.Label57.TabIndex = 11- Me.Label57.Text = "Manage project output"- '- 'lstScenes- '- Me.lstScenes.BackColor = System.Drawing.SystemColors.MenuBar- Me.lstScenes.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.colSceneName, Me.colSceneCreated})- Me.lstScenes.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lstScenes.FullRowSelect = True- Me.lstScenes.HideSelection = False- Me.lstScenes.Location = New System.Drawing.Point(460, 51)- Me.lstScenes.Name = "lstScenes"- Me.lstScenes.Size = New System.Drawing.Size(432, 126)- Me.lstScenes.TabIndex = 10- Me.lstScenes.UseCompatibleStateImageBehavior = False- Me.lstScenes.View = System.Windows.Forms.View.Details- '- 'colSceneName- '- Me.colSceneName.Text = "Scene file name"- Me.colSceneName.Width = 262- '- 'colSceneCreated- '- Me.colSceneCreated.Text = "Created on"- Me.colSceneCreated.Width = 138- '- 'lstImages- '- Me.lstImages.BackColor = System.Drawing.SystemColors.Menu- Me.lstImages.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.colImageName, Me.colCreatedOn})- Me.lstImages.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lstImages.FullRowSelect = True- Me.lstImages.HideSelection = False- Me.lstImages.Location = New System.Drawing.Point(460, 221)- Me.lstImages.Name = "lstImages"- Me.lstImages.Size = New System.Drawing.Size(432, 183)- Me.lstImages.TabIndex = 9- Me.lstImages.UseCompatibleStateImageBehavior = False- Me.lstImages.View = System.Windows.Forms.View.Details- '- 'colImageName- '- Me.colImageName.Text = "Image file name"- Me.colImageName.Width = 258- '- 'colCreatedOn- '- Me.colCreatedOn.Text = "Created on"- Me.colCreatedOn.Width = 141- '- 'lstVideo- '- Me.lstVideo.BackColor = System.Drawing.SystemColors.Menu- Me.lstVideo.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.colVideoName, Me.colCreatedOn2})- Me.lstVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lstVideo.FullRowSelect = True- Me.lstVideo.HideSelection = False- Me.lstVideo.Location = New System.Drawing.Point(457, 452)- Me.lstVideo.Name = "lstVideo"- Me.lstVideo.Size = New System.Drawing.Size(435, 173)- Me.lstVideo.TabIndex = 9- Me.lstVideo.UseCompatibleStateImageBehavior = False- Me.lstVideo.View = System.Windows.Forms.View.Details- '- 'colVideoName- '- Me.colVideoName.Text = "Video file name"- Me.colVideoName.Width = 255- '- 'colCreatedOn2- '- Me.colCreatedOn2.Text = "Created on"- Me.colCreatedOn2.Width = 145- '- 'lstAllProjects3- '- Me.lstAllProjects3.BackColor = System.Drawing.SystemColors.Menu- Me.lstAllProjects3.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.colProjectName2, Me.colLastEdited2})- Me.lstAllProjects3.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lstAllProjects3.FullRowSelect = True- Me.lstAllProjects3.HideSelection = False- Me.lstAllProjects3.Location = New System.Drawing.Point(18, 51)- Me.lstAllProjects3.MultiSelect = False- Me.lstAllProjects3.Name = "lstAllProjects3"- Me.lstAllProjects3.Size = New System.Drawing.Size(427, 611)- Me.lstAllProjects3.TabIndex = 9- Me.lstAllProjects3.UseCompatibleStateImageBehavior = False- Me.lstAllProjects3.View = System.Windows.Forms.View.Details- '- 'colProjectName2- '- Me.colProjectName2.Text = "Project name"- Me.colProjectName2.Width = 280- '- 'colLastEdited2- '- Me.colLastEdited2.Text = "Last edited"- Me.colLastEdited2.Width = 160- '- 'tabColorScheme- '- Me.tabColorScheme.Controls.Add(Me.lblType)- Me.tabColorScheme.Controls.Add(Me.radSchemeTypeIntensity)- Me.tabColorScheme.Controls.Add(Me.radSchemeTypeField)- Me.tabColorScheme.Controls.Add(Me.btnLoadScheme)- Me.tabColorScheme.Controls.Add(Me.btbChooseFFolder)- Me.tabColorScheme.Controls.Add(Me.lblSchemeFolder)- Me.tabColorScheme.Controls.Add(Me.ListView1)- Me.tabColorScheme.Controls.Add(Me.txtSchemeFolder)- Me.tabColorScheme.Controls.Add(Me.txtCurrentColorScheme)- Me.tabColorScheme.Controls.Add(Me.lblCurrentCOlorScheme)- Me.tabColorScheme.Controls.Add(Me.lblColorSchemeEditor)- Me.tabColorScheme.Controls.Add(Me.btnColor9)- Me.tabColorScheme.Controls.Add(Me.btnColor8)- Me.tabColorScheme.Controls.Add(Me.btnColor7)- Me.tabColorScheme.Controls.Add(Me.btnColor6)- Me.tabColorScheme.Controls.Add(Me.btnColor5)- Me.tabColorScheme.Controls.Add(Me.btnColor4)- Me.tabColorScheme.Controls.Add(Me.btnColor3)- Me.tabColorScheme.Controls.Add(Me.btnCOlor2)- Me.tabColorScheme.Controls.Add(Me.btnColor1)- Me.tabColorScheme.Controls.Add(Me.lblColorPicker)- Me.tabColorScheme.Controls.Add(Me.Panel2)- Me.tabColorScheme.Controls.Add(Me.pnlScheme)- Me.tabColorScheme.Controls.Add(Me.btnDeleteColorScheme)- Me.tabColorScheme.Controls.Add(Me.btnRenameColorScheme)- Me.tabColorScheme.Controls.Add(Me.btnSaveAsColorScheme)- Me.tabColorScheme.Controls.Add(Me.btnSaveCurrentScheme)- Me.tabColorScheme.Location = New System.Drawing.Point(4, 34)- Me.tabColorScheme.Name = "tabColorScheme"- Me.tabColorScheme.Padding = New System.Windows.Forms.Padding(3)- Me.tabColorScheme.Size = New System.Drawing.Size(1742, 693)- Me.tabColorScheme.TabIndex = 0- Me.tabColorScheme.Text = " Colors "- Me.tabColorScheme.UseVisualStyleBackColor = True- '- 'lblType- '- Me.lblType.AutoSize = True- Me.lblType.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblType.Location = New System.Drawing.Point(23, 93)- Me.lblType.Name = "lblType"- Me.lblType.Size = New System.Drawing.Size(98, 18)- Me.lblType.TabIndex = 19- Me.lblType.Text = "Scheme type:"- '- 'radSchemeTypeIntensity- '- Me.radSchemeTypeIntensity.AutoSize = True- Me.radSchemeTypeIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.radSchemeTypeIntensity.Location = New System.Drawing.Point(197, 91)- Me.radSchemeTypeIntensity.Name = "radSchemeTypeIntensity"- Me.radSchemeTypeIntensity.Size = New System.Drawing.Size(79, 22)- Me.radSchemeTypeIntensity.TabIndex = 18- Me.radSchemeTypeIntensity.Text = "Intensity"- Me.radSchemeTypeIntensity.UseVisualStyleBackColor = True- '- 'radSchemeTypeField- '- Me.radSchemeTypeField.AutoSize = True- Me.radSchemeTypeField.Checked = True- Me.radSchemeTypeField.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.radSchemeTypeField.Location = New System.Drawing.Point(134, 91)- Me.radSchemeTypeField.Name = "radSchemeTypeField"- Me.radSchemeTypeField.Size = New System.Drawing.Size(57, 22)- Me.radSchemeTypeField.TabIndex = 18- Me.radSchemeTypeField.TabStop = True- Me.radSchemeTypeField.Text = "Field"- Me.radSchemeTypeField.UseVisualStyleBackColor = True- '- 'btnLoadScheme- '- Me.btnLoadScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnLoadScheme.Location = New System.Drawing.Point(27, 528)- Me.btnLoadScheme.Name = "btnLoadScheme"- Me.btnLoadScheme.Size = New System.Drawing.Size(88, 28)- Me.btnLoadScheme.TabIndex = 11- Me.btnLoadScheme.Text = "Load "- Me.btnLoadScheme.UseVisualStyleBackColor = True- '- 'btbChooseFFolder- '- Me.btbChooseFFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btbChooseFFolder.Location = New System.Drawing.Point(470, 125)- Me.btbChooseFFolder.Name = "btbChooseFFolder"- Me.btbChooseFFolder.Size = New System.Drawing.Size(89, 25)- Me.btbChooseFFolder.TabIndex = 10- Me.btbChooseFFolder.Text = "Choose..."- Me.btbChooseFFolder.UseVisualStyleBackColor = True- '- 'lblSchemeFolder- '- Me.lblSchemeFolder.AutoSize = True- Me.lblSchemeFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblSchemeFolder.Location = New System.Drawing.Point(24, 128)- Me.lblSchemeFolder.Name = "lblSchemeFolder"- Me.lblSchemeFolder.Size = New System.Drawing.Size(104, 18)- Me.lblSchemeFolder.TabIndex = 9- Me.lblSchemeFolder.Text = "Scheme folder"- '- 'ListView1- '- Me.ListView1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.ListView1.HideSelection = False- Me.ListView1.Location = New System.Drawing.Point(27, 157)- Me.ListView1.Name = "ListView1"- Me.ListView1.Size = New System.Drawing.Size(531, 365)- Me.ListView1.TabIndex = 8- Me.ListView1.UseCompatibleStateImageBehavior = False- '- 'txtSchemeFolder- '- Me.txtSchemeFolder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle- Me.txtSchemeFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.txtSchemeFolder.Location = New System.Drawing.Point(134, 125)- Me.txtSchemeFolder.Name = "txtSchemeFolder"- Me.txtSchemeFolder.Size = New System.Drawing.Size(330, 22)- Me.txtSchemeFolder.TabIndex = 7- '- 'txtCurrentColorScheme- '- Me.txtCurrentColorScheme.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle- Me.txtCurrentColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.txtCurrentColorScheme.Location = New System.Drawing.Point(135, 56)- Me.txtCurrentColorScheme.Name = "txtCurrentColorScheme"- Me.txtCurrentColorScheme.Size = New System.Drawing.Size(299, 24)- Me.txtCurrentColorScheme.TabIndex = 7- '- 'lblCurrentCOlorScheme- '- Me.lblCurrentCOlorScheme.AutoSize = True- Me.lblCurrentCOlorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblCurrentCOlorScheme.Location = New System.Drawing.Point(23, 58)- Me.lblCurrentCOlorScheme.Name = "lblCurrentCOlorScheme"- Me.lblCurrentCOlorScheme.Size = New System.Drawing.Size(108, 18)- Me.lblCurrentCOlorScheme.TabIndex = 6- Me.lblCurrentCOlorScheme.Text = "Color Scheme:"- '- 'lblColorSchemeEditor- '- Me.lblColorSchemeEditor.AutoSize = True- Me.lblColorSchemeEditor.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblColorSchemeEditor.Location = New System.Drawing.Point(22, 12)- Me.lblColorSchemeEditor.Name = "lblColorSchemeEditor"- Me.lblColorSchemeEditor.Size = New System.Drawing.Size(204, 24)- Me.lblColorSchemeEditor.TabIndex = 5- Me.lblColorSchemeEditor.Text = "Color Scheme Editor"- '- 'btnColor9- '- Me.btnColor9.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnColor9.Location = New System.Drawing.Point(1054, 514)- Me.btnColor9.Name = "btnColor9"- Me.btnColor9.Size = New System.Drawing.Size(78, 34)- Me.btnColor9.TabIndex = 4- Me.btnColor9.Text = "Color 9 ->"- Me.btnColor9.UseVisualStyleBackColor = True- '- 'btnColor8- '- Me.btnColor8.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnColor8.Location = New System.Drawing.Point(1055, 465)- Me.btnColor8.Name = "btnColor8"- Me.btnColor8.Size = New System.Drawing.Size(78, 34)- Me.btnColor8.TabIndex = 4- Me.btnColor8.Text = "Color 8 ->"- Me.btnColor8.UseVisualStyleBackColor = True- '- 'btnColor7- '- Me.btnColor7.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnColor7.Location = New System.Drawing.Point(1055, 416)- Me.btnColor7.Name = "btnColor7"- Me.btnColor7.Size = New System.Drawing.Size(78, 34)- Me.btnColor7.TabIndex = 4- Me.btnColor7.Text = "Color 7 ->"- Me.btnColor7.UseVisualStyleBackColor = True- '- 'btnColor6- '- Me.btnColor6.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnColor6.Location = New System.Drawing.Point(1055, 368)- Me.btnColor6.Name = "btnColor6"- Me.btnColor6.Size = New System.Drawing.Size(78, 34)- Me.btnColor6.TabIndex = 4- Me.btnColor6.Text = "Color 6 ->"- Me.btnColor6.UseVisualStyleBackColor = True- '- 'btnColor5- '- Me.btnColor5.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnColor5.Location = New System.Drawing.Point(1055, 322)- Me.btnColor5.Name = "btnColor5"- Me.btnColor5.Size = New System.Drawing.Size(78, 34)- Me.btnColor5.TabIndex = 4- Me.btnColor5.Text = "Color 5 ->"- Me.btnColor5.UseVisualStyleBackColor = True- '- 'btnColor4- '- Me.btnColor4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnColor4.Location = New System.Drawing.Point(1054, 273)- Me.btnColor4.Name = "btnColor4"- Me.btnColor4.Size = New System.Drawing.Size(78, 34)- Me.btnColor4.TabIndex = 4- Me.btnColor4.Text = "Color 4 ->"- Me.btnColor4.UseVisualStyleBackColor = True- '- 'btnColor3- '- Me.btnColor3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnColor3.Location = New System.Drawing.Point(1054, 225)- Me.btnColor3.Name = "btnColor3"- Me.btnColor3.Size = New System.Drawing.Size(78, 34)- Me.btnColor3.TabIndex = 4- Me.btnColor3.Text = "Color 3 ->"- Me.btnColor3.UseVisualStyleBackColor = True- '- 'btnCOlor2- '- Me.btnCOlor2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnCOlor2.Location = New System.Drawing.Point(1055, 176)- Me.btnCOlor2.Name = "btnCOlor2"- Me.btnCOlor2.Size = New System.Drawing.Size(78, 34)- Me.btnCOlor2.TabIndex = 4- Me.btnCOlor2.Text = "Color 2 ->"- Me.btnCOlor2.UseVisualStyleBackColor = True- '- 'btnColor1- '- Me.btnColor1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnColor1.Location = New System.Drawing.Point(1055, 128)- Me.btnColor1.Name = "btnColor1"- Me.btnColor1.Size = New System.Drawing.Size(78, 34)- Me.btnColor1.TabIndex = 4- Me.btnColor1.Text = "Color 1 ->"- Me.btnColor1.UseVisualStyleBackColor = True- '- 'lblColorPicker- '- Me.lblColorPicker.AutoSize = True- Me.lblColorPicker.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblColorPicker.Location = New System.Drawing.Point(596, 101)- Me.lblColorPicker.Name = "lblColorPicker"- Me.lblColorPicker.Size = New System.Drawing.Size(93, 20)- Me.lblColorPicker.TabIndex = 2- Me.lblColorPicker.Text = "Color Picker"- '- 'Panel2- '- Me.Panel2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.Panel2.Location = New System.Drawing.Point(598, 125)- Me.Panel2.Name = "Panel2"- Me.Panel2.Size = New System.Drawing.Size(445, 425)- Me.Panel2.TabIndex = 1- '- 'pnlScheme- '- Me.pnlScheme.Location = New System.Drawing.Point(1139, 139)- Me.pnlScheme.Name = "pnlScheme"- Me.pnlScheme.Size = New System.Drawing.Size(55, 399)- Me.pnlScheme.TabIndex = 1- '- 'btnDeleteColorScheme- '- Me.btnDeleteColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnDeleteColorScheme.Location = New System.Drawing.Point(470, 528)- Me.btnDeleteColorScheme.Name = "btnDeleteColorScheme"- Me.btnDeleteColorScheme.Size = New System.Drawing.Size(89, 28)- Me.btnDeleteColorScheme.TabIndex = 0- Me.btnDeleteColorScheme.Text = "Delete"- Me.btnDeleteColorScheme.UseVisualStyleBackColor = True- '- 'btnRenameColorScheme- '- Me.btnRenameColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnRenameColorScheme.Location = New System.Drawing.Point(376, 528)- Me.btnRenameColorScheme.Name = "btnRenameColorScheme"- Me.btnRenameColorScheme.Size = New System.Drawing.Size(88, 28)- Me.btnRenameColorScheme.TabIndex = 0- Me.btnRenameColorScheme.Text = "Rename"- Me.btnRenameColorScheme.UseVisualStyleBackColor = True- '- 'btnSaveAsColorScheme- '- Me.btnSaveAsColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnSaveAsColorScheme.Location = New System.Drawing.Point(215, 528)- Me.btnSaveAsColorScheme.Name = "btnSaveAsColorScheme"- Me.btnSaveAsColorScheme.Size = New System.Drawing.Size(88, 28)- Me.btnSaveAsColorScheme.TabIndex = 0- Me.btnSaveAsColorScheme.Text = "Save As"- Me.btnSaveAsColorScheme.UseVisualStyleBackColor = True- '- 'btnSaveCurrentScheme- '- Me.btnSaveCurrentScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnSaveCurrentScheme.Location = New System.Drawing.Point(121, 528)- Me.btnSaveCurrentScheme.Name = "btnSaveCurrentScheme"- Me.btnSaveCurrentScheme.Size = New System.Drawing.Size(88, 28)- Me.btnSaveCurrentScheme.TabIndex = 0- Me.btnSaveCurrentScheme.Text = "Save "- Me.btnSaveCurrentScheme.UseVisualStyleBackColor = True- '- 'btnSaveConfiguration- '- Me.btnSaveConfiguration.BackColor = System.Drawing.Color.Azure- Me.btnSaveConfiguration.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnSaveConfiguration.Location = New System.Drawing.Point(1503, 840)- Me.btnSaveConfiguration.Name = "btnSaveConfiguration"- Me.btnSaveConfiguration.Size = New System.Drawing.Size(259, 53)- Me.btnSaveConfiguration.TabIndex = 2- Me.btnSaveConfiguration.Text = "Save changes to project"- Me.btnSaveConfiguration.UseVisualStyleBackColor = False- '- 'btnStartSimulation- '- Me.btnStartSimulation.BackColor = System.Drawing.Color.Azure- Me.btnStartSimulation.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnStartSimulation.Location = New System.Drawing.Point(18, 23)- Me.btnStartSimulation.Name = "btnStartSimulation"- Me.btnStartSimulation.Size = New System.Drawing.Size(216, 42)- Me.btnStartSimulation.TabIndex = 7- Me.btnStartSimulation.Text = "Start Simulation"- Me.btnStartSimulation.UseVisualStyleBackColor = False- '- 'btnPauzeResume- '- Me.btnPauzeResume.BackColor = System.Drawing.Color.Azure- Me.btnPauzeResume.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnPauzeResume.Location = New System.Drawing.Point(18, 71)- Me.btnPauzeResume.Name = "btnPauzeResume"- Me.btnPauzeResume.Size = New System.Drawing.Size(215, 46)- Me.btnPauzeResume.TabIndex = 2- Me.btnPauzeResume.Text = "Pauze simulation"- Me.btnPauzeResume.UseVisualStyleBackColor = False- '- 'MenuStrip1- '- Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.itemFile, Me.InfoToolStripMenuItem})- Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)- Me.MenuStrip1.Name = "MenuStrip1"- Me.MenuStrip1.Size = New System.Drawing.Size(1781, 28)- Me.MenuStrip1.TabIndex = 1- Me.MenuStrip1.Text = "MenuStrip1"- '- 'itemFile- '- Me.itemFile.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.NewToolStripMenuItem, Me.OpenToolStripMenuItem, Me.ChooseProjectRootToolStripMenuItem, Me.SetCValueToolStripMenuItem, Me.SaveToolStripMenuItem, Me.ExitToolStripMenuItem})- Me.itemFile.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.itemFile.Name = "itemFile"- Me.itemFile.Size = New System.Drawing.Size(44, 24)- Me.itemFile.Text = "File"- '- 'NewToolStripMenuItem- '- Me.NewToolStripMenuItem.Name = "NewToolStripMenuItem"- Me.NewToolStripMenuItem.Size = New System.Drawing.Size(210, 24)- Me.NewToolStripMenuItem.Text = "New"- '- 'OpenToolStripMenuItem- '- Me.OpenToolStripMenuItem.Name = "OpenToolStripMenuItem"- Me.OpenToolStripMenuItem.Size = New System.Drawing.Size(210, 24)- Me.OpenToolStripMenuItem.Text = "Open"- '- 'ChooseProjectRootToolStripMenuItem- '- Me.ChooseProjectRootToolStripMenuItem.Name = "ChooseProjectRootToolStripMenuItem"- Me.ChooseProjectRootToolStripMenuItem.Size = New System.Drawing.Size(210, 24)- Me.ChooseProjectRootToolStripMenuItem.Text = "Choose project root"- '- 'SetCValueToolStripMenuItem- '- Me.SetCValueToolStripMenuItem.Name = "SetCValueToolStripMenuItem"- Me.SetCValueToolStripMenuItem.Size = New System.Drawing.Size(210, 24)- Me.SetCValueToolStripMenuItem.Text = "Set c-value"- '- 'SaveToolStripMenuItem- '- Me.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"- Me.SaveToolStripMenuItem.Size = New System.Drawing.Size(210, 24)- Me.SaveToolStripMenuItem.Text = "Save"- '- 'ExitToolStripMenuItem- '- Me.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem"- Me.ExitToolStripMenuItem.Size = New System.Drawing.Size(210, 24)- Me.ExitToolStripMenuItem.Text = "Exit"- '- 'InfoToolStripMenuItem- '- Me.InfoToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.HelpToolStripMenuItem, Me.AboutToolStripMenuItem})- Me.InfoToolStripMenuItem.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.InfoToolStripMenuItem.Name = "InfoToolStripMenuItem"- Me.InfoToolStripMenuItem.Size = New System.Drawing.Size(47, 24)- Me.InfoToolStripMenuItem.Text = "Info"- '- 'HelpToolStripMenuItem- '- Me.HelpToolStripMenuItem.Name = "HelpToolStripMenuItem"- Me.HelpToolStripMenuItem.Size = New System.Drawing.Size(119, 24)- Me.HelpToolStripMenuItem.Text = "Help"- '- 'AboutToolStripMenuItem- '- Me.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem"- Me.AboutToolStripMenuItem.Size = New System.Drawing.Size(119, 24)- Me.AboutToolStripMenuItem.Text = "About"- '- 'lblProjectName- '- Me.lblProjectName.AutoSize = True- Me.lblProjectName.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblProjectName.Location = New System.Drawing.Point(1101, 13)- Me.lblProjectName.Name = "lblProjectName"- Me.lblProjectName.Size = New System.Drawing.Size(96, 18)- Me.lblProjectName.TabIndex = 2- Me.lblProjectName.Text = "Project name"- '- 'txtProjectName- '- Me.txtProjectName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle- Me.txtProjectName.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.txtProjectName.Location = New System.Drawing.Point(1203, 11)- Me.txtProjectName.Name = "txtProjectName"- Me.txtProjectName.ReadOnly = True- Me.txtProjectName.Size = New System.Drawing.Size(292, 24)- Me.txtProjectName.TabIndex = 3- '- 'txtRootFolder- '- Me.txtRootFolder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle- Me.txtRootFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.txtRootFolder.Location = New System.Drawing.Point(145, 11)- Me.txtRootFolder.Name = "txtRootFolder"- Me.txtRootFolder.ReadOnly = True- Me.txtRootFolder.Size = New System.Drawing.Size(810, 24)- Me.txtRootFolder.TabIndex = 3- '- 'lblRootFolder- '- Me.lblRootFolder.AutoSize = True- Me.lblRootFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.lblRootFolder.Location = New System.Drawing.Point(12, 13)- Me.lblRootFolder.Name = "lblRootFolder"- Me.lblRootFolder.Size = New System.Drawing.Size(127, 18)- Me.lblRootFolder.TabIndex = 2- Me.lblRootFolder.Text = "Project root folder"- '- 'btnBrowseRoot- '- Me.btnBrowseRoot.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnBrowseRoot.Location = New System.Drawing.Point(966, 8)- Me.btnBrowseRoot.Name = "btnBrowseRoot"- Me.btnBrowseRoot.Size = New System.Drawing.Size(124, 29)- Me.btnBrowseRoot.TabIndex = 4- Me.btnBrowseRoot.TabStop = False- Me.btnBrowseRoot.Text = "Browse root"- Me.btnBrowseRoot.UseVisualStyleBackColor = True- '- 'StatusStrip1- '- Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabel1})- Me.StatusStrip1.Location = New System.Drawing.Point(0, 967)- Me.StatusStrip1.Name = "StatusStrip1"- Me.StatusStrip1.Size = New System.Drawing.Size(1781, 22)- Me.StatusStrip1.TabIndex = 5- Me.StatusStrip1.Text = "StatusStrip1"- '- 'ToolStripStatusLabel1- '- Me.ToolStripStatusLabel1.Name = "ToolStripStatusLabel1"- Me.ToolStripStatusLabel1.Size = New System.Drawing.Size(120, 17)- Me.ToolStripStatusLabel1.Text = "ToolStripStatusLabel1"- '- 'grpNavigateTabs- '- Me.grpNavigateTabs.Controls.Add(Me.btnGotoPreview)- Me.grpNavigateTabs.Controls.Add(Me.btnGotoProbes)- Me.grpNavigateTabs.Controls.Add(Me.btnGotoSources)- Me.grpNavigateTabs.Controls.Add(Me.btnGotoConfiguration)- Me.grpNavigateTabs.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.grpNavigateTabs.Location = New System.Drawing.Point(511, 827)- Me.grpNavigateTabs.Name = "grpNavigateTabs"- Me.grpNavigateTabs.Size = New System.Drawing.Size(858, 76)- Me.grpNavigateTabs.TabIndex = 8- Me.grpNavigateTabs.TabStop = False- Me.grpNavigateTabs.Text = "Quick navigate to"- '- 'btnGotoPreview- '- Me.btnGotoPreview.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnGotoPreview.Location = New System.Drawing.Point(635, 27)- Me.btnGotoPreview.Name = "btnGotoPreview"- Me.btnGotoPreview.Size = New System.Drawing.Size(194, 31)- Me.btnGotoPreview.TabIndex = 0- Me.btnGotoPreview.Text = "Preview"- Me.btnGotoPreview.UseVisualStyleBackColor = True- '- 'btnGotoProbes- '- Me.btnGotoProbes.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnGotoProbes.Location = New System.Drawing.Point(431, 27)- Me.btnGotoProbes.Name = "btnGotoProbes"- Me.btnGotoProbes.Size = New System.Drawing.Size(198, 31)- Me.btnGotoProbes.TabIndex = 0- Me.btnGotoProbes.Text = "Probes"- Me.btnGotoProbes.UseVisualStyleBackColor = True- '- 'btnGotoSources- '- Me.btnGotoSources.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnGotoSources.Location = New System.Drawing.Point(228, 27)- Me.btnGotoSources.Name = "btnGotoSources"- Me.btnGotoSources.Size = New System.Drawing.Size(197, 31)- Me.btnGotoSources.TabIndex = 0- Me.btnGotoSources.Text = "Sources"- Me.btnGotoSources.UseVisualStyleBackColor = True- '- 'btnGotoConfiguration- '- Me.btnGotoConfiguration.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnGotoConfiguration.Location = New System.Drawing.Point(25, 27)- Me.btnGotoConfiguration.Name = "btnGotoConfiguration"- Me.btnGotoConfiguration.Size = New System.Drawing.Size(197, 31)- Me.btnGotoConfiguration.TabIndex = 0- Me.btnGotoConfiguration.Text = "Settings"- Me.btnGotoConfiguration.UseVisualStyleBackColor = True- '- 'grpSimulationControlButtons- '- Me.grpSimulationControlButtons.BackColor = System.Drawing.SystemColors.Control- Me.grpSimulationControlButtons.Controls.Add(Me.btnPauzeResume)- Me.grpSimulationControlButtons.Controls.Add(Me.btnStartSimulation)- Me.grpSimulationControlButtons.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.grpSimulationControlButtons.Location = New System.Drawing.Point(16, 827)- Me.grpSimulationControlButtons.Name = "grpSimulationControlButtons"- Me.grpSimulationControlButtons.Size = New System.Drawing.Size(262, 127)- Me.grpSimulationControlButtons.TabIndex = 9- Me.grpSimulationControlButtons.TabStop = False- Me.grpSimulationControlButtons.Text = "Simulation Control"- '- 'Panel1- '- Me.Panel1.BackColor = System.Drawing.Color.Azure- Me.Panel1.Controls.Add(Me.btnDescription)- Me.Panel1.Controls.Add(Me.txtRootFolder)- Me.Panel1.Controls.Add(Me.txtProjectName)- Me.Panel1.Controls.Add(Me.lblRootFolder)- Me.Panel1.Controls.Add(Me.lblProjectName)- Me.Panel1.Controls.Add(Me.btnBrowseRoot)- Me.Panel1.Location = New System.Drawing.Point(19, 33)- Me.Panel1.Name = "Panel1"- Me.Panel1.Size = New System.Drawing.Size(1734, 43)- Me.Panel1.TabIndex = 10- '- 'btnDescription- '- Me.btnDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnDescription.Location = New System.Drawing.Point(1536, 8)- Me.btnDescription.Name = "btnDescription"- Me.btnDescription.Size = New System.Drawing.Size(168, 29)- Me.btnDescription.TabIndex = 5- Me.btnDescription.Text = "Edit description"- Me.btnDescription.UseVisualStyleBackColor = True- '- 'grpShareImage- '- Me.grpShareImage.Controls.Add(Me.btnShareIntensityImage)- Me.grpShareImage.Controls.Add(Me.btnShareFieldImage)- Me.grpShareImage.Controls.Add(Me.btnShareSceneImage)- Me.grpShareImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.grpShareImage.Location = New System.Drawing.Point(295, 827)- Me.grpShareImage.Name = "grpShareImage"- Me.grpShareImage.Size = New System.Drawing.Size(199, 125)- Me.grpShareImage.TabIndex = 11- Me.grpShareImage.TabStop = False- Me.grpShareImage.Text = "Share with source / probe"- '- 'btnShareIntensityImage- '- Me.btnShareIntensityImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnShareIntensityImage.Location = New System.Drawing.Point(14, 86)- Me.btnShareIntensityImage.Name = "btnShareIntensityImage"- Me.btnShareIntensityImage.Size = New System.Drawing.Size(154, 27)- Me.btnShareIntensityImage.TabIndex = 0- Me.btnShareIntensityImage.Text = "Intensity image"- Me.btnShareIntensityImage.UseVisualStyleBackColor = True- '- 'btnShareFieldImage- '- Me.btnShareFieldImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnShareFieldImage.Location = New System.Drawing.Point(16, 53)- Me.btnShareFieldImage.Name = "btnShareFieldImage"- Me.btnShareFieldImage.Size = New System.Drawing.Size(154, 27)- Me.btnShareFieldImage.TabIndex = 0- Me.btnShareFieldImage.Text = "Field image"- Me.btnShareFieldImage.UseVisualStyleBackColor = True- '- 'btnShareSceneImage- '- Me.btnShareSceneImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnShareSceneImage.Location = New System.Drawing.Point(15, 21)- Me.btnShareSceneImage.Name = "btnShareSceneImage"- Me.btnShareSceneImage.Size = New System.Drawing.Size(155, 27)- Me.btnShareSceneImage.TabIndex = 0- Me.btnShareSceneImage.Text = "Scene image"- Me.btnShareSceneImage.UseVisualStyleBackColor = True- '- 'Form1- '- Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)- Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font- Me.ClientSize = New System.Drawing.Size(1781, 989)- Me.Controls.Add(Me.grpShareImage)- Me.Controls.Add(Me.Panel1)- Me.Controls.Add(Me.grpSimulationControlButtons)- Me.Controls.Add(Me.grpNavigateTabs)- Me.Controls.Add(Me.StatusStrip1)- Me.Controls.Add(Me.tabMainFunctions)- Me.Controls.Add(Me.MenuStrip1)- Me.Controls.Add(Me.btnSaveConfiguration)- Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)- Me.MainMenuStrip = Me.MenuStrip1- Me.Name = "Form1"- Me.Text = "Wave Dude 2D V0.29"- Me.tabMainFunctions.ResumeLayout(False)- Me.tabConfiguration.ResumeLayout(False)- Me.grpProjects.ResumeLayout(False)- Me.grpSimulationSettings.ResumeLayout(False)- Me.grpSimulationSettings.PerformLayout()- CType(Me.numTimeDecayFactor, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numSimulationSteps, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numQuality, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numIntensityScaling, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numOffsetIntensity, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numOffsetField, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numFieldScaling, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numVisualizeEvery, System.ComponentModel.ISupportInitialize).EndInit()- Me.grpSceneProperties.ResumeLayout(False)- Me.grpSceneProperties.PerformLayout()- CType(Me.numRefractiveIndex, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.picImagePreview, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numScaleImageSource, System.ComponentModel.ISupportInitialize).EndInit()- Me.tabSourceList.ResumeLayout(False)- Me.tabSourceList.PerformLayout()- CType(Me.picPreviewSource, System.ComponentModel.ISupportInitialize).EndInit()- Me.grpPlaceSource.ResumeLayout(False)- Me.pnlPosition.ResumeLayout(False)- Me.pnlPosition.PerformLayout()- CType(Me.numSourcePositionX, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numSourcePositionY, System.ComponentModel.ISupportInitialize).EndInit()- Me.grpSourceDetails.ResumeLayout(False)- Me.grpSourceDetails.PerformLayout()- Me.grpComposite.ResumeLayout(False)- Me.grpComposite.PerformLayout()- CType(Me.numRandomizeOffWidth, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numRandomizePosition, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.NumRandomizePhase, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numRandomizeFrequency, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numSpacingSizeY, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numSpacingSizeX, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numArraySizeY, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numArraySizeX, System.ComponentModel.ISupportInitialize).EndInit()- Me.grpSingleSource.ResumeLayout(False)- Me.grpSingleSource.PerformLayout()- CType(Me.numOffStateCycles, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numPhase, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numAmplitude, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numFrequency, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numPulseWidthCycles, System.ComponentModel.ISupportInitialize).EndInit()- Me.tabProbeList.ResumeLayout(False)- Me.GroupBox2.ResumeLayout(False)- Me.GroupBox2.PerformLayout()- Me.grpProbe2.ResumeLayout(False)- Me.grpProbe2.PerformLayout()- CType(Me.numRunningWindow2, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numBPosY2, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numAPosY2, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numBPosX2, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numAPosX2, System.ComponentModel.ISupportInitialize).EndInit()- Me.grpProbe1.ResumeLayout(False)- Me.grpProbe1.PerformLayout()- CType(Me.numRunningWindow, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numBPosY, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numAPosY, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numBPosX, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numAPosX, System.ComponentModel.ISupportInitialize).EndInit()- Me.tabViewer.ResumeLayout(False)- Me.tabViewer.PerformLayout()- Me.pnlPreviewIntensityProps.ResumeLayout(False)- Me.pnlPreviewIntensityProps.PerformLayout()- CType(Me.numBrightnessIntensityOverlay, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numIntensityScaling2, System.ComponentModel.ISupportInitialize).EndInit()- Me.Panel3.ResumeLayout(False)- Me.Panel3.PerformLayout()- CType(Me.numFieldScaling2, System.ComponentModel.ISupportInitialize).EndInit()- CType(Me.numBrightnessFieldOverlay, System.ComponentModel.ISupportInitialize).EndInit()- Me.tabOutput.ResumeLayout(False)- Me.tabOutput.PerformLayout()- Me.tabColorScheme.ResumeLayout(False)- Me.tabColorScheme.PerformLayout()- Me.MenuStrip1.ResumeLayout(False)- Me.MenuStrip1.PerformLayout()- Me.StatusStrip1.ResumeLayout(False)- Me.StatusStrip1.PerformLayout()- Me.grpNavigateTabs.ResumeLayout(False)- Me.grpSimulationControlButtons.ResumeLayout(False)- Me.Panel1.ResumeLayout(False)- Me.Panel1.PerformLayout()- Me.grpShareImage.ResumeLayout(False)- Me.ResumeLayout(False)- Me.PerformLayout()-- End Sub-- Friend WithEvents tabMainFunctions As TabControl- Friend WithEvents tabColorScheme As TabPage- Friend WithEvents txtCurrentColorScheme As TextBox- Friend WithEvents lblCurrentCOlorScheme As Label- Friend WithEvents lblColorSchemeEditor As Label- Friend WithEvents btnColor5 As Button- Friend WithEvents btnColor4 As Button- Friend WithEvents btnColor3 As Button- Friend WithEvents btnCOlor2 As Button- Friend WithEvents btnColor1 As Button- Friend WithEvents lblColorPicker As Label- Friend WithEvents Panel2 As Panel- Friend WithEvents pnlScheme As Panel- Friend WithEvents btnSaveAsColorScheme As Button- Friend WithEvents btnSaveCurrentScheme As Button- Friend WithEvents tabConfiguration As TabPage- Friend WithEvents tabProbeList As TabPage- Friend WithEvents tabOutput As TabPage- Friend WithEvents tabViewer As TabPage- Friend WithEvents ListView1 As ListView- Friend WithEvents MenuStrip1 As MenuStrip- Friend WithEvents itemFile As ToolStripMenuItem- Friend WithEvents NewToolStripMenuItem As ToolStripMenuItem- Friend WithEvents OpenToolStripMenuItem As ToolStripMenuItem- Friend WithEvents SaveToolStripMenuItem As ToolStripMenuItem- Friend WithEvents ExitToolStripMenuItem As ToolStripMenuItem- Friend WithEvents lblSchemeFolder As Label- Friend WithEvents btnLoadScheme As Button- Friend WithEvents lblType As Label- Friend WithEvents radSchemeTypeIntensity As RadioButton- Friend WithEvents radSchemeTypeField As RadioButton- Friend WithEvents btbChooseFFolder As Button- Friend WithEvents txtSchemeFolder As TextBox- Friend WithEvents btnColor7 As Button- Friend WithEvents btnColor6 As Button- Friend WithEvents lblProjectName As Label- Friend WithEvents txtProjectName As TextBox- Friend WithEvents txtRootFolder As TextBox- Friend WithEvents lblRootFolder As Label- Friend WithEvents btnBrowseRoot As Button- Friend WithEvents btnSaveAs As Button- Friend WithEvents grpSceneProperties As GroupBox- Friend WithEvents txtDampingEdgeSize As TextBox- Friend WithEvents chkUseImageSources As CheckBox- Friend WithEvents chkDampingEdge As CheckBox- Friend WithEvents btnLoadSceneImage As Button- Friend WithEvents lblImageNameAndSize As Label- Friend WithEvents Label1 As Label- Friend WithEvents lblPix As Label- Friend WithEvents lblX As Label- Friend WithEvents txtYsize As TextBox- Friend WithEvents txtXSize As TextBox- Friend WithEvents radUserDefinedScene As RadioButton- Friend WithEvents picImagePreview As PictureBox- Friend WithEvents radUseSceneImage As RadioButton- Friend WithEvents tabSourceList As TabPage- Friend WithEvents btnSaveConfiguration As Button- Friend WithEvents grpSimulationSettings As GroupBox- Friend WithEvents numVisualizeEvery As NumericUpDown- Friend WithEvents Label4 As Label- Friend WithEvents lblVisualizeEvery As Label- Friend WithEvents lblSimulationSteps As Label- Friend WithEvents chkPreviewVideoIntensity As CheckBox- Friend WithEvents chkExportVideoIntensity As CheckBox- Friend WithEvents chkPreviewVideoField As CheckBox- Friend WithEvents chkExportVideoField As CheckBox- Friend WithEvents lblPreviewVideo As Label- Friend WithEvents lblExportVideo As Label- Friend WithEvents pnlPreviewIntensity As Panel- Friend WithEvents pnlPreviewField As Panel- Friend WithEvents cmbFieldColorScheme As ComboBox- Friend WithEvents Label3 As Label- Friend WithEvents Label2 As Label- Friend WithEvents cmbIntensityColorScheme As ComboBox- Friend WithEvents btnStartSimulation As Button- Friend WithEvents numFieldScaling As NumericUpDown- Friend WithEvents Label5 As Label- Friend WithEvents numIntensityScaling As NumericUpDown- Friend WithEvents numScaleIntensityValues As Label- Friend WithEvents btnEditObjectSourceList As Button- Friend WithEvents chkUseObjectSources As CheckBox- Friend WithEvents lblScaleImgSourceIntensity As Label- Friend WithEvents numScaleImageSource As NumericUpDown- Friend WithEvents numOffsetIntensity As NumericUpDown- Friend WithEvents numOffsetField As NumericUpDown- Friend WithEvents Label6 As Label- Friend WithEvents lblOffsetField As Label- Friend WithEvents btnViewIntensityVideo As Button- Friend WithEvents btnViewFieldVideo As Button- Friend WithEvents lblVideoQuality As Label- Friend WithEvents numQuality As NumericUpDown- Friend WithEvents chkUseGPU As CheckBox- Friend WithEvents Label7 As Label- Friend WithEvents StatusStrip1 As StatusStrip- Friend WithEvents ToolStripStatusLabel1 As ToolStripStatusLabel- Friend WithEvents btnPauzeResume As Button- Friend WithEvents pnlSourceImage As Panel- Friend WithEvents pnlProbeImage As Panel- Friend WithEvents grpProbe1 As GroupBox- Friend WithEvents radFullScale As RadioButton- Friend WithEvents radRunningScale As RadioButton- Friend WithEvents chkAutoScaleY As CheckBox- Friend WithEvents chkAutoScaleX As CheckBox- Friend WithEvents numBPosY As NumericUpDown- Friend WithEvents numAPosY As NumericUpDown- Friend WithEvents numBPosX As NumericUpDown- Friend WithEvents numAPosX As NumericUpDown- Friend WithEvents butPicPositions As Button- Friend WithEvents Label16 As Label- Friend WithEvents cmbPlaceOn As ComboBox- Friend WithEvents cmbMeasurement As ComboBox- Friend WithEvents Label13 As Label- Friend WithEvents Label15 As Label- Friend WithEvents cmbBoxSize As ComboBox- Friend WithEvents cmbProbeType As ComboBox- Friend WithEvents Label14 As Label- Friend WithEvents Label12 As Label- Friend WithEvents Label11 As Label- Friend WithEvents Label17 As Label- Friend WithEvents Label10 As Label- Friend WithEvents Label9 As Label- Friend WithEvents Label8 As Label- Friend WithEvents txtStartAfterStep As TextBox- Friend WithEvents chkStartAfterStep As CheckBox- Friend WithEvents Label19 As Label- Friend WithEvents Label18 As Label- Friend WithEvents txtMaxScaleY As TextBox- Friend WithEvents txtMinScaleY As TextBox- Friend WithEvents Label20 As Label- Friend WithEvents numRefractiveIndex As NumericUpDown- Friend WithEvents chkProbeOn1 As CheckBox- Friend WithEvents Label21 As Label- Friend WithEvents numRunningWindow As NumericUpDown- Friend WithEvents grpProbe2 As GroupBox- Friend WithEvents Label22 As Label- Friend WithEvents numRunningWindow2 As NumericUpDown- Friend WithEvents chkProbeOn2 As CheckBox- Friend WithEvents txtStartAfterStep2 As TextBox- Friend WithEvents chkStartAfterStep2 As CheckBox- Friend WithEvents Label23 As Label- Friend WithEvents Label24 As Label- Friend WithEvents txtMaxScaleY2 As TextBox- Friend WithEvents txtMinScaleY2 As TextBox- Friend WithEvents radFullScale2 As RadioButton- Friend WithEvents radRunningScale2 As RadioButton- Friend WithEvents chkAutoScaleY2 As CheckBox- Friend WithEvents chkAutoScaleX2 As CheckBox- Friend WithEvents numBPosY2 As NumericUpDown- Friend WithEvents numAPosY2 As NumericUpDown- Friend WithEvents numBPosX2 As NumericUpDown- Friend WithEvents numAPosX2 As NumericUpDown- Friend WithEvents butPicPositions2 As Button- Friend WithEvents Label25 As Label- Friend WithEvents cmbPlaceOn2 As ComboBox- Friend WithEvents cmbMeasurement2 As ComboBox- Friend WithEvents Label26 As Label- Friend WithEvents Label27 As Label- Friend WithEvents cmbBoxSize2 As ComboBox- Friend WithEvents cmbProbeType2 As ComboBox- Friend WithEvents Label28 As Label- Friend WithEvents Label29 As Label- Friend WithEvents Label30 As Label- Friend WithEvents Label31 As Label- Friend WithEvents Label32 As Label- Friend WithEvents Label33 As Label- Friend WithEvents Label34 As Label- Friend WithEvents btnDelete As Button- Friend WithEvents lstSources As ListBox- Friend WithEvents grpSourceDetails As GroupBox- Friend WithEvents lblPosition As Label- Friend WithEvents numSourcePositionY As NumericUpDown- Friend WithEvents numSourcePositionX As NumericUpDown- Friend WithEvents btnPickSourcePosition As Button- Friend WithEvents Label36 As Label- Friend WithEvents Label35 As Label- Friend WithEvents btnCopy As Button- Friend WithEvents grpSingleSource As GroupBox- Friend WithEvents Label43 As Label- Friend WithEvents Label42 As Label- Friend WithEvents Label41 As Label- Friend WithEvents Label40 As Label- Friend WithEvents radModePulsed As RadioButton- Friend WithEvents radModeContinuous As RadioButton- Friend WithEvents txtName As TextBox- Friend WithEvents cmbMainType As ComboBox- Friend WithEvents Label39 As Label- Friend WithEvents lblName As Label- Friend WithEvents Label38 As Label- Friend WithEvents numOffStateCycles As NumericUpDown- Friend WithEvents numAmplitude As NumericUpDown- Friend WithEvents numFrequency As NumericUpDown- Friend WithEvents numPulseWidthCycles As NumericUpDown- Friend WithEvents Label44 As Label- Friend WithEvents Label46 As Label- Friend WithEvents Label45 As Label- Friend WithEvents cmbPulseShape As ComboBox- Friend WithEvents grpComposite As GroupBox- Friend WithEvents numSpacingSizeX As NumericUpDown- Friend WithEvents numArraySizeX As NumericUpDown- Friend WithEvents numRandomizeFrequency As NumericUpDown- Friend WithEvents Label50 As Label- Friend WithEvents Label51 As Label- Friend WithEvents Label52 As Label- Friend WithEvents Label53 As Label- Friend WithEvents cmbCompositeProperties As ComboBox- Friend WithEvents numPhase As NumericUpDown- Friend WithEvents Label54 As Label- Friend WithEvents numSpacingSizeY As NumericUpDown- Friend WithEvents numArraySizeY As NumericUpDown- Friend WithEvents btnSaveSource As Button- Friend WithEvents numRandomizeOffWidth As NumericUpDown- Friend WithEvents numRandomizePosition As NumericUpDown- Friend WithEvents NumRandomizePhase As NumericUpDown- Friend WithEvents chkRandomizePhase As CheckBox- Friend WithEvents chkRandomizePosition As CheckBox- Friend WithEvents chkOffWidth As CheckBox- Friend WithEvents chkRandomizeFrequency As CheckBox- Friend WithEvents btnOpenVideoFolder As Button- Friend WithEvents txtDetachAfterSteps As TextBox- Friend WithEvents Label47 As Label- Friend WithEvents chkDetachSource As CheckBox- Friend WithEvents pnlPosition As Panel- Friend WithEvents lblLambdaIs As Label- Friend WithEvents chkSourceOn As CheckBox- Friend WithEvents btnRenameProject As Button- Friend WithEvents btnDeleteProject As Button- Friend WithEvents btnLoadProject As Button- Friend WithEvents ChooseProjectRootToolStripMenuItem As ToolStripMenuItem- Friend WithEvents SetCValueToolStripMenuItem As ToolStripMenuItem- Friend WithEvents btnExportIntensityFrame As Button- Friend WithEvents btnExportFieldFrame As Button- Friend WithEvents btnOpenImageFolder As Button- Friend WithEvents btnNew As Button- Friend WithEvents lblWarningIntensity As Label- Friend WithEvents lblWarningField As Label- Friend WithEvents grpNavigateTabs As GroupBox- Friend WithEvents grpSimulationControlButtons As GroupBox- Friend WithEvents btnGotoPreview As Button- Friend WithEvents btnGotoProbes As Button- Friend WithEvents btnGotoSources As Button- Friend WithEvents btnGotoConfiguration As Button- Friend WithEvents Panel1 As Panel- Friend WithEvents grpShareImage As GroupBox- Friend WithEvents btnShareIntensityImage As Button- Friend WithEvents btnShareFieldImage As Button- Friend WithEvents btnShareSceneImage As Button- Friend WithEvents btnNewProject As Button- Friend WithEvents btnColor9 As Button- Friend WithEvents btnColor8 As Button- Friend WithEvents grpProjects As GroupBox- Friend WithEvents grpPlaceSource As GroupBox- Friend WithEvents GroupBox2 As GroupBox- Friend WithEvents Label49 As Label- Friend WithEvents Label48 As Label- Friend WithEvents Label37 As Label- Friend WithEvents btnDeleteColorScheme As Button- Friend WithEvents btnRenameColorScheme As Button- Friend WithEvents Label56 As Label- Friend WithEvents Label55 As Label- Friend WithEvents lstAllProjects As ListView- Friend WithEvents colProjectName As ColumnHeader- Friend WithEvents colLastEdit As ColumnHeader- Friend WithEvents lstImages As ListView- Friend WithEvents colImageName As ColumnHeader- Friend WithEvents colCreatedOn As ColumnHeader- Friend WithEvents lstVideo As ListView- Friend WithEvents colVideoName As ColumnHeader- Friend WithEvents lstAllProjects3 As ListView- Friend WithEvents colProjectName2 As ColumnHeader- Friend WithEvents colLastEdited2 As ColumnHeader- Friend WithEvents btnDeleteScene As Button- Friend WithEvents btnLoadExternal As Button- Friend WithEvents pnlPreview As Panel- Friend WithEvents Label57 As Label- Friend WithEvents lstScenes As ListView- Friend WithEvents colSceneName As ColumnHeader- Friend WithEvents colSceneCreated As ColumnHeader- Friend WithEvents btnOpenImageFolder2 As Button- Friend WithEvents btnViewVIdeoInPlayer2 As Button- Friend WithEvents btnOpenVIdeoFolder2 As Button- Friend WithEvents lblPreview As Label- Friend WithEvents btnDeleteVideos As Button- Friend WithEvents btnDeleteImages As Button- Friend WithEvents btnCopyToClipboard As Button- Protected Friend WithEvents colCreatedOn2 As ColumnHeader- Friend WithEvents btnShareWithEditors As Button- Friend WithEvents chkUse4thOrderLaplacian As CheckBox- Friend WithEvents lblInfo As Label- Friend WithEvents btnRenameVideo As Button- Friend WithEvents picPreviewSource As PictureBox- Friend WithEvents chkAutoRescaleSourceOn As CheckBox- Friend WithEvents numSimulationSteps As NumericUpDown- Friend WithEvents Label59 As Label- Friend WithEvents Label58 As Label- Friend WithEvents Label60 As Label- Friend WithEvents Label61 As Label- Friend WithEvents numTimeDecayFactor As NumericUpDown- Friend WithEvents Label62 As Label- Friend WithEvents Label63 As Label- Friend WithEvents numFieldScaling2 As NumericUpDown- Friend WithEvents chkDiplayOverlayInField As CheckBox- Friend WithEvents Label64 As Label- Friend WithEvents numIntensityScaling2 As NumericUpDown- Friend WithEvents chkDiplayOverlayInIntensity As CheckBox- Friend WithEvents numBrightnessIntensityOverlay As NumericUpDown- Friend WithEvents numBrightnessFieldOverlay As NumericUpDown- Friend WithEvents Label66 As Label- Friend WithEvents Label65 As Label- Friend WithEvents pnlPreviewIntensityProps As Panel- Friend WithEvents chkExportVideoIntensity2 As CheckBox- Friend WithEvents Panel3 As Panel- Friend WithEvents chkExportVideoField2 As CheckBox- Friend WithEvents InfoToolStripMenuItem As ToolStripMenuItem- Friend WithEvents HelpToolStripMenuItem As ToolStripMenuItem- Friend WithEvents AboutToolStripMenuItem As ToolStripMenuItem- Friend WithEvents btnSaveConfiguration2 As Button- Friend WithEvents btnDescription As Button- Friend WithEvents btnPickRoot As Button-End Classdiff --git a/2D_wave_sim_V01/Form1.Probes.vb b/2D_wave_sim_V01/Form1.Probes.vbdeleted file mode 100644index 8e09590..0000000--- a/2D_wave_sim_V01/Form1.Probes.vb+++ /dev/null@@ -1,885 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Drawing-Imports System.Drawing.Drawing2D-Imports System.Globalization--' ------------------------------------------------------------------ probes (Probes tab)-'-' A probe measures the field (amplitude) or the intensity while the simulation runs and shows the result in a little-' graph box in the field or intensity picture:-' Point (A) the value at A against the simulation step-' Line (A-B) the values along the line A-B (position on the line on X) at the current step; it changes every step-' The settings of the probe are kept in _probes (see ProbeSettings) and stored in the "probes" section of the project-' file. Each probe has its own "On" checkbox (ProbeSettings.Active): when off, the probe is hidden - its marker,-' graph box and burned-in overlay are all skipped - but it keeps being sampled, so switching it back on shows its-' recorded history rather than starting from a blank graph.-'-' There are two independent probes, Probe 1 and Probe 2, each with its own group of controls (grpProbe1/grpProbe2).-' _probeUi holds one ProbeControlSet per group, so the code that reads/writes a probe's settings and the events of-' its controls can be shared between the two groups instead of being written out twice.-'-' The Probes tab shows a copy of a simulation picture (Preview tab, "Copy Image..." buttons), shared by both probes.-' Each group has its own Pick button: it lets you click in that picture for that probe's position A, for a line-' position B, and the top left corner of that probe's graph box.-Partial Public Class Form1-- ' the number of probe groups the controls support (Probe 1, Probe 2)- Private Const ProbeCount As Integer = 2-- ' the probes of the project, always exactly ProbeCount entries, one per group of controls- Private _probes As List(Of ProbeSettings) = NewProbeList()-- ' the controls of each probe group; built once in InitializeProbeControls- Private _probeUi As ProbeControlSet()-- ' True while the code itself fills the probe controls (their change events are then ignored)- Private _loadingProbe As Boolean-- ' picking positions in the picture: 0 = not picking, 1 = position A is next, 2 = position B is next (line only),- ' 3 = the top left corner of the graph box is next. _pickIndex is the probe (into _probes/_probeUi) being picked.- Private _pickStep As Integer- Private _pickIndex As Integer- Private _pickHover As Point?-- ' the probes, the canvas and the number of steps of the run whose pictures are shown in the previews- Private _runProbes As List(Of ProbeSettings)- Private _runCanvas As Size- Private _runSteps As Integer- Private ReadOnly _probeTraces As New List(Of ProbeTrace)()-- ''' <summary>- ''' The control set for a probe index, or Nothing while the form is still being constructed: InitializeComponent- ''' (which runs before InitializeProbeControls) sets some control values away from their .NET default, such as- ''' numRunningWindow's 500, and that alone fires the control's change event immediately, before _probeUi exists.- ''' The event handlers below go through this instead of indexing _probeUi directly, so that early firing is a- ''' harmless no-op instead of a NullReferenceException.- ''' </summary>- Private Function ProbeUi(index As Integer) As ProbeControlSet- If _probeUi Is Nothing Then Return Nothing- Return _probeUi(index)- End Function-- Private Shared Function NewProbeList() As List(Of ProbeSettings)- Dim list As New List(Of ProbeSettings)()- For i As Integer = 0 To ProbeCount - 1- list.Add(New ProbeSettings())- Next- Return list- End Function-- ''' <summary>Keeps _probes at exactly ProbeCount entries: pads with new (default) probes when a saved project has- ''' fewer (from before Probe 2 existed), trims extras when it somehow has more.</summary>- Private Sub NormalizeProbeCount()- While _probes.Count < ProbeCount- _probes.Add(New ProbeSettings())- End While- While _probes.Count > ProbeCount- _probes.RemoveAt(_probes.Count - 1)- End While- End Sub-- ''' <summary>The controls of one probe's group box (Probe 1 or Probe 2), so the code that reads and writes a- ''' probe's settings, and the events of its controls, can be shared between the two groups.</summary>- Private NotInheritable Class ProbeControlSet- Public ReadOnly Index As Integer- Public ReadOnly Title As String- Public ReadOnly ChkOn As CheckBox- Public ReadOnly CmbPlaceOn As ComboBox- Public ReadOnly CmbMeasurement As ComboBox- Public ReadOnly CmbProbeType As ComboBox- Public ReadOnly CmbBoxSize As ComboBox- Public ReadOnly NumAPosX As NumericUpDown- Public ReadOnly NumAPosY As NumericUpDown- Public ReadOnly NumBPosX As NumericUpDown- Public ReadOnly NumBPosY As NumericUpDown- Public ReadOnly ButPick As Button- Public ReadOnly RadRunning As RadioButton- Public ReadOnly RadFull As RadioButton- Public ReadOnly ChkAutoX As CheckBox- Public ReadOnly ChkAutoY As CheckBox- Public ReadOnly TxtMinY As TextBox- Public ReadOnly TxtMaxY As TextBox- Public ReadOnly ChkStartAfter As CheckBox- Public ReadOnly TxtStartAfter As TextBox- Public ReadOnly NumRunningWindow As NumericUpDown-- ''' <summary>The controls that only make sense for a line probe (position B and its labels); disabled for a point probe.</summary>- Public ReadOnly BOnlyControls As Control()-- ''' <summary>The Pick button's own text ("Pick"), so it can be restored after showing "Cancel" while picking.</summary>- Public ReadOnly PickButtonText As String-- Public Sub New(index As Integer, title As String, chkOn As CheckBox, cmbPlaceOn As ComboBox, cmbMeasurement As ComboBox,- cmbProbeType As ComboBox, cmbBoxSize As ComboBox, numAPosX As NumericUpDown, numAPosY As NumericUpDown,- numBPosX As NumericUpDown, numBPosY As NumericUpDown, butPick As Button, radRunning As RadioButton,- radFull As RadioButton, chkAutoX As CheckBox, chkAutoY As CheckBox, txtMinY As TextBox, txtMaxY As TextBox,- chkStartAfter As CheckBox, txtStartAfter As TextBox, numRunningWindow As NumericUpDown, bOnlyControls As Control())- Me.Index = index- Me.Title = title- Me.ChkOn = chkOn- Me.CmbPlaceOn = cmbPlaceOn- Me.CmbMeasurement = cmbMeasurement- Me.CmbProbeType = cmbProbeType- Me.CmbBoxSize = cmbBoxSize- Me.NumAPosX = numAPosX- Me.NumAPosY = numAPosY- Me.NumBPosX = numBPosX- Me.NumBPosY = numBPosY- Me.ButPick = butPick- Me.RadRunning = radRunning- Me.RadFull = radFull- Me.ChkAutoX = chkAutoX- Me.ChkAutoY = chkAutoY- Me.TxtMinY = txtMinY- Me.TxtMaxY = txtMaxY- Me.ChkStartAfter = chkStartAfter- Me.TxtStartAfter = txtStartAfter- Me.NumRunningWindow = numRunningWindow- Me.BOnlyControls = bOnlyControls- Me.PickButtonText = butPick.Text- End Sub- End Class-- ' ---------------------------------------------------------------- setting up-- Private Sub InitializeProbeControls()- _probeUi = New ProbeControlSet() {- New ProbeControlSet(index:=0, title:="Probe 1", chkOn:=chkProbeOn1, cmbPlaceOn:=cmbPlaceOn, cmbMeasurement:=cmbMeasurement,- cmbProbeType:=cmbProbeType, cmbBoxSize:=cmbBoxSize, numAPosX:=numAPosX, numAPosY:=numAPosY,- numBPosX:=numBPosX, numBPosY:=numBPosY, butPick:=butPicPositions, radRunning:=radRunningScale,- radFull:=radFullScale, chkAutoX:=chkAutoScaleX, chkAutoY:=chkAutoScaleY, txtMinY:=txtMinScaleY,- txtMaxY:=txtMaxScaleY, chkStartAfter:=chkStartAfterStep, txtStartAfter:=txtStartAfterStep,- numRunningWindow:=numRunningWindow, bOnlyControls:=New Control() {numBPosX, numBPosY, Label14, Label15, Label16}),- New ProbeControlSet(index:=1, title:="Probe 2", chkOn:=chkProbeOn2, cmbPlaceOn:=cmbPlaceOn2, cmbMeasurement:=cmbMeasurement2,- cmbProbeType:=cmbProbeType2, cmbBoxSize:=cmbBoxSize2, numAPosX:=numAPosX2, numAPosY:=numAPosY2,- numBPosX:=numBPosX2, numBPosY:=numBPosY2, butPick:=butPicPositions2, radRunning:=radRunningScale2,- radFull:=radFullScale2, chkAutoX:=chkAutoScaleX2, chkAutoY:=chkAutoScaleY2, txtMinY:=txtMinScaleY2,- txtMaxY:=txtMaxScaleY2, chkStartAfter:=chkStartAfterStep2, txtStartAfter:=txtStartAfterStep2,- numRunningWindow:=numRunningWindow2, bOnlyControls:=New Control() {numBPosX2, numBPosY2, Label28, Label27, Label25})- }-- For Each ui As ProbeControlSet In _probeUi- For Each combo As ComboBox In New ComboBox() {ui.CmbPlaceOn, ui.CmbMeasurement, ui.CmbProbeType, ui.CmbBoxSize}- combo.DropDownStyle = ComboBoxStyle.DropDownList- Next-- ' the choices are made here (not in the designer), in the order of the enumerations of ProbeSettings- ui.CmbPlaceOn.Items.Clear()- ui.CmbPlaceOn.Items.AddRange(New Object() {"Field", "Intensity"})- ui.CmbProbeType.Items.Clear()- ui.CmbProbeType.Items.AddRange(New Object() {"Point (A)", "Line (A-B)"})- ui.CmbBoxSize.Items.Clear()- ui.CmbBoxSize.Items.AddRange(New Object() {"Tiny (200 x 100)", "Small (300 x 150)", "Medium (400 x 200)", "Large (500 x 250)", "Extra Large (700 x 350)"})-- For Each box As NumericUpDown In New NumericUpDown() {ui.NumAPosX, ui.NumAPosY, ui.NumBPosX, ui.NumBPosY}- box.DecimalPlaces = 0- box.Minimum = 0D- box.Maximum = CDec(SceneSettings.MaxCanvasSize - 1)- Next-- ui.NumRunningWindow.DecimalPlaces = 0- ui.NumRunningWindow.Minimum = 10D- ui.NumRunningWindow.Maximum = CDec(ProbeSettings.MaxRunningWindow)- Next-- ' the graphs and markers are drawn over the pictures (the pictures themselves stay clean)- AddHandler _picField.Paint, AddressOf PreviewPicture_Paint- AddHandler _picIntensity.Paint, AddressOf PreviewPicture_Paint- AddHandler _picProbe.Paint, AddressOf ProbePicture_Paint- AddHandler _picProbe.MouseClick, AddressOf ProbePicture_MouseClick- AddHandler _picProbe.MouseMove, AddressOf ProbePicture_MouseMove- AddHandler _picProbe.MouseLeave, AddressOf ProbePicture_MouseLeave-- ShowProbesInControls()- End Sub-- ''' <summary>Copies the values of both probes into their controls.</summary>- Private Sub ShowProbesInControls()- EndPick()- For Each ui As ProbeControlSet In _probeUi- ShowProbeInControls(ui)- Next- End Sub-- ''' <summary>Copies the values of one probe into its group of controls.</summary>- Private Sub ShowProbeInControls(ui As ProbeControlSet)- Dim p As ProbeSettings = _probes(ui.Index)- p.Normalize()-- _loadingProbe = True- Try- SetProbeRanges(ui)-- ui.ChkOn.Checked = p.Active- ui.CmbPlaceOn.SelectedIndex = CInt(p.PlaceOn)- FillMeasurementCombo(ui, p)- ui.CmbProbeType.SelectedIndex = CInt(p.Kind)- ui.CmbBoxSize.SelectedIndex = CInt(p.BoxSize)-- ui.NumAPosX.Value = ClampToRange(ui.NumAPosX, p.PosAX)- ui.NumAPosY.Value = ClampToRange(ui.NumAPosY, p.PosAY)- ui.NumBPosX.Value = ClampToRange(ui.NumBPosX, p.PosBX)- ui.NumBPosY.Value = ClampToRange(ui.NumBPosY, p.PosBY)-- ui.RadRunning.Checked = (p.ScaleMode = ProbeScaleMode.Running)- ui.RadFull.Checked = (p.ScaleMode = ProbeScaleMode.Full)- ui.ChkAutoX.Checked = p.AutoScaleX- ui.ChkAutoY.Checked = p.AutoScaleY- ui.TxtMinY.Text = p.YMin.ToString("G6", CultureInfo.InvariantCulture)- ui.TxtMaxY.Text = p.YMax.ToString("G6", CultureInfo.InvariantCulture)- ui.ChkStartAfter.Checked = p.UseStartAfterStep- ui.TxtStartAfter.Text = p.StartAfterStep.ToString(CultureInfo.InvariantCulture)- ui.NumRunningWindow.Value = ClampToRange(ui.NumRunningWindow, p.RunningWindow)- Finally- _loadingProbe = False- End Try-- UpdateProbeControlState(ui)- InvalidateProbePictures()- End Sub-- ''' <summary>The measurements that fit the picture: only the amplitude on the field, intensity and integrated intensity on the intensity.</summary>- Private Sub FillMeasurementCombo(ui As ProbeControlSet, p As ProbeSettings)- ui.CmbMeasurement.Items.Clear()- If p.PlaceOn = ProbePlaceOn.Field Then- ui.CmbMeasurement.Items.Add("Amplitude")- ui.CmbMeasurement.SelectedIndex = 0- Else- ui.CmbMeasurement.Items.Add("Intensity")- ui.CmbMeasurement.Items.Add("Integrated intensity")- ui.CmbMeasurement.SelectedIndex = If(p.Measurement = ProbeMeasurement.IntegratedIntensity, 1, 0)- End If- End Sub-- Private Shared Function MeasurementFromIndex(placeOn As ProbePlaceOn, index As Integer) As ProbeMeasurement- If placeOn = ProbePlaceOn.Field Then Return ProbeMeasurement.Amplitude- Return If(index = 1, ProbeMeasurement.IntegratedIntensity, ProbeMeasurement.Intensity)- End Function-- ''' <summary>- ''' Position B is only used by a line; with a point only position A is available. The step axis (running or full- ''' scale, automatic X, running window) is only used by a point: the X axis of a line is the line itself. The- ''' manual Y range boxes are only usable when the Y axis is not scaled automatically, and the "start after step"- ''' box only when that is ticked.- ''' </summary>- Private Sub UpdateProbeControlState(ui As ProbeControlSet)- Dim isLine As Boolean = (_probes(ui.Index).Kind = ProbeKind.Line)- For Each c As Control In ui.BOnlyControls- c.Enabled = isLine- Next- For Each c As Control In New Control() {ui.RadRunning, ui.RadFull, ui.ChkAutoX, ui.NumRunningWindow}- c.Enabled = Not isLine- Next- ui.TxtMinY.Enabled = Not ui.ChkAutoY.Checked- ui.TxtMaxY.Enabled = Not ui.ChkAutoY.Checked- ui.TxtStartAfter.Enabled = ui.ChkStartAfter.Checked- End Sub-- ''' <summary>The positions of both probes can be as large as the canvas of the scene (when that is known).</summary>- Private Sub SetProbeRanges()- If _probeUi Is Nothing Then Return- For Each ui As ProbeControlSet In _probeUi- SetProbeRanges(ui)- Next- End Sub-- ''' <summary>The positions of one probe can be as large as the canvas of the scene (when that is known).</summary>- Private Sub SetProbeRanges(ui As ProbeControlSet)- Dim canvas As Size = EffectiveCanvas()- Dim maxX As Decimal = CDec(If(canvas.Width > 0, canvas.Width - 1, SceneSettings.MaxCanvasSize - 1))- Dim maxY As Decimal = CDec(If(canvas.Height > 0, canvas.Height - 1, SceneSettings.MaxCanvasSize - 1))-- Dim wasLoading As Boolean = _loadingProbe- _loadingProbe = True- Try- ui.NumAPosX.Maximum = maxX- ui.NumBPosX.Maximum = maxX- ui.NumAPosY.Maximum = maxY- ui.NumBPosY.Maximum = maxY- Finally- _loadingProbe = wasLoading- End Try- End Sub-- ''' <summary>Takes the values from one probe's controls into that probe.</summary>- Private Sub ReadProbeControls(ui As ProbeControlSet)- Dim p As ProbeSettings = _probes(ui.Index)-- p.Active = ui.ChkOn.Checked- If ui.CmbPlaceOn.SelectedIndex >= 0 Then p.PlaceOn = CType(ui.CmbPlaceOn.SelectedIndex, ProbePlaceOn)- If ui.CmbMeasurement.SelectedIndex >= 0 Then p.Measurement = MeasurementFromIndex(p.PlaceOn, ui.CmbMeasurement.SelectedIndex)- If ui.CmbProbeType.SelectedIndex >= 0 Then p.Kind = CType(ui.CmbProbeType.SelectedIndex, ProbeKind)- If ui.CmbBoxSize.SelectedIndex >= 0 Then p.BoxSize = CType(ui.CmbBoxSize.SelectedIndex, ProbeBoxSize)-- ui.NumAPosX.Validate()- ui.NumAPosY.Validate()- ui.NumBPosX.Validate()- ui.NumBPosY.Validate()- p.PosAX = CInt(ui.NumAPosX.Value)- p.PosAY = CInt(ui.NumAPosY.Value)- p.PosBX = CInt(ui.NumBPosX.Value)- p.PosBY = CInt(ui.NumBPosY.Value)-- p.ScaleMode = If(ui.RadFull.Checked, ProbeScaleMode.Full, ProbeScaleMode.Running)- p.AutoScaleX = ui.ChkAutoX.Checked- p.AutoScaleY = ui.ChkAutoY.Checked-- If Not ui.ChkAutoY.Checked Then- Dim yMin As Double- Dim yMax As Double- If Double.TryParse(ui.TxtMinY.Text, NumberStyles.Float, CultureInfo.InvariantCulture, yMin) Then p.YMin = yMin- If Double.TryParse(ui.TxtMaxY.Text, NumberStyles.Float, CultureInfo.InvariantCulture, yMax) Then p.YMax = yMax- End If-- p.UseStartAfterStep = ui.ChkStartAfter.Checked- Dim startStep As Integer- If Integer.TryParse(ui.TxtStartAfter.Text, NumberStyles.Integer, CultureInfo.InvariantCulture, startStep) Then p.StartAfterStep = startStep-- ui.NumRunningWindow.Validate()- p.RunningWindow = CInt(ui.NumRunningWindow.Value)-- p.Normalize()- End Sub-- ' ---------------------------------------------------------------- events of the controls (Probe 1)-- Private Sub ProbeCombo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbPlaceOn.SelectedIndexChanged,- cmbMeasurement.SelectedIndexChanged, cmbProbeType.SelectedIndexChanged, cmbBoxSize.SelectedIndexChanged- HandleProbeComboChanged(ProbeUi(0), sender)- End Sub-- Private Sub ProbePosition_ValueChanged(sender As Object, e As EventArgs) Handles numAPosX.ValueChanged, numAPosY.ValueChanged,- numBPosX.ValueChanged, numBPosY.ValueChanged- HandleProbePositionChanged(ProbeUi(0))- End Sub-- Private Sub ProbeOn_CheckedChanged(sender As Object, e As EventArgs) Handles chkProbeOn1.CheckedChanged- HandleProbeOnChanged(ProbeUi(0))- End Sub-- Private Sub ProbeTextBox_KeyDown(sender As Object, e As KeyEventArgs) Handles txtMinScaleY.KeyDown, txtMaxScaleY.KeyDown,- txtStartAfterStep.KeyDown- HandleProbeTextBoxKeyDown(ProbeUi(0), e)- End Sub-- Private Sub ProbeScaleMode_CheckedChanged(sender As Object, e As EventArgs) Handles radRunningScale.CheckedChanged, radFullScale.CheckedChanged- HandleProbeScaleModeChanged(ProbeUi(0))- End Sub-- Private Sub ProbeAutoScale_CheckedChanged(sender As Object, e As EventArgs) Handles chkAutoScaleX.CheckedChanged, chkAutoScaleY.CheckedChanged- HandleProbeAutoScaleChanged(ProbeUi(0))- End Sub-- Private Sub ProbeYRange_Validated(sender As Object, e As EventArgs) Handles txtMinScaleY.Validated, txtMaxScaleY.Validated- HandleProbeControlApplied(ProbeUi(0))- End Sub-- Private Sub ProbeStartAfterStep_CheckedChanged(sender As Object, e As EventArgs) Handles chkStartAfterStep.CheckedChanged- HandleProbeStartAfterStepChanged(ProbeUi(0))- End Sub-- Private Sub ProbeStartAfterStep_Validated(sender As Object, e As EventArgs) Handles txtStartAfterStep.Validated- HandleProbeControlApplied(ProbeUi(0))- End Sub-- Private Sub ProbeRunningWindow_ValueChanged(sender As Object, e As EventArgs) Handles numRunningWindow.ValueChanged- HandleProbeControlApplied(ProbeUi(0))- End Sub-- ' ---------------------------------------------------------------- events of the controls (Probe 2), same handling as Probe 1-- Private Sub ProbeCombo2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbPlaceOn2.SelectedIndexChanged,- cmbMeasurement2.SelectedIndexChanged, cmbProbeType2.SelectedIndexChanged, cmbBoxSize2.SelectedIndexChanged- HandleProbeComboChanged(ProbeUi(1), sender)- End Sub-- Private Sub ProbePosition2_ValueChanged(sender As Object, e As EventArgs) Handles numAPosX2.ValueChanged, numAPosY2.ValueChanged,- numBPosX2.ValueChanged, numBPosY2.ValueChanged- HandleProbePositionChanged(ProbeUi(1))- End Sub-- Private Sub ProbeOn2_CheckedChanged(sender As Object, e As EventArgs) Handles chkProbeOn2.CheckedChanged- HandleProbeOnChanged(ProbeUi(1))- End Sub-- Private Sub ProbeTextBox2_KeyDown(sender As Object, e As KeyEventArgs) Handles txtMinScaleY2.KeyDown, txtMaxScaleY2.KeyDown,- txtStartAfterStep2.KeyDown- HandleProbeTextBoxKeyDown(ProbeUi(1), e)- End Sub-- Private Sub ProbeScaleMode2_CheckedChanged(sender As Object, e As EventArgs) Handles radRunningScale2.CheckedChanged, radFullScale2.CheckedChanged- HandleProbeScaleModeChanged(ProbeUi(1))- End Sub-- Private Sub ProbeAutoScale2_CheckedChanged(sender As Object, e As EventArgs) Handles chkAutoScaleX2.CheckedChanged, chkAutoScaleY2.CheckedChanged- HandleProbeAutoScaleChanged(ProbeUi(1))- End Sub-- Private Sub ProbeYRange2_Validated(sender As Object, e As EventArgs) Handles txtMinScaleY2.Validated, txtMaxScaleY2.Validated- HandleProbeControlApplied(ProbeUi(1))- End Sub-- Private Sub ProbeStartAfterStep2_CheckedChanged(sender As Object, e As EventArgs) Handles chkStartAfterStep2.CheckedChanged- HandleProbeStartAfterStepChanged(ProbeUi(1))- End Sub-- Private Sub ProbeStartAfterStep2_Validated(sender As Object, e As EventArgs) Handles txtStartAfterStep2.Validated- HandleProbeControlApplied(ProbeUi(1))- End Sub-- Private Sub ProbeRunningWindow2_ValueChanged(sender As Object, e As EventArgs) Handles numRunningWindow2.ValueChanged- HandleProbeControlApplied(ProbeUi(1))- End Sub-- ' ---------------------------------------------------------------- shared handling of one probe (given its control set)-- Private Sub HandleProbeComboChanged(ui As ProbeControlSet, sender As Object)- If ui Is Nothing OrElse _loadingProbe Then Return- If sender Is ui.CmbProbeType AndAlso _pickStep <> 0 AndAlso _pickIndex = ui.Index Then EndPick() ' the number of clicks depends on the type; only cancel a pick that belongs to this probe-- If sender Is ui.CmbPlaceOn AndAlso ui.CmbPlaceOn.SelectedIndex >= 0 Then- ' the measurements that are possible depend on the picture- Dim p As ProbeSettings = _probes(ui.Index)- p.PlaceOn = CType(ui.CmbPlaceOn.SelectedIndex, ProbePlaceOn)- p.Normalize()- _loadingProbe = True- Try- FillMeasurementCombo(ui, p)- Finally- _loadingProbe = False- End Try- End If-- ReadProbeControls(ui)- UpdateProbeControlState(ui)- ProbeSettingsChanged()- End Sub-- Private Sub HandleProbePositionChanged(ui As ProbeControlSet)- If ui Is Nothing OrElse _loadingProbe Then Return- Dim p As ProbeSettings = _probes(ui.Index)- p.PosAX = CInt(ui.NumAPosX.Value)- p.PosAY = CInt(ui.NumAPosY.Value)- p.PosBX = CInt(ui.NumBPosX.Value)- p.PosBY = CInt(ui.NumBPosY.Value)- ProbeSettingsChanged()- End Sub-- Private Sub HandleProbeOnChanged(ui As ProbeControlSet)- If ui Is Nothing OrElse _loadingProbe Then Return- _probes(ui.Index).Active = ui.ChkOn.Checked- ProbeSettingsChanged()- End Sub-- ''' <summary>- ''' Enter in a probe text box applies the value right away (like losing focus does), instead of just beeping;- ''' these are single line boxes, so Enter never inserts an actual line break.- ''' </summary>- Private Sub HandleProbeTextBoxKeyDown(ui As ProbeControlSet, e As KeyEventArgs)- If e.KeyCode <> Keys.Enter Then Return- e.SuppressKeyPress = True- e.Handled = True- If ui Is Nothing OrElse _loadingProbe Then Return- ReadProbeControls(ui)- ProbeSettingsChanged()- End Sub-- Private Sub HandleProbeScaleModeChanged(ui As ProbeControlSet)- If ui Is Nothing OrElse _loadingProbe Then Return- _probes(ui.Index).ScaleMode = If(ui.RadFull.Checked, ProbeScaleMode.Full, ProbeScaleMode.Running)- ProbeSettingsChanged()- End Sub-- Private Sub HandleProbeAutoScaleChanged(ui As ProbeControlSet)- If ui Is Nothing OrElse _loadingProbe Then Return- Dim p As ProbeSettings = _probes(ui.Index)- Dim wasAutoY As Boolean = p.AutoScaleY- p.AutoScaleX = ui.ChkAutoX.Checked- p.AutoScaleY = ui.ChkAutoY.Checked-- ' switching the automatic value axis off keeps the range that is shown now, ready to fine-tune by hand- If wasAutoY AndAlso Not p.AutoScaleY Then- FreezeValueRange(ui, p)- _loadingProbe = True- Try- ui.TxtMinY.Text = p.YMin.ToString("G6", CultureInfo.InvariantCulture)- ui.TxtMaxY.Text = p.YMax.ToString("G6", CultureInfo.InvariantCulture)- Finally- _loadingProbe = False- End Try- End If- UpdateProbeControlState(ui)- ProbeSettingsChanged()- End Sub-- ''' <summary>The shared tail of the Validated/ValueChanged handlers: re-read this probe's controls and mark the change.</summary>- Private Sub HandleProbeControlApplied(ui As ProbeControlSet)- If ui Is Nothing OrElse _loadingProbe Then Return- ReadProbeControls(ui)- ProbeSettingsChanged()- End Sub-- Private Sub HandleProbeStartAfterStepChanged(ui As ProbeControlSet)- If ui Is Nothing OrElse _loadingProbe Then Return- _probes(ui.Index).UseStartAfterStep = ui.ChkStartAfter.Checked- UpdateProbeControlState(ui)- ProbeSettingsChanged()- End Sub-- ''' <summary>Makes the current value range of the graph the fixed range.</summary>- Private Sub FreezeValueRange(ui As ProbeControlSet, p As ProbeSettings)- Dim i As Integer = ui.Index- If _probeTraces.Count <= i OrElse _runProbes Is Nothing OrElse _runProbes.Count <= i Then Return- If _runProbes(i).Kind <> p.Kind Then Return-- Dim trace As ProbeTrace = _probeTraces(i)- If p.Kind = ProbeKind.Line Then- ' a line probe shows nothing at all before the start step: nothing to freeze- If p.UseStartAfterStep AndAlso trace.StepsSampled < p.StartAfterStep Then Return- If trace.Profile Is Nothing Then Return- ElseIf trace.Series.Count = 0 Then- Return- End If-- Dim automatic As ProbeSettings = p.Clone()- automatic.AutoScaleY = True- Dim x0, x1, y0, y1 As Double- ProbeGraphPainter.ComputeRanges(automatic, trace, _runSteps, x0, x1, y0, y1)- If y1 > y0 Then- p.YMin = y0- p.YMax = y1- End If- End Sub-- Private Sub ProbeSettingsChanged()- MarkProjectChanged()- InvalidateProbePictures()- End Sub-- Private Sub InvalidateProbePictures()- If _picProbe IsNot Nothing Then _picProbe.Invalidate()- If _picField IsNot Nothing Then _picField.Invalidate()- If _picIntensity IsNot Nothing Then _picIntensity.Invalidate()- End Sub-- Private Sub ProbeTabChanged(sender As Object, e As EventArgs) Handles tabMainFunctions.SelectedIndexChanged- EndPick()- SetProbeRanges()- If tabMainFunctions.SelectedTab Is tabProbeList Then- AutoLoadSceneImageIfEmpty(_picProbe)- End If- End Sub-- ' ---------------------------------------------------------------- picking positions in the picture-- Private Sub butPicPositions_Click(sender As Object, e As EventArgs) Handles butPicPositions.Click- StartOrCancelPick(ProbeUi(0))- End Sub-- Private Sub butPicPositions2_Click(sender As Object, e As EventArgs) Handles butPicPositions2.Click- StartOrCancelPick(ProbeUi(1))- End Sub-- ''' <summary>Pressing a group's own Pick button while it is already picking cancels it; pressing it while the- ''' other probe is being picked cancels that one and starts picking this probe instead.</summary>- Private Sub StartOrCancelPick(ui As ProbeControlSet)- If ui Is Nothing Then Return- Dim wasPickingThis As Boolean = (_pickStep <> 0 AndAlso _pickIndex = ui.Index)- EndPick()- If Not wasPickingThis Then StartPick(ui)- End Sub-- ''' <summary>- ''' When there is no picture yet to pick from (no simulation has run), makes a plain black one at the canvas size- ''' that the Configuration tab currently specifies (the scene image's size, or the user defined width/height), so- ''' a probe position can still be picked before ever running a simulation. Replaced by the real picture as soon as- ''' one is copied over from the Preview tab.- ''' </summary>- Private Sub EnsureProbePicture()- Dim canvas As Size = EffectiveCanvas()- If canvas.Width <= 0 OrElse canvas.Height <= 0 Then Return-- Dim placeholder As New Bitmap(canvas.Width, canvas.Height)- Using g As Graphics = Graphics.FromImage(placeholder)- g.Clear(Color.Black)- End Using- _picProbe.Image = placeholder- End Sub-- Private Sub StartPick(ui As ProbeControlSet)- If _picProbe.Image Is Nothing Then EnsureProbePicture()- If _picProbe.Image Is Nothing Then- MessageBox.Show(Me, "There is no picture to pick from yet, and the canvas size is not known either" & vbCrLf &- "(choose a scene image, or a user defined width and height, on the Configuration tab first).",- "Probe positions", MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- _pickIndex = ui.Index- _pickStep = 1- _pickHover = Nothing- _picProbe.Cursor = Cursors.Cross- ui.ButPick.Text = "Cancel"- ShowPickInstruction()- End Sub-- Private Sub ShowPickInstruction()- Dim ui As ProbeControlSet = _probeUi(_pickIndex)- Select Case _pickStep- Case 1- ToolStripStatusLabel1.Text = If(_probes(_pickIndex).Kind = ProbeKind.Line,- ui.Title & ": click in the picture for position A, the start of the line (press Cancel to stop picking).",- ui.Title & ": click in the picture for the position of the probe (press Cancel to stop picking).")- Case 2- ToolStripStatusLabel1.Text = ui.Title & ": click in the picture for position B, the end of the line."- Case 3- ToolStripStatusLabel1.Text = ui.Title & ": click in the picture for the top left corner of the graph box."- Case Else- ToolStripStatusLabel1.Text = ""- End Select- End Sub-- Private Sub EndPick()- Dim wasPicking As Boolean = (_pickStep <> 0)- If wasPicking Then _probeUi(_pickIndex).ButPick.Text = _probeUi(_pickIndex).PickButtonText- _pickStep = 0- _pickHover = Nothing- If _picProbe IsNot Nothing Then- _picProbe.Cursor = Cursors.Default- _picProbe.Invalidate()- End If- If wasPicking Then ToolStripStatusLabel1.Text = ""- End Sub-- Private Sub ProbePicture_MouseClick(sender As Object, e As MouseEventArgs)- If _pickStep = 0 OrElse e.Button <> MouseButtons.Left Then Return- Dim ui As ProbeControlSet = _probeUi(_pickIndex)-- Dim x As Integer- Dim y As Integer- If Not TryPictureToCanvas(_picProbe, e.Location, x, y) Then Return-- Select Case _pickStep- Case 1- ui.NumAPosX.Value = ClampToRange(ui.NumAPosX, x)- ui.NumAPosY.Value = ClampToRange(ui.NumAPosY, y)- _pickStep = If(_probes(_pickIndex).Kind = ProbeKind.Line, 2, 3)- ShowPickInstruction()- Case 2- ui.NumBPosX.Value = ClampToRange(ui.NumBPosX, x)- ui.NumBPosY.Value = ClampToRange(ui.NumBPosY, y)- _pickStep = 3- ShowPickInstruction()- Case Else- _probes(_pickIndex).BoxX = x- _probes(_pickIndex).BoxY = y- ProbeSettingsChanged()- EndPick()- ToolStripStatusLabel1.Text = ""- End Select- _picProbe.Invalidate()- End Sub-- ''' <summary>While the corner of the graph box is picked, the box follows the mouse.</summary>- Private Sub ProbePicture_MouseMove(sender As Object, e As MouseEventArgs)- If _pickStep <> 3 Then Return- _pickHover = e.Location- _picProbe.Invalidate()- End Sub-- Private Sub ProbePicture_MouseLeave(sender As Object, e As EventArgs)- If _pickHover.HasValue Then- _pickHover = Nothing- _picProbe.Invalidate()- End If- End Sub-- ''' <summary>The simulation pixel that is under a point of a picture box; False when the point is outside the picture.</summary>- Private Function TryPictureToCanvas(box As PictureBox, point As Point, ByRef x As Integer, ByRef y As Integer) As Boolean- If box.Image Is Nothing Then Return False-- Dim area As RectangleF = ZoomedImageRectangle(box)- If area.Width <= 0 OrElse area.Height <= 0 OrElse Not area.Contains(point.X, point.Y) Then Return False-- Dim canvas As Size = EffectiveCanvas()- If canvas.Width <= 0 Then canvas = box.Image.Size-- x = CInt(Math.Floor((point.X - area.X) / area.Width * canvas.Width))- y = CInt(Math.Floor((point.Y - area.Y) / area.Height * canvas.Height))- x = Math.Max(0, Math.Min(canvas.Width - 1, x))- y = Math.Max(0, Math.Min(canvas.Height - 1, y))- Return True- End Function-- ''' <summary>The rectangle (in the client area of the picture box) in which the picture is shown (SizeMode Zoom).</summary>- Private Shared Function ZoomedImageRectangle(box As PictureBox) As RectangleF- Dim img As Image = box.Image- If img Is Nothing OrElse img.Width <= 0 OrElse img.Height <= 0 Then Return RectangleF.Empty-- Dim cw As Single = box.ClientSize.Width- Dim ch As Single = box.ClientSize.Height- Dim scale As Single = Math.Min(cw / img.Width, ch / img.Height)- Dim w As Single = img.Width * scale- Dim h As Single = img.Height * scale- Return New RectangleF((cw - w) / 2.0F, (ch - h) / 2.0F, w, h)- End Function-- ''' <summary>A rectangle in scene pixels on the screen: the picture is shown in area, the scene has canvas pixels.</summary>- Private Shared Function ToScreen(r As Rectangle, area As RectangleF, sx As Single, sy As Single) As Rectangle- Return New Rectangle(CInt(Math.Round(area.X + r.X * sx)), CInt(Math.Round(area.Y + r.Y * sy)),- CInt(Math.Round(r.Width * sx)), CInt(Math.Round(r.Height * sy)))- End Function-- ' ---------------------------------------------------------------- drawing over the pictures-- ''' <summary>The markers and graphs of the run over the field or intensity picture of the Preview tab.</summary>- Private Sub PreviewPicture_Paint(sender As Object, e As PaintEventArgs)- Dim box As PictureBox = DirectCast(sender, PictureBox)- If box.Image Is Nothing OrElse _runProbes Is Nothing OrElse _runCanvas.Width <= 0 Then Return-- Dim place As ProbePlaceOn = If(box Is _picField, ProbePlaceOn.Field, ProbePlaceOn.Intensity)- Dim area As RectangleF = ZoomedImageRectangle(box)- If area.Width <= 0 Then Return- Dim sx As Single = area.Width / _runCanvas.Width- Dim sy As Single = area.Height / _runCanvas.Height-- For i As Integer = 0 To _runProbes.Count - 1- ' what is measured comes from the run; how the graph looks can be changed while it runs- Dim probe As ProbeSettings = _runProbes(i).Clone()- If i < _probes.Count Then probe.CopyDisplayFrom(_probes(i))- If probe.PlaceOn <> place OrElse Not probe.Active Then Continue For-- ProbeGraphPainter.DrawMarkers(e.Graphics, probe, i, area.X, area.Y, sx, sy)-- Dim trace As ProbeTrace = Nothing- If i < _probeTraces.Count Then trace = _probeTraces(i)- Dim rect As Rectangle = ToScreen(ProbeGraphPainter.BoxInCanvas(probe, _runCanvas.Width, _runCanvas.Height), area, sx, sy)- ProbeGraphPainter.DrawGraph(e.Graphics, rect, probe.Title(i), probe, trace, _runSteps)- Next- End Sub-- ''' <summary>The markers of both probes, and the graph box outline of whichever one is being edited or positioned, over- ''' the picture on the Probes tab. A switched off probe ("On" unchecked) is hidden here too - the only exception is- ''' while you are actively picking its position or graph box, so you can still see what you are placing.</summary>- Private Sub ProbePicture_Paint(sender As Object, e As PaintEventArgs)- If _picProbe.Image Is Nothing Then Return-- Dim canvas As Size = EffectiveCanvas()- If canvas.Width <= 0 Then canvas = _picProbe.Image.Size- Dim area As RectangleF = ZoomedImageRectangle(_picProbe)- If area.Width <= 0 Then Return- Dim sx As Single = area.Width / canvas.Width- Dim sy As Single = area.Height / canvas.Height-- For i As Integer = 0 To _probes.Count - 1- Dim probe As ProbeSettings = _probes(i)- Dim isBeingPicked As Boolean = (_pickStep <> 0 AndAlso _pickIndex = i)- If Not probe.Active AndAlso Not isBeingPicked Then Continue For-- ProbeGraphPainter.DrawMarkers(e.Graphics, probe, i, area.X, area.Y, sx, sy)-- ' while the corner of this probe's box is being picked, the box follows the mouse- Dim shown As ProbeSettings = probe- If _pickStep = 3 AndAlso _pickIndex = i AndAlso _pickHover.HasValue Then- Dim cx As Integer- Dim cy As Integer- If TryPictureToCanvas(_picProbe, _pickHover.Value, cx, cy) Then- shown = probe.Clone()- shown.BoxX = cx- shown.BoxY = cy- End If- End If-- Dim rect As Rectangle = ToScreen(ProbeGraphPainter.BoxInCanvas(shown, canvas.Width, canvas.Height), area, sx, sy)- Using fill As New SolidBrush(Color.FromArgb(40, 255, 208, 64))- e.Graphics.FillRectangle(fill, rect)- End Using- Using pen As New Pen(Color.FromArgb(230, 255, 208, 64), 1.5F)- pen.DashStyle = DashStyle.Dash- e.Graphics.DrawRectangle(pen, rect)- End Using- Using font As New Font("Segoe UI", 12.0F, FontStyle.Bold, GraphicsUnit.Pixel)- Using brush As New SolidBrush(Color.FromArgb(240, 255, 208, 64))- e.Graphics.DrawString(probe.Title(i), font, brush, rect.X + 4, rect.Y + 3)- End Using- End Using- Next- End Sub-- ' ---------------------------------------------------------------- probes in a simulation run-- Private Sub LoadProbesFromProject()- If _project Is Nothing Then Return- _probes = ProbeSettings.ListFromConfig(_project.Config)- NormalizeProbeCount()- ShowProbesInControls()- End Sub-- Private Sub ResetProbes()- _probes = NewProbeList()- ShowProbesInControls()- End Sub-- ''' <summary>Copies of the probes for a run.</summary>- Private Function ProbesForRun() As List(Of ProbeSettings)- For Each ui As ProbeControlSet In _probeUi- ReadProbeControls(ui)- Next- Dim list As New List(Of ProbeSettings)()- For Each p As ProbeSettings In _probes- list.Add(p.Clone())- Next- Return list- End Function-- ''' <summary>A run starts: the graphs start empty.</summary>- Private Sub BeginProbeRun(probes As List(Of ProbeSettings), canvas As Size, steps As Integer)- _runProbes = probes- _runCanvas = canvas- _runSteps = steps-- _probeTraces.Clear()- If probes IsNot Nothing Then- For i As Integer = 0 To probes.Count - 1- _probeTraces.Add(New ProbeTrace())- Next- End If- InvalidateProbePictures()- End Sub-- ''' <summary>New values of the probes arrive from the running simulation.</summary>- Private Sub ShowProbeSamples(runner As SimulationRunner, update As ProbeUpdate)- If runner IsNot _runner OrElse IsDisposed Then Return-- For i As Integer = 0 To Math.Min(update.Samples.Length, _probeTraces.Count) - 1- _probeTraces(i).Series.Add(update.Samples(i))- If update.Profiles(i) IsNot Nothing Then _probeTraces(i).SetProfile(update.Profiles(i), update.Lengths(i))- _probeTraces(i).StepsSampled = update.StepsDone- Next- If _picField IsNot Nothing Then _picField.Invalidate()- If _picIntensity IsNot Nothing Then _picIntensity.Invalidate()- End Sub--End Classdiff --git a/2D_wave_sim_V01/Form1.Source.vb b/2D_wave_sim_V01/Form1.Source.vbdeleted file mode 100644index 0914e1b..0000000--- a/2D_wave_sim_V01/Form1.Source.vb+++ /dev/null@@ -1,913 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Drawing-Imports System.Globalization--' ------------------------------------------------------------------ object sources (Sources tab)-'-' An object source is a point (or, for a composite source, an X-Y array of points) that drives the field directly,-' as opposed to the image-derived sources (the green channel of the scene image). Unlike an image source it has its-' own frequency, amplitude and phase, and it can be continuous or pulsed (on for a number of cycles, then off for a-' number of cycles). A composite source is a set of point sources built from the same base ("single source")-' parameters, optionally randomized per element.-'-' Editing a source is a two step process:-' 1. txtName/cmbMainType/grpSingleSource/grpComposite describe the source; the position is typed or picked with-' the Pick button in the picture (a copy of a Preview tab picture, "Copy Image to probe and source tab"). A-' freshly created source has no position yet (SourceSettings.HasPosition is False) - the picture shows no-' marker for it until one is picked or typed, so an unpositioned source is never mistaken for one at (0, 0)-' or wherever the numeric fields default to.-' 2. "Save source" resolves those parameters - for a composite source, including a fresh random draw when-' "Inherit + randomize" is chosen - into a fixed list of point-source elements (_editing.Elements), then adds-' the result to lstSources (a new source) or updates the selected one. Only saved sources are used in a-' simulation (when "Use object sources" is ticked in the scene properties) - the engine always runs the-' already-generated element list, never re-randomizing, so a run is reproducible.-' Selecting a source in lstSources loads it straight into the editor (there is no separate Edit step/button).-' New and Copy load a (blank, respectively copied) source into the editor and clear the list selection; neither-' touches lstSources itself until Save is pressed, which adds or updates the entry.-Partial Public Class Form1-- ' the sources of the project- Private _sources As New List(Of SourceSettings)()-- ' the source currently shown in the editor: -1 while creating a new one (New or Copy), otherwise its index in _sources- Private _currentSourceIndex As Integer = -1-- ' the source being built in the editor; GenerateElements fills _editing.Elements, SaveSource commits it to _sources- Private _editing As New SourceSettings()-- ' True while the code itself fills the editor controls (their change events are then ignored)- Private _loadingSource As Boolean-- ' True while the list is being rebuilt, or its selection set, by code rather than by the user clicking in it -- ' so lstSources_SelectedIndexChanged does not reload the editor for that (see RefreshSourceList)- Private _syncingSourceList As Boolean-- ' True while waiting for a click in the picture for the source position- Private _sourcePicking As Boolean- Private _pickSourceButtonText As String = "Pick"-- Private ReadOnly _sourceRandom As New Random()-- ' btnSaveSource's own Designer BackColor, captured once at startup so ClearSourceDirty can restore exactly that- ' (rather than a hardcoded color) once the pending changes it warns about are saved- Private _sourceSaveButtonDefaultBackColor As Color-- ' ---------------------------------------------------------------- setting up-- Private Sub InitializeSourceControls()- _pickSourceButtonText = btnPickSourcePosition.Text- _sourceSaveButtonDefaultBackColor = btnSaveSource.BackColor- WireSourceDirtyTracking(grpSourceDetails)-- numSourcePositionX.DecimalPlaces = 0- numSourcePositionX.Minimum = 0D- numSourcePositionX.Maximum = CDec(SceneSettings.MaxCanvasSize - 1)- numSourcePositionY.DecimalPlaces = 0- numSourcePositionY.Minimum = 0D- numSourcePositionY.Maximum = CDec(SceneSettings.MaxCanvasSize - 1)-- ' Minimum (1) and Maximum (999) are both odd, and Increment is 2, so the up/down spinner buttons can only- ' ever land on an odd array size - see ArraySize_Validating for what catches an even value typed in- ' directly (the spinner can't produce one, but the keyboard can).- numArraySizeX.DecimalPlaces = 0- numArraySizeX.Minimum = 1D- numArraySizeX.Maximum = 999D- numArraySizeX.Increment = 2D- numArraySizeY.DecimalPlaces = 0- numArraySizeY.Minimum = 1D- numArraySizeY.Maximum = 999D- numArraySizeY.Increment = 2D-- numSpacingSizeX.DecimalPlaces = 0- numSpacingSizeX.Minimum = 0D- numSpacingSizeX.Maximum = CDec(SceneSettings.MaxCanvasSize)- numSpacingSizeY.DecimalPlaces = 0- numSpacingSizeY.Minimum = 0D- numSpacingSizeY.Maximum = CDec(SceneSettings.MaxCanvasSize)-- numAmplitude.DecimalPlaces = 0- numPulseWidthCycles.DecimalPlaces = 0- If numPulseWidthCycles.Minimum < 1D Then numPulseWidthCycles.Minimum = 1D- If numPulseWidthCycles.Maximum < 100D Then numPulseWidthCycles.Maximum = 1000000D- numOffStateCycles.DecimalPlaces = 0- numRandomizeFrequency.DecimalPlaces = 0- numRandomizeOffWidth.DecimalPlaces = 0- numRandomizePosition.DecimalPlaces = 0- NumRandomizePhase.DecimalPlaces = 0-- AddHandler _picSource.Paint, AddressOf SourcePicture_Paint- AddHandler _picSource.MouseClick, AddressOf SourcePicture_MouseClick-- ' owner-drawn so a switched-off source (chkSourceOn unchecked) can be shown greyed out in the list -- ' it stays fully selectable, only its text color changes (see lstSources_DrawItem)- lstSources.DrawMode = DrawMode.OwnerDrawFixed-- RefreshSourceList()- ShowSourceInControls(_editing)- ClearSourceDirty()- UpdateListButtonState()- End Sub-- ''' <summary>Loads the project's sources and shows the first one (if any) selected and loaded into the editor,- ''' rather than always starting the editor on a blank "new source" template - so opening a project that already- ''' has sources shows one of them, not a to-be-inserted one. "First" is whichever GenerateElements/save order the- ''' list is in; there is no separate "last edited" tracking kept across a save/reload to prefer instead.</summary>- Private Sub LoadSourcesFromProject()- If _project Is Nothing Then Return- _sources = SourceSettings.ListFromConfig(_project.Config)- If _sources.Count > 0 Then- _currentSourceIndex = 0- _editing = _sources(0).Clone()- Else- _currentSourceIndex = -1- _editing = New SourceSettings()- End If- RefreshSourceList()- _syncingSourceList = True- Try- lstSources.SelectedIndex = _currentSourceIndex- Finally- _syncingSourceList = False- End Try- ShowSourceInControls(_editing)- ClearSourceDirty()- UpdateListButtonState()- End Sub-- Private Sub ResetSources()- _sources = New List(Of SourceSettings)()- _currentSourceIndex = -1- _editing = New SourceSettings()- RefreshSourceList()- If _picSource IsNot Nothing Then- ShowSourceInControls(_editing)- ClearSourceDirty()- End If- UpdateListButtonState()- End Sub-- ''' <summary>The elements of every saved source, for a simulation run; Nothing when object sources are switched off or there are none.</summary>- Private Function SourcesForRun() As List(Of SourceElement)- If _scene Is Nothing OrElse Not _scene.UseObjectSources OrElse _sources.Count = 0 Then Return Nothing-- Dim result As New List(Of SourceElement)()- For Each s As SourceSettings In _sources- ' switched off (chkSourceOn unchecked): keep the source and its parameters, just leave it out of the- ' run entirely, so it neither drives the field nor gets in the way of waves passing through it- If Not s.SourceOn Then Continue For- If s.Elements Is Nothing OrElse s.Elements.Count = 0 Then- ' a source saved before it was ever generated (should not normally happen) - generate it now, once- s.GenerateElements(_sourceRandom)- End If- result.AddRange(s.Elements)- Next- Return result- End Function-- ' ---------------------------------------------------------------- the list-- Private Sub RefreshSourceList()- Dim selected As Integer = lstSources.SelectedIndex- _syncingSourceList = True- Try- lstSources.Items.Clear()- For Each s As SourceSettings In _sources- lstSources.Items.Add(SourceListText(s))- Next- If selected >= 0 AndAlso selected < lstSources.Items.Count Then lstSources.SelectedIndex = selected- Finally- _syncingSourceList = False- End Try- End Sub-- Private Shared Function SourceListText(s As SourceSettings) As String- If s.MainType = SourceMainType.Composite Then- Return s.Name & " (composite, " & s.ArraySizeX.ToString(CultureInfo.InvariantCulture) & " x " &- s.ArraySizeY.ToString(CultureInfo.InvariantCulture) & ")"- End If- Return s.Name & " (single)"- End Function-- ''' <summary>Draws a switched-off source (chkSourceOn unchecked) greyed out; it stays fully selectable, only the- ''' text color changes, so the selection highlight still shows normally.</summary>- Private Sub lstSources_DrawItem(sender As Object, e As DrawItemEventArgs) Handles lstSources.DrawItem- If e.Index < 0 OrElse e.Index >= lstSources.Items.Count Then Return- e.DrawBackground()-- Dim isOff As Boolean = (e.Index < _sources.Count AndAlso Not _sources(e.Index).SourceOn)- Dim textColor As Color = If(isOff, Color.Gray, e.ForeColor)-- Using brush As New SolidBrush(textColor)- e.Graphics.DrawString(lstSources.Items(e.Index).ToString(), e.Font, brush, e.Bounds)- End Using- e.DrawFocusRectangle()- End Sub-- ''' <summary>Selecting a source loads it straight into the editor; clearing the selection (New/Copy, or the- ''' list becoming empty) shows a blank/default source instead. Programmatic selection changes (RefreshSourceList,- ''' btnSaveSource_Click) set _syncingSourceList first so they do not re-trigger this.</summary>- Private Sub lstSources_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstSources.SelectedIndexChanged- UpdateListButtonState()- If _syncingSourceList Then Return-- EndSourcePick()- If lstSources.SelectedIndex < 0 Then- _currentSourceIndex = -1- _editing = New SourceSettings()- Else- _currentSourceIndex = lstSources.SelectedIndex- _editing = _sources(_currentSourceIndex).Clone()- End If- ShowSourceInControls(_editing)- ClearSourceDirty()- If _picSource IsNot Nothing Then _picSource.Invalidate()- picPreviewSource.Invalidate()- ToolStripStatusLabel1.Text = If(_currentSourceIndex >= 0,- "Editing '" & _editing.Name & "': press Save source to keep the changes.",- "")- End Sub-- Private Sub UpdateListButtonState()- Dim hasSelection As Boolean = (lstSources.SelectedIndex >= 0)- btnCopy.Enabled = hasSelection- btnDelete.Enabled = hasSelection- End Sub-- Private Sub btnNew_Click(sender As Object, e As EventArgs) Handles btnNew.Click- EndSourcePick()- _syncingSourceList = True- Try- lstSources.SelectedIndex = -1- Finally- _syncingSourceList = False- End Try- _currentSourceIndex = -1- _editing = New SourceSettings()- _editing.Name = "Source " & (_sources.Count + 1).ToString(CultureInfo.InvariantCulture)- ShowSourceInControls(_editing)- MarkSourceDirty() ' not saved yet - pressing Save source is what actually adds it- UpdateListButtonState()- If _picSource IsNot Nothing Then _picSource.Invalidate()- picPreviewSource.Invalidate()- ToolStripStatusLabel1.Text = "New source: fill in its properties, then press Save source."- txtName.Focus()- txtName.SelectAll()- End Sub-- Private Sub btnCopy_Click(sender As Object, e As EventArgs) Handles btnCopy.Click- If lstSources.SelectedIndex < 0 Then Return- EndSourcePick()- Dim sourceName As String = _sources(lstSources.SelectedIndex).Name- _editing = _sources(lstSources.SelectedIndex).Clone()- _editing.Name = _editing.Name & " copy"- _syncingSourceList = True- Try- lstSources.SelectedIndex = -1- Finally- _syncingSourceList = False- End Try- _currentSourceIndex = -1- ShowSourceInControls(_editing)- MarkSourceDirty() ' not saved yet - pressing Save source is what actually adds it- UpdateListButtonState()- If _picSource IsNot Nothing Then _picSource.Invalidate()- picPreviewSource.Invalidate()- ToolStripStatusLabel1.Text = "Copy of '" & sourceName & "': change it and press Save source to add it as a new source."- txtName.Focus()- txtName.SelectAll()- End Sub-- Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click- If lstSources.SelectedIndex < 0 Then Return- Dim index As Integer = lstSources.SelectedIndex- Dim name As String = _sources(index).Name- Dim answer As DialogResult = MessageBox.Show(Me, "Delete the source '" & name & "'?", "Delete source",- MessageBoxButtons.YesNo, MessageBoxIcon.Warning)- If answer <> DialogResult.Yes Then Return-- _sources.RemoveAt(index)- If _currentSourceIndex = index Then- _currentSourceIndex = -1- _editing = New SourceSettings()- ShowSourceInControls(_editing)- ClearSourceDirty()- ElseIf _currentSourceIndex > index Then- _currentSourceIndex -= 1- End If- RefreshSourceList()- UpdateListButtonState()- MarkProjectChanged()- If _picSource IsNot Nothing Then _picSource.Invalidate()- picPreviewSource.Invalidate()- ToolStripStatusLabel1.Text = "Source '" & name & "' deleted."- End Sub-- Private Sub btnSaveSource_Click(sender As Object, e As EventArgs) Handles btnSaveSource.Click- CommitSourceEdits()- End Sub-- ''' <summary>- ''' Reads the editor into _editing, (re)generates its elements and writes the result back to _sources - updating- ''' the entry at _currentSourceIndex when one is selected, or adding a new entry otherwise - then clears the- ''' "unsaved changes" indicator on btnSaveSource. Shared by "Save source" itself and by completing a position- ''' pick for an already-selected source (see SourcePicture_MouseClick/EndSourcePick), so picking a new position- ''' for an existing source is never left stale until a separate press of Save source. Returns False (without- ''' committing anything) when the source has no name yet, same as "Save source" always required.- ''' </summary>- Private Function CommitSourceEdits() As Boolean- ReadSourceControls(_editing)- If _editing.Name.Trim().Length = 0 Then- MessageBox.Show(Me, "Give the source a name first.", "Save source", MessageBoxButtons.OK, MessageBoxIcon.Information)- txtName.Focus()- Return False- End If-- ' always (re)generate the elements from the current editor values, so a changed position (or any other- ' parameter) is never left stale in a source that already had elements from an earlier generate/save- _editing.GenerateElements(_sourceRandom)-- If _currentSourceIndex >= 0 AndAlso _currentSourceIndex < _sources.Count Then- _sources(_currentSourceIndex) = _editing- Else- _sources.Add(_editing)- _currentSourceIndex = _sources.Count - 1- End If-- RefreshSourceList()- _syncingSourceList = True- Try- lstSources.SelectedIndex = _currentSourceIndex- Finally- _syncingSourceList = False- End Try- UpdateListButtonState()- MarkProjectChanged()- If _picSource IsNot Nothing Then _picSource.Invalidate()- picPreviewSource.Invalidate()- ToolStripStatusLabel1.Text = "Source '" & _editing.Name & "' saved (" & _editing.Elements.Count.ToString(CultureInfo.InvariantCulture) & " element(s))."-- ' the editor keeps editing the source that was just saved, so pressing Save again updates it in place- _editing = _editing.Clone()- ClearSourceDirty()- Return True- End Function-- ' ---------------------------------------------------------------- the editor-- ''' <summary>Copies a source's values into the editor controls.</summary>- Private Sub ShowSourceInControls(s As SourceSettings)- s.Normalize()- _loadingSource = True- Try- txtName.Text = s.Name- cmbMainType.SelectedIndex = CInt(s.MainType)- chkSourceOn.Checked = s.SourceOn- chkDetachSource.Checked = s.DetachSource- txtDetachAfterSteps.Text = s.DetachAfterSteps.ToString(CultureInfo.InvariantCulture)- numSourcePositionX.Value = ClampToRange(numSourcePositionX, s.PosX)- numSourcePositionY.Value = ClampToRange(numSourcePositionY, s.PosY)-- numFrequency.Value = ClampToRange(numFrequency, s.Frequency)- numAmplitude.Value = ClampToRange(numAmplitude, s.Amplitude)- numPhase.Value = ClampToRange(numPhase, s.PhaseDeg)- radModePulsed.Checked = (s.Mode = SourceMode.Pulsed)- radModeContinuous.Checked = (s.Mode = SourceMode.Continuous)- cmbPulseShape.SelectedIndex = CInt(s.PulseShape)- numPulseWidthCycles.Value = ClampToRange(numPulseWidthCycles, s.PulseWidthCycles)- numOffStateCycles.Value = ClampToRange(numOffStateCycles, s.OffStateCycles)-- numArraySizeX.Value = ClampToRange(numArraySizeX, s.ArraySizeX)- numArraySizeY.Value = ClampToRange(numArraySizeY, s.ArraySizeY)- numSpacingSizeX.Value = ClampToRange(numSpacingSizeX, s.SpacingX)- numSpacingSizeY.Value = ClampToRange(numSpacingSizeY, s.SpacingY)-- ' the three "amount" fields below are clamped against the just-loaded values above (see- ' UpdateRandomizeLimits) - called explicitly here rather than relying only on the ValueChanged handler- ' further down, since a value that happens to equal what a control already shows does not raise that event- UpdateRandomizeLimits()-- cmbCompositeProperties.SelectedIndex = CInt(s.CompositeMode)- chkRandomizeFrequency.Checked = s.RandomizeFrequency- numRandomizeFrequency.Value = ClampToRange(numRandomizeFrequency, s.RandomizeFrequencyAmount)- chkRandomizePhase.Checked = s.RandomizePhase- NumRandomizePhase.Value = ClampToRange(NumRandomizePhase, s.RandomizePhaseAmount)- chkOffWidth.Checked = s.RandomizeOffWidth- numRandomizeOffWidth.Value = ClampToRange(numRandomizeOffWidth, s.RandomizeOffWidthAmount)- chkRandomizePosition.Checked = s.RandomizePosition- numRandomizePosition.Value = ClampToRange(numRandomizePosition, s.RandomizePositionAmount)- Finally- _loadingSource = False- End Try-- UpdateSourceControlState()- UpdateLambdaLabel()- End Sub-- ' ---------------------------------------------------------------- unsaved-changes indicator (btnSaveSource)-- ''' <summary>- ''' Wires every input control inside grpSourceDetails - recursively, since it nests grpSingleSource and- ''' grpComposite - to MarkSourceDirty, so any change the user makes to a source's properties there turns- ''' btnSaveSource orange until the change is saved (see MarkSourceDirty/ClearSourceDirty). Called once, from- ''' InitializeSourceControls. The source's position (numSourcePositionX/Y, in grpPlaceSource, not grpSourceDetails)- ''' is deliberately not included here: picking or typing a position is committed through its own path instead- ''' (SourcePicture_MouseClick/SourcePosition_ValueChanged).- ''' </summary>- Private Sub WireSourceDirtyTracking(container As Control)- For Each child As Control In container.Controls- If TypeOf child Is TextBox Then- AddHandler DirectCast(child, TextBox).TextChanged, AddressOf SourceDetail_Changed- ElseIf TypeOf child Is NumericUpDown Then- AddHandler DirectCast(child, NumericUpDown).ValueChanged, AddressOf SourceDetail_Changed- ElseIf TypeOf child Is CheckBox Then- AddHandler DirectCast(child, CheckBox).CheckedChanged, AddressOf SourceDetail_Changed- ElseIf TypeOf child Is RadioButton Then- AddHandler DirectCast(child, RadioButton).CheckedChanged, AddressOf SourceDetail_Changed- ElseIf TypeOf child Is ComboBox Then- AddHandler DirectCast(child, ComboBox).SelectedIndexChanged, AddressOf SourceDetail_Changed- End If-- If child.HasChildren Then WireSourceDirtyTracking(child)- Next- End Sub-- ''' <summary>Common handler for every control wired by WireSourceDirtyTracking. Ignored while the code itself is- ''' filling the controls (ShowSourceInControls sets _loadingSource first), so only an actual user edit counts.</summary>- Private Sub SourceDetail_Changed(sender As Object, e As EventArgs)- If _loadingSource Then Return- MarkSourceDirty()- End Sub-- ''' <summary>Flags that grpSourceDetails has changes not yet saved to the selected (or not yet added) source.</summary>- Private Sub MarkSourceDirty()- btnSaveSource.BackColor = Color.Orange- End Sub-- ''' <summary>Restores btnSaveSource to its own Designer color, once its pending changes are saved (or discarded- ''' by loading a different/blank source into the editor).</summary>- Private Sub ClearSourceDirty()- btnSaveSource.BackColor = _sourceSaveButtonDefaultBackColor- End Sub-- ''' <summary>Reads the editor controls into a source.</summary>- Private Sub ReadSourceControls(target As SourceSettings)- target.Name = txtName.Text.Trim()- target.MainType = If(cmbMainType.SelectedIndex = 1, SourceMainType.Composite, SourceMainType.Simple)- target.SourceOn = chkSourceOn.Checked- target.DetachSource = chkDetachSource.Checked- Dim detachAfter As Integer- If Integer.TryParse(txtDetachAfterSteps.Text.Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, detachAfter) AndAlso detachAfter >= 0 Then- target.DetachAfterSteps = detachAfter- End If- target.PosX = CInt(numSourcePositionX.Value)- target.PosY = CInt(numSourcePositionY.Value)-- target.Frequency = CInt(numFrequency.Value)- target.Amplitude = CInt(numAmplitude.Value)- target.PhaseDeg = CInt(numPhase.Value)- target.Mode = If(radModePulsed.Checked, SourceMode.Pulsed, SourceMode.Continuous)- target.PulseShape = If(cmbPulseShape.SelectedIndex = 1, SourcePulseShape.SmoothedSquare, SourcePulseShape.Gaussian)- target.PulseWidthCycles = CInt(numPulseWidthCycles.Value)- target.OffStateCycles = CInt(numOffStateCycles.Value)-- target.ArraySizeX = CInt(numArraySizeX.Value)- target.ArraySizeY = CInt(numArraySizeY.Value)- target.SpacingX = CInt(numSpacingSizeX.Value)- target.SpacingY = CInt(numSpacingSizeY.Value)- target.CompositeMode = If(cmbCompositeProperties.SelectedIndex = 1, SourceCompositeMode.InheritAndRandomize, SourceCompositeMode.InheritFromSingle)- target.RandomizeFrequency = chkRandomizeFrequency.Checked- target.RandomizeFrequencyAmount = CInt(numRandomizeFrequency.Value)- target.RandomizePhase = chkRandomizePhase.Checked- target.RandomizePhaseAmount = CInt(NumRandomizePhase.Value)- target.RandomizeOffWidth = chkOffWidth.Checked- target.RandomizeOffWidthAmount = CInt(numRandomizeOffWidth.Value)- target.RandomizePosition = chkRandomizePosition.Checked- target.RandomizePositionAmount = CInt(numRandomizePosition.Value)- target.Normalize()- End Sub-- ''' <summary>Enables the controls that apply to the chosen main type / mode / composite mode.</summary>- Private Sub UpdateSourceControlState()- Dim isComposite As Boolean = (cmbMainType.SelectedIndex = 1)- grpComposite.Enabled = isComposite-- Dim isPulsed As Boolean = radModePulsed.Checked- cmbPulseShape.Enabled = isPulsed- numPulseWidthCycles.Enabled = isPulsed- numOffStateCycles.Enabled = isPulsed-- txtDetachAfterSteps.Enabled = chkDetachSource.Checked-- Dim randomizeOn As Boolean = isComposite AndAlso (cmbCompositeProperties.SelectedIndex = 1)- cmbCompositeProperties.Enabled = isComposite- numArraySizeX.Enabled = isComposite- numArraySizeY.Enabled = isComposite- numSpacingSizeX.Enabled = isComposite- numSpacingSizeY.Enabled = isComposite-- chkRandomizeFrequency.Enabled = randomizeOn- chkRandomizePhase.Enabled = randomizeOn- chkOffWidth.Enabled = randomizeOn- chkRandomizePosition.Enabled = randomizeOn- numRandomizeFrequency.Enabled = randomizeOn AndAlso chkRandomizeFrequency.Checked- NumRandomizePhase.Enabled = randomizeOn AndAlso chkRandomizePhase.Checked- numRandomizeOffWidth.Enabled = randomizeOn AndAlso chkOffWidth.Checked- numRandomizePosition.Enabled = randomizeOn AndAlso chkRandomizePosition.Checked- End Sub-- Private Sub SourceMainType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbMainType.SelectedIndexChanged, cmbCompositeProperties.SelectedIndexChanged- If _loadingSource Then Return- UpdateSourceControlState()- End Sub-- Private Sub SourceMode_CheckedChanged(sender As Object, e As EventArgs) Handles radModePulsed.CheckedChanged, radModeContinuous.CheckedChanged- If _loadingSource Then Return- UpdateSourceControlState()- End Sub-- ''' <summary>Keeps lblLambdaIs in sync with numFrequency - not guarded by _loadingSource, since it must also- ''' refresh when a source is loaded into the editor (ShowSourceInControls), not only on a user edit.</summary>- Private Sub SourceFrequency_ValueChanged(sender As Object, e As EventArgs) Handles numFrequency.ValueChanged- UpdateLambdaLabel()- End Sub-- ''' <summary>- ''' Shows an estimated wavelength for the current numFrequency value in lblLambdaIs, as "λ=xx,x px" (using the- ''' current culture's decimal separator). lambda = c / f: f is the cyclic frequency (cycles/step) that a- ''' source's Level (1-255, the numFrequency control) maps to via SourceFrequencyScale - the same formula the- ''' engine itself uses (WaveSimulator/GpuWaveSimulator: level/255*0.5*SourceFrequencyScale is the *angular*- ''' frequency in rad/step, so dividing by 2*pi gives cycles/step) - and c is the propagation speed set via- ''' File > Set c-value (SimulationSettings.WaveSpeedC), in simulation pixels per step. This is only ever an- ''' estimate/display value: the real per-pixel wave speed the simulation actually uses comes from the scene's- ''' refractive index instead (see SceneData.C2) and is not necessarily uniform.- ''' </summary>- Private Sub UpdateLambdaLabel()- If lblLambdaIs Is Nothing Then Return-- Dim level As Integer = CInt(numFrequency.Value)- Dim scale As Double = If(_simulation IsNot Nothing, _simulation.SourceFrequencyScale, 2.0)- Dim omega As Double = level / 255.0 * 0.5 * scale- Dim cyclesPerStep As Double = omega / (2.0 * Math.PI)-- If cyclesPerStep <= 0.0 Then- lblLambdaIs.Text = "λ= - px"- Return- End If-- Dim c As Double = If(_simulation IsNot Nothing, _simulation.WaveSpeedC, 0.563)- Dim lambda As Double = c / cyclesPerStep- ' the current culture's own decimal separator (a comma in nl-NL, for instance), not a fixed "."- lblLambdaIs.Text = "λ=" & lambda.ToString("0.0", CultureInfo.CurrentCulture) & " px"- End Sub-- Private Sub SourceDetach_CheckedChanged(sender As Object, e As EventArgs) Handles chkDetachSource.CheckedChanged- If _loadingSource Then Return- UpdateSourceControlState()- End Sub-- Private Sub SourceRandomizeCheck_CheckedChanged(sender As Object, e As EventArgs) Handles chkRandomizeFrequency.CheckedChanged,- chkRandomizePhase.CheckedChanged, chkOffWidth.CheckedChanged, chkRandomizePosition.CheckedChanged- If _loadingSource Then Return- UpdateSourceControlState()- End Sub-- ''' <summary>Keeps the three randomize "amount" fields' Maximum in step with the single-source values they are- ''' added to (see UpdateRandomizeLimits) whenever one of those values changes - not guarded by _loadingSource,- ''' since ShowSourceInControls also relies on this to be current before it sets the amount fields' Value- ''' (though it additionally calls UpdateRandomizeLimits directly itself, since a value that happens to already- ''' match a control's current Value does not raise ValueChanged).</summary>- Private Sub SourceRandomizeLimitInput_ValueChanged(sender As Object, e As EventArgs) Handles numFrequency.ValueChanged,- numOffStateCycles.ValueChanged, numArraySizeX.ValueChanged, numArraySizeY.ValueChanged,- numSpacingSizeX.ValueChanged, numSpacingSizeY.ValueChanged- UpdateRandomizeLimits()- End Sub-- ''' <summary>- ''' Caps how large a "randomize amount" can be set to, so GenerateElements' Vinherited +/- amount (SourceSettings)- ''' can never be forced to clip against a hard limit and so end up biased instead of a true symmetric spread:- ''' - frequency (numRandomizeFrequency): the source's Level must stay within 1-255, so the amount cannot- ''' exceed the smaller of (Frequency - 1) and (255 - Frequency).- ''' - off-width cycles (numRandomizeOffWidth): GenerateElements floors the result at 1 cycle, so the amount- ''' cannot exceed (OffStateCycles - 1).- ''' - position (numRandomizePosition): position has no natural upper/lower bound the way frequency and- ''' off-width do, so instead the amount is capped at half the array's own spacing along whichever axis- ''' (or axes) actually separate elements (ArraySizeX/Y > 1) - a randomized element's jitter can then never- ''' overshoot as far as a neighboring (unrandomized) grid position. An array that is only one element wide- ''' in both directions (ArraySizeX = ArraySizeY = 1, no neighbor to protect against) is left unbounded.- ''' Phase (NumRandomizePhase) is not limited here: its result is already clamped to -180..180 in GenerateElements,- ''' and since +/-180 degrees is the same angle either way, that clipping does not bias the result the way it- ''' would for frequency or off-width.- ''' Lowering a Maximum below a field's current Value clamps that Value down to it automatically (standard- ''' NumericUpDown behavior), so the amount fields never need to be set here, only their Maximum.- ''' </summary>- Private Sub UpdateRandomizeLimits()- Dim frequency As Integer = CInt(numFrequency.Value)- numRandomizeFrequency.Maximum = CDec(Math.Max(0, Math.Min(frequency - 1, 255 - frequency)))-- Dim offWidth As Integer = CInt(numOffStateCycles.Value)- numRandomizeOffWidth.Maximum = CDec(Math.Max(0, offWidth - 1))-- Dim cols As Integer = CInt(numArraySizeX.Value)- Dim rows As Integer = CInt(numArraySizeY.Value)- If cols <= 1 AndAlso rows <= 1 Then- numRandomizePosition.Maximum = CDec(SceneSettings.MaxCanvasSize)- Else- ' the smallest spacing among the axes that actually separate elements (Count > 1), without relying on- ' System.Linq (not imported by this file) for a two/one-element Min()- Dim relevantSpacing As New List(Of Integer)()- If cols > 1 Then relevantSpacing.Add(CInt(numSpacingSizeX.Value))- If rows > 1 Then relevantSpacing.Add(CInt(numSpacingSizeY.Value))- Dim minSpacing As Integer = relevantSpacing(0)- For i As Integer = 1 To relevantSpacing.Count - 1- If relevantSpacing(i) < minSpacing Then minSpacing = relevantSpacing(i)- Next- numRandomizePosition.Maximum = CDec(Math.Max(0, minSpacing \ 2))- End If- End Sub-- ''' <summary>- ''' numArraySizeX/numArraySizeY must stay odd: an even-sized array has its centre between two pixels instead- ''' of on one, which (especially at small spacings) places the whole array off-grid in an irregular way. The- ''' spinner buttons can never produce an even value (Minimum/Maximum are both odd and Increment is 2 - see- ''' InitializeSourceControls), but typing a value directly can, so this catches that on Validating (the point- ''' where a typed value is finalized - on Tab/click-away, or on Enter via the global NumericUpDown_KeyDown- ''' hook that moves focus off the control) and bumps it up by one, with a warning so the change is not a- ''' silent surprise. Not guarded by _loadingSource: Validating only fires from an actual focus change, never- ''' from a plain Value assignment in code (e.g. ShowSourceInControls loading a project), so it can only ever- ''' be the user's own keyboard entry.- ''' </summary>- Private Sub ArraySize_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles numArraySizeX.Validating, numArraySizeY.Validating- Dim box As NumericUpDown = DirectCast(sender, NumericUpDown)- Dim value As Integer = CInt(box.Value)- If value Mod 2 <> 0 Then Return-- Dim corrected As Integer = Math.Min(CInt(box.Maximum), value + 1)- box.Value = CDec(corrected)- MessageBox.Show(Me, "Use uneven numbers only - the array size has been increased to " &- corrected.ToString(CultureInfo.InvariantCulture) & ".",- "Array size", MessageBoxButtons.OK, MessageBoxIcon.Information)- End Sub-- Private Sub SourceTabChanged(sender As Object, e As EventArgs) Handles tabMainFunctions.SelectedIndexChanged- EndSourcePick()- If tabMainFunctions.SelectedTab Is tabSourceList Then- AutoLoadSceneImageIfEmpty(_picSource)- SyncSourceListSelectionToEditor()- End If- End Sub-- ''' <summary>Makes lstSources' highlighted item and grpSourceDetails agree with the source actually loaded in- ''' the editor (_editing/_currentSourceIndex - the last source that was selected or edited) whenever the tab- ''' is opened. Without this, coming back from another tab could show some list item highlighted (left over- ''' from before, or the list's own default) while the detail controls still showed a different source, or one- ''' that no longer matched the highlighted entry at all.</summary>- Private Sub SyncSourceListSelectionToEditor()- _syncingSourceList = True- Try- If _currentSourceIndex >= 0 AndAlso _currentSourceIndex < lstSources.Items.Count Then- lstSources.SelectedIndex = _currentSourceIndex- Else- lstSources.SelectedIndex = -1- End If- Finally- _syncingSourceList = False- End Try- ShowSourceInControls(_editing)- End Sub-- ' ---------------------------------------------------------------- picking the position in the picture-- Private Sub PickSourcePosition_Click(sender As Object, e As EventArgs) Handles btnPickSourcePosition.Click- If _sourcePicking Then- EndSourcePick()- Else- StartSourcePick()- End If- End Sub-- Private Sub StartSourcePick()- If _picSource.Image Is Nothing Then EnsureSourcePicture()- If _picSource.Image Is Nothing Then- MessageBox.Show(Me, "There is no picture to pick from yet, and the canvas size is not known either" & vbCrLf &- "(choose a scene image, or a user defined width and height, on the Configuration tab first).",- "Source position", MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- _sourcePicking = True- _picSource.Cursor = Cursors.Cross- btnPickSourcePosition.Text = "Cancel"- ToolStripStatusLabel1.Text = "Click in the picture for the position of the source (press Cancel to stop picking)."- End Sub-- ''' <summary>- ''' When there is no picture yet to pick from (no simulation has run), makes a plain black one at the canvas size- ''' that the Configuration tab currently specifies (the scene image's size, or the user defined width/height), so- ''' a source position can still be picked before ever running a simulation. Replaced by the real picture as soon- ''' as one is copied over from the Preview tab.- ''' </summary>- Private Sub EnsureSourcePicture()- Dim canvas As Size = EffectiveCanvas()- If canvas.Width <= 0 OrElse canvas.Height <= 0 Then Return-- Dim placeholder As New Bitmap(canvas.Width, canvas.Height)- Using g As Graphics = Graphics.FromImage(placeholder)- g.Clear(Color.Black)- End Using- _picSource.Image = placeholder- End Sub-- Private Sub EndSourcePick()- If Not _sourcePicking Then Return- _sourcePicking = False- btnPickSourcePosition.Text = _pickSourceButtonText- If _picSource IsNot Nothing Then _picSource.Cursor = Cursors.Default- ToolStripStatusLabel1.Text = ""- End Sub-- Private Sub SourcePicture_MouseClick(sender As Object, e As MouseEventArgs)- If Not _sourcePicking OrElse e.Button <> MouseButtons.Left Then Return-- Dim x As Integer- Dim y As Integer- If Not TryPictureToCanvas(_picSource, e.Location, x, y) Then Return-- numSourcePositionX.Value = ClampToRange(numSourcePositionX, x)- numSourcePositionY.Value = ClampToRange(numSourcePositionY, y)- ' SourcePosition_ValueChanged (below) updates _editing and invalidates the picture even when the values above- ' did not actually change (e.g. clicking back on the same pixel), so do it here too, explicitly- If Not _loadingSource Then- _editing.PosX = x- _editing.PosY = y- _editing.HasPosition = True- _picSource.Invalidate()- End If- EndSourcePick()-- ' picking a position for a source that is already in the list commits the editor's current data (the- ' picked position and anything else changed since the last save) straight to it, the same as pressing Save- ' source - so the pick is never left stale waiting for a separate save. A brand new/copied source (not- ' selected in the list yet) is left as before: still just a live, unsaved position until Save source is- ' pressed, since adding it here could otherwise silently add an incomplete/unnamed source to the list.- If _currentSourceIndex >= 0 Then CommitSourceEdits()- End Sub-- ''' <summary>Keeps the live marker in the picture in sync while typing a new position, same as picking one does.</summary>- Private Sub SourcePosition_ValueChanged(sender As Object, e As EventArgs) Handles numSourcePositionX.ValueChanged, numSourcePositionY.ValueChanged- If _loadingSource Then Return- _editing.PosX = CInt(numSourcePositionX.Value)- _editing.PosY = CInt(numSourcePositionY.Value)- _editing.HasPosition = True- If _picSource IsNot Nothing Then _picSource.Invalidate()- End Sub-- ' ---------------------------------------------------------------- drawing over the picture-- ''' <summary>A marker for every saved source, and for the source being edited when it is not saved yet.</summary>- Private Sub SourcePicture_Paint(sender As Object, e As PaintEventArgs)- If _picSource.Image Is Nothing Then Return-- Dim canvas As Size = EffectiveCanvas()- If canvas.Width <= 0 Then canvas = _picSource.Image.Size- Dim area As RectangleF = ZoomedImageRectangle(_picSource)- If area.Width <= 0 Then Return- Dim sx As Single = area.Width / canvas.Width- Dim sy As Single = area.Height / canvas.Height-- For i As Integer = 0 To _sources.Count - 1- Dim isCurrent As Boolean = (i = _currentSourceIndex)- ' the source being edited is shown at its live (not yet saved) position, so moving it in the picture or- ' the X/Y boxes is reflected immediately instead of only after Save source- Dim shown As SourceSettings = If(isCurrent, _editing, _sources(i))- If shown.HasPosition Then DrawSourceMarker(e.Graphics, shown, area, sx, sy, isCurrent)- Next-- ' the source being created or copied (not in _sources yet) is shown too, so its position can be seen while picking -- ' but only once it actually has one (Pick or a typed X/Y), never at the unset default- If _currentSourceIndex < 0 AndAlso _editing.HasPosition Then DrawSourceMarker(e.Graphics, _editing, area, sx, sy, True)- End Sub-- Private Shared Sub DrawSourceMarker(g As Graphics, s As SourceSettings, area As RectangleF, sx As Single, sy As Single, isCurrent As Boolean)- Dim color As Color = If(isCurrent, Color.FromArgb(230, 255, 208, 64), Color.FromArgb(200, 64, 180, 255))- Dim radius As Single = If(isCurrent, 5.0F, 4.0F)-- Dim px As Single = area.X + s.PosX * sx- Dim py As Single = area.Y + s.PosY * sy- Using pen As New Pen(color, If(isCurrent, 2.0F, 1.5F))- g.DrawEllipse(pen, px - radius, py - radius, radius * 2.0F, radius * 2.0F)- g.DrawLine(pen, px - radius - 3.0F, py, px + radius + 3.0F, py)- g.DrawLine(pen, px, py - radius - 3.0F, px, py + radius + 3.0F)- End Using- Using font As New Font("Segoe UI", 11.0F, FontStyle.Bold, GraphicsUnit.Pixel)- Using brush As New SolidBrush(color)- g.DrawString(s.Name, font, brush, px + radius + 4.0F, py - radius - 2.0F)- End Using- End Using- End Sub-- ' ---------------------------------------------------------------- source configuration preview (picPreviewSource)-- ''' <summary>- ''' Shows the layout of the source currently loaded in the editor (_editing) as white dots on a black background.- ''' The source picture above is at canvas scale, so a source - especially a composite source's individual- ''' elements - can be too small or too close together to make out there. chkAutoRescaleSourceOn (checked by- ''' default) picks which of two views this shows instead:- ''' - checked: zooms in on just the elements themselves (centered, scaled to fill the box, each shown as a- ''' several-pixel dot so it stays visible), so their relative arrangement is always visible regardless of- ''' where the source sits on the canvas or how tightly its array is spaced.- ''' - unchecked: the true, unscaled size - one simulation pixel is one screen pixel, and each element is drawn- ''' as exactly that: a single pixel, the same size it actually is in the simulation - so a composite source's- ''' real physical footprint (how many actual simulation pixels its array spans) can be judged directly.- ''' Either way it shows _editing.Elements - the last generated list - so it is blank for a brand new/copied- ''' source until it is generated by Save source, and otherwise reflects whatever was last saved (or, for the- ''' source just saved, just regenerated). Kept in sync by a picPreviewSource.Invalidate() call everywhere- ''' _editing/the currently edited source changes (loading a different one, New/Copy/Delete, and Save source) -- ''' the same places _picSource.Invalidate() is called for the position marker above - and by- ''' chkAutoRescaleSourceOn_CheckedChanged when the view itself is switched.- ''' </summary>- Private Sub picPreviewSource_Paint(sender As Object, e As PaintEventArgs) Handles picPreviewSource.Paint- e.Graphics.Clear(Color.Black)-- Dim elements As List(Of SourceElement) = If(_editing IsNot Nothing, _editing.Elements, Nothing)- If elements Is Nothing OrElse elements.Count = 0 Then Return-- Dim minX As Integer = elements(0).PosX- Dim maxX As Integer = elements(0).PosX- Dim minY As Integer = elements(0).PosY- Dim maxY As Integer = elements(0).PosY- For Each el As SourceElement In elements- If el.PosX < minX Then minX = el.PosX- If el.PosX > maxX Then maxX = el.PosX- If el.PosY < minY Then minY = el.PosY- If el.PosY > maxY Then maxY = el.PosY- Next-- Dim boxW As Single = picPreviewSource.ClientSize.Width- Dim boxH As Single = picPreviewSource.ClientSize.Height- If boxW <= 0.0F OrElse boxH <= 0.0F Then Return-- Dim centerX As Single = (minX + maxX) / 2.0F- Dim centerY As Single = (minY + maxY) / 2.0F-- Dim autoRescale As Boolean = (chkAutoRescaleSourceOn Is Nothing) OrElse chkAutoRescaleSourceOn.Checked- Dim scale As Single- If autoRescale Then- ' a single element (or several coinciding at the same spot) has no span to scale to - fall back to a- ' fixed half-extent instead of dividing by zero, so it still just shows one dot in the middle of the box- Dim halfExtent As Single = Math.Max(maxX - minX, maxY - minY) / 2.0F- If halfExtent <= 0.0F Then halfExtent = 1.0F-- Const marginFraction As Single = 0.15F ' keeps outer dots from touching/clipping at the edge of the box- Dim usable As Single = Math.Min(boxW, boxH) * (1.0F - 2.0F * marginFraction)- scale = usable / (halfExtent * 2.0F)- Else- scale = 1.0F ' true size: one simulation pixel is one screen pixel- End If-- Const dotRadius As Single = 3.0F- Using brush As New SolidBrush(Color.White)- For Each el As SourceElement In elements- Dim px As Single = boxW / 2.0F + (el.PosX - centerX) * scale- Dim py As Single = boxH / 2.0F + (el.PosY - centerY) * scale- If autoRescale Then- e.Graphics.FillEllipse(brush, px - dotRadius, py - dotRadius, dotRadius * 2.0F, dotRadius * 2.0F)- Else- e.Graphics.FillRectangle(brush, px, py, 1.0F, 1.0F)- End If- Next- End Using- End Sub-- ''' <summary>Redraws at the (centered, rescaled) size whenever the box itself is resized - same idea as any other- ''' owner-drawn control that scales to its client area.</summary>- Private Sub picPreviewSource_SizeChanged(sender As Object, e As EventArgs) Handles picPreviewSource.SizeChanged- picPreviewSource.Invalidate()- End Sub-- ''' <summary>Switches picPreviewSource between the auto-rescaled and true-size views (see picPreviewSource_Paint).</summary>- Private Sub chkAutoRescaleSourceOn_CheckedChanged(sender As Object, e As EventArgs) Handles chkAutoRescaleSourceOn.CheckedChanged- picPreviewSource.Invalidate()- End Sub--End Classdiff --git a/2D_wave_sim_V01/Form1.resx b/2D_wave_sim_V01/Form1.resxdeleted file mode 100644index 0e07e99..0000000--- a/2D_wave_sim_V01/Form1.resx+++ /dev/null@@ -1,748 +0,0 @@-<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />- <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" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </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" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">- <value>17, 17</value>- </metadata>- <metadata name="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">- <value>132, 17</value>- </metadata>- <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />- <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">- <value>- AAABAAYAEBAAAAAAIAD3AgAAZgAAABgYAAAAACAAtwUAAF0DAAAgIAAAAAAgABEJAAAUCQAAMDAAAAAA- IACdEQAAJRIAAEBAAAAAACAAvhsAAMIjAACAgAAAAAAgAAZRAACAPwAAiVBORw0KGgoAAAANSUhEUgAA- ABAAAAAQCAYAAAAf8/9hAAACvklEQVR4nF2TzWtcZRSHn/Pe996bTO7HTIZ0IJNAI9hQuhAqdiUULFVR- FwV3/Q/cuHKn5G9wnaWLWgpudFsXJe6MRRQ30bgQmoSZ2DuTmczc3Hfe97gYP8D1+Z3Dgef3SJEXCgCC- EBAAiVGJQcxypB5RB+pQBF2mALD/LXtELJiMWGAlzEmCQ4FGYuoow6lH/CUQUAT554DgMZJAlNHVKbl6- 5ukWTdwDDeTulI3mhIqUkS0Rf4GoJyDY5UMWooxeqEjTTUbFXTb8mFfcKd4IxytvMJKUzvgpiRsxiEpY- jIGAtPNcNSrZ0BlryQbz9n3uTw7o12cMuI2RBT2ec9S6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pRRfP2Mf5X4- 01/4/8fxY+IPx8+p+P/5O/u/O1F6QKTXLp8AAAAASUVORK5CYII=-</value>- </data>-</root>\ No newline at end of filediff --git a/2D_wave_sim_V01/Form1.vb b/2D_wave_sim_V01/Form1.vbdeleted file mode 100644index 57e2137..0000000--- a/2D_wave_sim_V01/Form1.vb+++ /dev/null@@ -1,4339 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Drawing-Imports System.Drawing.Drawing2D-Imports System.Drawing.Imaging-Imports System.Globalization-Imports System.IO-Imports System.Runtime.InteropServices-Imports System.Windows.Forms--Public Class Form1-- ' ------------------------------------------------------------------ state of the ColorScheme tab-- ' all schemes found in the chosen folder- Private _schemes As New List(Of ColorScheme)()-- ' the scheme that is being edited (a working copy; Nothing until one has been loaded)- Private _current As ColorScheme- Private _dirty As Boolean-- ' the scheme that is selected in the list and only previewed (Nothing when no list item is selected)- Private _previewScheme As ColorScheme-- ' the stop (0 to ColorScheme.StopCount - 1) that the picker is editing, -1 for none- Private _selectedStop As Integer = -1-- ' True while the code itself changes the radio buttons (so their events are ignored)- Private _updatingRadios As Boolean-- Private _stopButtons As Button()- Private _picker As ColorPickerControl- Private ReadOnly _thumbs As New ImageList()-- ' lstAllProjects's current sort (Configuration tab project list): which column, and which direction. Column 0- ' is colProjectName, column 1 is colLastEdit. Defaults to "last edited, newest first", per column 1 descending.- Private _projectSortColumn As Integer = 1- Private _projectSortAscending As Boolean = False-- ' lstAllProjects3's own sort state (Outputs tab) - same idea, kept separate since it is an independent list.- Private _outputProjectSortColumn As Integer = 1- Private _outputProjectSortAscending As Boolean = False-- ' ListView1's own sort state (color scheme list, tabColorSchemes): which column, and which direction. Column 0- ' is the "Scheme" (name) column, column 2 is "Type" (field/intensity); column 1 ("Kind") is not sortable.- ' Defaults to "type, then name", ascending - the standard order asked for.- Private _schemeSortColumn As Integer = 2- Private _schemeSortAscending As Boolean = True-- ' The PictureBox that shows the selected scene/image in pnlPreview (Outputs tab) - built in code in Form1_Load- ' the same way _picker is built for Panel2, since pnlPreview is a plain, empty Panel.- Private _outputPreviewPic As PictureBox-- ' True while pnlPreview shows a video's thumbnail rather than an actual scene/output image - see- ' SetOutputPreviewImage and UpdateShareWithEditorsButton (btnShareWithEditors is disabled for a video, since- ' its thumbnail has a different size than the simulation and would not make sense on the Sources/Probes tabs).- Private _outputPreviewIsVideo As Boolean-- ' lstScenes/lstImages/lstVideo's own sort state (Outputs tab): which column (0 = name, 1 = created on) and- ' which direction, one pair per list since they sort independently. All three default to "created on, newest- ' first", per column 1 descending - the same idea as _projectSortColumn/_outputProjectSortColumn above.- Private _sceneSortColumn As Integer = 1- Private _sceneSortAscending As Boolean = False- Private _imageSortColumn As Integer = 1- Private _imageSortAscending As Boolean = False- Private _videoSortColumn As Integer = 1- Private _videoSortAscending As Boolean = False-- ' The ImageList keeps using the bitmaps that were added to it (it re-creates its native image list from- ' them, e.g. after Clear or when the ListView on a hidden tab is created). They must therefore stay- ' alive until the list is rebuilt or the form is closed, and must not be disposed right after Add.- Private ReadOnly _thumbBitmaps As New List(Of Bitmap)()-- Private Const ThumbWidth As Integer = 120- Private Const ThumbHeight As Integer = 16-- ' ------------------------------------------------------------------ state of the project-- ' the open project (Nothing when none is open) and the settings of the program itself- Private _project As Project- Private _settings As New AppSettings()-- ' ------------------------------------------------------------------ form events-- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load- ' one button per stop, in scale order (Color 1 = first entry ... last button = last entry)- _stopButtons = New Button() {btnColor1, btnCOlor2, btnColor3, btnColor4, btnColor5, btnColor6, btnColor7, btnColor8, btnColor9}- Debug.Assert(_stopButtons.Length = ColorScheme.StopCount, "The number of Color buttons must equal ColorScheme.StopCount.")- For Each btn As Button In _stopButtons- btn.UseVisualStyleBackColor = False- btn.FlatStyle = FlatStyle.Flat- btn.FlatAppearance.BorderSize = 1- btn.FlatAppearance.BorderColor = Color.Black- Next-- ' scheme list: thumbnail + name, grouped by category- _thumbs.ImageSize = New Size(ThumbWidth, ThumbHeight)- _thumbs.ColorDepth = ColorDepth.Depth32Bit- ListView1.View = View.Details- ListView1.FullRowSelect = True- ListView1.MultiSelect = False- ListView1.HideSelection = False- ListView1.HeaderStyle = ColumnHeaderStyle.Clickable- ListView1.SmallImageList = _thumbs- ListView1.Columns.Clear()- ListView1.Columns.Add("Scheme", 250)- ListView1.Columns.Add("Kind", 55)- ListView1.Columns.Add("Type", 62)- UpdateSchemeListSortHeaders()-- ' scheme bar and picker- pnlScheme.BorderStyle = BorderStyle.FixedSingle- Panel2.BorderStyle = BorderStyle.FixedSingle- _picker = New ColorPickerControl()- _picker.Dock = DockStyle.Fill- Panel2.Controls.Add(_picker)- AddHandler _picker.ColorChanged, AddressOf Picker_ColorChanged-- txtCurrentColorScheme.ReadOnly = True-- ' tabMainFunctions: owner-drawn only so a disabled tab's own label can be shown in a lighter gray- ' (WinForms does not do this by itself - a disabled TabPage still draws its label at full strength) -- ' see tabMainFunctions_DrawItem.- tabMainFunctions.DrawMode = TabDrawMode.OwnerDrawFixed-- ' lstAllProjects (Configuration tab project list): sortable by clicking colProjectName/colLastEdit, see- ' lstAllProjects_ColumnClick. Show the initial sort direction in the header the same way a click would.- UpdateProjectListSortHeaders()-- ' the program's own scheme folder (ColorSchemeList in the project, or next to the exe when deployed)- txtSchemeFolder.Text = ColorSchemeStore.FindDefaultFolder()- If Directory.Exists(txtSchemeFolder.Text) Then LoadSchemeList()-- RefreshEditorState()-- ' lblInfo (Settings tab): a clickable "hyperlink" style label - see lblInfo_Click for what it shows- lblInfo.ForeColor = Color.Blue- lblInfo.Cursor = Cursors.Hand-- InitializeSceneControls()- InitializeSimulationControls()- InitializeProbeControls()- InitializeSourceControls()-- ' btnPickRoot must stay clickable even when no project root is known yet (that is the one situation it- ' exists for), but the Designer put it inside grpProjects, and WinForms disables an enabled child along- ' with a disabled parent - grpProjects.Enabled = False (UpdateProjectAccess, no root) would silently- ' swallow its clicks right when they matter most. Move it onto tabConfiguration itself, in the same- ' screen position, so it is never caught by that.- Dim rootButtonSpot As Point = grpProjects.Location- rootButtonSpot.Offset(btnPickRoot.Location)- grpProjects.Controls.Remove(btnPickRoot)- tabConfiguration.Controls.Add(btnPickRoot)- btnPickRoot.Location = rootButtonSpot- btnPickRoot.BringToFront()-- InitializeProject()- InitializeOutputsTab()-- ' Enter in a NumericUpDown's edit box otherwise just beeps (Windows beeps on an unhandled Enter- ' keystroke) and leaves the typed value sitting there uncommitted - HookNumericUpDownEnterKey wires- ' every NumericUpDown on the form, wherever it lives, to NumericUpDown_KeyDown instead.- HookNumericUpDownEnterKey(Me)- End Sub-- ''' <summary>Wires every NumericUpDown found anywhere under root (recursing into GroupBox/TabPage/Panel/...- ''' containers) to NumericUpDown_KeyDown, so Enter commits the typed value and moves on instead of beeping.- ''' Called once, from Form1_Load, on the whole form - a plain loop over Controls rather than a fixed list, so- ''' it also covers any NumericUpDown added later without needing to come back and wire it up by hand.</summary>- Private Sub HookNumericUpDownEnterKey(root As Control)- For Each child As Control In root.Controls- Dim box As NumericUpDown = TryCast(child, NumericUpDown)- If box IsNot Nothing Then AddHandler box.KeyDown, AddressOf NumericUpDown_KeyDown- If child.HasChildren Then HookNumericUpDownEnterKey(child)- Next- End Sub-- ''' <summary>Enter in a NumericUpDown: stops the beep (e.SuppressKeyPress - Enter is not a character its- ''' edit box accepts, which is what Windows was beeping about) and moves focus on to the next control, the- ''' same as Tab would - which also commits whatever was typed, since a NumericUpDown parses/clamps its text- ''' on losing focus regardless of how focus was lost.</summary>- Private Sub NumericUpDown_KeyDown(sender As Object, e As KeyEventArgs)- If e.KeyCode <> Keys.Enter Then Return- e.SuppressKeyPress = True- e.Handled = True- Dim box As Control = TryCast(sender, Control)- If box IsNot Nothing Then Me.SelectNextControl(box, True, True, True, True)- End Sub-- Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed- ClearPreviews()-- For Each thumb As Bitmap In _thumbBitmaps- thumb.Dispose()- Next- _thumbBitmaps.Clear()-- ReplaceSceneImage(Nothing)- DisposeEmptyPreview()- ClearOutputPreview()- End Sub-- Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing- If Not ConfirmSaveProject() Then- e.Cancel = True- Return- End If-- If _runner IsNot Nothing Then- Dim running As DialogResult = MessageBox.Show(Me, "A simulation is running. Stop it and close the program?",- "Simulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question)- If running <> DialogResult.Yes Then- e.Cancel = True- Return- End If- ' the runner closes the video files before it ends- _runner.Cancel()- _runner.WaitForExit(15000)- End If-- If _dirty Then- Dim answer As DialogResult = MessageBox.Show(Me,- "The current color scheme has unsaved changes. Close anyway?",- "Unsaved changes", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)- If answer <> DialogResult.Yes Then e.Cancel = True- End If- End Sub-- ' ------------------------------------------------------------------ project name and folder- '- ' A project is a folder inside the root folder; the folder name is the project name (txtProjectName).- ' The main folder of a project holds configuration.json and the standard subfolders (see ProjectStore).- '- ' The settings on the tabs are kept in memory and only written to configuration.json by "Save project"- ' and "Save as". _project is Nothing for a new project that has not been saved yet.-- ' True when there are changes that are not saved in configuration.json- Private _projectDirty As Boolean-- ' btnPickRoot (grpProjects) blinks light blue, slowly, while no project root is known yet - e.g. right after- ' installing on a different computer, when AppSettings.ProjectRoot is still empty and nothing on the Sources/- ' Probes/Viewer tabs works yet. UpdateProjectAccess starts/stops this alongside the rest of the "has a root"- ' state; RootBlinkTimer_Tick does the actual blinking.- Private WithEvents _rootBlinkTimer As New Timer() With {.Interval = 700}- Private _rootBlinkOn As Boolean-- ''' <summary>Enables/disables everything that depends on a project root being chosen and/or an actual, named- ''' project being the current one. grpProjects and the Outputs tab (its own project list, not necessarily the- ''' one that is open) only need a root. The scene/simulation groups, the Sources/Probes/Viewer tabs, most of- ''' "Quick navigate to" (all but btnGotoConfiguration, which jumps to the always-available Configuration tab),- ''' "Simulation Control", "Share with source / probe" and Save all need a real project. The Configuration tab- ''' (where the root and the project list themselves live) and the color scheme tab manage the application's- ''' own settings, not a project's, so they are never restricted. Disabling- ''' a TabPage here is not enough by itself to keep the user out of it - see tabMainFunctions_Selecting, which- ''' refuses to switch to a disabled tab at all instead of just showing its (disabled) contents.</summary>- Private Sub UpdateProjectAccess()- Dim hasRoot As Boolean = _settings.ProjectRoot.Length > 0- Dim hasProject As Boolean = _project IsNot Nothing-- grpProjects.Enabled = hasRoot- tabOutput.Enabled = hasRoot-- ' btnPickRoot (moved onto tabConfiguration itself in Form1_Load, so grpProjects.Enabled above cannot- ' disable it) blinks light blue, slowly, for exactly the situation it exists for: no project root known- ' yet - a fresh install on another computer, before AppSettings.ProjectRoot is set and everything else- ' on screen is still disabled.- If hasRoot Then- _rootBlinkTimer.Stop()- _rootBlinkOn = False- btnPickRoot.UseVisualStyleBackColor = True- Else- _rootBlinkTimer.Start()- End If-- grpSceneProperties.Enabled = hasProject- grpSimulationSettings.Enabled = hasProject- tabSourceList.Enabled = hasProject- tabProbeList.Enabled = hasProject- tabViewer.Enabled = hasProject-- ' grpNavigateTabs itself stays enabled: btnGotoConfiguration jumps to the always-available Configuration- ' tab, so only the other three "quick navigate" buttons need a real project.- btnGotoPreview.Enabled = hasProject- btnGotoProbes.Enabled = hasProject- btnGotoSources.Enabled = hasProject-- grpSimulationControlButtons.Enabled = hasProject- grpShareImage.Enabled = hasProject- btnSaveConfiguration.Enabled = hasProject- btnSaveConfiguration2.Enabled = hasProject- btnSaveAs.Enabled = hasProject- btnDescription.Enabled = hasProject-- ' Changing a TabPage's Enabled does not by itself repaint the tab strip, so a label's color- ' (tabMainFunctions_DrawItem) would otherwise stay stuck at its old, disabled gray until something- ' unrelated forced a redraw (resizing the window, switching tabs, ...) - force it here instead.- tabMainFunctions.Invalidate()- End Sub-- ''' <summary>Toggles btnPickRoot between light blue and its normal color (UpdateProjectAccess starts/stops- ''' this timer, only while no project root is known yet).</summary>- Private Sub RootBlinkTimer_Tick(sender As Object, e As EventArgs) Handles _rootBlinkTimer.Tick- _rootBlinkOn = Not _rootBlinkOn- btnPickRoot.UseVisualStyleBackColor = False- btnPickRoot.BackColor = If(_rootBlinkOn, Color.LightBlue, SystemColors.Control)- End Sub-- ''' <summary>A disabled TabPage (UpdateProjectAccess) still lets itself be clicked into and shows its- ''' (disabled) contents unless refused here - WinForms' TabControl has no built-in notion of a locked tab.</summary>- Private Sub tabMainFunctions_Selecting(sender As Object, e As TabControlCancelEventArgs) Handles tabMainFunctions.Selecting- If e.TabPage.Enabled Then Return- e.Cancel = True- MessageBox.Show(Me, "Please open or create a project first.", "No project", MessageBoxButtons.OK, MessageBoxIcon.Information)- End Sub-- ''' <summary>Draws each tab's own label - needed only so a disabled tab's label can be shown in a lighter- ''' gray than an enabled one's (Form1_Load sets tabMainFunctions.DrawMode to OwnerDrawFixed for this).</summary>- Private Sub tabMainFunctions_DrawItem(sender As Object, e As DrawItemEventArgs) Handles tabMainFunctions.DrawItem- Dim page As TabPage = tabMainFunctions.TabPages(e.Index)- Dim tabRect As Rectangle = tabMainFunctions.GetTabRect(e.Index)-- ' the selected tab a shade lighter than the rest, so which one is open is still visible without the- ' native visual style this drawing replaces- Dim backColor As Color = If(e.Index = tabMainFunctions.SelectedIndex, SystemColors.Window, SystemColors.Control)- Using backBrush As New SolidBrush(backColor)- e.Graphics.FillRectangle(backBrush, tabRect)- End Using-- Dim textColor As Color = If(page.Enabled, SystemColors.ControlText, Color.Silver)- Dim flags As TextFormatFlags = TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter Or TextFormatFlags.SingleLine- TextRenderer.DrawText(e.Graphics, page.Text, tabMainFunctions.Font, tabRect, textColor, flags)- End Sub-- ''' <summary>Startup: nothing from any previous project is filled into the form. Only the chosen project- ''' root folder (AppSettings.ProjectRoot) is restored, if one was already chosen on an earlier run - everything- ''' that needs a root or a real project stays disabled until then (UpdateProjectAccess).</summary>- Private Sub InitializeProject()- _settings = AppSettings.Load()-- txtRootFolder.Text = _settings.ProjectRoot- txtProjectName.Text = ""-- UpdateProjectAccess()-- UpdateTitle()- RefreshProjectList()- End Sub-- ''' <summary>File > Open: browse directly to the main folder of a project and open it, without going through- ''' the project list (browsing for the project ROOT folder instead is btnBrowseRoot / File > Choose project- ''' root / double-clicking txtRootFolder - see ChooseProjectRootToolStripMenuItem_Click).</summary>- Private Sub OpenProject_Click(sender As Object, e As EventArgs) Handles OpenToolStripMenuItem.Click- Try- Dim folder As String = BrowseForFolder("Choose the main folder of the project (the folder that contains configuration.json)",- txtRootFolder.Text.Trim(), False)- If folder.Length = 0 Then Return- If Not ConfirmSaveProject() Then Return-- SetCurrentProject(ProjectStore.Open(folder))- Catch ex As Exception- MessageBox.Show(Me, "The project could not be opened:" & vbCrLf & vbCrLf & ex.Message,- "Open project", MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Try- End Sub-- ''' <summary>Save project (buttons and File > Save): creates the project (folders and configuration file) when it is new, otherwise overwrites its configuration file.</summary>- Private Sub SaveProject_Click(sender As Object, e As EventArgs) Handles btnSaveConfiguration.Click, SaveToolStripMenuItem.Click- SaveProject()- End Sub-- ''' <summary>- ''' Save as: a simple name prompt (PromptForText, the same small dialog btnRenameProject uses), not a file- ''' dialog - the new project always goes into the current root folder (txtRootFolder), never somewhere else,- ''' and there is no file extension to worry about (a project is just a folder, see ProjectStore). Saving under- ''' a name that already exists in the root is not refused up front: SaveProjectTo itself asks to overwrite in- ''' that case, same as plain Save would for an existing project.- ''' </summary>- Private Sub SaveAs_Click(sender As Object, e As EventArgs) Handles btnSaveAs.Click- Dim root As String = txtRootFolder.Text.Trim()- If root.Length = 0 Then- MessageBox.Show(Me, "Enter a root folder first (double-click the box to browse).", "Save project as",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- Dim projectName As String = txtProjectName.Text.Trim()- If Not PromptForText("Save project as", "New project name (saved in the current root folder):", projectName, projectName) Then Return- projectName = projectName.Trim()-- Dim problem As String = ProjectStore.ValidateName(projectName)- If problem.Length > 0 Then- MessageBox.Show(Me, problem, "Save project as", MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- SaveProjectTo(root, projectName)- End Sub-- ''' <summary>Opens frmDescription so the user can add/edit a free-form description of the current project,- ''' stored in the project's own configuration.json (ProjectConfig.Description) - saved to disk immediately- ''' on OK, the same as btnRenameProject's rename takes effect right away rather than waiting for "Save- ''' project". Only enabled while a real (saved) project is open (UpdateProjectAccess) - a new, unsaved- ''' project has no configuration.json yet to hold it.</summary>- Private Sub btnDescription_Click(sender As Object, e As EventArgs) Handles btnDescription.Click- If _project Is Nothing Then Return- Using dlg As New frmDescription()- dlg.DescriptionText = _project.Config.Description- If dlg.ShowDialog(Me) = DialogResult.OK Then- _project.Config.Description = dlg.DescriptionText- _project.Save()- End If- End Using- End Sub-- Private Sub ExitProgram_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click- Close()- End Sub-- ' Info menu (added on tabMainFunctions's menu strip): Help opens a page describing the program's tabs and- ' controls, About shows the program name/version. Both are plain, self-built forms (HelpForm.vb, AboutForm.vb).-- Private Sub HelpToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles HelpToolStripMenuItem.Click- Using dlg As New HelpForm()- dlg.ShowDialog(Me)- End Using- End Sub-- Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click- Using dlg As New AboutForm()- dlg.ShowDialog(Me)- End Using- End Sub-- ''' <summary>File > Choose project root, the btnBrowseRoot button, btnPickRoot (the blinking button that is- ''' always reachable even with no root yet - see Form1_Load/UpdateProjectAccess), and double-clicking the- ''' (read-only) root folder box: all four let the user pick the folder that contains the project folders- ''' (txtRootFolder just displays it - AppSettings.ProjectRoot is the real, persisted value, restored again on- ''' the next start). Once a root is chosen, grpProjects and the Outputs tab become usable and the project- ''' list is (re)populated.</summary>- Private Sub ChooseProjectRootToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ChooseProjectRootToolStripMenuItem.Click, btnBrowseRoot.Click, btnPickRoot.Click, txtRootFolder.DoubleClick- Dim start As String = If(_settings.ProjectRoot.Length > 0, _settings.ProjectRoot, txtRootFolder.Text.Trim())- Dim chosen As String = BrowseForFolder("Choose the root folder that contains your project folders", start, True)- If chosen.Length = 0 Then Return-- _settings.ProjectRoot = chosen- _settings.Save()- txtRootFolder.Text = chosen- UpdateProjectAccess()- RefreshProjectList()- End Sub-- ''' <summary>lblInfo (Settings tab): a clickable "hyperlink" style label (see Form1_Load for its Cursor/ForeColor)- ''' that explains the 4th order Laplacian option and why it needs a different "Set c-value" (File menu).</summary>- Private Sub lblInfo_Click(sender As Object, e As EventArgs) Handles lblInfo.Click- MessageBox.Show(Me,- "The standard 3rd order Laplacian processing inherently leads to large dispersion, meaning that longer " &- "wavelengths propagate faster through the medium. Choosing 4th order processing (including sub-step sampling) " &- "reduces this effect significantly. However, processing is somewhat slower. Another effect of 4th order " &- "processing is that it requires a different propagation speed (c). The value can be specified per project and set in the File menu. " &- "For 4th order processing choose 1.00 for c. For standard processing, this value can be quite a bit " &- "different. For example, with standard processing for waves with a frequency of 100, c = 0.56, leading in " &- "this case to a wavelength of only 9 pixels (instead of 15). Because of the dispersion present in standard " &- "processing, the exact value of c is strongly dependent on the frequency. (lower frequencies -> higher c " &- "value; higher frequencies -> lower c value).",- "4th order Laplacian and wave speed (c)", MessageBoxButtons.OK, MessageBoxIcon.Information)- End Sub-- ''' <summary>File > Set c-value: shows the current wave propagation speed c (SimulationSettings.WaveSpeedC) and- ''' lets it be changed. c is only used to estimate a source's wavelength (lblLambdaIs on the Sources tab).</summary>- Private Sub SetCValueToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SetCValueToolStripMenuItem.Click- Dim newValue As Double- If PromptForCValue(_simulation.WaveSpeedC, newValue) Then- If newValue <> _simulation.WaveSpeedC Then- _simulation.WaveSpeedC = newValue- MarkProjectChanged()- End If- UpdateLambdaLabel()- End If- End Sub-- ''' <summary>- ''' A small modal dialog, built entirely in code (no Designer file needed), to view and change the wave- ''' propagation speed c. Returns True (with the chosen value in result) when the user pressed OK.- ''' </summary>- Private Function PromptForCValue(current As Double, ByRef result As Double) As Boolean- Using dlg As New Form()- dlg.Text = "Set c-value"- dlg.FormBorderStyle = FormBorderStyle.FixedDialog- dlg.StartPosition = FormStartPosition.CenterParent- dlg.MinimizeBox = False- dlg.MaximizeBox = False- dlg.ShowInTaskbar = False- dlg.ClientSize = New Size(340, 116)-- Dim lbl As New Label()- lbl.Text = "Wave propagation speed c (in pixels per step)" & vbCrLf &- "(lambda = c / frequency)." & vbCrLf &- "Only used to estimate a source's wavelength in screen pixels"- lbl.SetBounds(12, 10, 316, 44)-- Dim num As New NumericUpDown()- num.DecimalPlaces = 3- num.Minimum = 0.001D- num.Maximum = 1000000D- num.Increment = 0.1D- num.SetBounds(12, 60, 110, 22)- Dim clamped As Double = Math.Max(CDbl(num.Minimum), Math.Min(CDbl(num.Maximum), current))- num.Value = CDec(clamped)-- Dim btnOk As New Button()- btnOk.Text = "OK"- btnOk.DialogResult = DialogResult.OK- btnOk.SetBounds(152, 80, 84, 26)-- Dim btnCancel As New Button()- btnCancel.Text = "Cancel"- btnCancel.DialogResult = DialogResult.Cancel- btnCancel.SetBounds(244, 80, 84, 26)-- dlg.Controls.AddRange(New Control() {lbl, num, btnOk, btnCancel})- dlg.AcceptButton = btnOk- dlg.CancelButton = btnCancel-- If dlg.ShowDialog(Me) = DialogResult.OK Then- result = CDbl(num.Value)- Return True- End If- End Using- result = current- Return False- End Function-- ''' <summary>- ''' A small modal dialog, built entirely in code (no Designer file needed), that asks for one line of text -- ''' used to rename a project. Returns True (with the typed text in result) when the user pressed OK.- ''' </summary>- Private Function PromptForText(title As String, prompt As String, defaultValue As String, ByRef result As String) As Boolean- Using dlg As New Form()- dlg.Text = title- dlg.FormBorderStyle = FormBorderStyle.FixedDialog- dlg.StartPosition = FormStartPosition.CenterParent- dlg.MinimizeBox = False- dlg.MaximizeBox = False- dlg.ShowInTaskbar = False- dlg.ClientSize = New Size(340, 110)-- Dim lbl As New Label()- lbl.Text = prompt- lbl.SetBounds(12, 10, 316, 20)-- Dim txt As New TextBox()- txt.SetBounds(12, 34, 316, 22)- txt.Text = defaultValue- txt.SelectAll()-- Dim btnOk As New Button()- btnOk.Text = "OK"- btnOk.DialogResult = DialogResult.OK- btnOk.SetBounds(152, 68, 84, 26)-- Dim btnCancel As New Button()- btnCancel.Text = "Cancel"- btnCancel.DialogResult = DialogResult.Cancel- btnCancel.SetBounds(244, 68, 84, 26)-- dlg.Controls.AddRange(New Control() {lbl, txt, btnOk, btnCancel})- dlg.AcceptButton = btnOk- dlg.CancelButton = btnCancel- dlg.ActiveControl = txt-- If dlg.ShowDialog(Me) = DialogResult.OK Then- result = txt.Text- Return True- End If- End Using- result = defaultValue- Return False- End Function-- ''' <summary>Saves the project in the folder root\name shown in the boxes. Returns False when nothing was saved.</summary>- Private Function SaveProject() As Boolean- Dim root As String = txtRootFolder.Text.Trim()- Dim projectName As String = txtProjectName.Text.Trim()-- If root.Length = 0 Then- MessageBox.Show(Me, "Enter a root folder first (double-click the box to browse).", "Save project",- MessageBoxButtons.OK, MessageBoxIcon.Information)- txtRootFolder.Focus()- Return False- End If-- Dim problem As String = ProjectStore.ValidateName(projectName)- If problem.Length > 0 Then- MessageBox.Show(Me, problem, "Save project", MessageBoxButtons.OK, MessageBoxIcon.Information)- txtProjectName.Focus()- Return False- End If-- Return SaveProjectTo(root, projectName)- End Function-- ''' <summary>- ''' Saves the current settings as the project root\projectName:- ''' the open project itself: its configuration file is overwritten;- ''' another existing project: after confirmation its configuration file is overwritten;- ''' a folder that does not exist yet: the project folder, its subfolders and the configuration file are created.- ''' </summary>- Private Function SaveProjectTo(root As String, projectName As String) As Boolean- Try- Dim rootFull As String = ProjectStore.NormalizeFolder(root)- Dim folder As String = Path.Combine(rootFull, projectName)- Dim previous As Project = _project- Dim target As Project-- If previous IsNot Nothing AndAlso String.Equals(folder, previous.FolderPath, StringComparison.OrdinalIgnoreCase) Then- target = previous- ElseIf ProjectStore.IsProjectFolder(folder) Then- Dim answer As DialogResult = MessageBox.Show(Me,- "A project named '" & projectName & "' already exists in the root folder" & vbCrLf & rootFull & vbCrLf & vbCrLf &- "Overwrite its configuration with the current settings?",- "Save project", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)- If answer <> DialogResult.Yes Then Return False- target = ProjectStore.Open(folder)- Else- If Not Directory.Exists(rootFull) Then- Dim answer As DialogResult = MessageBox.Show(Me,- "The root folder does not exist:" & vbCrLf & rootFull & vbCrLf & vbCrLf & "Create it?",- "Save project", MessageBoxButtons.YesNo, MessageBoxIcon.Question)- If answer <> DialogResult.Yes Then Return False- End If- target = ProjectStore.Create(rootFull, projectName)- End If-- PrepareSceneImageFor(target, previous)- _scene.ToConfig(target.Config)- _simulation.ToConfig(target.Config)- ProbeSettings.ListToConfig(_probes, target.Config)- SourceSettings.ListToConfig(_sources, target.Config)- target.Save()-- SetCurrentProject(target)- Return True- Catch ex As Exception- MessageBox.Show(Me, "The project could not be saved:" & vbCrLf & vbCrLf & ex.Message,- "Save project", MessageBoxButtons.OK, MessageBoxIcon.Warning)- Return False- End Try- End Function-- ''' <summary>- ''' Makes the scene image path in _scene right for the project it is saved in: an image that does not already lie- ''' inside the target project's own folder (the previous project's folder, or anywhere else) is copied into the- ''' target's scene_images folder. This is the same copy that btnLOadSceneImage_Click already does when a project- ''' exists; this one catches an image that was picked before the (new) project was ever saved.- ''' </summary>- Private Sub PrepareSceneImageFor(target As Project, previous As Project)- If _scene.ImageFile.Length = 0 OrElse Object.ReferenceEquals(target, previous) Then Return-- Dim oldFolder As String = If(previous Is Nothing, "", previous.FolderPath)- Dim fullPath As String = SceneSettings.ToFullPath(oldFolder, _scene.ImageFile)-- If File.Exists(fullPath) AndAlso Not IsInsideFolder(fullPath, target.FolderPath) Then- fullPath = CopyIntoSceneImageFolder(target, fullPath)- End If-- _scene.ImageFile = SceneSettings.ToStoredPath(target.FolderPath, fullPath)- End Sub-- ''' <summary>True when fullPath lies inside folder (or one of its subfolders).</summary>- Private Shared Function IsInsideFolder(fullPath As String, folder As String) As Boolean- If String.IsNullOrEmpty(folder) Then Return False- Dim prefix As String = folder.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) & Path.DirectorySeparatorChar- Return Path.GetFullPath(fullPath).StartsWith(Path.GetFullPath(prefix), StringComparison.OrdinalIgnoreCase)- End Function-- ''' <summary>- ''' Copies an image file into the scene_images folder of a project and returns the full path of the copy. A different- ''' file with the same name is not overwritten: the copy then gets a number. A copy that is already there (the same- ''' file, same size) is reused instead of copied again.- ''' </summary>- Private Shared Function CopyIntoSceneImageFolder(project As Project, fullPath As String) As String- Directory.CreateDirectory(project.SceneImageFolder)- Dim fileName As String = Path.GetFileName(fullPath)- Dim copy As String = Path.Combine(project.SceneImageFolder, fileName)-- Dim counter As Integer = 2- Do While File.Exists(copy) AndAlso New FileInfo(copy).Length <> New FileInfo(fullPath).Length- copy = Path.Combine(project.SceneImageFolder, Path.GetFileNameWithoutExtension(fileName) & " (" &- counter.ToString(CultureInfo.InvariantCulture) & ")" & Path.GetExtension(fileName))- counter += 1- Loop- If Not File.Exists(copy) Then File.Copy(fullPath, copy)- Return copy- End Function-- ''' <summary>- ''' Asks what to do with unsaved changes before they would be lost. Returns False when the user cancels- ''' (or saving failed), True when it is fine to continue.- ''' </summary>- Private Function ConfirmSaveProject() As Boolean- ' Nothing to save when no named project exists yet (a project only exists once it has been loaded from- ' the list or created and named through btnNewProject's dialog) - there is no such thing as an- ' "unsaved new project" to ask about any more.- If _project Is Nothing OrElse Not _projectDirty Then Return True-- Dim answer As DialogResult = MessageBox.Show(Me, "There are unsaved changes in the project '" & _project.Name & "'. Save them first?",- "Unsaved changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)- Select Case answer- Case DialogResult.Yes- Return SaveProject()- Case DialogResult.No- Return True- Case Else- Return False- End Select- End Function-- ''' <summary>Resets the in-memory project state (scene, simulation, probes, sources) to blank defaults.- ''' Does not touch grpSceneProperties/grpSimulationSettings/grpProjects.Enabled - a caller that goes on to- ''' make a real, named project current (SetCurrentProject) re-enables them there; a caller that ends up with- ''' no project at all (e.g. deleting the one that was open) should instead disable them, since - per the- ''' startup design - there is no such thing as an editable "new project" that does not exist on disk yet.</summary>- Private Sub StartNewProject()- _project = Nothing- _scene = New SceneSettings()- ' chkDampingEdge and chkUseObjectSources have no software-chosen default of their own (see their- ' comments in SceneSettings.vb) - a new project starts at whatever the controls' own Designer values are- _scene.DampingEdgeEnabled = chkDampingEdge.Checked- _scene.UseObjectSources = chkUseObjectSources.Checked- ReplaceSceneImage(Nothing)- txtProjectName.Text = ""- ShowSceneInControls()- _simulation = New SimulationSettings()- ' numSimulationSteps and numTimeDecayFactor have no software-chosen default of their own (see their- ' comments in SimulationSettings.vb) - a new project starts at whatever the controls' own Designer- ' values are- _simulation.Steps = CInt(numSimulationSteps.Value)- _simulation.TimeDecayFactor = CDbl(numTimeDecayFactor.Value)- ShowSimulationInControls()- ResetProbes()- ResetSources()- _fieldVideoFile = ""- _intensityVideoFile = ""- UpdateVideoButtons()- _projectDirty = False- UpdateTitle()- txtProjectName.Focus()- End Sub-- ''' <summary>Makes a saved project the current one: shows it in the boxes and remembers it for the next start.- ''' Also called by SaveProjectTo for a plain "Save project" of the project that is already open (target and- ''' the previous _project are then the same folder) - the preview-clearing below must only run when the- ''' project is actually changing, or every "Save configuration" would blank the Sources/Probes tab's picture- ''' (see ClearPreviewImage's comment) even though nothing about that picture is out of date.</summary>- Private Sub SetCurrentProject(opened As Project)- Dim isDifferentProject As Boolean = _project Is Nothing OrElse- Not String.Equals(_project.FolderPath, opened.FolderPath, StringComparison.OrdinalIgnoreCase)-- _project = opened- txtRootFolder.Text = opened.RootFolder- txtProjectName.Text = opened.Name- UpdateProjectAccess()-- _settings.LastRootFolder = opened.RootFolder- _settings.LastProjectName = opened.Name- _settings.Save()-- If isDifferentProject Then- ' a preview picture (Sources/Probes tab) loaded for the previous project has no relevance to this one -- ' clear it so the tab shows this project's own scene image (or a blank placeholder) the next time it is- ' visited, rather than a leftover picture from whatever was open before (AutoLoadSceneImageIfEmpty only- ' fills a picture that is empty, so a stale one left behind would otherwise never be replaced)- ClearPreviewImage(_picSource)- ClearPreviewImage(_picProbe)- End If-- LoadSceneFromProject()- _simulation = SimulationSettings.FromConfig(_project.Config)- ShowSimulationInControls()- LoadProbesFromProject()- LoadSourcesFromProject()- _projectDirty = False- UpdateTitle()- RefreshProjectList()- End Sub-- ''' <summary>Disposes and clears a preview picture's image (Sources/Probes tab), if it has one.</summary>- Private Sub ClearPreviewImage(pic As PictureBox)- If pic Is Nothing OrElse pic.Image Is Nothing Then Return- Dim old As Image = pic.Image- pic.Image = Nothing- old.Dispose()- pic.Invalidate()- End Sub-- ''' <summary>Something in the project was changed and is not saved yet.</summary>- Private Sub MarkProjectChanged()- If _loadingScene OrElse _loadingSim OrElse _loadingProbe OrElse _loadingSource Then Return- _projectDirty = True- UpdateTitle()- End Sub-- Private Sub UpdateTitle()- Dim projectLabel As String = If(_project Is Nothing, "(new project)", _project.Name)- Text = "2D wave simulation - " & projectLabel & If(_projectDirty, " *", "") & If(_simStatus.Length > 0, " | " & _simStatus, "")- End Sub-- ''' <summary>- ''' Lets the user choose a folder: type or paste a full path directly into the box, or click "Browse..." for- ''' the usual Windows tree picker - rooted at "This PC" rather than the Desktop, so every drive (C:\, D:\, a- ''' network drive, anywhere) is one click away instead of buried under Desktop. This replaces a plain- ''' FolderBrowserDialog call, which on this machine shows no address bar to type a path into and makes other- ''' drives awkward to reach from its Desktop-rooted tree. Returns the chosen folder, or an empty string when- ''' cancelled; when allowNewFolder is False, OK is refused until the typed/picked path actually exists (a new,- ''' not-yet-created one is fine when allowNewFolder is True - the caller decides whether/how to create it).- ''' </summary>- Private Function BrowseForFolder(description As String, startFolder As String, allowNewFolder As Boolean) As String- Using dlg As New Form()- dlg.Text = "Choose a folder"- dlg.FormBorderStyle = FormBorderStyle.FixedDialog- dlg.StartPosition = FormStartPosition.CenterParent- dlg.MinimizeBox = False- dlg.MaximizeBox = False- dlg.ShowInTaskbar = False- dlg.ClientSize = New Size(480, 124)-- Dim lbl As New Label()- lbl.Text = description- lbl.SetBounds(12, 10, 456, 34)-- Dim txt As New TextBox()- txt.SetBounds(12, 50, 362, 22)- txt.Text = startFolder-- Dim btnBrowse As New Button()- btnBrowse.Text = "Browse..."- btnBrowse.SetBounds(380, 49, 88, 24)- AddHandler btnBrowse.Click, Sub(sender As Object, e As EventArgs)- Using pick As New FolderBrowserDialog()- pick.Description = description- pick.ShowNewFolderButton = allowNewFolder- ' MyComputer (not the default Desktop) so every drive is a- ' top-level node, reachable in one click instead of nested- ' under Desktop/This PC- pick.RootFolder = Environment.SpecialFolder.MyComputer- If Directory.Exists(txt.Text.Trim()) Then pick.SelectedPath = txt.Text.Trim()- If pick.ShowDialog(dlg) = DialogResult.OK Then- txt.Text = pick.SelectedPath- txt.SelectAll()- End If- End Using- End Sub-- Dim btnOk As New Button()- btnOk.Text = "OK"- btnOk.SetBounds(228, 86, 84, 26)- AddHandler btnOk.Click, Sub(sender As Object, e As EventArgs)- Dim path As String = txt.Text.Trim()- If path.Length = 0 Then- MessageBox.Show(dlg, "Enter or browse to a folder first.", "Choose a folder",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- If Not allowNewFolder AndAlso Not Directory.Exists(path) Then- MessageBox.Show(dlg, "This folder does not exist:" & vbCrLf & path,- "Choose a folder", MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- dlg.DialogResult = DialogResult.OK- dlg.Close()- End Sub-- Dim btnCancel As New Button()- btnCancel.Text = "Cancel"- btnCancel.DialogResult = DialogResult.Cancel- btnCancel.SetBounds(320, 86, 84, 26)-- dlg.Controls.AddRange(New Control() {lbl, txt, btnBrowse, btnOk, btnCancel})- dlg.AcceptButton = btnOk- dlg.CancelButton = btnCancel- dlg.ActiveControl = txt-- If dlg.ShowDialog(Me) = DialogResult.OK Then Return txt.Text.Trim()- End Using- Return ""- End Function-- ' ------------------------------------------------------------------ the project list (Configuration tab)- '- ' lstAllProjects lists every project found directly inside the chosen project root folder (File > Choose project- ' root, AppSettings.ProjectRoot) - a quick way to switch projects without browsing to their folder every- ' time. New creates another project there; Load/Delete/Rename act on the selected entry.- '- ' Two columns, colProjectName and colLastEdit ("last edited" = the last write time of that project's- ' configuration.json). Clicking either header sorts by it (lstAllProjects_ColumnClick), toggling direction on a- ' repeat click of the same header - the usual Explorer/Excel convention. Each row's Tag holds a- ' ProjectListEntry so the raw name and date stay available without re-parsing the displayed text.-- ''' <summary>One row in lstAllProjects, kept in ListViewItem.Tag.</summary>- Private NotInheritable Class ProjectListEntry- Public ReadOnly Name As String- Public ReadOnly LastModified As DateTime-- Public Sub New(name As String, lastModified As DateTime)- Me.Name = name- Me.LastModified = lastModified- End Sub- End Class-- ''' <summary>Reads every project under AppSettings.ProjectRoot into a ProjectListEntry (name plus the last- ''' write time of its configuration.json). Shared by lstAllProjects (Configuration tab) and lstAllProjects3- ''' (Outputs tab) - see the "the Outputs tab" section further down.</summary>- Private Function BuildProjectEntries() As List(Of ProjectListEntry)- Dim entries As New List(Of ProjectListEntry)()- For Each name As String In ProjectStore.ListProjects(_settings.ProjectRoot)- Dim folder As String = ProjectStore.FolderPathFor(_settings.ProjectRoot, name)- Dim configPath As String = Path.Combine(folder, ProjectConfig.FileName)- Dim lastModified As DateTime = If(File.Exists(configPath), File.GetLastWriteTime(configPath), Directory.GetLastWriteTime(folder))- entries.Add(New ProjectListEntry(name, lastModified))- Next- Return entries- End Function-- ''' <summary>Sorts the project entries in place, by name (sortColumn 0) or last-edited (sortColumn 1).</summary>- Private Sub SortProjectEntries(entries As List(Of ProjectListEntry), sortColumn As Integer, ascending As Boolean)- Dim result As Comparison(Of ProjectListEntry)- If sortColumn = 0 Then- result = Function(a As ProjectListEntry, b As ProjectListEntry) String.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)- Else- result = Function(a As ProjectListEntry, b As ProjectListEntry) DateTime.Compare(a.LastModified, b.LastModified)- End If- entries.Sort(result)- If Not ascending Then entries.Reverse()- End Sub-- ''' <summary>Fills a two-column (name, last edited) project ListView from the given, already-sorted entries.</summary>- Private Sub PopulateProjectListView(list As ListView, entries As List(Of ProjectListEntry))- list.BeginUpdate()- Try- list.Items.Clear()- For Each entry As ProjectListEntry In entries- Dim item As New ListViewItem(entry.Name)- item.SubItems.Add(entry.LastModified.ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture))- item.Tag = entry- list.Items.Add(item)- Next- Finally- list.EndUpdate()- End Try- End Sub-- ''' <summary>The plain project name selected in a project ListView (lstAllProjects or lstAllProjects3), or ""- ''' when nothing is selected there.</summary>- Private Function SelectedProjectName(list As ListView) As String- If list.SelectedItems.Count = 0 Then Return ""- Dim entry As ProjectListEntry = TryCast(list.SelectedItems(0).Tag, ProjectListEntry)- Return If(entry IsNot Nothing, entry.Name, "")- End Function-- ''' <summary>Selects, in a project ListView, the row for the project with the given name (case-insensitive), if any.</summary>- Private Sub SelectProjectInList(list As ListView, name As String)- If name.Length = 0 Then Return- For Each item As ListViewItem In list.Items- Dim entry As ProjectListEntry = DirectCast(item.Tag, ProjectListEntry)- If String.Equals(entry.Name, name, StringComparison.OrdinalIgnoreCase) Then- item.Selected = True- item.EnsureVisible()- Return- End If- Next- End Sub-- ''' <summary>Repopulates lstAllProjects from AppSettings.ProjectRoot, sorted per _projectSortColumn/Ascending.- ''' Keeps the current selection, by name, when that project is still in the refreshed list.</summary>- Private Sub RefreshProjectList()- Dim selectedName As String = SelectedProjectName(lstAllProjects)-- Dim entries As List(Of ProjectListEntry) = BuildProjectEntries()- SortProjectEntries(entries, _projectSortColumn, _projectSortAscending)- PopulateProjectListView(lstAllProjects, entries)-- UpdateProjectListSortHeaders()- SelectProjectInList(lstAllProjects, selectedName)- UpdateProjectListButtons()- End Sub-- ''' <summary>Clicking a column header sorts by it; clicking the same header again reverses the direction.</summary>- Private Sub lstAllProjects_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstAllProjects.ColumnClick- If e.Column = _projectSortColumn Then- _projectSortAscending = Not _projectSortAscending- Else- _projectSortColumn = e.Column- _projectSortAscending = True- End If- RefreshProjectList()- End Sub-- ''' <summary>Marks the currently sorted column's header with a small arrow, the way a sortable list usually does.</summary>- Private Sub UpdateProjectListSortHeaders()- Dim arrow As String = If(_projectSortAscending, " ^", " v")- colProjectName.Text = "Project name" & If(_projectSortColumn = 0, arrow, "")- colLastEdit.Text = "Last edited" & If(_projectSortColumn = 1, arrow, "")- End Sub-- ''' <summary>New needs a chosen project root; Load/Delete/Rename only make sense with something selected.</summary>- Private Sub UpdateProjectListButtons()- Dim hasSelection As Boolean = (lstAllProjects.SelectedItems.Count > 0)- btnNewProject.Enabled = (_settings IsNot Nothing) AndAlso (_settings.ProjectRoot.Length > 0)- btnLoadProject.Enabled = hasSelection- btnDeleteProject.Enabled = hasSelection- btnRenameProject.Enabled = hasSelection- End Sub-- ''' <summary>- ''' Creates a new, empty project (folders and configuration.json, default settings) in the chosen project- ''' root, under a name the user types in a dialog, and makes it the current project. Never overwrites an- ''' existing project: a name already used there is refused and the dialog reopens so a different name can be- ''' chosen. Asks to save unsaved changes in the current project first, like Load. Shared by the button and- ''' File > New - there is no such thing as a "new project" until it has actually been named and created here,- ''' so File > New no longer leaves an unnamed, un-saved project open for editing.- ''' </summary>- Private Sub btnNewProject2_Click(sender As Object, e As EventArgs) Handles btnNewProject.Click, NewToolStripMenuItem.Click- If _settings.ProjectRoot.Length = 0 Then- MessageBox.Show(Me, "Choose a project root folder first (File > Choose project root).", "New project",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- If Not ConfirmSaveProject() Then Return-- Dim name As String = ""- Do- If Not PromptForText("New project", "Name for the new project:", name, name) Then Return- name = name.Trim()-- Dim problem As String = ProjectStore.ValidateName(name)- If problem.Length > 0 Then- MessageBox.Show(Me, problem, "New project", MessageBoxButtons.OK, MessageBoxIcon.Information)- Continue Do- End If- If ProjectStore.IsProjectFolder(ProjectStore.FolderPathFor(_settings.ProjectRoot, name)) Then- MessageBox.Show(Me, "A project named '" & name & "' already exists in this root folder. Choose a different name.",- "New project", MessageBoxButtons.OK, MessageBoxIcon.Information)- Continue Do- End If-- Try- Dim created As Project = ProjectStore.Create(_settings.ProjectRoot, name)- StartNewProject()-- ' Write the just-computed defaults (StartNewProject read numSimulationSteps/numTimeDecayFactor- ' etc. from their Designer values) into the new project's configuration.json before- ' SetCurrentProject reads it back - otherwise, since a freshly created project has no "steps" or- ' "time_decay_factor" key yet, FromConfig would fall back to its own hardcoded legacy-compatibility- ' defaults (for an older project saved before these settings existed) instead, silently discarding- ' the Designer values StartNewProject just set.- _scene.ToConfig(created.Config)- _simulation.ToConfig(created.Config)- ProbeSettings.ListToConfig(_probes, created.Config)- SourceSettings.ListToConfig(_sources, created.Config)- created.Save()-- SetCurrentProject(created)- ToolStripStatusLabel1.Text = "Project '" & name & "' created."- Return- Catch ex As Exception- MessageBox.Show(Me, "The project could not be created:" & vbCrLf & vbCrLf & ex.Message,- "New project", MessageBoxButtons.OK, MessageBoxIcon.Warning)- Continue Do- End Try- Loop- End Sub-- Private Sub lstAllProjects_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstAllProjects.SelectedIndexChanged- UpdateProjectListButtons()- End Sub-- ''' <summary>Double-clicking a project in the list loads it, the same as pressing Load.</summary>- Private Sub lstAllProjects_DoubleClick(sender As Object, e As EventArgs) Handles lstAllProjects.DoubleClick- btnLoadProject_Click(sender, e)- End Sub-- ''' <summary>The project folder for the entry currently selected in lstAllProjects, or "" when nothing is selected.</summary>- Private Function SelectedProjectFolder() As String- Dim name As String = SelectedProjectName(lstAllProjects)- If name.Length = 0 Then Return ""- Return ProjectStore.FolderPathFor(_settings.ProjectRoot, name)- End Function-- ''' <summary>True when the given project folder is the one currently open, and a simulation is running for- ''' it - Delete and Rename refuse in that case, since the run may still be writing files into that folder.</summary>- Private Function IsOpenProjectRunning(folder As String) As Boolean- Return (_project IsNot Nothing) AndAlso (_runner IsNot Nothing) AndAlso- String.Equals(_project.FolderPath, folder, StringComparison.OrdinalIgnoreCase)- End Function-- ''' <summary>Loads the project selected in lstAllProjects - the same as "Open existing", just picked from the- ''' list instead of browsed to. Asks to save unsaved changes in the current project first, like every other- ''' action that replaces it (ConfirmSaveProject).</summary>- Private Sub btnLoadProject_Click(sender As Object, e As EventArgs) Handles btnLoadProject.Click- Dim folder As String = SelectedProjectFolder()- If folder.Length = 0 Then Return-- Try- If Not ConfirmSaveProject() Then Return- SetCurrentProject(ProjectStore.Open(folder))- Catch ex As Exception- MessageBox.Show(Me, "The project could not be opened:" & vbCrLf & vbCrLf & ex.Message,- "Load project", MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Try- End Sub-- ''' <summary>Deletes the project selected in lstAllProjects, after confirmation. Refuses while a simulation- ''' for that same project is still running. Clears the editor to a new, unsaved project when the deleted- ''' project was the one currently open, since its folder is gone.</summary>- Private Sub btnDeleteProject_Click(sender As Object, e As EventArgs) Handles btnDeleteProject.Click- Dim name As String = SelectedProjectName(lstAllProjects)- Dim folder As String = SelectedProjectFolder()- If folder.Length = 0 Then Return-- If IsOpenProjectRunning(folder) Then- MessageBox.Show(Me, "A simulation is running for this project. Stop it first.", "Delete project",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- Dim message As String = "Permanently delete the project '" & name & "' and everything in its folder?" & vbCrLf & vbCrLf & folder-- ' the assets folder is where the user keeps their own third-party files (e.g. a Photoshop source file) -- ' point this out explicitly, since deleting the project deletes those too, and they have no other copy here- Dim assetCount As Integer = CountFilesIn(Path.Combine(folder, ProjectStore.AssetsFolderName))- If assetCount > 0 Then- message &= vbCrLf & vbCrLf & "This includes " & assetCount.ToString(CultureInfo.InvariantCulture) &- " file(s) in its assets folder - copy them elsewhere first if you want to keep them."- End If-- Dim answer As DialogResult = MessageBox.Show(Me, message, "Delete project", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)- If answer <> DialogResult.Yes Then Return-- Dim wasOpenProject As Boolean = (_project IsNot Nothing) AndAlso String.Equals(_project.FolderPath, folder, StringComparison.OrdinalIgnoreCase)- Try- ProjectStore.Delete(folder)- Catch ex As Exception- MessageBox.Show(Me, "The project could not be deleted:" & vbCrLf & vbCrLf & ex.Message,- "Delete project", MessageBoxButtons.OK, MessageBoxIcon.Warning)- RefreshProjectList()- Return- End Try-- If wasOpenProject Then- StartNewProject()- UpdateProjectAccess()- End If- RefreshProjectList()- ToolStripStatusLabel1.Text = "Project '" & name & "' deleted."- End Sub-- ''' <summary>The number of files in folderPath (recursively), or 0 when it does not exist or cannot be read.</summary>- Private Shared Function CountFilesIn(folderPath As String) As Integer- If Not Directory.Exists(folderPath) Then Return 0- Try- Return Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories).Length- Catch ex As Exception When TypeOf ex Is IOException OrElse TypeOf ex Is UnauthorizedAccessException- Return 0- End Try- End Function-- ''' <summary>- ''' Renames the project selected in lstAllProjects. ProjectStore.Rename checks the new name and refuses a- ''' collision with an existing project (or any other file/folder with that name); if the renamed project was- ''' the one currently open, it is reopened under its new name and folder so the editor and the title bar stay- ''' in sync (a project's name is always just its folder name - see Project.Name).- ''' </summary>- Private Sub btnRenameProject_Click(sender As Object, e As EventArgs) Handles btnRenameProject.Click- Dim name As String = SelectedProjectName(lstAllProjects)- Dim folder As String = SelectedProjectFolder()- If folder.Length = 0 Then Return-- If IsOpenProjectRunning(folder) Then- MessageBox.Show(Me, "A simulation is running for this project. Stop it first.", "Rename project",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- Dim newName As String = name- If Not PromptForText("Rename project", "New name for '" & name & "':", name, newName) Then Return- newName = newName.Trim()- If newName = name Then Return-- Dim wasOpenProject As Boolean = (_project IsNot Nothing) AndAlso String.Equals(_project.FolderPath, folder, StringComparison.OrdinalIgnoreCase)- Try- Dim newFolder As String = ProjectStore.Rename(folder, newName)- If wasOpenProject Then SetCurrentProject(ProjectStore.Open(newFolder))-- RefreshProjectList()- SelectProjectInList(lstAllProjects, newName)- ToolStripStatusLabel1.Text = "Project '" & name & "' renamed to '" & newName & "'."- Catch ex As Exception- MessageBox.Show(Me, "The project could not be renamed:" & vbCrLf & vbCrLf & ex.Message,- "Rename project", MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Try- End Sub-- ' ------------------------------------------------------------------ the Outputs tab (project browser)- '- ' lstAllProjects3 lists every project the same way lstAllProjects does (see BuildProjectEntries and friends,- ' above); clicking a project fills lstScenes/lstImages/lstVideo from that project's scene_images/output_frames- ' /output_video folders. Clicking a scene or image shows it in pnlPreview (a PictureBox built in code, see- ' Form1_Load, since pnlPreview is a plain empty Panel). Each of the three file lists has its own name/"Created- ' on" column-click sort, the same idea as lstAllProjects/lstAllProjects3 (see FillFileList and friends below).- '- ' lstVideo shows just the file name and its creation date as text - no per-row thumbnail. Selecting exactly- ' one video instead shows a thumbnail-sized preview of it in pnlPreview, using the same operating-system shell- ' thumbnail cache Explorer itself uses (GetShellThumbnail, further down) rather than an actual video component- ' (there is no dependency-free way to decode/play a frame with just System.Drawing/System.Windows.Forms).- ' Selecting more than one video (lstVideo allows multi-select, for the delete button) clears the preview- ' instead, since a thumbnail can only stand for one file at a time.-- Private Shared ReadOnly SceneImageExtensions As String() = {".png", ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".gif"}- Private Shared ReadOnly OutputImageExtensions As String() = {".png"}- Private Shared ReadOnly OutputVideoExtensions As String() = {".mp4", ".avi"}-- ''' <summary>Sets up the PictureBox for pnlPreview and does the tab's first population. Called once, from- ''' Form1_Load.</summary>- Private Sub InitializeOutputsTab()- _outputPreviewPic = New PictureBox()- _outputPreviewPic.Dock = DockStyle.Fill- _outputPreviewPic.SizeMode = PictureBoxSizeMode.Zoom- pnlPreview.Controls.Add(_outputPreviewPic)-- RefreshOutputProjectList()- UpdateShareWithEditorsButton()- End Sub-- ''' <summary>Repopulates lstAllProjects3, sorted per _outputProjectSortColumn/Ascending, and selects a project- ''' afterwards: preferredName when one is given (used to default to the currently open project when the tab is- ''' focused - see tabMainFunctions_SelectedIndexChanged), otherwise whatever was already selected there, when- ''' that project is still in the refreshed list.</summary>- Private Sub RefreshOutputProjectList(Optional preferredName As String = "")- Dim selectedName As String = If(preferredName.Length > 0, preferredName, SelectedProjectName(lstAllProjects3))-- Dim entries As List(Of ProjectListEntry) = BuildProjectEntries()- SortProjectEntries(entries, _outputProjectSortColumn, _outputProjectSortAscending)- PopulateProjectListView(lstAllProjects3, entries)-- UpdateOutputProjectSortHeaders()- SelectProjectInList(lstAllProjects3, selectedName)- End Sub-- ''' <summary>Clicking a column header sorts by it; clicking the same header again reverses the direction.</summary>- Private Sub lstAllProjects3_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstAllProjects3.ColumnClick- If e.Column = _outputProjectSortColumn Then- _outputProjectSortAscending = Not _outputProjectSortAscending- Else- _outputProjectSortColumn = e.Column- _outputProjectSortAscending = True- End If- RefreshOutputProjectList()- End Sub-- Private Sub UpdateOutputProjectSortHeaders()- Dim arrow As String = If(_outputProjectSortAscending, " ^", " v")- colProjectName2.Text = "Project name" & If(_outputProjectSortColumn = 0, arrow, "")- colLastEdited2.Text = "Last edited" & If(_outputProjectSortColumn = 1, arrow, "")- End Sub-- ''' <summary>The folder of the project currently selected in lstAllProjects3, or "" when nothing is selected.</summary>- Private Function SelectedOutputProjectFolder() As String- Dim name As String = SelectedProjectName(lstAllProjects3)- If name.Length = 0 Then Return ""- Return ProjectStore.FolderPathFor(_settings.ProjectRoot, name)- End Function-- ''' <summary>Clicking a project fills the three file lists from its output folders and clears the preview- ''' (the previously selected scene/image no longer applies to the newly selected project).</summary>- Private Sub lstAllProjects3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstAllProjects3.SelectedIndexChanged- RefreshOutputFileLists()- End Sub-- ''' <summary>Refills lstScenes/lstImages/lstVideo from whichever project is currently selected in- ''' lstAllProjects3, and clears the preview and the Copy-to-clipboard button. Used both after picking a- ''' different project and after anything that changes the files themselves (delete, load external) - in- ''' both cases the previous selection no longer applies, so there is nothing to preserve here (contrast- ''' RefillSceneList/RefillImageList/RefillVideoList, used by the column-click sort handlers, which do keep- ''' the selection).</summary>- Private Sub RefreshOutputFileLists()- Dim folder As String = SelectedOutputProjectFolder()-- FillFileList(lstScenes, folder, ProjectStore.SceneImageFolderName, SceneImageExtensions, _sceneSortColumn, _sceneSortAscending)- FillFileList(lstImages, folder, ProjectStore.OutputFramesFolderName, OutputImageExtensions, _imageSortColumn, _imageSortAscending)- FillFileList(lstVideo, folder, ProjectStore.OutputVideoFolderName, OutputVideoExtensions, _videoSortColumn, _videoSortAscending)- UpdateFileListSortHeaders(colSceneName, "Scene file name", colSceneCreated, "Created on", _sceneSortColumn, _sceneSortAscending)- UpdateFileListSortHeaders(colImageName, "Image file name", colCreatedOn, "Created on", _imageSortColumn, _imageSortAscending)- UpdateFileListSortHeaders(colVideoName, "Video file name", colCreatedOn2, "Created on", _videoSortColumn, _videoSortAscending)- ClearOutputPreview()- UpdateCopyToClipboardButton()- End Sub-- ''' <summary>Fills a ListView with the matching files of one project subfolder: just the file name when the- ''' list has one column, plus a "Created on" sub-item when it has two (lstScenes, lstImages, lstVideo all do).- ''' sortColumn/sortAscending pick the order: 0 sorts by file name, 1 (only meaningful when there is a- ''' "Created on" column) sorts by creation date. Each item's Tag is the file's full path, for ShowOutputPreview- ''' /lstVideo_SelectedIndexChanged (and the delete/open/view buttons) to read back.</summary>- Private Sub FillFileList(list As ListView, projectFolder As String, subfolderName As String, extensions As String(),- sortColumn As Integer, sortAscending As Boolean)- list.BeginUpdate()- Try- list.Items.Clear()- If projectFolder.Length = 0 Then Return-- Dim folder As String = Path.Combine(projectFolder, subfolderName)- If Not Directory.Exists(folder) Then Return-- Dim files As New List(Of String)(Directory.GetFiles(folder))- files.RemoveAll(Function(f As String) Array.IndexOf(extensions, Path.GetExtension(f).ToLowerInvariant()) < 0)-- Dim byCreatedDate As Boolean = (list.Columns.Count > 1) AndAlso (sortColumn = 1)- files.Sort(Function(a As String, b As String) CompareFileEntries(a, b, byCreatedDate, sortAscending))-- For Each f As String In files- Dim item As New ListViewItem(Path.GetFileName(f))- If list.Columns.Count > 1 Then- item.SubItems.Add(File.GetCreationTime(f).ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture))- End If- item.Tag = f- list.Items.Add(item)- Next- Finally- list.EndUpdate()- End Try- End Sub-- ''' <summary>Compares two files by name (the usual case) or by creation date, ascending or descending - the- ''' sort FillFileList applies.</summary>- Private Shared Function CompareFileEntries(a As String, b As String, byCreatedDate As Boolean, ascending As Boolean) As Integer- Dim result As Integer- If byCreatedDate Then- result = File.GetCreationTime(a).CompareTo(File.GetCreationTime(b))- Else- result = String.Compare(Path.GetFileName(a), Path.GetFileName(b), StringComparison.OrdinalIgnoreCase)- End If- If Not ascending Then result = -result- Return result- End Function-- ''' <summary>Sets a name column's and a "Created on" column's header text, with a sort-direction arrow appended- ''' to whichever one is currently sorted (sortColumn 0 = name, 1 = created on). Always sets both from their- ''' base label, so the arrow never compounds across repeated calls.</summary>- Private Sub UpdateFileListSortHeaders(nameColumn As ColumnHeader, nameLabel As String, dateColumn As ColumnHeader, dateLabel As String,- sortColumn As Integer, ascending As Boolean)- Dim arrow As String = If(ascending, " ^", " v")- nameColumn.Text = nameLabel & If(sortColumn = 0, arrow, "")- dateColumn.Text = dateLabel & If(sortColumn = 1, arrow, "")- End Sub-- ''' <summary>The full paths (ListViewItem.Tag) of a file list's currently selected item(s), so a sort refill- ''' can restore the selection afterwards (see ReselectFiles).</summary>- Private Function SelectedFilePaths(list As ListView) As List(Of String)- Dim result As New List(Of String)()- For Each item As ListViewItem In list.SelectedItems- Dim p As String = TryCast(item.Tag, String)- If Not String.IsNullOrEmpty(p) Then result.Add(p)- Next- Return result- End Function-- ''' <summary>Re-selects whichever of a file list's items still have one of the given paths as their Tag - used- ''' after a sort refill to keep the same file(s) selected even though the rows have moved.</summary>- Private Sub ReselectFiles(list As ListView, paths As List(Of String))- If paths.Count = 0 Then Return- For Each item As ListViewItem In list.Items- Dim p As String = TryCast(item.Tag, String)- If p IsNot Nothing AndAlso paths.Contains(p, StringComparer.OrdinalIgnoreCase) Then item.Selected = True- Next- End Sub-- ''' <summary>Re-sorts lstScenes per _sceneSortColumn/Ascending, keeping the current selection.</summary>- Private Sub RefillSceneList()- Dim selected As List(Of String) = SelectedFilePaths(lstScenes)- FillFileList(lstScenes, SelectedOutputProjectFolder(), ProjectStore.SceneImageFolderName, SceneImageExtensions,- _sceneSortColumn, _sceneSortAscending)- UpdateFileListSortHeaders(colSceneName, "Scene file name", colSceneCreated, "Created on", _sceneSortColumn, _sceneSortAscending)- ReselectFiles(lstScenes, selected)- End Sub-- ''' <summary>Re-sorts lstImages per _imageSortColumn/Ascending, keeping the current selection.</summary>- Private Sub RefillImageList()- Dim selected As List(Of String) = SelectedFilePaths(lstImages)- FillFileList(lstImages, SelectedOutputProjectFolder(), ProjectStore.OutputFramesFolderName, OutputImageExtensions,- _imageSortColumn, _imageSortAscending)- UpdateFileListSortHeaders(colImageName, "Image file name", colCreatedOn, "Created on", _imageSortColumn, _imageSortAscending)- ReselectFiles(lstImages, selected)- End Sub-- ''' <summary>Re-sorts lstVideo per _videoSortColumn/Ascending, keeping the current selection.</summary>- Private Sub RefillVideoList()- Dim selected As List(Of String) = SelectedFilePaths(lstVideo)- FillFileList(lstVideo, SelectedOutputProjectFolder(), ProjectStore.OutputVideoFolderName, OutputVideoExtensions,- _videoSortColumn, _videoSortAscending)- UpdateFileListSortHeaders(colVideoName, "Video file name", colCreatedOn2, "Created on", _videoSortColumn, _videoSortAscending)- ReselectFiles(lstVideo, selected)- End Sub-- ''' <summary>Clicking a column header sorts that list by it; clicking the same header again reverses the- ''' direction - the same idea as lstAllProjects/lstAllProjects3's ColumnClick handlers.</summary>- Private Sub lstScenes_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstScenes.ColumnClick- ToggleFileSort(_sceneSortColumn, _sceneSortAscending, e.Column)- RefillSceneList()- End Sub-- Private Sub lstImages_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstImages.ColumnClick- ToggleFileSort(_imageSortColumn, _imageSortAscending, e.Column)- RefillImageList()- End Sub-- Private Sub lstVideo_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstVideo.ColumnClick- ToggleFileSort(_videoSortColumn, _videoSortAscending, e.Column)- RefillVideoList()- End Sub-- ''' <summary>Shared toggle logic for the three ColumnClick handlers above: same column clicked again reverses- ''' direction, a different column switches to it (ascending).</summary>- Private Shared Sub ToggleFileSort(ByRef sortColumn As Integer, ByRef sortAscending As Boolean, clickedColumn As Integer)- If clickedColumn = sortColumn Then- sortAscending = Not sortAscending- Else- sortColumn = clickedColumn- sortAscending = True- End If- End Sub-- ''' <summary>True while ClearOtherFileListSelections is clearing the other two file lists' selections, so- ''' those lists' own SelectedIndexChanged handlers (fired by that clearing) do nothing instead of clearing- ''' each other right back or re-touching the preview - see ClearOtherFileListSelections.</summary>- Private _clearingFileListSelection As Boolean-- ''' <summary>Deselects lstScenes/lstImages/lstVideo except for "active" (the one the user just clicked in), so- ''' only one of the three ever shows a selection at a time - otherwise it is unclear which list's item- ''' pnlPreview is actually showing. The Projects list (lstAllProjects3) is not one of these three and keeps- ''' its own selection regardless.</summary>- Private Sub ClearOtherFileListSelections(active As ListView)- _clearingFileListSelection = True- Try- If Not active Is lstScenes Then lstScenes.SelectedItems.Clear()- If Not active Is lstImages Then lstImages.SelectedItems.Clear()- If Not active Is lstVideo Then lstVideo.SelectedItems.Clear()- Finally- _clearingFileListSelection = False- End Try- End Sub-- Private Sub lstScenes_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstScenes.SelectedIndexChanged- If _clearingFileListSelection Then Return- ClearOtherFileListSelections(lstScenes)- ShowOutputPreview(lstScenes)- End Sub-- Private Sub lstImages_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstImages.SelectedIndexChanged- If _clearingFileListSelection Then Return- ClearOtherFileListSelections(lstImages)- ShowOutputPreview(lstImages)- UpdateCopyToClipboardButton()- End Sub-- ''' <summary>Loads the selected item's file (its Tag, from FillFileList) into pnlPreview.</summary>- Private Sub ShowOutputPreview(list As ListView)- If list.SelectedItems.Count = 0 Then Return- Dim imagePath As String = TryCast(list.SelectedItems(0).Tag, String)- If String.IsNullOrEmpty(imagePath) OrElse Not File.Exists(imagePath) Then- ClearOutputPreview()- Return- End If-- Try- SetOutputPreviewImage(LoadImageCopy(imagePath))- Catch ex As Exception- ClearOutputPreview()- End Try- End Sub-- ''' <summary>Shows a thumbnail-sized preview of the single selected video in pnlPreview, via the operating- ''' system's own shell thumbnail cache (GetShellThumbnail, further down) - there is no dependency-free way to- ''' decode/draw an actual video frame. Selecting zero or more than one video (lstVideo allows multi-select)- ''' clears the preview instead, since a single thumbnail cannot stand in for several files.</summary>- Private Sub lstVideo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstVideo.SelectedIndexChanged- If _clearingFileListSelection Then Return- ClearOtherFileListSelections(lstVideo)-- If lstVideo.SelectedItems.Count <> 1 Then- ClearOutputPreview()- Return- End If-- Dim videoPath As String = TryCast(lstVideo.SelectedItems(0).Tag, String)- If String.IsNullOrEmpty(videoPath) OrElse Not File.Exists(videoPath) Then- ClearOutputPreview()- Return- End If-- Try- Dim width As Integer = Math.Max(64, _outputPreviewPic.ClientSize.Width)- Dim height As Integer = Math.Max(64, _outputPreviewPic.ClientSize.Height)- SetOutputPreviewImage(GetShellThumbnail(videoPath, width, height), isVideo:=True)- Catch ex As Exception- ClearOutputPreview()- End Try- End Sub-- ''' <summary>Shows an image in pnlPreview, disposing whatever was shown there before. isVideo marks whether- ''' this is a video's thumbnail rather than an actual scene/output image - see _outputPreviewIsVideo.</summary>- Private Sub SetOutputPreviewImage(image As Image, Optional isVideo As Boolean = False)- Dim old As Image = _outputPreviewPic.Image- _outputPreviewPic.Image = image- If old IsNot Nothing Then old.Dispose()-- _outputPreviewIsVideo = isVideo- UpdateShareWithEditorsButton()- End Sub-- Private Sub ClearOutputPreview()- If _outputPreviewPic IsNot Nothing Then SetOutputPreviewImage(Nothing)- End Sub-- ' ---- the tab's buttons-- ''' <summary>- ''' Deletes the scene image(s) selected in lstScenes, after confirmation. When the project browsed here is the- ''' one currently open in the editor, and one of the selected files is its scene image in use- ''' (radUseSceneImage/_scene.ImageFile), an extra line warns about that before asking to confirm; if the user- ''' still goes ahead, radUserDefinedScene is checked afterwards for that project - exactly what clicking it- ''' by hand does (see SceneMode_CheckedChanged) - so the editor is not left pointing at a deleted file.- ''' </summary>- Private Sub btnDeleteScene_Click(sender As Object, e As EventArgs) Handles btnDeleteScene.Click- If lstScenes.SelectedItems.Count = 0 Then- MessageBox.Show(Me, "Select a scene image in the list first.", "Delete scene",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- Dim paths As New List(Of String)()- For Each item As ListViewItem In lstScenes.SelectedItems- paths.Add(DirectCast(item.Tag, String))- Next-- Dim isOpenProject As Boolean = (_project IsNot Nothing) AndAlso- String.Equals(_project.FolderPath, SelectedOutputProjectFolder(), StringComparison.OrdinalIgnoreCase)- Dim currentImagePath As String = If(isOpenProject AndAlso _scene.UseImage,- SceneSettings.ToFullPath(_project.FolderPath, _scene.ImageFile), "")- Dim usesCurrentImage As Boolean = currentImagePath.Length > 0 AndAlso- paths.Exists(Function(p As String) String.Equals(p, currentImagePath, StringComparison.OrdinalIgnoreCase))-- Dim message As String = If(paths.Count = 1,- "Permanently delete '" & Path.GetFileName(paths(0)) & "'?",- "Permanently delete these " & paths.Count.ToString(CultureInfo.InvariantCulture) & " scene images?")- If usesCurrentImage Then- message &= vbCrLf & vbCrLf & "This is the scene image currently used by the open project. Deleting it " &- "will switch the scene to ""User defined"" instead."- End If-- Dim answer As DialogResult = MessageBox.Show(Me, message, "Delete scene", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)- If answer <> DialogResult.Yes Then Return-- Dim errors As New List(Of String)()- For Each p As String In paths- Try- File.Delete(p)- Catch ex As Exception- errors.Add(Path.GetFileName(p) & ": " & ex.Message)- End Try- Next-- If usesCurrentImage Then radUserDefinedScene.Checked = True-- RefreshOutputFileLists()- ShowDeleteErrorsIfAny(errors, "Delete scene")- End Sub-- ''' <summary>Same as "Load scene image" on the Configuration tab (btnLoadSceneImage): browses for an image and- ''' sets it as the currently open project's scene image. Refreshes lstScenes afterwards when the project- ''' browsed here happens to be that same open project, so a newly copied-in file shows up right away.</summary>- Private Sub btnLoadExternal_Click(sender As Object, e As EventArgs) Handles btnLoadExternal.Click- btnLOadSceneImage_Click(sender, e)-- If _project IsNot Nothing AndAlso- String.Equals(_project.FolderPath, SelectedOutputProjectFolder(), StringComparison.OrdinalIgnoreCase) Then- RefreshOutputFileLists()- End If- End Sub-- ''' <summary>Deletes the image(s) selected in lstImages, after confirmation.</summary>- Private Sub btnDeleteImages_Click(sender As Object, e As EventArgs) Handles btnDeleteImages.Click- DeleteSelectedImages()- End Sub-- ''' <summary>Same as btnDeleteImages, so the Del key does the same thing as the button.</summary>- Private Sub lstImages_KeyDown(sender As Object, e As KeyEventArgs) Handles lstImages.KeyDown- If e.KeyCode = Keys.Delete Then- e.Handled = True- DeleteSelectedImages()- End If- End Sub-- Private Sub DeleteSelectedImages()- If lstImages.SelectedItems.Count = 0 Then- MessageBox.Show(Me, "Select one or more images in the list first.", "Delete images",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- Dim count As Integer = lstImages.SelectedItems.Count- Dim message As String = If(count = 1,- "Permanently delete '" & lstImages.SelectedItems(0).Text & "'?",- "Permanently delete these " & count.ToString(CultureInfo.InvariantCulture) & " images?")- Dim answer As DialogResult = MessageBox.Show(Me, message, "Delete images", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)- If answer <> DialogResult.Yes Then Return-- Dim errors As New List(Of String)()- For Each item As ListViewItem In lstImages.SelectedItems- Dim path As String = DirectCast(item.Tag, String)- Try- File.Delete(path)- Catch ex As Exception- errors.Add(item.Text & ": " & ex.Message)- End Try- Next-- RefreshOutputFileLists()- ShowDeleteErrorsIfAny(errors, "Delete images")- End Sub-- ''' <summary>Copies the single selected image in lstImages to the clipboard (for pasting into Paint,- ''' Photoshop, and so on). Only enabled while exactly one image is selected - see UpdateCopyToClipboardButton.</summary>- Private Sub btnCopyToClipboard_Click(sender As Object, e As EventArgs) Handles btnCopyToClipboard.Click- If lstImages.SelectedItems.Count <> 1 Then Return- Dim imagePath As String = TryCast(lstImages.SelectedItems(0).Tag, String)- If String.IsNullOrEmpty(imagePath) OrElse Not File.Exists(imagePath) Then Return-- Try- Using bmp As Bitmap = LoadImageCopy(imagePath)- Clipboard.SetImage(bmp)- End Using- ToolStripStatusLabel1.Text = "Copied '" & Path.GetFileName(imagePath) & "' to the clipboard."- Catch ex As Exception- MessageBox.Show(Me, "The image could not be copied to the clipboard:" & vbCrLf & vbCrLf & ex.Message,- "Copy to clipboard", MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Try- End Sub-- ''' <summary>btnCopyToClipboard only makes sense for exactly one selected image.</summary>- Private Sub UpdateCopyToClipboardButton()- btnCopyToClipboard.Enabled = (lstImages.SelectedItems.Count = 1)- End Sub-- ''' <summary>Opens the selected project's output_frames folder in Explorer, in "Large icons" view (see- ''' OpenFolderInExplorer).</summary>- Private Sub btnOpenImageFolder2_Click(sender As Object, e As EventArgs) Handles btnOpenImageFolder2.Click- Dim projectFolder As String = SelectedOutputProjectFolder()- If projectFolder.Length = 0 Then- MessageBox.Show(Me, "Select a project in the list first.", "Open image folder",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- Try- OpenFolderInExplorer(Path.Combine(projectFolder, ProjectStore.OutputFramesFolderName), FVM_ICON)- Catch ex As Exception- MessageBox.Show(Me, "The image folder could not be opened:" & vbCrLf & vbCrLf & ex.Message, "Open image folder",- MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Try- End Sub-- ''' <summary>Deletes the video(s) selected in lstVideo, after confirmation.</summary>- Private Sub btnDeleteVideos_Click(sender As Object, e As EventArgs) Handles btnDeleteVideos.Click- DeleteSelectedVideos()- End Sub-- ''' <summary>Same as btnDeleteVideos, so the Del key does the same thing as the button.</summary>- Private Sub lstVideo_KeyDown(sender As Object, e As KeyEventArgs) Handles lstVideo.KeyDown- If e.KeyCode = Keys.Delete Then- e.Handled = True- DeleteSelectedVideos()- End If- End Sub-- Private Sub DeleteSelectedVideos()- If lstVideo.SelectedItems.Count = 0 Then- MessageBox.Show(Me, "Select one or more videos in the list first.", "Delete videos",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- Dim count As Integer = lstVideo.SelectedItems.Count- Dim message As String = If(count = 1,- "Permanently delete '" & lstVideo.SelectedItems(0).Text & "'?",- "Permanently delete these " & count.ToString(CultureInfo.InvariantCulture) & " videos?")- Dim answer As DialogResult = MessageBox.Show(Me, message, "Delete videos", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)- If answer <> DialogResult.Yes Then Return-- Dim errors As New List(Of String)()- For Each item As ListViewItem In lstVideo.SelectedItems- Dim path As String = DirectCast(item.Tag, String)- Try- File.Delete(path)- Catch ex As Exception- errors.Add(item.Text & ": " & ex.Message)- End Try- Next-- RefreshOutputFileLists()- ShowDeleteErrorsIfAny(errors, "Delete videos")- End Sub-- ''' <summary>Opens the video selected in lstVideo with whatever program Windows uses for it - same as- ''' btnViewFieldVideo/btnViewIntensityVideo on the Preview tab (OpenVideo).</summary>- Private Sub btnViewVIdeoInPlayer2_Click(sender As Object, e As EventArgs) Handles btnViewVIdeoInPlayer2.Click- If lstVideo.SelectedItems.Count = 0 Then- MessageBox.Show(Me, "Select a video in the list first.", "View in player",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- OpenVideo(DirectCast(lstVideo.SelectedItems(0).Tag, String))- End Sub-- ''' <summary>Double-clicking a video in lstVideo opens it in the player, same as btnViewVIdeoInPlayer2.</summary>- Private Sub lstVideo_DoubleClick(sender As Object, e As EventArgs) Handles lstVideo.DoubleClick- If lstVideo.SelectedItems.Count = 0 Then Return- OpenVideo(DirectCast(lstVideo.SelectedItems(0).Tag, String))- End Sub-- ''' <summary>Renames the video file selected in lstVideo (exactly one), using a popup entry box - same- ''' PromptForText dialog as btnRenameProject.</summary>- Private Sub btnRenameVideo_Click(sender As Object, e As EventArgs) Handles btnRenameVideo.Click- If lstVideo.SelectedItems.Count <> 1 Then- MessageBox.Show(Me, "Select a single video in the list first.", "Rename video",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- Dim oldPath As String = DirectCast(lstVideo.SelectedItems(0).Tag, String)- Dim oldName As String = Path.GetFileName(oldPath)-- Dim newName As String = oldName- If Not PromptForText("Rename video", "New name for '" & oldName & "':", oldName, newName) Then Return- newName = newName.Trim()- If newName.Length = 0 OrElse newName = oldName Then Return- If newName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0 Then- MessageBox.Show(Me, "That name contains characters that are not allowed in a file name.", "Rename video",- MessageBoxButtons.OK, MessageBoxIcon.Warning)- Return- End If-- Dim newPath As String = Path.Combine(Path.GetDirectoryName(oldPath), newName)- If File.Exists(newPath) Then- MessageBox.Show(Me, "A file named '" & newName & "' already exists.", "Rename video",- MessageBoxButtons.OK, MessageBoxIcon.Warning)- Return- End If-- Try- File.Move(oldPath, newPath)- RefreshOutputFileLists()- Catch ex As Exception- MessageBox.Show(Me, "The video could not be renamed:" & vbCrLf & vbCrLf & ex.Message, "Rename video",- MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Try- End Sub-- ''' <summary>Opens the selected project's output_video folder in Explorer, in "Details" view - same as- ''' btnOpenVideoFolder on the Preview tab (OpenFolderInExplorer).</summary>- Private Sub btnOpenVIdeoFolder2_Click(sender As Object, e As EventArgs) Handles btnOpenVIdeoFolder2.Click- Dim projectFolder As String = SelectedOutputProjectFolder()- If projectFolder.Length = 0 Then- MessageBox.Show(Me, "Select a project in the list first.", "Open video folder",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- Try- OpenFolderInExplorer(Path.Combine(projectFolder, ProjectStore.OutputVideoFolderName), FVM_DETAILS)- Catch ex As Exception- MessageBox.Show(Me, "The video folder could not be opened:" & vbCrLf & vbCrLf & ex.Message, "Open video folder",- MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Try- End Sub-- ''' <summary>Puts a copy of whatever pnlPreview currently shows (a scene or an output image) into pnlSourceImage- ''' and pnlProbeImage - the same thing btnShareFieldImage/btnShareIntensityImage do for the live preview on the- ''' Preview tab (CopyPreviewToTabs, further down). Only enabled for a scene/image preview - see- ''' UpdateShareWithEditorsButton.</summary>- Private Sub btnShareWithEditors_Click(sender As Object, e As EventArgs) Handles btnShareWithEditors.Click- CopyPreviewToTabs(_outputPreviewPic)- End Sub-- ''' <summary>btnShareWithEditors only makes sense for a scene/output image preview: a video's thumbnail has a- ''' different size than the simulation, so it is disabled while pnlPreview shows one (or nothing at all).</summary>- Private Sub UpdateShareWithEditorsButton()- btnShareWithEditors.Enabled = (Not _outputPreviewIsVideo) AndAlso (_outputPreviewPic IsNot Nothing) AndAlso- (_outputPreviewPic.Image IsNot Nothing)- End Sub-- ''' <summary>Shared tail end of the three delete buttons: reports any files that could not be deleted (e.g.- ''' because they were open elsewhere), after the list has already been refreshed with whatever did succeed.</summary>- Private Sub ShowDeleteErrorsIfAny(errors As List(Of String), title As String)- If errors.Count = 0 Then Return- MessageBox.Show(Me, "Some files could not be deleted:" & vbCrLf & vbCrLf & String.Join(vbCrLf, errors),- title, MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Sub-- ' ---- the video preview thumbnail, via the Windows shell (no video codec of our own)-- ' Windows shell thumbnail interop (IShellItemImageFactory) - plain P/Invoke/COM interop against shell32.dll- ' and gdi32.dll, no NuGet package or project reference needed, but genuine COM interop nonetheless, which- ' could not be exercised on an actual Windows machine while writing it. GetShellThumbnail is written so a- ' wrong detail here surfaces as "no thumbnail for this file" (via the Try/Catch in lstVideo_SelectedIndexChanged)- ' rather than a crash - if the preview comes out consistently missing for videos, this is the place to revisit.-- <StructLayout(LayoutKind.Sequential)>- Private Structure NativeSize- Public cx As Integer- Public cy As Integer- End Structure-- <Flags>- Private Enum ThumbnailOptions As Integer- None = &H0- BiggerSizeOk = &H1- ThumbnailOnly = &H8- End Enum-- <ComImport(), Guid("bcc18b79-ba16-442f-80c4-8a59c30c463b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>- Private Interface IShellItemImageFactory- Sub GetImage(<[In]> size As NativeSize, <[In]> flags As ThumbnailOptions, <Out> ByRef phbm As IntPtr)- End Interface-- <DllImport("shell32.dll", CharSet:=CharSet.Unicode, PreserveSig:=False)>- Private Shared Sub SHCreateItemFromParsingName(- <MarshalAs(UnmanagedType.LPWStr)> path As String,- pbc As IntPtr,- <[In]> ByRef riid As Guid,- <MarshalAs(UnmanagedType.Interface)> <Out> ByRef ppv As Object)- End Sub-- <DllImport("gdi32.dll")>- Private Shared Function DeleteObject(hObject As IntPtr) As Boolean- End Function-- ''' <summary>Asks Windows for the same thumbnail Explorer would show for this file, at roughly the given size.- ''' Returns Nothing, never throws, when the shell has no thumbnail for it.</summary>- Private Shared Function GetShellThumbnail(filePath As String, width As Integer, height As Integer) As Bitmap- Dim riid As Guid = GetType(IShellItemImageFactory).GUID- Dim obj As Object = Nothing- SHCreateItemFromParsingName(filePath, IntPtr.Zero, riid, obj)- Dim factory As IShellItemImageFactory = TryCast(obj, IShellItemImageFactory)- If factory Is Nothing Then Return Nothing-- Dim hbmp As IntPtr = IntPtr.Zero- Try- Dim size As New NativeSize With {.cx = width, .cy = height}- factory.GetImage(size, ThumbnailOptions.ThumbnailOnly Or ThumbnailOptions.BiggerSizeOk, hbmp)- If hbmp = IntPtr.Zero Then Return Nothing- Using raw As Bitmap = CType(Image.FromHbitmap(hbmp), Bitmap)- Return New Bitmap(raw)- End Using- Finally- If hbmp <> IntPtr.Zero Then DeleteObject(hbmp)- Marshal.ReleaseComObject(factory)- End Try- End Function-- ' ------------------------------------------------------------------ scene properties (Configuration tab)- '- ' The settings are kept in _scene and stored in the "scene" section of the project's configuration file- ' (see SceneSettings) when the project is saved.-- Private _scene As New SceneSettings()-- ' True while the code itself fills the controls (their change events are then ignored)- Private _loadingScene As Boolean-- ' the scene image (Nothing when none is loaded) and the generated picture of an empty user defined canvas- Private _sceneImage As Bitmap- Private _emptyPreview As Bitmap-- Private ReadOnly _sceneTip As New ToolTip()-- Private Sub InitializeSceneControls()- picImagePreview.BorderStyle = BorderStyle.FixedSingle- picImagePreview.BackColor = SystemColors.ControlLight- picImagePreview.SizeMode = PictureBoxSizeMode.Zoom-- lblImageNameAndSize.AutoSize = False- lblImageNameAndSize.AutoEllipsis = True- lblImageNameAndSize.Size = New Size(470, 20)-- txtXSize.MaxLength = 5- txtYsize.MaxLength = 5- txtDampingEdgeSize.MaxLength = 4-- ' amplitude factor of the sources in the scene image- numScaleImageSource.Minimum = 0D- numScaleImageSource.Maximum = CDec(SceneSettings.MaxImageSourceScale)-- ' No ShowSceneInControls() here: grpSceneProperties is disabled until a real project exists- ' (UpdateProjectAccess). Populating it now from a blank _scene would overwrite whatever defaults the- ' Designer gave these controls before StartNewProject/SetCurrentProject ever get a chance to read them- ' back out (see the matching comment in InitializeSimulationControls, where this actually matters -- ' numSimulationSteps' Designer default of 3000).- End Sub-- ''' <summary>Reads the scene settings of the current project (and its image) and shows them.</summary>- Private Sub LoadSceneFromProject()- If _project Is Nothing Then Return-- _scene = SceneSettings.FromConfig(_project.Config)-- ReplaceSceneImage(Nothing)- If _scene.ImageFile.Length > 0 Then- Dim fullPath As String = SceneSettings.ToFullPath(_project.FolderPath, _scene.ImageFile)- If File.Exists(fullPath) Then- Try- ReplaceSceneImage(LoadImageCopy(fullPath))- Catch ex As Exception- ' the image label tells that the image could not be loaded- End Try- End If- End If-- ShowSceneInControls()- End Sub-- ''' <summary>Copies the values of _scene into the controls.</summary>- Private Sub ShowSceneInControls()- _loadingScene = True- Try- radUseSceneImage.Checked = _scene.UseImage- radUserDefinedScene.Checked = Not _scene.UseImage- txtXSize.Text = _scene.UserWidth.ToString(CultureInfo.InvariantCulture)- txtYsize.Text = _scene.UserHeight.ToString(CultureInfo.InvariantCulture)- chkDampingEdge.Checked = _scene.DampingEdgeEnabled- txtDampingEdgeSize.Text = _scene.DampingEdgeSize.ToString(CultureInfo.InvariantCulture)- chkUseImageSources.Checked = _scene.UseSources- numScaleImageSource.Value = ClampToRange(numScaleImageSource, _scene.ImageSourceScale)- chkUseObjectSources.Checked = _scene.UseObjectSources- numRefractiveIndex.Value = ClampToRange(numRefractiveIndex, _scene.BackgroundRefractiveIndex)- txtXSize.ForeColor = SystemColors.WindowText- txtYsize.ForeColor = SystemColors.WindowText- Finally- _loadingScene = False- End Try-- UpdateSceneControlState()- UpdateScenePreview()- ShowDampingValidity()- End Sub-- ''' <summary>Enables the controls that belong to the chosen canvas type and to the damping edge check box.</summary>- Private Sub UpdateSceneControlState()- Dim useImage As Boolean = _scene.UseImage- btnLoadSceneImage.Enabled = useImage- lblImageNameAndSize.Enabled = useImage-- txtXSize.Enabled = Not useImage- txtYsize.Enabled = Not useImage- lblX.Enabled = Not useImage- lblPix.Enabled = Not useImage- numRefractiveIndex.Enabled = Not useImage ' a scene image has its own refractive index per pixel- Label20.Enabled = Not useImage-- txtDampingEdgeSize.Enabled = _scene.DampingEdgeEnabled- Label1.Enabled = _scene.DampingEdgeEnabled-- numScaleImageSource.Enabled = _scene.UseSources- lblScaleImgSourceIntensity.Enabled = _scene.UseSources- End Sub-- ' ---- preview-- Private Sub UpdateScenePreview()- UpdateImageLabel()-- If _scene.UseImage Then- picImagePreview.SizeMode = PictureBoxSizeMode.Zoom- picImagePreview.Image = _sceneImage- DisposeEmptyPreview()- Else- ' user defined canvas: an empty picture with the proportions of the canvas- picImagePreview.SizeMode = PictureBoxSizeMode.CenterImage- Dim fresh As Bitmap = MakeEmptyCanvasPreview(_scene.UserWidth, _scene.UserHeight)- picImagePreview.Image = fresh- DisposeEmptyPreview()- _emptyPreview = fresh- End If- End Sub-- Private Sub UpdateImageLabel()- If _scene.ImageFile.Length = 0 Then- lblImageNameAndSize.Text = "(no image loaded)"- ElseIf _sceneImage Is Nothing Then- lblImageNameAndSize.Text = "(image not found or not readable: " & Path.GetFileName(_scene.ImageFile) & ")"- Else- lblImageNameAndSize.Text = Path.GetFileName(_scene.ImageFile) & " (" &- _sceneImage.Width.ToString(CultureInfo.InvariantCulture) & " x " &- _sceneImage.Height.ToString(CultureInfo.InvariantCulture) & " px)"- End If- End Sub-- Private Function MakeEmptyCanvasPreview(canvasWidth As Integer, canvasHeight As Integer) As Bitmap- Dim boxW As Integer = Math.Max(16, picImagePreview.ClientSize.Width - 8)- Dim boxH As Integer = Math.Max(16, picImagePreview.ClientSize.Height - 8)- Dim scale As Double = Math.Min(boxW / CDbl(canvasWidth), boxH / CDbl(canvasHeight))- Dim w As Integer = Math.Max(2, CInt(Math.Round(canvasWidth * scale)))- Dim h As Integer = Math.Max(2, CInt(Math.Round(canvasHeight * scale)))-- Dim bmp As New Bitmap(w, h, PixelFormat.Format32bppArgb)- Using g As Graphics = Graphics.FromImage(bmp)- g.Clear(Color.White)- Using pen As New Pen(Color.Gray)- g.DrawRectangle(pen, 0, 0, w - 1, h - 1)- End Using- Using f As New Font("Microsoft Sans Serif", 9.0F), sf As New StringFormat()- sf.Alignment = StringAlignment.Center- sf.LineAlignment = StringAlignment.Center- g.DrawString(canvasWidth.ToString(CultureInfo.InvariantCulture) & " x " &- canvasHeight.ToString(CultureInfo.InvariantCulture) & " px (empty scene)",- f, Brushes.Gray, New RectangleF(0, 0, w, h), sf)- End Using- End Using- Return bmp- End Function-- Private Sub DisposeEmptyPreview()- If _emptyPreview IsNot Nothing Then- _emptyPreview.Dispose()- _emptyPreview = Nothing- End If- End Sub-- ''' <summary>Makes newImage the scene image and disposes the previous one.</summary>- Private Sub ReplaceSceneImage(newImage As Bitmap)- Dim old As Bitmap = _sceneImage- _sceneImage = newImage- If old IsNot Nothing Then- If Object.ReferenceEquals(picImagePreview.Image, old) Then picImagePreview.Image = Nothing- old.Dispose()- End If- UpdateGlowEdgesImage()- End Sub-- ''' <summary>Disposes _glowEdgesImage and its cached resized copy (GetGlowOverlayResized) and sets both to- ''' Nothing, without touching _sceneImage - used both by UpdateGlowEdgesImage (about to rebuild it from the- ''' scene image) and by SceneMode_CheckedChanged (switching to radUserDefinedScene, where the overlay should- ''' disappear even though _sceneImage itself is kept around in case the user switches back).</summary>- Private Sub ClearGlowEdgesImage()- If _glowEdgesImage IsNot Nothing Then- _glowEdgesImage.Dispose()- _glowEdgesImage = Nothing- End If- If _glowOverlayCache IsNot Nothing Then- _glowOverlayCache.Dispose()- _glowOverlayCache = Nothing- End If- End Sub-- ''' <summary>- ''' Rebuilds _glowEdgesImage (the "glowing edges" picture used as the Field/Intensity preview overlay - see- ''' ComputeGlowingEdges) from the current scene image. Called from ReplaceSceneImage, so this runs every time- ''' the scene image itself changes, and from SceneMode_CheckedChanged when switching back to- ''' radUseSceneImage. Also refreshes whatever is currently shown on the Field/Intensity previews, so a- ''' checked overlay updates immediately rather than only on the next simulation frame.- ''' </summary>- Private Sub UpdateGlowEdgesImage()- ClearGlowEdgesImage()- If _sceneImage IsNot Nothing Then _glowEdgesImage = ComputeGlowingEdges(_sceneImage)-- RefreshPreviewOverlay(_picField, FieldOverlayGain())- RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain())- End Sub-- ''' <summary>How strongly to blend the glow-edges overlay into the Field preview: 0 when- ''' chkDiplayOverlayInField is unchecked (no overlay at all), otherwise numBrightnessFieldOverlay's value -- ''' see ComposeGlowOverlay's gain parameter.</summary>- Private Function FieldOverlayGain() As Double- Return If(chkDiplayOverlayInField.Checked, CDbl(numBrightnessFieldOverlay.Value), 0.0)- End Function-- ''' <summary>The Intensity preview's counterpart to FieldOverlayGain.</summary>- Private Function IntensityOverlayGain() As Double- Return If(chkDiplayOverlayInIntensity.Checked, CDbl(numBrightnessIntensityOverlay.Value), 0.0)- End Function-- ''' <summary>- ''' Builds a "glowing edges" picture of source: a same-size picture that is black except along its edges- ''' (fast color changes), where each of the three color channels is set to how sharp the change in THAT- ''' channel is there (a Sobel gradient magnitude, scaled and clamped to a byte). This is deliberately done- ''' per channel rather than as a single grayscale edge strength, so e.g. a hard red-to-black edge lights up- ''' mostly in red - keeping a hint of the original colors in the edge lines, the way Photoshop's "Glowing- ''' Edges" filter does. The GlowScale constant below is the one tunable "how bright" knob - a typical hard- ''' (full black-to-white) edge produces a raw Sobel magnitude of up to about 1442, and GlowScale brings that- ''' into the 0-255 byte range without every ordinary edge saturating to pure white; ask if this should be- ''' stronger/weaker. The outermost ring of pixels is left black (there is no full 3x3 neighborhood there).- ''' </summary>- Private Shared Function ComputeGlowingEdges(source As Bitmap) As Bitmap- Const GlowScale As Double = 0.25-- Dim w As Integer = source.Width- Dim h As Integer = source.Height- Dim result As New Bitmap(w, h, PixelFormat.Format24bppRgb)- Using g As Graphics = Graphics.FromImage(result)- g.Clear(Color.Black)- End Using- If w < 3 OrElse h < 3 Then Return result ' too small for a 3x3 kernel - stays plain black-- ' normalize the source into a plain 24bppRgb picture first (it may be indexed, 32bppArgb, ...)- Using normalized As New Bitmap(w, h, PixelFormat.Format24bppRgb)- Using g As Graphics = Graphics.FromImage(normalized)- g.DrawImageUnscaled(source, 0, 0)- End Using-- Dim rect As New Rectangle(0, 0, w, h)- Dim srcData As BitmapData = normalized.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb)- Dim dstData As BitmapData = result.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb)- Try- Dim srcStride As Integer = srcData.Stride- Dim dstStride As Integer = dstData.Stride- Dim srcBytes(srcStride * h - 1) As Byte- Dim dstBytes(dstStride * h - 1) As Byte- Marshal.Copy(srcData.Scan0, srcBytes, 0, srcBytes.Length)-- ' 24bppRgb stores each pixel as three bytes, in B,G,R order- For y As Integer = 1 To h - 2- Dim rowUp As Integer = (y - 1) * srcStride- Dim rowMid As Integer = y * srcStride- Dim rowDown As Integer = (y + 1) * srcStride- Dim dstRow As Integer = y * dstStride- For x As Integer = 1 To w - 2- Dim cUp As Integer = rowUp + (x - 1) * 3- Dim cMid As Integer = rowMid + (x - 1) * 3- Dim cDown As Integer = rowDown + (x - 1) * 3- Dim dstOffset As Integer = dstRow + x * 3-- For channel As Integer = 0 To 2- Dim p00 As Integer = srcBytes(cUp + channel)- Dim p01 As Integer = srcBytes(cUp + 3 + channel)- Dim p02 As Integer = srcBytes(cUp + 6 + channel)- Dim p10 As Integer = srcBytes(cMid + channel)- Dim p12 As Integer = srcBytes(cMid + 6 + channel)- Dim p20 As Integer = srcBytes(cDown + channel)- Dim p21 As Integer = srcBytes(cDown + 3 + channel)- Dim p22 As Integer = srcBytes(cDown + 6 + channel)-- Dim gx As Integer = (p02 + 2 * p12 + p22) - (p00 + 2 * p10 + p20)- Dim gy As Integer = (p20 + 2 * p21 + p22) - (p00 + 2 * p01 + p02)- Dim magnitude As Double = Math.Sqrt(CDbl(gx) * gx + CDbl(gy) * gy) * GlowScale- dstBytes(dstOffset + channel) = CByte(Math.Min(255.0, magnitude))- Next- Next- Next-- Marshal.Copy(dstBytes, 0, dstData.Scan0, dstBytes.Length)- Finally- normalized.UnlockBits(srcData)- result.UnlockBits(dstData)- End Try- End Using-- Return result- End Function-- ''' <summary>The glow-edges picture (_glowEdgesImage), resized to match a preview frame's size - cached and- ''' only rebuilt when that size changes, since the preview panels can ask for it on every single visualized- ''' step of a running simulation. Returns Nothing when there is no glow-edges picture (no scene image).</summary>- Private Function GetGlowOverlayResized(targetSize As Size) As Bitmap- If _glowEdgesImage Is Nothing Then Return Nothing- If _glowOverlayCache IsNot Nothing AndAlso _glowOverlayCacheSize.Equals(targetSize) Then Return _glowOverlayCache-- If _glowOverlayCache IsNot Nothing Then _glowOverlayCache.Dispose()- Dim resized As New Bitmap(Math.Max(1, targetSize.Width), Math.Max(1, targetSize.Height), PixelFormat.Format24bppRgb)- Using g As Graphics = Graphics.FromImage(resized)- g.Clear(Color.Black)- g.InterpolationMode = InterpolationMode.HighQualityBilinear- g.DrawImage(_glowEdgesImage, New Rectangle(Point.Empty, targetSize))- End Using- _glowOverlayCache = resized- _glowOverlayCacheSize = targetSize- Return _glowOverlayCache- End Function-- ''' <summary>Returns a new bitmap: a copy of frame with the glow-edges overlay (ComputeGlowingEdges,- ''' GetGlowOverlayResized) additively blended on top, each of the overlay's bytes multiplied by gain first- ''' (numBrightnessFieldOverlay/numBrightnessIntensityOverlay - 1 leaves ComputeGlowingEdges' own brightness- ''' as is, above 1 brightens the overlay, 0 removes it entirely). Multiplying (rather than e.g. adding a flat- ''' offset) is what keeps a still-black background black at any gain - 0 times anything is still 0 - while- ''' scaling up faint edges where the color change was small, which is the actual complaint this is for: a- ''' plain "brightness" slider that also lifted the black background to gray would defeat its own purpose- ''' here. The overlay's black pixels (no edge there) leave frame untouched, and its bright pixels brighten- ''' frame, clamped at 255 per channel. frame itself is never modified. Falls back to a plain copy of frame- ''' when there is no glow-edges picture to blend in.</summary>- Private Function ComposeGlowOverlay(frame As Bitmap, gain As Double) As Bitmap- Dim overlay As Bitmap = GetGlowOverlayResized(frame.Size)- Dim composed As New Bitmap(frame)- If overlay Is Nothing Then Return composed- Dim clampedGain As Double = Math.Max(0.0, gain)-- Dim bytesPerDstPixel As Integer = Bitmap.GetPixelFormatSize(composed.PixelFormat) \ 8- If bytesPerDstPixel < 3 Then Return composed ' an indexed/unexpected format we can't safely blend into-- Dim rect As New Rectangle(0, 0, frame.Width, frame.Height)- Dim dstData As BitmapData = composed.LockBits(rect, ImageLockMode.ReadWrite, composed.PixelFormat)- Dim srcData As BitmapData = overlay.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb)- Try- Dim dstStride As Integer = dstData.Stride- Dim srcStride As Integer = srcData.Stride- Dim h As Integer = frame.Height- Dim w As Integer = frame.Width- Dim dstBytes(dstStride * h - 1) As Byte- Dim srcBytes(srcStride * h - 1) As Byte- Marshal.Copy(dstData.Scan0, dstBytes, 0, dstBytes.Length)- Marshal.Copy(srcData.Scan0, srcBytes, 0, srcBytes.Length)-- For y As Integer = 0 To h - 1- Dim dRow As Integer = y * dstStride- Dim sRow As Integer = y * srcStride- For x As Integer = 0 To w - 1- Dim d As Integer = dRow + x * bytesPerDstPixel- Dim s As Integer = sRow + x * 3- ' both layouts are B,G,R... (composed may have a 4th, alpha byte - left untouched)- dstBytes(d) = CByte(Math.Min(255.0, CDbl(dstBytes(d)) + CDbl(srcBytes(s)) * clampedGain))- dstBytes(d + 1) = CByte(Math.Min(255.0, CDbl(dstBytes(d + 1)) + CDbl(srcBytes(s + 1)) * clampedGain))- dstBytes(d + 2) = CByte(Math.Min(255.0, CDbl(dstBytes(d + 2)) + CDbl(srcBytes(s + 2)) * clampedGain))- Next- Next-- Marshal.Copy(dstBytes, 0, dstData.Scan0, dstBytes.Length)- Finally- composed.UnlockBits(dstData)- overlay.UnlockBits(srcData)- End Try-- Return composed- End Function-- ''' <summary>- ''' Shows frame in box, replacing/disposing whatever was shown before, and additively blends in the- ''' glow-edges overlay (ComposeGlowOverlay) when gain is above 0. box.Tag always holds the frame exactly as- ''' produced (never itself modified), so the overlay can be added, removed, or re-scaled again later purely- ''' from what is already shown - see RefreshPreviewOverlay - without needing a fresh frame from a run that- ''' may by then be paused or already finished.- ''' </summary>- Private Sub SetPreviewFrame(box As PictureBox, frame As Bitmap, gain As Double)- Dim oldImage As Image = box.Image- Dim oldRaw As Bitmap = TryCast(box.Tag, Bitmap)-- box.Tag = frame- box.Image = If(gain > 0.0 AndAlso _glowEdgesImage IsNot Nothing, ComposeGlowOverlay(frame, gain), DirectCast(frame, Image))-- If oldImage IsNot Nothing AndAlso Not Object.ReferenceEquals(oldImage, oldRaw) Then oldImage.Dispose()- If oldRaw IsNot Nothing Then oldRaw.Dispose()- End Sub-- ''' <summary>Re-applies (or removes, or re-scales) the glow-edges overlay on whatever box is currently- ''' showing, using the raw frame kept in box.Tag (see SetPreviewFrame) - so this works without needing a new- ''' frame from a running simulation. Used when a "Display overlay" checkbox or its brightness box is- ''' changed, and when the glow-edges picture itself changes (UpdateGlowEdgesImage). Does nothing when box- ''' has nothing shown yet.</summary>- Private Sub RefreshPreviewOverlay(box As PictureBox, gain As Double)- If box Is Nothing Then Return- Dim raw As Bitmap = TryCast(box.Tag, Bitmap)- If raw Is Nothing Then Return-- Dim oldImage As Image = box.Image- box.Image = If(gain > 0.0 AndAlso _glowEdgesImage IsNot Nothing, ComposeGlowOverlay(raw, gain), DirectCast(raw, Image))- If oldImage IsNot Nothing AndAlso Not Object.ReferenceEquals(oldImage, raw) Then oldImage.Dispose()- End Sub-- Private Sub chkDiplayOverlayInField_CheckedChanged(sender As Object, e As EventArgs) Handles chkDiplayOverlayInField.CheckedChanged- RefreshPreviewOverlay(_picField, FieldOverlayGain())- End Sub-- Private Sub chkDiplayOverlayInIntensity_CheckedChanged(sender As Object, e As EventArgs) Handles chkDiplayOverlayInIntensity.CheckedChanged- RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain())- End Sub-- ''' <summary>numBrightnessFieldOverlay/numBrightnessIntensityOverlay (Viewer tab, next to the "Display- ''' overlay" checkboxes) scale the glow-edges overlay's own brightness - 1 is the Designer default (no- ''' change), higher brightens faint edges, 0 is the same as unchecking the overlay entirely. See- ''' ComposeGlowOverlay's gain parameter for why a multiplier (not a flat offset) is used.</summary>- Private Sub numBrightnessFieldOverlay_ValueChanged(sender As Object, e As EventArgs) Handles numBrightnessFieldOverlay.ValueChanged- RefreshPreviewOverlay(_picField, FieldOverlayGain())- End Sub-- Private Sub numBrightnessIntensityOverlay_ValueChanged(sender As Object, e As EventArgs) Handles numBrightnessIntensityOverlay.ValueChanged- RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain())- End Sub-- ''' <summary>Reads an image file into memory (the file is not kept open or locked).</summary>- Private Shared Function LoadImageCopy(fullPath As String) As Bitmap- Using fs As New FileStream(fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)- Using source As Image = Image.FromStream(fs)- Return New Bitmap(source)- End Using- End Using- End Function-- ''' <summary>The canvas size that the simulation would use now, or an empty size when it is not known (no image).</summary>- Private Function EffectiveCanvas() As Size- If _scene.UseImage Then- If _sceneImage Is Nothing Then Return Size.Empty- Return _sceneImage.Size- End If- Return New Size(_scene.UserWidth, _scene.UserHeight)- End Function-- ''' <summary>- ''' Loads the scene image (as chosen on the Configuration tab) into pic, or - when no scene image is loaded (a- ''' user defined canvas, or the image could not be read) - a plain black image sized to the current canvas- ''' (EffectiveCanvas). Used by the "Import scene image" buttons on the Sources and Probes tabs.- ''' </summary>- Private Sub ImportSceneImageInto(pic As PictureBox)- Dim old As Image = pic.Image- Dim fresh As Bitmap-- If _scene.UseImage AndAlso _sceneImage IsNot Nothing Then- fresh = New Bitmap(_sceneImage)- Else- Dim canvas As Size = EffectiveCanvas()- If canvas.Width <= 0 OrElse canvas.Height <= 0 Then- MessageBox.Show(Me, "The canvas size is not known yet" & vbCrLf &- "(choose a scene image, or a user defined width and height, on the Configuration tab first).",- "Import scene image", MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- fresh = New Bitmap(canvas.Width, canvas.Height)- Using g As Graphics = Graphics.FromImage(fresh)- g.Clear(Color.Black)- End Using- End If-- pic.Image = fresh- pic.Invalidate()- If old IsNot Nothing Then old.Dispose()- End Sub-- ''' <summary>- ''' Loads the scene image (as chosen on the Configuration tab), or a black placeholder sized to the current- ''' canvas when there is none, into pic - but only when pic does not already have an image. Called when the- ''' Sources or Probes tab is opened or switched to, so there is always something to see and pick a position in- ''' without an explicit "Import scene image" first, while never overwriting a picture the user already loaded- ''' or that a simulation run already produced.- ''' </summary>- Private Sub AutoLoadSceneImageIfEmpty(pic As PictureBox)- If pic Is Nothing OrElse pic.Image IsNot Nothing Then Return-- If _scene.UseImage AndAlso _sceneImage IsNot Nothing Then- pic.Image = New Bitmap(_sceneImage)- pic.Invalidate()- Return- End If-- Dim canvas As Size = EffectiveCanvas()- If canvas.Width <= 0 OrElse canvas.Height <= 0 Then Return ' canvas size not known yet - nothing to show-- Dim placeholder As New Bitmap(canvas.Width, canvas.Height)- Using g As Graphics = Graphics.FromImage(placeholder)- g.Clear(Color.Black)- End Using- pic.Image = placeholder- pic.Invalidate()- End Sub-- ' ---- validation-- Private Shared Function TryParseInt(text As String, minValue As Integer, maxValue As Integer, ByRef value As Integer) As Boolean- If Integer.TryParse(text.Trim(), NumberStyles.None, CultureInfo.InvariantCulture, value) Then- Return value >= minValue AndAlso value <= maxValue- End If- Return False- End Function-- ''' <summary>Empty when the text is a usable damping edge size, otherwise a message.</summary>- Private Function DampingProblem(text As String, ByRef value As Integer) As String- If Not TryParseInt(text, 1, SceneSettings.MaxDampingEdgeSize, value) Then- Return "Enter a whole number of pixels, 1 or more."- End If- Dim canvas As Size = EffectiveCanvas()- If canvas.Width > 0 AndAlso 2 * value >= Math.Min(canvas.Width, canvas.Height) Then- Return "The damping edge must be less than half of the smaller canvas side (" &- Math.Min(canvas.Width, canvas.Height).ToString(CultureInfo.InvariantCulture) & " px)."- End If- Return ""- End Function-- ''' <summary>Shows the damping edge size in red when it does not fit the canvas.</summary>- Private Sub ShowDampingValidity()- Dim value As Integer- If DampingProblem(txtDampingEdgeSize.Text, value).Length = 0 Then- txtDampingEdgeSize.ForeColor = SystemColors.WindowText- Else- txtDampingEdgeSize.ForeColor = Color.Red- End If- End Sub-- ' ---- events-- ''' <summary>Switching to radUserDefinedScene drops the glow-edges overlay (ClearGlowEdgesImage) - without it,- ''' a "Display overlay" checkbox left checked on the Preview tab would otherwise keep showing the old scene- ''' image's overlay, which no longer corresponds to anything in a user-defined scene, and that stale overlay- ''' would then also be baked into any picture shared afterwards into the Sources/Probes tabs (CopyPreviewToTabs).- ''' _sceneImage itself is kept (not disposed) so switching back to radUseSceneImage restores the overlay too,- ''' via UpdateGlowEdgesImage, without needing to reload the image file.</summary>- Private Sub SceneMode_CheckedChanged(sender As Object, e As EventArgs) Handles radUseSceneImage.CheckedChanged, radUserDefinedScene.CheckedChanged- If _loadingScene Then Return- Dim button As RadioButton = DirectCast(sender, RadioButton)- If Not button.Checked Then Return-- _scene.UseImage = Object.ReferenceEquals(button, radUseSceneImage)- If _scene.UseImage Then- UpdateGlowEdgesImage()- Else- ClearGlowEdgesImage()- RefreshPreviewOverlay(_picField, FieldOverlayGain())- RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain())- End If- UpdateSceneControlState()- UpdateScenePreview()- ShowDampingValidity()- MarkProjectChanged()- End Sub-- Private Sub btnLOadSceneImage_Click(sender As Object, e As EventArgs) Handles btnLoadSceneImage.Click- Dim projectFolder As String = If(_project Is Nothing, "", _project.FolderPath)-- Using dlg As New OpenFileDialog()- dlg.Title = "Choose the scene image"- dlg.Filter = "Images (*.png;*.jpg;*.jpeg;*.bmp;*.tif;*.tiff;*.gif)|*.png;*.jpg;*.jpeg;*.bmp;*.tif;*.tiff;*.gif|All files (*.*)|*.*"- If _project IsNot Nothing Then- If Directory.Exists(_project.SceneImageFolder) Then- dlg.InitialDirectory = _project.SceneImageFolder- Else- dlg.InitialDirectory = _project.FolderPath- End If- End If- If dlg.ShowDialog(Me) <> DialogResult.OK Then Return-- Dim loaded As Bitmap = Nothing- Try- loaded = LoadImageCopy(dlg.FileName)- Catch ex As Exception- MessageBox.Show(Me, "The file could not be read as an image:" & vbCrLf & vbCrLf & ex.Message,- "Scene image", MessageBoxButtons.OK, MessageBoxIcon.Warning)- Return- End Try-- ReplaceSceneImage(loaded)-- ' an image from outside the project's own folder is copied in, so the project does not depend on a file- ' elsewhere on disk; the copy is what gets used and saved from here on- Dim imagePath As String = dlg.FileName- If _project IsNot Nothing AndAlso Not IsInsideFolder(imagePath, _project.FolderPath) Then- imagePath = CopyIntoSceneImageFolder(_project, imagePath)- End If-- _scene.ImageFile = SceneSettings.ToStoredPath(projectFolder, imagePath)- _scene.UseImage = True- End Using-- _loadingScene = True- Try- radUseSceneImage.Checked = True- Finally- _loadingScene = False- End Try-- UpdateSceneControlState()- UpdateScenePreview()- ShowDampingValidity()- MarkProjectChanged()- End Sub-- Private Sub CanvasSize_TextChanged(sender As Object, e As EventArgs) Handles txtXSize.TextChanged, txtYsize.TextChanged- If _loadingScene Then Return- Dim box As TextBox = DirectCast(sender, TextBox)- Dim value As Integer-- If TryParseInt(box.Text, SceneSettings.MinCanvasSize, SceneSettings.MaxCanvasSize, value) Then- box.ForeColor = SystemColors.WindowText- _sceneTip.Hide(box)- If Object.ReferenceEquals(box, txtXSize) Then- _scene.UserWidth = value- Else- _scene.UserHeight = value- End If- UpdateScenePreview()- ShowDampingValidity()- MarkProjectChanged()- Else- box.ForeColor = Color.Red- _sceneTip.Show("Enter a whole number of pixels from " & SceneSettings.MinCanvasSize.ToString(CultureInfo.InvariantCulture) &- " to " & SceneSettings.MaxCanvasSize.ToString(CultureInfo.InvariantCulture) & ".",- box, 0, box.Height + 2, 3000)- End If- End Sub-- Private Sub chkDampingEdge_CheckedChanged(sender As Object, e As EventArgs) Handles chkDampingEdge.CheckedChanged- If _loadingScene Then Return- _scene.DampingEdgeEnabled = chkDampingEdge.Checked- UpdateSceneControlState()- MarkProjectChanged()- End Sub-- Private Sub DampingSize_TextChanged(sender As Object, e As EventArgs) Handles txtDampingEdgeSize.TextChanged- If _loadingScene Then Return- Dim value As Integer- Dim problem As String = DampingProblem(txtDampingEdgeSize.Text, value)-- If problem.Length = 0 Then- _scene.DampingEdgeSize = value- txtDampingEdgeSize.ForeColor = SystemColors.WindowText- _sceneTip.Hide(txtDampingEdgeSize)- MarkProjectChanged()- Else- txtDampingEdgeSize.ForeColor = Color.Red- _sceneTip.Show(problem, txtDampingEdgeSize, 0, txtDampingEdgeSize.Height + 2, 3000)- End If- End Sub-- ''' <summary>When a size box is left its text is put back to the last valid value, and the scene is saved.</summary>- Private Sub SceneText_Leave(sender As Object, e As EventArgs) Handles txtXSize.Leave, txtYsize.Leave, txtDampingEdgeSize.Leave- Dim box As TextBox = DirectCast(sender, TextBox)- _sceneTip.Hide(box)-- _loadingScene = True- Try- If Object.ReferenceEquals(box, txtXSize) Then- box.Text = _scene.UserWidth.ToString(CultureInfo.InvariantCulture)- ElseIf Object.ReferenceEquals(box, txtYsize) Then- box.Text = _scene.UserHeight.ToString(CultureInfo.InvariantCulture)- Else- box.Text = _scene.DampingEdgeSize.ToString(CultureInfo.InvariantCulture)- End If- box.ForeColor = SystemColors.WindowText- Finally- _loadingScene = False- End Try-- ShowDampingValidity()- End Sub-- Private Sub chkUseSources_CheckedChanged(sender As Object, e As EventArgs) Handles chkUseImageSources.CheckedChanged- If _loadingScene Then Return- _scene.UseSources = chkUseImageSources.Checked- UpdateSceneControlState()- MarkProjectChanged()- End Sub-- Private Sub chkUseObjectSources_CheckedChanged(sender As Object, e As EventArgs) Handles chkUseObjectSources.CheckedChanged- If _loadingScene Then Return- _scene.UseObjectSources = chkUseObjectSources.Checked- MarkProjectChanged()- End Sub-- Private Sub ImageSourceScale_ValueChanged(sender As Object, e As EventArgs) Handles numScaleImageSource.ValueChanged- If _loadingScene Then Return- _scene.ImageSourceScale = CDbl(numScaleImageSource.Value)- MarkProjectChanged()- End Sub-- Private Sub RefractiveIndex_ValueChanged(sender As Object, e As EventArgs) Handles numRefractiveIndex.ValueChanged- If _loadingScene Then Return- _scene.BackgroundRefractiveIndex = CDbl(numRefractiveIndex.Value)- MarkProjectChanged()- End Sub-- ''' <summary>The value limited to the range of the numeric box.</summary>- Private Shared Function ClampToRange(box As NumericUpDown, value As Double) As Decimal- Dim v As Decimal = If(value < CDbl(box.Minimum), box.Minimum, If(value > CDbl(box.Maximum), box.Maximum, CDec(value)))- Return v- End Function-- Private Sub btnEditSourceList_Click(sender As Object, e As EventArgs) Handles btnEditObjectSourceList.Click- tabMainFunctions.SelectedTab = tabSourceList- End Sub-- ' ------------------------------------------------------------------ scheme folder and list-- Private Sub btbChooseFFolder_Click(sender As Object, e As EventArgs) Handles btbChooseFFolder.Click- Using dlg As New FolderBrowserDialog()- dlg.Description = "Choose the folder that contains the color scheme (.json) files"- If Directory.Exists(txtSchemeFolder.Text) Then dlg.SelectedPath = txtSchemeFolder.Text- If dlg.ShowDialog(Me) = DialogResult.OK Then- txtSchemeFolder.Text = dlg.SelectedPath- LoadSchemeList()- End If- End Using- End Sub-- Private Sub txtSchemeFolder_KeyDown(sender As Object, e As KeyEventArgs) Handles txtSchemeFolder.KeyDown- If e.KeyCode = Keys.Enter Then- e.SuppressKeyPress = True- LoadSchemeList()- End If- End Sub-- ''' <summary>Reads all schemes from the folder in txtSchemeFolder and fills the list.</summary>- Private Sub LoadSchemeList()- Dim folder As String = txtSchemeFolder.Text.Trim()- If Not Directory.Exists(folder) Then- MessageBox.Show(Me, "The folder '" & folder & "' does not exist.", "Color schemes",- MessageBoxButtons.OK, MessageBoxIcon.Warning)- Return- End If-- Dim errors As New List(Of String)()- _schemes = ColorSchemeStore.LoadFolder(folder, errors)- SortSchemes(_schemes, _schemeSortColumn, _schemeSortAscending)-- ListView1.BeginUpdate()- Try- ListView1.Items.Clear()- _thumbs.Images.Clear()- For Each old As Bitmap In _thumbBitmaps- old.Dispose()- Next- _thumbBitmaps.Clear()-- For Each scheme As ColorScheme In _schemes- Dim thumb As Bitmap = MakeThumbnail(scheme)- _thumbBitmaps.Add(thumb)- _thumbs.Images.Add(thumb)-- Dim item As New ListViewItem(scheme.Name, _thumbs.Images.Count - 1)- item.SubItems.Add(If(scheme.HasStops, ColorScheme.StopCount.ToString() & "-stop", "table"))- item.SubItems.Add(If(String.IsNullOrEmpty(scheme.SchemeType), "-", scheme.SchemeType))- item.Tag = scheme- ListView1.Items.Add(item)- Next- Finally- ListView1.EndUpdate()- End Try-- UpdateSchemeListSortHeaders()-- If errors.Count > 0 Then- Dim shown As Integer = Math.Min(errors.Count, 8)- Dim text As String = String.Join(vbCrLf, errors.GetRange(0, shown))- If errors.Count > shown Then text &= vbCrLf & "... and " & (errors.Count - shown).ToString() & " more"- MessageBox.Show(Me, "Some files could not be read as color schemes:" & vbCrLf & vbCrLf & text,- "Color schemes", MessageBoxButtons.OK, MessageBoxIcon.Warning)- End If-- RefreshSchemeCombos()-- _previewScheme = Nothing- RefreshEditorState()- End Sub-- ''' <summary>Sorts schemes in place: by name (sortColumn 0), or by type then name (sortColumn 2, or anything- ''' else) - "type then name" is also the tie-break used within a column-0 (name) sort's reversed order, same- ''' as SortProjectEntries's style.</summary>- Private Sub SortSchemes(schemes As List(Of ColorScheme), sortColumn As Integer, ascending As Boolean)- Dim result As Comparison(Of ColorScheme)- If sortColumn = 0 Then- result = Function(a As ColorScheme, b As ColorScheme) String.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)- Else- result = Function(a As ColorScheme, b As ColorScheme)- Dim c As Integer = String.Compare(a.SchemeType, b.SchemeType, StringComparison.OrdinalIgnoreCase)- If c <> 0 Then Return c- Return String.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)- End Function- End If- schemes.Sort(result)- If Not ascending Then schemes.Reverse()- End Sub-- ''' <summary>Clicking the Scheme or Type header sorts by it; clicking the same header again reverses the- ''' direction. The Kind column (1) is not sortable.</summary>- Private Sub ListView1_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles ListView1.ColumnClick- If e.Column <> 0 AndAlso e.Column <> 2 Then Return- If e.Column = _schemeSortColumn Then- _schemeSortAscending = Not _schemeSortAscending- Else- _schemeSortColumn = e.Column- _schemeSortAscending = True- End If- LoadSchemeList()- End Sub-- ''' <summary>Marks the currently sorted column's header with a small arrow, the way lstAllProjects does.</summary>- Private Sub UpdateSchemeListSortHeaders()- If ListView1.Columns.Count < 3 Then Return- Dim arrow As String = If(_schemeSortAscending, " ^", " v")- ListView1.Columns(0).Text = "Scheme" & If(_schemeSortColumn = 0, arrow, "")- ListView1.Columns(2).Text = "Type" & If(_schemeSortColumn = 2, arrow, "")- End Sub-- Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView1.SelectedIndexChanged- If ListView1.SelectedItems.Count = 0 Then- _previewScheme = Nothing- Else- _previewScheme = DirectCast(ListView1.SelectedItems(0).Tag, ColorScheme)- End If- RefreshEditorState()- End Sub-- Private Sub ListView1_DoubleClick(sender As Object, e As EventArgs) Handles ListView1.DoubleClick- LoadPreviewedScheme()- End Sub-- ' ------------------------------------------------------------------ load / keep-- Private Sub btnLoadScheme_Click(sender As Object, e As EventArgs) Handles btnLoadScheme.Click- If _previewScheme Is Nothing Then- MessageBox.Show(Me, "Select a scheme in the list first.", "Load scheme",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- LoadPreviewedScheme()- End Sub-- ' Escape in the list ends the preview and shows the current scheme again- Private Sub ListView1_KeyDown(sender As Object, e As KeyEventArgs) Handles ListView1.KeyDown- If e.KeyCode = Keys.Escape Then- ListView1.SelectedItems.Clear()- e.Handled = True- End If- End Sub-- ''' <summary>Makes a working copy of the previewed scheme the current scheme. Returns False if cancelled.</summary>- Private Function LoadPreviewedScheme() As Boolean- If _previewScheme Is Nothing Then Return False- If Not ConfirmDiscardChanges() Then Return False-- Dim source As ColorScheme = _previewScheme- _current = source.Clone(source.Name)- _current.FilePath = source.FilePath- _dirty = False- _selectedStop = -1-- ListView1.SelectedItems.Clear() ' ends the preview; also refreshes the display- RefreshEditorState()- Return True- End Function-- Private Function ConfirmDiscardChanges() As Boolean- If Not _dirty Then Return True- Dim answer As DialogResult = MessageBox.Show(Me,- "The current color scheme '" & _current.Name & "' has unsaved changes. Discard them?",- "Unsaved changes", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)- Return answer = DialogResult.Yes- End Function-- ' ------------------------------------------------------------------ editing the stops-- Private Sub StopButton_Click(sender As Object, e As EventArgs) Handles btnColor1.Click, btnCOlor2.Click, btnColor3.Click, btnColor4.Click, btnColor5.Click, btnColor6.Click, btnColor7.Click, btnColor9.Click, btnColor8.Click- Dim index As Integer = Array.IndexOf(_stopButtons, DirectCast(sender, Button))- If index < 0 Then Return-- ' clicking a Color button while a list item is only previewed loads that scheme first- If _previewScheme IsNot Nothing Then- If Not LoadPreviewedScheme() Then Return- End If- If _current Is Nothing Then Return-- ' an imported scheme is a full table without stops: editing it means making a stop-based approximation- If Not _current.HasStops Then- Dim answer As DialogResult = MessageBox.Show(Me,- "The scheme '" & _current.Name & "' is a full table of 255 colors without " &- ColorScheme.StopCount.ToString() & " editable stops." & vbCrLf & vbCrLf &- "Editing it creates a smooth " & ColorScheme.StopCount.ToString() & "-stop approximation as a new, " &- "unsaved scheme (the original file stays unchanged). Continue?",- "Edit scheme", MessageBoxButtons.YesNo, MessageBoxIcon.Question)- If answer <> DialogResult.Yes Then Return- _current = _current.ToStopScheme(_current.Name & " (" & ColorScheme.StopCount.ToString() & "-stop)")- _dirty = True- End If-- _selectedStop = index- Dim c As Color = _current.Stops(index)- _picker.OriginalColor = c- _picker.SelectedColor = c- RefreshEditorState()- End Sub-- Private Sub Picker_ColorChanged(sender As Object, e As EventArgs)- If _current Is Nothing OrElse Not _current.HasStops OrElse _selectedStop < 0 Then Return- _current.SetStop(_selectedStop, _picker.SelectedColor)- _dirty = True- RefreshEditorState()- End Sub-- ' ------------------------------------------------------------------ save-- Private Sub btnSaveCurrentScheme_Click(sender As Object, e As EventArgs) Handles btnSaveCurrentScheme.Click- If _current Is Nothing Then Return- If String.IsNullOrEmpty(_current.FilePath) Then- SaveAsNew()- Return- End If- Try- ColorSchemeStore.Save(_current, _current.FilePath)- _dirty = False- Catch ex As Exception- MessageBox.Show(Me, "The scheme could not be saved:" & vbCrLf & ex.Message, "Save scheme",- MessageBoxButtons.OK, MessageBoxIcon.Error)- Return- End Try- ReloadListAfterSave()- End Sub-- Private Sub btnSaveAsColorScheme_Click(sender As Object, e As EventArgs) Handles btnSaveAsColorScheme.Click- SaveAsNew()- End Sub-- Private Sub SaveAsNew()- If _current Is Nothing Then Return-- Dim folder As String = txtSchemeFolder.Text.Trim()- If Not Directory.Exists(folder) Then- MessageBox.Show(Me, "Choose an existing scheme folder first.", "Save scheme",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- Dim newName As String = Microsoft.VisualBasic.Interaction.InputBox(- "Name for the new color scheme:", "Save as new scheme", _current.Name).Trim()- If newName.Length = 0 Then Return-- Dim target As String = ColorSchemeStore.PathFor(folder, newName)- If File.Exists(target) Then- Dim answer As DialogResult = MessageBox.Show(Me,- "A scheme file named '" & Path.GetFileName(target) & "' already exists. Overwrite it?",- "Save scheme", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)- If answer <> DialogResult.Yes Then Return- End If-- Try- Dim copy As ColorScheme = _current.Clone(newName)- If copy.HasStops AndAlso String.IsNullOrEmpty(copy.Category) Then copy.Category = "custom"- ColorSchemeStore.Save(copy, target)- _current = copy- _dirty = False- Catch ex As Exception- MessageBox.Show(Me, "The scheme could not be saved:" & vbCrLf & ex.Message, "Save scheme",- MessageBoxButtons.OK, MessageBoxIcon.Error)- Return- End Try- ReloadListAfterSave()- End Sub-- Private Sub ReloadListAfterSave()- LoadSchemeList()- End Sub-- ' ------------------------------------------------------------------ rename / delete (list toolbar)-- ''' <summary>- ''' Renames the color scheme selected in the list (btnRenameColorScheme). Works directly on the scheme's JSON- ''' file: writes a new file under the new name and removes the old one. If the renamed scheme is also the one- ''' currently loaded in the editor (_current), that in-memory copy is renamed too, so a later Save does not- ''' resurrect the old file under the old name.- ''' </summary>- Private Sub btnRenameColorScheme_Click(sender As Object, e As EventArgs) Handles btnRenameColorScheme.Click- If _previewScheme Is Nothing Then- MessageBox.Show(Me, "Select a scheme in the list first.", "Rename color scheme",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- Dim scheme As ColorScheme = _previewScheme- Dim oldName As String = scheme.Name- Dim oldPath As String = scheme.FilePath-- Dim newName As String = oldName- If Not PromptForText("Rename color scheme", "New name for '" & oldName & "':", oldName, newName) Then Return- newName = newName.Trim()- If newName.Length = 0 OrElse newName = oldName Then Return-- Dim folder As String = If(String.IsNullOrEmpty(oldPath), txtSchemeFolder.Text.Trim(), Path.GetDirectoryName(oldPath))- Dim newPath As String = ColorSchemeStore.PathFor(folder, newName)-- If Not String.Equals(newPath, oldPath, StringComparison.OrdinalIgnoreCase) AndAlso File.Exists(newPath) Then- MessageBox.Show(Me, "A scheme file named '" & Path.GetFileName(newPath) & "' already exists.",- "Rename color scheme", MessageBoxButtons.OK, MessageBoxIcon.Warning)- Return- End If-- Try- scheme.Name = newName- ColorSchemeStore.Save(scheme, newPath)- If Not String.IsNullOrEmpty(oldPath) AndAlso Not String.Equals(oldPath, newPath, StringComparison.OrdinalIgnoreCase) AndAlso File.Exists(oldPath) Then- File.Delete(oldPath)- End If-- If _current IsNot Nothing AndAlso Not String.IsNullOrEmpty(oldPath) AndAlso- String.Equals(_current.FilePath, oldPath, StringComparison.OrdinalIgnoreCase) Then- _current.Name = newName- _current.FilePath = newPath- End If- Catch ex As Exception- MessageBox.Show(Me, "The scheme could not be renamed:" & vbCrLf & ex.Message, "Rename color scheme",- MessageBoxButtons.OK, MessageBoxIcon.Error)- Return- End Try-- LoadSchemeList()- SelectSchemeInList(newName)- ToolStripStatusLabel1.Text = "Color scheme '" & oldName & "' renamed to '" & newName & "'."- End Sub-- ''' <summary>- ''' Permanently deletes the color scheme selected in the list (btnDeleteColorScheme), after asking for- ''' confirmation. If the deleted scheme is also the one currently loaded in the editor, the editor keeps its- ''' in-memory copy on screen (nothing changes there) but that copy no longer has a file to save back over -- ''' the next save falls through to "save as new" instead.- ''' </summary>- Private Sub btnDeleteColorScheme_Click(sender As Object, e As EventArgs) Handles btnDeleteColorScheme.Click- If _previewScheme Is Nothing Then- MessageBox.Show(Me, "Select a scheme in the list first.", "Delete color scheme",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- Dim scheme As ColorScheme = _previewScheme- Dim name As String = scheme.Name- Dim path As String = scheme.FilePath-- If String.IsNullOrEmpty(path) OrElse Not File.Exists(path) Then- MessageBox.Show(Me, "That scheme has no file on disk (nothing to delete).", "Delete color scheme",- MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- Dim answer As DialogResult = MessageBox.Show(Me,- "Permanently delete the color scheme '" & name & "'?" & vbCrLf & vbCrLf & path,- "Delete color scheme", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)- If answer <> DialogResult.Yes Then Return-- Try- File.Delete(path)- Catch ex As Exception- MessageBox.Show(Me, "The scheme could not be deleted:" & vbCrLf & ex.Message, "Delete color scheme",- MessageBoxButtons.OK, MessageBoxIcon.Warning)- Return- End Try-- If _current IsNot Nothing AndAlso String.Equals(_current.FilePath, path, StringComparison.OrdinalIgnoreCase) Then- _current.FilePath = Nothing- End If-- _previewScheme = Nothing- LoadSchemeList()- ToolStripStatusLabel1.Text = "Color scheme '" & name & "' deleted."- End Sub-- ''' <summary>Selects, in ListView1, the item for the scheme with the given name (case-insensitive), if any.</summary>- Private Sub SelectSchemeInList(name As String)- For Each item As ListViewItem In ListView1.Items- Dim scheme As ColorScheme = TryCast(item.Tag, ColorScheme)- If scheme IsNot Nothing AndAlso String.Equals(scheme.Name, name, StringComparison.OrdinalIgnoreCase) Then- item.Selected = True- item.EnsureVisible()- Exit For- End If- Next- End Sub-- ' ------------------------------------------------------------------ scheme type (field / intensity)-- ' The radio buttons say what the current scheme is meant for. The choice is saved in the scheme file- ' as "scheme_type": "field" or "scheme_type": "intensity" and is shown again when the file is loaded.- Private Sub SchemeType_CheckedChanged(sender As Object, e As EventArgs) Handles radSchemeTypeField.CheckedChanged, radSchemeTypeIntensity.CheckedChanged- If _updatingRadios Then Return- If _current Is Nothing OrElse _previewScheme IsNot Nothing Then Return-- Dim radio As RadioButton = DirectCast(sender, RadioButton)- If Not radio.Checked Then Return ' only react to the button that became checked-- Dim newType As String = If(radio Is radSchemeTypeField, ColorScheme.SchemeTypeField, ColorScheme.SchemeTypeIntensity)- If _current.SchemeType <> newType Then- _current.SchemeType = newType- _dirty = True- RefreshEditorState()- End If- End Sub-- ' ------------------------------------------------------------------ display-- ''' <summary>The scheme shown in the scheme bar: the previewed one, otherwise the current one.</summary>- Private Function DisplayedScheme() As ColorScheme- If _previewScheme IsNot Nothing Then Return _previewScheme- Return _current- End Function-- ''' <summary>Brings the buttons, texts, picker and scheme bar in line with the current state.</summary>- Private Sub RefreshEditorState()- Dim previewing As Boolean = (_previewScheme IsNot Nothing)- Dim shown As ColorScheme = DisplayedScheme()- Dim hasCurrent As Boolean = (_current IsNot Nothing)- Dim editing As Boolean = hasCurrent AndAlso Not previewing AndAlso _selectedStop >= 0-- If hasCurrent Then- txtCurrentColorScheme.Text = _current.Name & If(_dirty, " (unsaved changes)", "")- Else- txtCurrentColorScheme.Text = "(none loaded)"- End If-- For k As Integer = 0 To ColorScheme.StopCount - 1- Dim btn As Button = _stopButtons(k)- btn.Enabled = (shown IsNot Nothing)- If shown IsNot Nothing Then- Dim c As Color = StopColorOf(shown, k)- btn.BackColor = c- btn.ForeColor = ContrastColor(c)- Else- btn.BackColor = SystemColors.Control- btn.ForeColor = SystemColors.ControlText- End If- btn.FlatAppearance.BorderSize = If(editing AndAlso k = _selectedStop, 4, 1)- Next-- _picker.Enabled = editing- If editing Then- lblColorPicker.Text = "Color Picker - editing Color " & (_selectedStop + 1).ToString() & StopRole(_selectedStop)- Else- lblColorPicker.Text = "Color Picker (click a Color button to edit it)"- End If-- btnLoadScheme.Enabled = previewing- btnSaveCurrentScheme.Enabled = hasCurrent AndAlso _dirty- btnSaveAsColorScheme.Enabled = hasCurrent-- ' radio buttons show the type of the displayed scheme; they can only be changed for the current scheme- _updatingRadios = True- Try- Dim shownType As String = If(shown Is Nothing, "", shown.SchemeType)- radSchemeTypeField.Checked = (shownType = ColorScheme.SchemeTypeField)- radSchemeTypeIntensity.Checked = (shownType = ColorScheme.SchemeTypeIntensity)- radSchemeTypeField.Enabled = hasCurrent AndAlso Not previewing- radSchemeTypeIntensity.Enabled = hasCurrent AndAlso Not previewing- Finally- _updatingRadios = False- End Try-- pnlScheme.Invalidate()- End Sub-- Private Sub pnlScheme_Paint(sender As Object, e As PaintEventArgs) Handles pnlScheme.Paint- Dim scheme As ColorScheme = DisplayedScheme()- Dim g As Graphics = e.Graphics- Dim r As Rectangle = pnlScheme.ClientRectangle- If scheme Is Nothing Then- g.Clear(SystemColors.ControlLight)- Return- End If-- ' vertical gradient: top = entry 0 (Color 1), bottom = entry 254 (last Color), middle = entry 127 (centre Color)- Using strip As New Bitmap(1, ColorScheme.EntryCount, PixelFormat.Format32bppArgb)- For i As Integer = 0 To ColorScheme.EntryCount - 1- strip.SetPixel(0, i, scheme.GetEntry(i))- Next- g.InterpolationMode = InterpolationMode.NearestNeighbor- g.PixelOffsetMode = PixelOffsetMode.Half- g.DrawImage(strip, r)- End Using-- ' tick marks at the stop positions (dark and light so they show on any color)- Dim editingHere As Boolean = (_previewScheme Is Nothing AndAlso _selectedStop >= 0)- For k As Integer = 0 To ColorScheme.StopCount - 1- Dim y As Integer = CInt(Math.Round(k * (r.Height - 1) / CDbl(ColorScheme.StopCount - 1)))- Dim selected As Boolean = editingHere AndAlso k = _selectedStop- Dim tick As Integer = If(selected, r.Width, 9)- Dim thick As Integer = If(selected, 3, 1)- Using darkPen As New Pen(Color.Black, CSng(thick + 2))- g.DrawLine(darkPen, 0, y, tick, y)- g.DrawLine(darkPen, r.Width - tick, y, r.Width, y)- End Using- Using lightPen As New Pen(Color.White, CSng(thick))- g.DrawLine(lightPen, 0, y, tick, y)- g.DrawLine(lightPen, r.Width - tick, y, r.Width, y)- End Using- Next-- ' scale labels that depend on the scheme type- If scheme.SchemeType = ColorScheme.SchemeTypeField Then- DrawScaleLabel(g, r, "-1", 0, scheme)- DrawScaleLabel(g, r, "0", ColorScheme.EntryCount \ 2, scheme)- DrawScaleLabel(g, r, "+1", ColorScheme.EntryCount - 1, scheme)- ElseIf scheme.SchemeType = ColorScheme.SchemeTypeIntensity Then- DrawScaleLabel(g, r, "0", 0, scheme)- DrawScaleLabel(g, r, "max", ColorScheme.EntryCount - 1, scheme)- End If- End Sub-- ''' <summary>Draws a small label on the scheme bar at the height of a table entry, readable on any color.</summary>- Private Sub DrawScaleLabel(g As Graphics, bar As Rectangle, text As String, entryIndex As Integer, scheme As ColorScheme)- Dim textSize As Size = TextRenderer.MeasureText(g, text, pnlScheme.Font)- Dim y As Integer = CInt(Math.Round(entryIndex * (bar.Height - 1) / CDbl(ColorScheme.EntryCount - 1)))- Dim top As Integer = y - textSize.Height \ 2- If top < 12 Then top = 12 ' keep clear of the end ticks- If top + textSize.Height > bar.Height - 12 Then top = bar.Height - 12 - textSize.Height- Dim box As New Rectangle(0, top, bar.Width, textSize.Height)- TextRenderer.DrawText(g, text, pnlScheme.Font, box, ContrastColor(scheme.GetEntry(entryIndex)),- TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter)- End Sub-- ' ------------------------------------------------------------------ helpers-- Private Shared Function StopColorOf(scheme As ColorScheme, k As Integer) As Color- If scheme.HasStops Then Return scheme.Stops(k)- Return scheme.SampleAt(k * (ColorScheme.EntryCount - 1) / CDbl(ColorScheme.StopCount - 1))- End Function-- Private Shared Function StopRole(k As Integer) As String- If k = 0 Then Return " (start of the scale)"- If k = ColorScheme.StopCount - 1 Then Return " (end of the scale)"- If ColorScheme.StopCount Mod 2 = 1 AndAlso k = ColorScheme.StopCount \ 2 Then Return " (centre = zero field)"- Return ""- End Function-- Private Shared Function ContrastColor(c As Color) As Color- Dim lum As Double = 0.299 * c.R + 0.587 * c.G + 0.114 * c.B- If lum > 140.0 Then Return Color.Black- Return Color.White- End Function-- ''' <summary>A horizontal preview of a scheme for the list: left = entry 0, right = entry 254.</summary>- Private Shared Function MakeThumbnail(scheme As ColorScheme) As Bitmap- Dim bmp As New Bitmap(ThumbWidth, ThumbHeight, PixelFormat.Format32bppArgb)- Using g As Graphics = Graphics.FromImage(bmp)- For x As Integer = 0 To ThumbWidth - 1- Dim index As Integer = CInt(Math.Round(x * (ColorScheme.EntryCount - 1) / CDbl(ThumbWidth - 1)))- Using br As New SolidBrush(scheme.GetEntry(index))- g.FillRectangle(br, x, 0, 1, ThumbHeight)- End Using- Next- g.DrawRectangle(Pens.Gray, 0, 0, ThumbWidth - 1, ThumbHeight - 1)- End Using- Return bmp- End Function-- ' ------------------------------------------------------------------ simulation- '- ' The settings on the Configuration tab (steps, video export, previews, color schemes) are kept in _simulation- ' and saved in configuration.json with the project. "Start simulation" hands a copy of everything to a- ' SimulationRunner, which does the work on a background thread. The runner reports back through events;- ' PostToUi passes them on to this thread.-- Private _simulation As New SimulationSettings()-- ' True while the code fills the controls, so that their events do not change the settings- Private _loadingSim As Boolean-- ' The running simulation (Nothing when none runs) and the progress text shown in the title bar- Private _runner As SimulationRunner- Private _simStatus As String = ""-- ' The videos of the last finished run (empty = none) and the settings of the run that is running or ran last- Private _fieldVideoFile As String = ""- Private _intensityVideoFile As String = ""- Private _runInfo As String = ""-- ' state of the running simulation: paused, a stop was asked, and the last progress text- Private _paused As Boolean- Private _stopRequested As Boolean- Private _progressText As String = ""- Private _lastStepsDone As Integer-- ' the color tables of the run that is running or ran last (for a still export while paused, so it matches the- ' colors of the live preview), and a full-resolution snapshot of its last frame (for a still export once the- ' run has fully stopped - see SimulationResult.LastFieldFrame/LastIntensityFrame)- Private _lastFieldLut As Integer()- Private _lastIntensityLut As Integer()- Private _lastFullFieldFrame As Bitmap- Private _lastFullIntensityFrame As Bitmap-- ' The pictures on the Preview tab- Private _picField As PictureBox- Private _picIntensity As PictureBox-- ' the "glowing edges" picture of the scene image (ComputeGlowingEdges), same size as _sceneImage, rebuilt- ' whenever the scene image changes (see ReplaceSceneImage/UpdateGlowEdgesImage); Nothing when there is no- ' scene image. Optionally overlaid on the Field/Intensity previews - chkDiplayOverlayInField/- ' chkDiplayOverlayInIntensity say whether to, per preview - see ComposeGlowOverlay/RefreshPreviewOverlay.- Private _glowEdgesImage As Bitmap-- ' _glowEdgesImage resized to whatever size a preview frame last asked for (GetGlowOverlayResized) - rebuilding- ' this by resampling the full scene-image-sized picture on every single visualized step of a run would be- ' wasteful, so it is cached until either the target size or _glowEdgesImage itself changes.- Private _glowOverlayCache As Bitmap- Private _glowOverlayCacheSize As Size-- ' The pictures on the Sources and Probes tabs (copies of a preview picture, for later evaluation)- Private _picSource As PictureBox- Private _picProbe As PictureBox-- ' True once a simulation has run (and ended), so that the stop button becomes a restart button- Private _hasRun As Boolean-- Private Sub InitializeSimulationControls()- numVisualizeEvery.Minimum = 1-- ' brightness factors of the field and intensity pictures (render_field / render_intensity in the Python code)- numFieldScaling.Minimum = 0.1D- numFieldScaling.Maximum = 1000D- numIntensityScaling.Minimum = 0.1D- numIntensityScaling.Maximum = 1000D-- ' numFieldScaling2/numIntensityScaling2 (Viewer tab) are a second set of controls for the very same- ' FieldBrightness/IntensityBrightness values as numFieldScaling/numIntensityScaling (Configuration tab) -- ' see numScaleFieldValues_ValueChanged/numScaleIntensity_ValueChanged and their "2" counterparts, which- ' keep both pairs in sync. Match the originals' range/precision so a value entered in either pair means- ' the same thing and is not rejected/rounded differently by the other.- numFieldScaling2.Minimum = numFieldScaling.Minimum- numFieldScaling2.Maximum = numFieldScaling.Maximum- numFieldScaling2.DecimalPlaces = numFieldScaling.DecimalPlaces- numFieldScaling2.Increment = numFieldScaling.Increment- numIntensityScaling2.Minimum = numIntensityScaling.Minimum- numIntensityScaling2.Maximum = numIntensityScaling.Maximum- numIntensityScaling2.DecimalPlaces = numIntensityScaling.DecimalPlaces- numIntensityScaling2.Increment = numIntensityScaling.Increment-- ' offsets (black levels of the color tables): 2 decimals, otherwise the default of -0.05 would be rounded- For Each box As NumericUpDown In New NumericUpDown() {numOffsetField, numOffsetIntensity}- box.DecimalPlaces = 2- box.Minimum = -1D- box.Maximum = 1D- box.Increment = 0.01D- Next-- numQuality.Minimum = 1D- numQuality.Maximum = 100D- numQuality.DecimalPlaces = 0-- ' the summary of a run is shown in the status bar, its details in the tooltip- StatusStrip1.ShowItemToolTips = True- ToolStripStatusLabel1.Spring = True- ToolStripStatusLabel1.TextAlign = ContentAlignment.MiddleLeft- ToolStripStatusLabel1.Text = ""-- UpdateRunButtons()-- btnViewIntensityVideo.Text = "View intensity video in media player"- UpdateVideoButtons()- cmbFieldColorScheme.DropDownStyle = ComboBoxStyle.DropDownList- cmbIntensityColorScheme.DropDownStyle = ComboBoxStyle.DropDownList-- _picField = MakePreviewBox(pnlPreviewField)- _picIntensity = MakePreviewBox(pnlPreviewIntensity)- _picSource = MakePreviewBox(pnlSourceImage)- _picProbe = MakePreviewBox(pnlProbeImage)- UpdateCopyButtons()-- ' warn, in lblWarningField/lblWarningIntensity, when the last (or next) run will not export that video -- ' shown/hidden per video in UpdateSimulationControlState; these are Designer labels placed in the clear,- ' not (like the dynamic label this used to be) a control positioned over other controls at runtime- lblWarningField.Text = "Field video not exported"- lblWarningField.ForeColor = Color.DarkBlue- lblWarningIntensity.Text = "Intensity video not exported"- lblWarningIntensity.ForeColor = Color.DarkBlue-- ' No ShowSimulationInControls() here: grpSimulationSettings is disabled until a real project exists- ' (UpdateProjectAccess). Steps and TimeDecayFactor have no software default of their own any more (see- ' their comments in SimulationSettings.vb) - populating the controls now, from the blank _simulation this- ' form starts with, would clamp numSimulationSteps/numTimeDecayFactor down from their Designer defaults- ' (3000 and 10) to their Minimum before StartNewProject ever gets a chance to read the Designer value back- ' out of them. StartNewProject/SetCurrentProject call ShowSimulationInControls() themselves once a real- ' project exists.- End Sub-- ''' <summary>Puts a picture box that fills the panel (the picture is shown as large as fits) in a preview panel.</summary>- Private Shared Function MakePreviewBox(host As Panel) As PictureBox- host.BackColor = Color.Black- Dim box As New PictureBox()- box.Dock = DockStyle.Fill- box.SizeMode = PictureBoxSizeMode.Zoom- box.BackColor = Color.Black- host.Controls.Add(box)- Return box- End Function-- ''' <summary>Copies the values of _simulation into the controls.</summary>- Private Sub ShowSimulationInControls()- _loadingSim = True- Try- ' the range of the numeric box is set in the designer; keep the settings inside it- Dim every As Integer = Math.Max(CInt(numVisualizeEvery.Minimum), Math.Min(CInt(numVisualizeEvery.Maximum), _simulation.VisualizeEvery))- _simulation.VisualizeEvery = every-- numSimulationSteps.Value = ClampToRange(numSimulationSteps, _simulation.Steps)- numVisualizeEvery.Value = every-- numFieldScaling.Value = ClampToRange(numFieldScaling, _simulation.FieldBrightness)- numIntensityScaling.Value = ClampToRange(numIntensityScaling, _simulation.IntensityBrightness)- numFieldScaling2.Value = ClampToRange(numFieldScaling2, _simulation.FieldBrightness)- numIntensityScaling2.Value = ClampToRange(numIntensityScaling2, _simulation.IntensityBrightness)- numQuality.Value = ClampToRange(numQuality, _simulation.VideoQuality)- numOffsetField.Value = ClampToRange(numOffsetField, _simulation.FieldBlackLevel)- numOffsetIntensity.Value = ClampToRange(numOffsetIntensity, _simulation.IntensityBlackLevel)- numTimeDecayFactor.Value = ClampToRange(numTimeDecayFactor, _simulation.TimeDecayFactor)-- chkExportVideoField.Checked = _simulation.ExportField- chkExportVideoIntensity.Checked = _simulation.ExportIntensity- chkExportVideoField2.Checked = _simulation.ExportField- chkExportVideoIntensity2.Checked = _simulation.ExportIntensity- chkPreviewVideoField.Checked = _simulation.PreviewField- chkPreviewVideoIntensity.Checked = _simulation.PreviewIntensity- chkUseGPU.Checked = _simulation.UseGpu- chkUse4thOrderLaplacian.Checked = _simulation.Use4thOrderLaplacian-- FillSchemeCombo(cmbFieldColorScheme, ColorScheme.SchemeTypeField, _simulation.FieldColorScheme)- FillSchemeCombo(cmbIntensityColorScheme, ColorScheme.SchemeTypeIntensity, _simulation.IntensityColorScheme)- Finally- _loadingSim = False- End Try-- UpdateSimulationControlState()- End Sub-- ''' <summary>A color scheme combo box is only useful when the field (or intensity) is exported or previewed.</summary>- Private Sub UpdateSimulationControlState()- cmbFieldColorScheme.Enabled = chkExportVideoField.Checked OrElse chkPreviewVideoField.Checked- cmbIntensityColorScheme.Enabled = chkExportVideoIntensity.Checked OrElse chkPreviewVideoIntensity.Checked-- ' the quality only matters for exported videos- Dim exporting As Boolean = chkExportVideoField.Checked OrElse chkExportVideoIntensity.Checked- numQuality.Enabled = exporting- lblVideoQuality.Enabled = exporting- lblWarningField.Visible = Not chkExportVideoField.Checked- lblWarningIntensity.Visible = Not chkExportVideoIntensity.Checked- End Sub-- ''' <summary>Fills the two color scheme combo boxes again from the loaded schemes (after loading or saving schemes).</summary>- Private Sub RefreshSchemeCombos()- Dim wasLoading As Boolean = _loadingSim- _loadingSim = True- Try- FillSchemeCombo(cmbFieldColorScheme, ColorScheme.SchemeTypeField, _simulation.FieldColorScheme)- FillSchemeCombo(cmbIntensityColorScheme, ColorScheme.SchemeTypeIntensity, _simulation.IntensityColorScheme)- Finally- _loadingSim = wasLoading- End Try- End Sub-- ''' <summary>Lists the schemes of one type (field or intensity); schemes without a type are left out.</summary>- Private Sub FillSchemeCombo(combo As ComboBox, schemeType As String, selectedName As String)- combo.BeginUpdate()- Try- combo.Items.Clear()- Dim selected As ColorScheme = Nothing- For Each scheme As ColorScheme In _schemes- If String.Equals(scheme.SchemeType, schemeType, StringComparison.OrdinalIgnoreCase) Then- combo.Items.Add(scheme)- If String.Equals(scheme.Name, selectedName, StringComparison.OrdinalIgnoreCase) Then selected = scheme- End If- Next- If selected IsNot Nothing Then- combo.SelectedItem = selected- Else- combo.SelectedIndex = -1- End If- Finally- combo.EndUpdate()- End Try- End Sub-- Private Function FindScheme(name As String, schemeType As String) As ColorScheme- For Each scheme As ColorScheme In _schemes- If String.Equals(scheme.Name, name, StringComparison.OrdinalIgnoreCase) AndAlso- String.Equals(scheme.SchemeType, schemeType, StringComparison.OrdinalIgnoreCase) Then Return scheme- Next- Return Nothing- End Function-- ' ---- events of the settings controls-- Private Sub tabMainFunctions_SelectedIndexChanged(sender As Object, e As EventArgs) Handles tabMainFunctions.SelectedIndexChanged- ' cmbFieldColorScheme/cmbIntensityColorScheme live on the Configuration tab. Schemes may have been added,- ' renamed or deleted on the Color Scheme tab since these were last filled - or even just added to the- ' folder from outside the app - so re-read the scheme folder from disk (RefreshSchemeCombos alone only- ' refills the combos from the in-memory list, which can be stale) rather than assume it is still current.- If tabMainFunctions.SelectedTab Is tabConfiguration Then- Dim folder As String = txtSchemeFolder.Text.Trim()- If Directory.Exists(folder) Then- LoadSchemeList()- Else- RefreshSchemeCombos()- End If- End If-- ' lstAllProjects3 (Outputs tab) has the same staleness problem - a project may have appeared, been- ' renamed or been deleted since it was last filled, so re-read it fresh on every arrival too. Default the- ' selection to whichever project is currently open in the editor (falls back to the previous selection,- ' or none, when no project is open - see RefreshOutputProjectList).- If tabMainFunctions.SelectedTab Is tabOutput Then- RefreshOutputProjectList(If(_project IsNot Nothing, _project.Name, ""))- End If- End Sub-- ''' <summary>numSimulationSteps replaces the old cmbSimulationSteps combo box, so the number of steps is no- ''' longer limited to a fixed preset list - the range (currently 1 to 50,000) is set in the Designer, and the- ''' control itself never allows an out-of-range or non-integer value, so unlike the old free-text combo this- ''' needs no separate parsing/validation/error-coloring here.</summary>- Private Sub numSimulationSteps_ValueChanged(sender As Object, e As EventArgs) Handles numSimulationSteps.ValueChanged- If _loadingSim Then Return- _simulation.Steps = CInt(numSimulationSteps.Value)- MarkProjectChanged()- End Sub-- Private Sub numVisualizeEvery_ValueChanged(sender As Object, e As EventArgs) Handles numVisualizeEvery.ValueChanged- If _loadingSim Then Return- _simulation.VisualizeEvery = CInt(numVisualizeEvery.Value)- MarkProjectChanged()- End Sub-- ''' <summary>Copies a value into a NumericUpDown that mirrors another one (numFieldScaling/numFieldScaling2,- ''' numIntensityScaling/numIntensityScaling2 - Configuration tab and Viewer tab controls for the very same- ''' setting), without re-triggering that control's own ValueChanged - every simulation control's ValueChanged- ''' already checks _loadingSim first, so reusing it here as the reentrancy guard stops the two controls from- ''' setting each other back and forth.</summary>- Private Sub SetLinkedScalingValue(box As NumericUpDown, value As Decimal)- Dim clamped As Decimal = If(value < box.Minimum, box.Minimum, If(value > box.Maximum, box.Maximum, value))- If box.Value = clamped Then Return- Dim wasLoading As Boolean = _loadingSim- _loadingSim = True- Try- box.Value = clamped- Finally- _loadingSim = wasLoading- End Try- End Sub-- ''' <summary>Copies a checked state into a CheckBox that mirrors another one (chkExportVideoField/- ''' chkExportVideoField2, chkExportVideoIntensity/chkExportVideoIntensity2 - Configuration tab and Viewer tab- ''' controls for the very same setting) - the same _loadingSim reentrancy-guard idea as SetLinkedScalingValue,- ''' for a CheckBox's Checked instead of a NumericUpDown's Value.</summary>- Private Sub SetLinkedCheckedValue(box As CheckBox, value As Boolean)- If box.Checked = value Then Return- Dim wasLoading As Boolean = _loadingSim- _loadingSim = True- Try- box.Checked = value- Finally- _loadingSim = wasLoading- End Try- End Sub-- Private Sub numScaleFieldValues_ValueChanged(sender As Object, e As EventArgs) Handles numFieldScaling.ValueChanged- If _loadingSim Then Return- _simulation.FieldBrightness = CDbl(numFieldScaling.Value)- SetLinkedScalingValue(numFieldScaling2, numFieldScaling.Value)- MarkProjectChanged()- End Sub-- Private Sub numScaleFieldValues2_ValueChanged(sender As Object, e As EventArgs) Handles numFieldScaling2.ValueChanged- If _loadingSim Then Return- _simulation.FieldBrightness = CDbl(numFieldScaling2.Value)- SetLinkedScalingValue(numFieldScaling, numFieldScaling2.Value)- MarkProjectChanged()- End Sub-- Private Sub numQuality_ValueChanged(sender As Object, e As EventArgs) Handles numQuality.ValueChanged- If _loadingSim Then Return- _simulation.VideoQuality = CInt(numQuality.Value)- MarkProjectChanged()- End Sub-- Private Sub numOffsetField_ValueChanged(sender As Object, e As EventArgs) Handles numOffsetField.ValueChanged- If _loadingSim Then Return- _simulation.FieldBlackLevel = CDbl(numOffsetField.Value)- MarkProjectChanged()- End Sub-- Private Sub numOffsetIntensity_ValueChanged(sender As Object, e As EventArgs) Handles numOffsetIntensity.ValueChanged- If _loadingSim Then Return- _simulation.IntensityBlackLevel = CDbl(numOffsetIntensity.Value)- MarkProjectChanged()- End Sub-- ''' <summary>"Intensity decay factor" - see SimulationSettings.TimeDecayFactor's comment.</summary>- Private Sub numTimeDecayFactor_ValueChanged(sender As Object, e As EventArgs) Handles numTimeDecayFactor.ValueChanged- If _loadingSim Then Return- _simulation.TimeDecayFactor = CDbl(numTimeDecayFactor.Value)- MarkProjectChanged()- End Sub-- Private Sub numScaleIntensity_ValueChanged(sender As Object, e As EventArgs) Handles numIntensityScaling.ValueChanged- If _loadingSim Then Return- _simulation.IntensityBrightness = CDbl(numIntensityScaling.Value)- SetLinkedScalingValue(numIntensityScaling2, numIntensityScaling.Value)- MarkProjectChanged()- End Sub-- Private Sub numScaleIntensity2_ValueChanged(sender As Object, e As EventArgs) Handles numIntensityScaling2.ValueChanged- If _loadingSim Then Return- _simulation.IntensityBrightness = CDbl(numIntensityScaling2.Value)- SetLinkedScalingValue(numIntensityScaling, numIntensityScaling2.Value)- MarkProjectChanged()- End Sub-- Private Sub SimulationOption_CheckedChanged(sender As Object, e As EventArgs) Handles chkExportVideoField.CheckedChanged,- chkExportVideoIntensity.CheckedChanged, chkPreviewVideoField.CheckedChanged, chkPreviewVideoIntensity.CheckedChanged- If _loadingSim Then Return- _simulation.ExportField = chkExportVideoField.Checked- _simulation.ExportIntensity = chkExportVideoIntensity.Checked- _simulation.PreviewField = chkPreviewVideoField.Checked- _simulation.PreviewIntensity = chkPreviewVideoIntensity.Checked- SetLinkedCheckedValue(chkExportVideoField2, chkExportVideoField.Checked)- SetLinkedCheckedValue(chkExportVideoIntensity2, chkExportVideoIntensity.Checked)- UpdateSimulationControlState()- MarkProjectChanged()- End Sub-- ''' <summary>chkExportVideoField2/chkExportVideoIntensity2 (Viewer tab) mirror chkExportVideoField/- ''' chkExportVideoIntensity (Configuration tab) - the same pair-linking pattern as numFieldScaling/- ''' numFieldScaling2 (SetLinkedScalingValue/SetLinkedCheckedValue).</summary>- Private Sub chkExportVideoField2_CheckedChanged(sender As Object, e As EventArgs) Handles chkExportVideoField2.CheckedChanged- If _loadingSim Then Return- _simulation.ExportField = chkExportVideoField2.Checked- SetLinkedCheckedValue(chkExportVideoField, chkExportVideoField2.Checked)- UpdateSimulationControlState()- MarkProjectChanged()- End Sub-- Private Sub chkExportVideoIntensity2_CheckedChanged(sender As Object, e As EventArgs) Handles chkExportVideoIntensity2.CheckedChanged- If _loadingSim Then Return- _simulation.ExportIntensity = chkExportVideoIntensity2.Checked- SetLinkedCheckedValue(chkExportVideoIntensity, chkExportVideoIntensity2.Checked)- UpdateSimulationControlState()- MarkProjectChanged()- End Sub-- Private Sub chkUseGPU_CheckedChanged(sender As Object, e As EventArgs) Handles chkUseGPU.CheckedChanged- If _loadingSim Then Return- _simulation.UseGpu = chkUseGPU.Checked- MarkProjectChanged()- End Sub-- Private Sub chkUse4thOrderLaplacian_CheckedChanged(sender As Object, e As EventArgs) Handles chkUse4thOrderLaplacian.CheckedChanged- If _loadingSim Then Return- _simulation.Use4thOrderLaplacian = chkUse4thOrderLaplacian.Checked- MarkProjectChanged()- End Sub-- Private Sub SchemeCombo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbFieldColorScheme.SelectedIndexChanged,- cmbIntensityColorScheme.SelectedIndexChanged- If _loadingSim Then Return- Dim combo As ComboBox = DirectCast(sender, ComboBox)- Dim scheme As ColorScheme = TryCast(combo.SelectedItem, ColorScheme)- If scheme Is Nothing Then Return-- If combo Is cmbFieldColorScheme Then- _simulation.FieldColorScheme = scheme.Name- Else- _simulation.IntensityColorScheme = scheme.Name- End If- MarkProjectChanged()- End Sub-- ' ---- start and stop-- Private Sub btnStartSimulation_Click(sender As Object, e As EventArgs) Handles btnStartSimulation.Click- If _runner IsNot Nothing Then- ' the button is also a stop button while a simulation runs- RequestStop()- Return- End If- StartSimulation()- End Sub-- ' ---- sharing a picture with the Sources and Probes tabs (grpShareImage, Preview tab)-- ''' <summary>Puts a copy of the current scene image (or the black placeholder when there is none) in- ''' pnlSourceImage and pnlProbeImage - the same picture the "Import scene image" buttons on those tabs load,- ''' just from here instead.</summary>- Private Sub btnShareSceneImage_Click(sender As Object, e As EventArgs) Handles btnShareSceneImage.Click- ImportSceneImageInto(_picSource)- ImportSceneImageInto(_picProbe)- End Sub-- Private Sub btnShareFieldImage_Click(sender As Object, e As EventArgs) Handles btnShareFieldImage.Click- CopyPreviewToTabs(_picField)- End Sub-- Private Sub btnShareIntensityImage_Click(sender As Object, e As EventArgs) Handles btnShareIntensityImage.Click- CopyPreviewToTabs(_picIntensity)- End Sub-- ''' <summary>Puts a copy of the picture that is shown in a preview on the Sources tab and on the Probes tab -- ''' source.Image exactly as currently displayed, glow-edges overlay baked in when "Display overlay" happens- ''' to be checked for that preview (SetPreviewFrame/RefreshPreviewOverlay), and not when it is not.</summary>- Private Sub CopyPreviewToTabs(source As PictureBox)- Dim shown As Image = source.Image- If shown Is Nothing Then Return-- For Each target As PictureBox In New PictureBox() {_picSource, _picProbe}- Dim copy As New Bitmap(shown)- Dim old As Image = target.Image- target.Image = copy- If old IsNot Nothing Then old.Dispose()- Next- End Sub-- ''' <summary>The field/intensity share buttons are only on when their preview shows a picture; btnShareSceneImage- ''' is not gated the same way, matching "Import scene image" on the Sources/Probes tabs, which always works- ''' (it falls back to a black placeholder when there is no scene image).</summary>- Private Sub UpdateCopyButtons()- btnShareFieldImage.Enabled = (_picField IsNot Nothing) AndAlso (_picField.Image IsNot Nothing)- btnShareIntensityImage.Enabled = (_picIntensity IsNot Nothing) AndAlso (_picIntensity.Image IsNot Nothing)- UpdateExportButtons()- End Sub-- ''' <summary>- ''' The "Export current Field/Intensity frame" buttons are only on while the simulation is not actively- ''' running (paused, or fully stopped) and there is something to export: either a live, paused engine- ''' (RenderCurrentFrame), a full-resolution snapshot cached from the last run (_lastFullFieldFrame /- ''' _lastFullIntensityFrame), or at least the picture currently shown in the preview.- ''' </summary>- Private Sub UpdateExportButtons()- Dim canExport As Boolean = _paused OrElse _runner Is Nothing- btnExportFieldFrame.Enabled = canExport AndAlso- (_lastFullFieldFrame IsNot Nothing OrElse ((_picField IsNot Nothing) AndAlso (_picField.Image IsNot Nothing)))- btnExportIntensityFrame.Enabled = canExport AndAlso- (_lastFullIntensityFrame IsNot Nothing OrElse ((_picIntensity IsNot Nothing) AndAlso (_picIntensity.Image IsNot Nothing)))- End Sub-- Private Sub btnPauzeResume_Click(sender As Object, e As EventArgs) Handles btnPauzeResume.Click- If _runner Is Nothing OrElse _stopRequested Then Return-- If _paused Then- _paused = False- _simStatus = _progressText- ToolStripStatusLabel1.Text = "Simulation running..."- _runner.ResumeRun()- ' back to the Preview tab, so the user follows the simulation again- tabMainFunctions.SelectedTab = tabViewer- Else- _paused = True- _simStatus = "paused - " & _progressText- ToolStripStatusLabel1.Text = "Simulation paused (press Resume to continue, or Stop to finish and save the videos)"- _runner.PauseRun()- End If- UpdateRunButtons()- UpdateTitle()- End Sub-- ' ---- grpNavigateTabs (Preview tab): jump straight to another tab-- Private Sub btnGotoConfiguration_Click(sender As Object, e As EventArgs) Handles btnGotoConfiguration.Click- tabMainFunctions.SelectedTab = tabConfiguration- End Sub-- Private Sub btnGotoSources_Click(sender As Object, e As EventArgs) Handles btnGotoSources.Click- tabMainFunctions.SelectedTab = tabSourceList- End Sub-- Private Sub btnGotoProbes_Click(sender As Object, e As EventArgs) Handles btnGotoProbes.Click- tabMainFunctions.SelectedTab = tabProbeList- End Sub-- Private Sub btnGotoPreview_Click(sender As Object, e As EventArgs) Handles btnGotoPreview.Click- tabMainFunctions.SelectedTab = tabViewer- End Sub-- ''' <summary>- ''' Stops the run after the current step. The runner then closes the videos properly and reports that it is- ''' finished, which switches on the buttons that open the videos.- ''' </summary>- Private Sub RequestStop()- If _runner Is Nothing OrElse _stopRequested Then Return-- _stopRequested = True- _paused = False- _runner.Cancel()- btnStartSimulation.Enabled = False- btnStartSimulation.Text = "Stopping..."- _simStatus = "stopping..."- ToolStripStatusLabel1.Text = "Stopping the simulation and closing the video files..."- UpdateRunButtons()- UpdateTitle()- End Sub-- ''' <summary>- ''' The pause button on the Preview tab is only on while a simulation runs. btnStartSimulation is also the- ''' stop/restart button (see its own Click handler) and keeps its own Text/Enabled state (RequestStop,- ''' StartSimulation, OnSimulationFinished) - there used to be a separate btnStopSimulation for that, removed- ''' as redundant once btnStartSimulation started doing double duty.- ''' </summary>- Private Sub UpdateRunButtons()- Dim running As Boolean = (_runner IsNot Nothing) AndAlso Not _stopRequested- ' Not actually disabling the button here: with its custom Azure BackColor, Windows' own disabled-button- ' rendering draws the text with a strange two-tone (etched) effect instead of plain gray. So the button- ' stays enabled and its color is set by hand instead - btnPauzeResume_Click already ignores clicks while- ' no simulation is running, so behaviorally it is still "disabled".- btnPauzeResume.ForeColor = If(running, SystemColors.ControlText, Color.Gray)- btnPauzeResume.Text = If(_paused, "Resume simulation", "Pause simulation")- UpdateExportButtons()- End Sub-- Private Sub ShowSimulationProblem(message As String)- MessageBox.Show(Me, message, "Start simulation", MessageBoxButtons.OK, MessageBoxIcon.Information)- End Sub-- ''' <summary>- ''' Takes the values from the controls, so the run always uses what is on the screen (also a value that was- ''' typed in but not confirmed yet is used).- ''' </summary>- Private Sub ReadSimulationControls()- numVisualizeEvery.Validate()- numFieldScaling.Validate()- numIntensityScaling.Validate()- numFieldScaling2.Validate()- numIntensityScaling2.Validate()- numOffsetField.Validate()- numOffsetIntensity.Validate()- numQuality.Validate()- numScaleImageSource.Validate()- numTimeDecayFactor.Validate()-- _simulation.VisualizeEvery = CInt(numVisualizeEvery.Value)- _simulation.FieldBrightness = CDbl(numFieldScaling.Value)- _simulation.IntensityBrightness = CDbl(numIntensityScaling.Value)- _simulation.FieldBlackLevel = CDbl(numOffsetField.Value)- _simulation.IntensityBlackLevel = CDbl(numOffsetIntensity.Value)- _simulation.VideoQuality = CInt(numQuality.Value)- _simulation.TimeDecayFactor = CDbl(numTimeDecayFactor.Value)- _simulation.ExportField = chkExportVideoField.Checked- _simulation.ExportIntensity = chkExportVideoIntensity.Checked- _simulation.PreviewField = chkPreviewVideoField.Checked- _simulation.PreviewIntensity = chkPreviewVideoIntensity.Checked- _simulation.UseGpu = chkUseGPU.Checked- _simulation.Use4thOrderLaplacian = chkUse4thOrderLaplacian.Checked- _scene.ImageSourceScale = CDbl(numScaleImageSource.Value)- End Sub-- ''' <summary>Checks the settings, builds the job and starts the runner.</summary>- Private Sub StartSimulation()- ReadSimulationControls()- Dim settings As SimulationSettings = _simulation- Dim needField As Boolean = settings.ExportField OrElse settings.PreviewField- Dim needIntensity As Boolean = settings.ExportIntensity OrElse settings.PreviewIntensity- Dim export As Boolean = settings.ExportField OrElse settings.ExportIntensity- Dim preview As Boolean = settings.PreviewField OrElse settings.PreviewIntensity-- If Not (needField OrElse needIntensity) Then- ShowSimulationProblem("Nothing to do: tick at least one of the export or preview options.")- Return- End If-- ' numSimulationSteps (a NumericUpDown) never holds an out-of-range or non-integer value, so unlike the old- ' cmbSimulationSteps combo box this needs no parsing/validation here- settings.Steps = CInt(numSimulationSteps.Value)-- ' the videos are written in the output folder of the project, so the project has to exist on disk- If export AndAlso _project Is Nothing Then- Dim answer As DialogResult = MessageBox.Show(Me,- "The videos are saved in the output folder of the project, so the project must be saved first." & vbCrLf & vbCrLf &- "Save the project now?", "Start simulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question)- If answer <> DialogResult.Yes Then Return- If Not SaveProject() Then Return- settings = _simulation- End If-- ' the canvas- Dim canvas As Size = EffectiveCanvas()- If canvas.Width <= 0 Then- ShowSimulationProblem("There is no scene yet: load a scene image in the Scene properties, or define a canvas size.")- Return- End If-- Dim damping As Integer = 0- If _scene.DampingEdgeEnabled Then- Dim problem As String = DampingProblem(txtDampingEdgeSize.Text, damping)- If problem.Length > 0 Then- ShowSimulationProblem("The damping edge cannot be used: " & problem)- txtDampingEdgeSize.Focus()- Return- End If- End If-- ' without any source (image or object) nothing happens- Dim useSources As Boolean = _scene.UseSources- Dim hasImageSources As Boolean = _scene.UseImage AndAlso useSources AndAlso SceneData.CountSources(_sceneImage) > 0- Dim hasObjectSources As Boolean = _scene.UseObjectSources AndAlso _sources.Count > 0- Dim noSources As String = ""- If Not hasImageSources AndAlso Not hasObjectSources Then- Dim reasons As New List(Of String)()- If _scene.UseImage Then- If Not useSources Then- reasons.Add("image sources are switched off in the Scene properties")- ElseIf SceneData.CountSources(_sceneImage) = 0 Then- reasons.Add("the scene image has no sources (no pixels with a green value above 0)")- End If- End If- If Not _scene.UseObjectSources Then- reasons.Add("object sources are switched off in the Scene properties")- ElseIf _sources.Count = 0 Then- reasons.Add("there are no object sources yet (add one on the Sources tab)")- End If- noSources = "This scene has no sources yet: " & String.Join("; ", reasons) & ". The field will stay empty."- End If- If noSources.Length > 0 Then- Dim answer As DialogResult = MessageBox.Show(Me, noSources & vbCrLf & vbCrLf & "Run the simulation anyway?",- "Start simulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)- If answer <> DialogResult.Yes Then Return- End If-- ' color tables- Dim fieldLut As Integer() = Nothing- Dim intensityLut As Integer() = Nothing- If needField Then- Dim scheme As ColorScheme = FindScheme(settings.FieldColorScheme, ColorScheme.SchemeTypeField)- If scheme Is Nothing Then- ShowSimulationProblem("Choose a color scheme for the field first.")- cmbFieldColorScheme.Focus()- Return- End If- fieldLut = ColorLut.Build(scheme, False, settings.FieldBlackLevel).Argb- End If- If needIntensity Then- Dim scheme As ColorScheme = FindScheme(settings.IntensityColorScheme, ColorScheme.SchemeTypeIntensity)- If scheme Is Nothing Then- ShowSimulationProblem("Choose a color scheme for the intensity first.")- cmbIntensityColorScheme.Focus()- Return- End If- intensityLut = ColorLut.Build(scheme, False, settings.IntensityBlackLevel).Argb- End If-- ' the job: the runner works on copies, so the settings can be edited while it runs- Dim job As New SimulationJob()- If _scene.UseImage Then- job.Image = New Bitmap(_sceneImage)- Else- job.Width = canvas.Width- job.Height = canvas.Height- job.BackgroundRefractiveIndex = _scene.BackgroundRefractiveIndex- End If- job.UseSources = useSources- job.SourceAmplitude = _scene.ImageSourceScale- job.DampingEdge = damping- job.Settings = settings.Clone()- job.FieldLut = fieldLut- job.IntensityLut = intensityLut- _lastFieldLut = fieldLut- _lastIntensityLut = intensityLut- job.PreviewWidth = Math.Max(16, Math.Min(pnlPreviewField.ClientSize.Width, pnlPreviewIntensity.ClientSize.Width))- job.PreviewHeight = Math.Max(16, Math.Min(pnlPreviewField.ClientSize.Height, pnlPreviewIntensity.ClientSize.Height))- job.Probes = ProbesForRun()- job.ObjectSources = SourcesForRun()-- ' the glow-edges overlay (Viewer tab) is only ever needed by the runner to bake into an exported video -- ' the live preview blends its own copy in locally (ShowPreview/ComposeGlowOverlay), which can track the- ' checkbox/brightness box live while this, like Settings, is frozen at the start of the run- job.FieldOverlayGain = FieldOverlayGain()- job.IntensityOverlayGain = IntensityOverlayGain()- If export AndAlso _glowEdgesImage IsNot Nothing AndAlso (job.FieldOverlayGain > 0.0 OrElse job.IntensityOverlayGain > 0.0) Then- job.GlowOverlay = New Bitmap(_glowEdgesImage)- End If-- If export Then- Try- Directory.CreateDirectory(_project.OutputVideoFolder)- Catch ex As Exception- If job.Image IsNot Nothing Then job.Image.Dispose()- If job.GlowOverlay IsNot Nothing Then job.GlowOverlay.Dispose()- ShowSimulationProblem("The output folder could not be created:" & vbCrLf & _project.OutputVideoFolder & vbCrLf & vbCrLf & ex.Message)- Return- End Try- Dim suffix As String = NextNumericSuffix(_project.OutputVideoFolder).ToString("D4", CultureInfo.InvariantCulture)- If settings.ExportField Then- job.FieldVideoPath = Path.Combine(_project.OutputVideoFolder, _project.Name & "_field_" & suffix & ".mp4")- End If- If settings.ExportIntensity Then- job.IntensityVideoPath = Path.Combine(_project.OutputVideoFolder, _project.Name & "_intensity_" & suffix & ".mp4")- End If- End If-- ' go- ClearPreviews()- BeginProbeRun(job.Probes, canvas, settings.Steps)- _fieldVideoFile = ""- _intensityVideoFile = ""- UpdateVideoButtons()- _runInfo = "Field: brightness " & settings.FieldBrightness.ToString("0.0#", CultureInfo.CurrentCulture) &- ", offset " & settings.FieldBlackLevel.ToString("0.0#", CultureInfo.CurrentCulture) &- vbCrLf & "Intensity: brightness " & settings.IntensityBrightness.ToString("0.0#", CultureInfo.CurrentCulture) &- ", offset " & settings.IntensityBlackLevel.ToString("0.0#", CultureInfo.CurrentCulture) &- vbCrLf & "Image source scale: " & _scene.ImageSourceScale.ToString("0.0#", CultureInfo.CurrentCulture)- If preview Then tabMainFunctions.SelectedTab = tabViewer-- Dim runner As New SimulationRunner(job)- AddHandler runner.ProgressChanged, Sub(done As Integer, total As Integer) PostToUi(Sub() ShowProgress(runner, done, total))- AddHandler runner.EngineReady, Sub(description As String, note As String) PostToUi(Sub() ShowEngine(runner, description, note))- AddHandler runner.ProbesUpdated, Sub(update As ProbeUpdate) PostToUi(Sub() ShowProbeSamples(runner, update))- AddHandler runner.PreviewReady, Sub(isField As Boolean, frame As Bitmap) PostToUi(Sub() ShowPreview(runner, isField, frame))- AddHandler runner.Finished, Sub(result As SimulationResult) PostToUi(Sub() OnSimulationFinished(runner, result))-- _runner = runner- btnStartSimulation.Text = "Stop Simulation"- _simStatus = "starting..."- _progressText = "starting..."- _paused = False- _stopRequested = False- UpdateRunButtons()- ToolStripStatusLabel1.Text = "Simulation running..."- ToolStripStatusLabel1.ToolTipText = ""- UpdateTitle()- runner.Start()- End Sub-- ' ---- messages from the runner (they arrive on the worker thread)-- Private Sub PostToUi(work As Action)- If IsDisposed OrElse Not IsHandleCreated Then Return- Try- BeginInvoke(work)- Catch ex As InvalidOperationException- ' the window is gone (this includes ObjectDisposedException)- End Try- End Sub-- Private Sub ShowProgress(runner As SimulationRunner, done As Integer, total As Integer)- If runner IsNot _runner OrElse _simStatus = "stopping..." Then Return- _lastStepsDone = done- Dim percent As Integer = CInt(100L * done \ Math.Max(1, total))- _progressText = "step " & done.ToString("N0", CultureInfo.CurrentCulture) & " of " & total.ToString("N0", CultureInfo.CurrentCulture) &- " (" & percent.ToString(CultureInfo.InvariantCulture) & "%)"- _simStatus = If(_paused, "paused - ", "") & _progressText- UpdateTitle()- End Sub-- ''' <summary>Tells in the status bar where the simulation runs (CPU or GPU), and why the GPU is not used if it was asked for.</summary>- Private Sub ShowEngine(runner As SimulationRunner, description As String, note As String)- If runner IsNot _runner OrElse IsDisposed Then Return- Dim text As String = "Simulation running on " & description- If note.Length > 0 Then text &= " - " & note- ToolStripStatusLabel1.Text = text- ToolStripStatusLabel1.ToolTipText = text- End Sub-- Private Sub ShowPreview(runner As SimulationRunner, isField As Boolean, frame As Bitmap)- If runner IsNot _runner OrElse IsDisposed Then- frame.Dispose()- runner.PreviewShown()- Return- End If-- Dim box As PictureBox = If(isField, _picField, _picIntensity)- Dim gain As Double = If(isField, FieldOverlayGain(), IntensityOverlayGain())- SetPreviewFrame(box, frame, gain)- UpdateCopyButtons()- runner.PreviewShown()- End Sub-- Private Sub OnSimulationFinished(runner As SimulationRunner, result As SimulationResult)- If runner IsNot _runner OrElse IsDisposed Then Return-- _runner = Nothing- _hasRun = True- _paused = False- _stopRequested = False- _lastStepsDone = result.StepsDone- UpdateRunButtons()- _simStatus = ""- btnStartSimulation.Text = "Start Simulation"- btnStartSimulation.Enabled = True- UpdateTitle()-- _fieldVideoFile = result.FieldFile- _intensityVideoFile = result.IntensityFile- UpdateVideoButtons()-- ' a full-resolution snapshot of the last frame, for a still export once nothing is running any more- Dim oldField As Bitmap = _lastFullFieldFrame- _lastFullFieldFrame = result.LastFieldFrame- If oldField IsNot Nothing Then oldField.Dispose()- Dim oldIntensity As Bitmap = _lastFullIntensityFrame- _lastFullIntensityFrame = result.LastIntensityFrame- If oldIntensity IsNot Nothing Then oldIntensity.Dispose()- UpdateExportButtons()-- Dim time As String = result.Elapsed.ToString("hh\:mm\:ss", CultureInfo.InvariantCulture)- Dim files As String = ""- If result.Files.Count > 0 Then- files = vbCrLf & vbCrLf & "Videos (in " & Path.GetDirectoryName(result.Files(0)) & "):"- For Each videoFile As String In result.Files- files &= vbCrLf & Path.GetFileName(videoFile)- Next- End If- If result.Status <> SimulationStatus.Failed AndAlso result.Message.Length > 0 Then- files &= vbCrLf & vbCrLf & result.Message- End If- If result.Engine.Length > 0 Then- files &= vbCrLf & vbCrLf & "Engine: " & result.Engine- If result.EngineNote.Length > 0 Then files &= vbCrLf & result.EngineNote- End If- files &= vbCrLf & vbCrLf & _runInfo- Dim stepsText As String = result.StepsDone.ToString("N0", CultureInfo.CurrentCulture)-- ' the summary goes in the status bar (the details in its tooltip); only a failure gets a message box- Dim summary As String- Select Case result.Status- Case SimulationStatus.Completed- summary = "Simulation completed: " & stepsText & " steps in " & time- Case SimulationStatus.Cancelled- summary = "Simulation stopped after " & stepsText & " steps (" & time & ")"- Case Else- summary = "Simulation failed after " & stepsText & " steps"- End Select- If result.Elapsed.TotalSeconds > 0.5 AndAlso result.StepsDone > 0 Then- summary &= " - " & (result.StepsDone / result.Elapsed.TotalSeconds).ToString("0.0", CultureInfo.CurrentCulture) & " steps/s"- End If- If result.Engine.Length > 0 Then- summary &= " - " & result.Engine- If result.EngineNote.Length > 0 Then summary &= " (" & result.EngineNote & ")"- End If- If result.Files.Count > 0 Then- Dim names As New List(Of String)()- For Each videoFile As String In result.Files- names.Add(Path.GetFileName(videoFile))- Next- summary &= " - video: " & String.Join(", ", names)- End If- If result.Status <> SimulationStatus.Failed AndAlso result.Message.Length > 0 Then- summary &= " - MP4 (H.264) was not available, the videos are .avi files"- End If-- ToolStripStatusLabel1.Text = summary- ToolStripStatusLabel1.ToolTipText = summary & files-- If result.Status = SimulationStatus.Failed Then- MessageBox.Show(Me, "The simulation failed after " & stepsText & " steps:" & vbCrLf & vbCrLf & result.Message & files,- "Simulation", MessageBoxButtons.OK, MessageBoxIcon.Warning)- End If- End Sub-- ' ---- the videos of the last run-- ''' <summary>The buttons under the previews are on when the video of the last run exists.</summary>- Private Sub UpdateVideoButtons()- btnViewFieldVideo.Enabled = _fieldVideoFile.Length > 0 AndAlso File.Exists(_fieldVideoFile)- btnViewIntensityVideo.Enabled = _intensityVideoFile.Length > 0 AndAlso File.Exists(_intensityVideoFile)- End Sub-- Private Sub btnViewFieldVideo_Click(sender As Object, e As EventArgs) Handles btnViewFieldVideo.Click- OpenVideo(_fieldVideoFile)- End Sub-- Private Sub btnViewIntensityVideo_Click(sender As Object, e As EventArgs) Handles btnViewIntensityVideo.Click- OpenVideo(_intensityVideoFile)- End Sub-- ''' <summary>Opens a video with the program that Windows uses for this kind of file.</summary>- Private Sub OpenVideo(videoFile As String)- If videoFile.Length = 0 OrElse Not File.Exists(videoFile) Then- MessageBox.Show(Me, "The video file does not exist (any more):" & vbCrLf & videoFile, "Video",- MessageBoxButtons.OK, MessageBoxIcon.Information)- UpdateVideoButtons()- Return- End If- Try- Dim info As New ProcessStartInfo(videoFile)- info.UseShellExecute = True- Process.Start(info)- Catch ex As Exception- MessageBox.Show(Me, "The video could not be opened:" & vbCrLf & vbCrLf & ex.Message, "Video",- MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Try- End Sub-- Private Sub btnOpenVideoFolder_Click(sender As Object, e As EventArgs) Handles btnOpenVideoFolder.Click- OpenVideoFolder()- End Sub-- Private Sub btnOpenImageFolder_Click(sender As Object, e As EventArgs) Handles btnOpenImageFolder.Click- OpenFramesFolder()- End Sub-- ' ---- exporting a single still frame (Preview tab)-- Private Sub btnExportFieldFrame_Click(sender As Object, e As EventArgs) Handles btnExportFieldFrame.Click- ExportFrame(True)- End Sub-- Private Sub btnExportIntensityFrame_Click(sender As Object, e As EventArgs) Handles btnExportIntensityFrame.Click- ExportFrame(False)- End Sub-- ''' <summary>- ''' Saves the current Field or Intensity picture, at full simulation resolution, as a PNG in the project's- ''' output frames folder. Only enabled (see UpdateExportButtons) while nothing is actively running: while- ''' paused, a fresh frame is rendered straight from the live, paused engine (full resolution - not the- ''' downscaled picture the preview shows); once the run has fully stopped, the last full-resolution frame it- ''' produced just before closing is used instead (_lastFullFieldFrame/_lastFullIntensityFrame), since the- ''' engine itself no longer exists by then.- ''' </summary>- Private Sub ExportFrame(isField As Boolean)- Dim frame As Bitmap = Nothing- Dim disposeFrame As Boolean = False-- If _runner IsNot Nothing AndAlso _paused Then- Dim lut As Integer() = If(isField, _lastFieldLut, _lastIntensityLut)- Dim brightness As Single = CSng(If(isField, _simulation.FieldBrightness, _simulation.IntensityBrightness))- frame = _runner.RenderCurrentFrame(isField, lut, brightness)- disposeFrame = True- End If-- If frame Is Nothing Then frame = If(isField, _lastFullFieldFrame, _lastFullIntensityFrame)-- If frame Is Nothing Then- MessageBox.Show(Me, "There is no picture to export yet.", "Export frame", MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If-- Try- Directory.CreateDirectory(_project.OutputFramesFolder)- Catch ex As Exception- If disposeFrame Then frame.Dispose()- MessageBox.Show(Me, "The output folder could not be created:" & vbCrLf & _project.OutputFramesFolder & vbCrLf & vbCrLf & ex.Message,- "Export frame", MessageBoxButtons.OK, MessageBoxIcon.Warning)- Return- End Try-- Dim kind As String = If(isField, "field", "intensity")- Dim gain As Double = If(isField, FieldOverlayGain(), IntensityOverlayGain())- Dim toSave As Bitmap = frame- Dim disposeToSave As Boolean = False- If gain > 0.0 AndAlso _glowEdgesImage IsNot Nothing Then- toSave = ComposeGlowOverlay(frame, gain)- disposeToSave = True- End If-- Dim suffix As String = NextNumericSuffix(_project.OutputFramesFolder).ToString("D4", CultureInfo.InvariantCulture)- Dim fileName As String = _project.Name & "_" & kind & "_frame" & _lastStepsDone.ToString(CultureInfo.InvariantCulture) & "_" & suffix & ".png"- Dim fullPath As String = Path.Combine(_project.OutputFramesFolder, fileName)-- Try- toSave.Save(fullPath, System.Drawing.Imaging.ImageFormat.Png)- ToolStripStatusLabel1.Text = "Frame exported: " & fileName- Catch ex As Exception- MessageBox.Show(Me, "The frame could not be saved:" & vbCrLf & vbCrLf & ex.Message, "Export frame", MessageBoxButtons.OK, MessageBoxIcon.Warning)- Finally- If disposeToSave Then toSave.Dispose()- If disposeFrame Then frame.Dispose()- End Try- End Sub-- ''' <summary>Next available 4-digit numeric filename suffix for a file saved into folder: the highest existing- ''' file in folder whose name (before the extension) ends in exactly 4 digits, plus 1 - starts at 1 when there- ''' is no such file yet. Used for exported frames (ExportFrame) and videos (RunSimulation) instead of the- ''' previous date/time stamp, which was found to make file names too long. Formats with "D4" (e.g. "0001"),- ''' growing past 4 digits rather than wrapping once the count passes 9999.</summary>- Private Function NextNumericSuffix(folder As String) As Integer- Dim best As Integer = 0- If Directory.Exists(folder) Then- For Each f As String In Directory.GetFiles(folder)- Dim nameOnly As String = Path.GetFileNameWithoutExtension(f)- If nameOnly.Length >= 4 Then- Dim tail As String = nameOnly.Substring(nameOnly.Length - 4)- Dim n As Integer- If Integer.TryParse(tail, NumberStyles.None, CultureInfo.InvariantCulture, n) Then- If n > best Then best = n- End If- End If- Next- End If- Return best + 1- End Function-- ''' <summary>- ''' Opens the project's video output folder in Windows Explorer - which already shows video thumbnails and lets- ''' the files be renamed or deleted there, so there is no need to build a picker of our own for that. Opened in- ''' "Details" view (see OpenFolderInExplorer) - more useful than thumbnails for a folder of video files.- ''' </summary>- Private Sub OpenVideoFolder()- Dim folder As String = If(_project Is Nothing, "", _project.OutputVideoFolder)- If folder.Length = 0 Then- MessageBox.Show(Me, "There is no project open yet.", "Open video folder", MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- Try- ' so the folder can be opened even before any video has been exported- OpenFolderInExplorer(folder, FVM_DETAILS)- Catch ex As Exception- MessageBox.Show(Me, "The video folder could not be opened:" & vbCrLf & vbCrLf & ex.Message, "Open video folder",- MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Try- End Sub-- ''' <summary>Opens the project's output frames folder (btnOpenImageFolder on the Preview tab) in Windows- ''' Explorer, the same way OpenVideoFolder does for the video folder - but in "Large icons" view (see- ''' OpenFolderInExplorer), which shows thumbnails of the exported images.</summary>- Private Sub OpenFramesFolder()- Dim folder As String = If(_project Is Nothing, "", _project.OutputFramesFolder)- If folder.Length = 0 Then- MessageBox.Show(Me, "There is no project open yet.", "Open image folder", MessageBoxButtons.OK, MessageBoxIcon.Information)- Return- End If- Try- ' so the folder can be opened even before any frame has been exported- OpenFolderInExplorer(folder, FVM_ICON)- Catch ex As Exception- MessageBox.Show(Me, "The image folder could not be opened:" & vbCrLf & vbCrLf & ex.Message, "Open image folder",- MessageBoxButtons.OK, MessageBoxIcon.Warning)- End Try- End Sub-- ' Windows Explorer's own view-mode numbers (the classic Shell "FOLDERVIEWMODE" enum), used below.- Private Const FVM_ICON As Integer = 1 ' "Large icons"- Private Const FVM_DETAILS As Integer = 4 ' "Details"-- ''' <summary>- ''' Opens a folder in Windows Explorer and tries to make that window use the given view mode (one of the- ''' FVM_ constants above). Explorer has no command-line switch for this, so the folder is opened as before- ''' (explorer.exe on the path) and then, best-effort, the "Shell.Application" COM automation object is used- ''' to find the newly opened window for that exact folder and set its Document.CurrentViewMode. This uses late- ''' binding via reflection rather than a direct COM reference, since Option Strict is on here and adding a COM- ''' reference to the project for this alone is more trouble than it is worth.- '''- ''' This is not fully reliable: if a window for the folder is already open, Explorer reuses it instead of- ''' opening a new one (so its view stays whatever it already was), and Explorer separately remembers, per- ''' folder, whatever view the user leaves it in afterwards - so this only really matters the first time (or- ''' after Explorer has forgotten it). Either way the folder itself always opens; only the requested view can- ''' silently fail to apply, which is why every failure here is swallowed rather than shown to the user.- ''' </summary>- Private Sub OpenFolderInExplorer(folder As String, viewMode As Integer)- Directory.CreateDirectory(folder)- Dim info As New ProcessStartInfo("explorer.exe", """" & folder & """")- info.UseShellExecute = True- Process.Start(info)-- Try- SetExplorerWindowViewMode(folder, viewMode)- Catch- ' best effort only - the folder is already open regardless of whether this succeeds- End Try- End Sub-- Private Sub SetExplorerWindowViewMode(folder As String, viewMode As Integer)- Dim targetPath As String = Path.GetFullPath(folder).TrimEnd(Path.DirectorySeparatorChar)- Dim shellType As Type = Type.GetTypeFromProgID("Shell.Application")- If shellType Is Nothing Then Return- Dim shell As Object = Activator.CreateInstance(shellType)-- Try- Const memberFlags As Reflection.BindingFlags = Reflection.BindingFlags.InvokeMethod Or Reflection.BindingFlags.GetProperty-- ' give the freshly launched Explorer window a moment to appear- For attempt As Integer = 1 To 8- Dim windows As Object = shellType.InvokeMember("Windows", memberFlags, Nothing, shell, Nothing)- Dim windowsType As Type = windows.GetType()- Dim count As Integer = CInt(windowsType.InvokeMember("Count", memberFlags, Nothing, windows, Nothing))-- For i As Integer = 0 To count - 1- Dim win As Object = windowsType.InvokeMember("Item", memberFlags, Nothing, windows, New Object() {i})- If win Is Nothing Then Continue For- Dim winType As Type = win.GetType()-- Dim locationUrl As String = TryCast(winType.InvokeMember("LocationURL", memberFlags, Nothing, win, Nothing), String)- If String.IsNullOrEmpty(locationUrl) Then Continue For-- Dim winPath As String- Try- winPath = New Uri(locationUrl).LocalPath.TrimEnd(Path.DirectorySeparatorChar)- Catch- Continue For- End Try-- If String.Equals(winPath, targetPath, StringComparison.OrdinalIgnoreCase) Then- Dim doc As Object = winType.InvokeMember("Document", memberFlags, Nothing, win, Nothing)- If doc IsNot Nothing Then- doc.GetType().InvokeMember("CurrentViewMode", Reflection.BindingFlags.SetProperty, Nothing, doc, New Object() {viewMode})- End If- Return- End If- Next-- Threading.Thread.Sleep(120)- Next- Finally- Runtime.InteropServices.Marshal.ReleaseComObject(shell)- End Try- End Sub-- ''' <summary>Removes the pictures from the Preview tab and frees them (including the raw frame kept in- ''' box.Tag by SetPreviewFrame, when it is a different bitmap from what box.Image itself was showing).</summary>- Private Sub ClearPreviews()- For Each box As PictureBox In New PictureBox() {_picField, _picIntensity}- If box Is Nothing Then Continue For- Dim oldImage As Image = box.Image- Dim oldRaw As Bitmap = TryCast(box.Tag, Bitmap)- box.Image = Nothing- box.Tag = Nothing- If oldImage IsNot Nothing AndAlso Not Object.ReferenceEquals(oldImage, oldRaw) Then oldImage.Dispose()- If oldRaw IsNot Nothing Then oldRaw.Dispose()- Next-- ' a new run is starting - the cached last-frame snapshots are from the previous run, so drop them- If _lastFullFieldFrame IsNot Nothing Then _lastFullFieldFrame.Dispose()- _lastFullFieldFrame = Nothing- If _lastFullIntensityFrame IsNot Nothing Then _lastFullIntensityFrame.Dispose()- _lastFullIntensityFrame = Nothing-- UpdateCopyButtons()- End Sub-- ' grpProbe1_Enter/grpProbe2_Enter and Label21/Label22 Click are unused Designer-generated stubs (harmless, left- ' empty). The Pick button, the Sources combo boxes and Button1 (the Probes tab's "Import scene image", still- ' under its Designer default name) are wired in Form1.Source.vb/Form1.Probes.vb instead, where the rest of- ' those tabs lives.- Private Sub grpProbe1_Enter(sender As Object, e As EventArgs) Handles grpProbe1.Enter, grpProbe2.Enter- End Sub-- Private Sub Label21_Click(sender As Object, e As EventArgs) Handles Label21.Click, Label22.Click- End Sub-- Private Sub lblVideoQuality_Click(sender As Object, e As EventArgs) Handles lblVideoQuality.Click-- End Sub-- Private Sub btnSaveConfiguration2_Click(sender As Object, e As EventArgs) Handles btnSaveConfiguration2.Click- SaveProject()- End Sub-End Classdiff --git a/2D_wave_sim_V01/HelpForm.Designer.vb b/2D_wave_sim_V01/HelpForm.Designer.vbdeleted file mode 100644index dad42e1..0000000--- a/2D_wave_sim_V01/HelpForm.Designer.vb+++ /dev/null@@ -1,89 +0,0 @@-<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _-Partial Class HelpForm- Inherits System.Windows.Forms.Form-- 'Form overrides dispose to clean up the component list.- <System.Diagnostics.DebuggerNonUserCode()> _- Protected Overrides Sub Dispose(ByVal disposing As Boolean)- Try- If disposing AndAlso components IsNot Nothing Then- components.Dispose()- End If- Finally- MyBase.Dispose(disposing)- End Try- End Sub-- 'Required by the Windows Form Designer- Private components As System.ComponentModel.IContainer-- 'NOTE: The following procedure is required by the Windows Form Designer- 'It can be modified using the Windows Form Designer.- 'Do not modify it using the code editor.- <System.Diagnostics.DebuggerStepThrough()> _- Private Sub InitializeComponent()- Me.rtbHelp = New System.Windows.Forms.RichTextBox()- Me.pnlButtons = New System.Windows.Forms.FlowLayoutPanel()- Me.btnClose = New System.Windows.Forms.Button()- Me.pnlButtons.SuspendLayout()- Me.SuspendLayout()- '- 'rtbHelp- '- Me.rtbHelp.BackColor = System.Drawing.SystemColors.Window- Me.rtbHelp.BorderStyle = System.Windows.Forms.BorderStyle.None- Me.rtbHelp.Dock = System.Windows.Forms.DockStyle.Fill- Me.rtbHelp.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.rtbHelp.Location = New System.Drawing.Point(0, 0)- Me.rtbHelp.Margin = New System.Windows.Forms.Padding(12)- Me.rtbHelp.Name = "rtbHelp"- Me.rtbHelp.ReadOnly = True- Me.rtbHelp.Size = New System.Drawing.Size(1039, 843)- Me.rtbHelp.TabIndex = 0- Me.rtbHelp.Text = ""- '- 'pnlButtons- '- Me.pnlButtons.Controls.Add(Me.btnClose)- Me.pnlButtons.Dock = System.Windows.Forms.DockStyle.Bottom- Me.pnlButtons.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft- Me.pnlButtons.Location = New System.Drawing.Point(0, 843)- Me.pnlButtons.Name = "pnlButtons"- Me.pnlButtons.Padding = New System.Windows.Forms.Padding(8)- Me.pnlButtons.Size = New System.Drawing.Size(1039, 46)- Me.pnlButtons.TabIndex = 1- '- 'btnClose- '- Me.btnClose.DialogResult = System.Windows.Forms.DialogResult.OK- Me.btnClose.Location = New System.Drawing.Point(930, 11)- Me.btnClose.Name = "btnClose"- Me.btnClose.Size = New System.Drawing.Size(90, 30)- Me.btnClose.TabIndex = 0- Me.btnClose.Text = "Close"- Me.btnClose.UseVisualStyleBackColor = True- '- 'HelpForm- '- Me.AcceptButton = Me.btnClose- Me.CancelButton = Me.btnClose- Me.ClientSize = New System.Drawing.Size(1039, 889)- Me.Controls.Add(Me.rtbHelp)- Me.Controls.Add(Me.pnlButtons)- Me.MinimizeBox = False- Me.MinimumSize = New System.Drawing.Size(560, 400)- Me.Name = "HelpForm"- Me.ShowIcon = False- Me.ShowInTaskbar = False- Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent- Me.Text = "Help - Wave Maker 2D"- Me.pnlButtons.ResumeLayout(False)- Me.ResumeLayout(False)-- End Sub-- Friend WithEvents rtbHelp As System.Windows.Forms.RichTextBox- Friend WithEvents pnlButtons As System.Windows.Forms.FlowLayoutPanel- Friend WithEvents btnClose As System.Windows.Forms.Button--End Classdiff --git a/2D_wave_sim_V01/HelpForm.resx b/2D_wave_sim_V01/HelpForm.resxdeleted file mode 100644index 1af7de1..0000000--- a/2D_wave_sim_V01/HelpForm.resx+++ /dev/null@@ -1,120 +0,0 @@-<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />- <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" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </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" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>-</root>\ No newline at end of filediff --git a/2D_wave_sim_V01/HelpForm.vb b/2D_wave_sim_V01/HelpForm.vbdeleted file mode 100644index e9daee7..0000000--- a/2D_wave_sim_V01/HelpForm.vb+++ /dev/null@@ -1,194 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Drawing-Imports System.Windows.Forms--''' <summary>-''' The Info > Help window: a structured description of what each tab of tabMainFunctions does, which controls-''' on it matter most, and what those controls influence elsewhere in the program - plus a dedicated section on-''' the propagation speed c, since its correct value depends on both the Laplacian order and the source-''' frequency and is easy to get wrong. Designer-editable - the layout (rtbHelp, the Close button) lives in-''' HelpForm.Designer.vb; this file only fills rtbHelp's text, in FillHelpText below. Opened from Form1's-''' HelpToolStripMenuItem_Click.-''' </summary>-Public Class HelpForm-- Public Sub New()- InitializeComponent()- FillHelpText(rtbHelp)- rtbHelp.SelectionStart = 0- rtbHelp.SelectionLength = 0- End Sub-- ''' <summary>Writes the actual help text into rtb, one section per tab/topic, using AppendHeading/AppendBody/- ''' AppendBullet for simple formatting (bold headings, indented bullets).</summary>- Private Sub FillHelpText(rtb As RichTextBox)- AppendHeading(rtb, "Wave Dude 2D - Help")-- AppendHeading(rtb, "Disclaimer")- AppendBody(rtb,- "The current software comes with no warranty or support and is used at your own risk. " &- "It is free software, released under the GNU General Public License, version 3 or later: you may use, modify and redistribute it under the terms of that license (see the LICENSE file that comes with the source code). " &- "Bugs or suggestions for future improvements can be send to the email address in the 'Info > About' screen")-- AppendHeading(rtb, "Getting started: the project root")- AppendBody(rtb,- "Every project, its settings, scene, sources, probes and exported files, lives in its own " &- "subfolder under one chosen 'project root' folder. Set it with File > Choose project root, or the " &- "'Browse root' button on the Settings tab; the current root is shown above the tabs.")- AppendBody(rtb,- "The 'Projects in current root' list (Settings tab) shows every project found there: New project, " &- "Load, Rename, Delete and Save as all act on the selected one. File > New / Open / Save and " &- "'Save changes to project' act on whichever project is currently open. Nothing is written to disk " &- "until you save your project." &- "Projects can be shared between users by sharing the project folder and copy it to their root folder ")- AppendBody(rtb, "Load, Rename, Delete and Save as all act on the selected one. File > New / Open / Save and " &- "'Save changes to project' act on whichever project is currently open. Nothing is written to disk " &- "until you save.")---- AppendHeading(rtb, "Settings tab")- AppendBody(rtb, "The main control panel: engine and rendering settings, the medium/scene, and starting a run.")- AppendBullet(rtb, "Use GPU (generally faster)", "switches the simulation engine between CPU and GPU (OpenCL). Faster for larger grids or step counts, but needs a working OpenCL GPU; the CPU engine is the safe fallback.")- AppendBullet(rtb, "Use 4th order Laplacian + sub-sampling", "switches the numerical scheme used to step the wave equation each frame. It runs somewhat slower but strongly reduces numerical dispersion (see 'Propagation speed c' below) - and changes what c should be set to.")- AppendBullet(rtb, "Simulation steps / Visualize every", "how many steps a run performs, and how often (in steps) the live preview and probes are refreshed while it runs. A larger 'visualize every' makes a run finish faster at the cost of a choppier preview.")- AppendBullet(rtb, "Intensity decay factor", "how quickly the accumulated Intensity view forgets past field energy, i.e. how 'persistent' the intensity build-up looks.")- AppendBullet(rtb, "Field/Intensity color scheme, scale and offset", "which color table renders each view (see the Colors tab), and how the raw field/intensity values are stretched (scale) and shifted (offset) into that table's brightness range before coloring. The same scale controls also appear, linked, on the Preview tab.")- AppendBullet(rtb, "Preview video of / Export video of (Field/Intensity)", "which of the two views is shown live while running, and which is written to a video file when the run finishes - independent choices.")- AppendBullet(rtb, "Video quality (%)", "the compression quality used when writing exported video files.")- AppendBullet(rtb, "Refractive index / Damping edge (Scene properties)", "the refractive index shapes the medium the wave travels through (a higher index locally slows the wave - it is what actually sets the per-pixel propagation speed the simulation uses, not c; see below). Damping edge adds an absorbing border so waves leave the grid instead of reflecting off its edges.")- AppendBullet(rtb, "User defined (X/Y) scene vs. Scene image", "whether the medium's layout comes from a simple, hand-set shape or from an imported image (its brightness mapped to refractive index).")- AppendBullet(rtb, "Use object sources / Use image sources, Edit source list", "whether wave sources are the ones built on the Sources tab, or amplitude taken from an image; 'Edit source list' jumps to the Sources tab.")- AppendBody(rtb, "Found at the bottom of everly screen: Quick navigate (jump to Preview/Probes/Sources/Settings), Simulation control (Start " &- "Simulation / Pause-Resume), and Share with source/probe (send the current scene, field or " &- "intensity picture into the Sources or Probes tools as a background image).")-- AppendHeading(rtb, "About Scene Images")- AppendBody(rtb, "Currently, scene images can only be created externally in a program like for example Photoshop. Save the images in a lossless format like .png . To add objects to a scene that the waves can interact with, you can use the red and green channels in the image color palette.")- AppendBullet(rtb, "Red channel (Refractive index)", "can effectively use values ranging from 100 to 255, which represent refractive index values ranging from 1.00 to 2.55. Values lower than 100 will be set to 100 as a minimum. The red channel can be used to refract or reflect waves and create for example lenses.")- AppendBullet(rtb, "Blue channel (Damping)", "reserved for damping - use values between 0 and 255, where zero means no damping and 255 heavy damping. It can be used to create regions that absorb waves like for example borders.")- AppendBullet(rtb, "Green channel (Sources)", "reserved for creating wave sources, where the values 1-255 represent the frequency of the waves emitted by a pixel. If you use in-scene sources, do not use anti-aliasing to create them since this can cause the pixels next to a source to also contain a (lower) value in the green channel. When you want to use in-image sources, you must have 'use image sources' checked in the setup tab.")-- AppendHeading(rtb, "Sources tab")- AppendBody(rtb, "Defines every object-type wave source placed in the scene; what Is set here directly drives what the simulation emits. When using ")- AppendBullet(rtb, "Main type: Single vs. composite", "a single source is one emitter; a composite source is a whole array of them, laid out with a chosen spacing and array size - useful for e.g. simulating an extended or phased source.")- AppendBullet(rtb, "Mode: Continuous vs. Pulsed, Frequency, Amplitude, Phase", "a continuous source oscillates forever at the set frequency; a pulsed one also uses the pulse shape/width to taper on and off. Frequency (via the estimated wavelength label) is one of the two things that determine the right value for c - see below.")- AppendBullet(rtb, "Composite array: Spacing, Array size, Randomize (Phase/Position/Frequency/Off state)", "how densely and how far the individual emitters in a composite source are spread, and how much each one's properties should vary at random rather than being identical.")- AppendBullet(rtb, "Place current source / Pick / Copy / Delete / Save source data", "positions a source in the scene, duplicates or removes it, and can save its data separately; 'Detach after' stops further edits in this panel from affecting an already-placed source.")-- AppendHeading(rtb, "Probes tab")- AppendBody(rtb, "Two independent probes (Probe 1, Probe 2), each measuring the field or intensity over the course of a run and graphing it.")- AppendBullet(rtb, "Place on: Field / Intensity, Measurement / Probe type", "which picture the probe samples, and what it reports from it (e.g. a value at a point, or an integrated quantity over a box).")- AppendBullet(rtb, "Position A / Position B, Box size, Pick", "where the probe samples - a single point, or a box defined by two corners - set either numerically or by picking on the preview.")- AppendBullet(rtb, "Full scale vs. Running scale, Auto scale X / Y", "whether the probe's graph shows the whole run at once or only a recent 'running' window, and whether its axes rescale automatically as new data comes in.")- AppendBullet(rtb, "Start recording at step #", "delays when the probe starts collecting data, useful for skipping an initial transient before the wave pattern settles.")-- AppendHeading(rtb, "Preview tab")- AppendBody(rtb, "Shows the live Field and Intensity pictures while a simulation runs, and is where finished pictures/video are exported.")- AppendBullet(rtb, "Field/intensity scale factor", "the same brightness scale as on the Settings tab - the two are linked, so changing one updates the other.")- AppendBullet(rtb, "Display overlay, overlay brightness", "blends a 'glowing edges' outline (derived from the scene image) on top of either preview, purely as a visual aid to see the scene layout under the field/intensity. This overlay is also baked into an exported frame or video when it is switched on, not just shown live.")- AppendBullet(rtb, "Export video of (Field/Intensity), Export frame as image", "start a video export for the checked view(s) once a run starts, or immediately save the current picture as a PNG. Exported file names end in a plain running number (e.g. _0001) - one higher than the highest such number already in that output folder - rather than a date/time stamp.")- AppendBullet(rtb, "Open image/video folder, View video in media player", "quick access to what has already been exported for this project.")-- AppendHeading(rtb, "Manage output tab")- AppendBody(rtb,- "An overview of everything a project has produced: scenes, exported images and exported videos, " &- "each with its creation date. From here files can be renamed, deleted, previewed, opened in their " &- "folder, viewed in the media player, copied to the clipboard, or shared back into the Sources/" &- "Probes tabs as a background image; external scene files can also be loaded in.")-- AppendHeading(rtb, "Colors tab")- AppendBody(rtb, "Manages the color schemes used to render the Field and Intensity pictures everywhere else in the program.")- AppendBullet(rtb, "Scheme list", "every scheme found in the scheme folder, sortable by clicking the Scheme or Type column header; Type marks whether a scheme is meant for the Field or the Intensity view (the Settings/Preview tabs' color-scheme pickers use this).")- AppendBullet(rtb, "Color Scheme Editor: Color 1..9, color picker", "builds a 9-stop scheme by picking a color for each stop; Save, Save As, Rename and Delete act on the scheme currently being edited.")- AppendBullet(rtb, "Scheme folder, Choose...", "where schemes are read from and saved to; changing it reloads the list.")-- AppendHeading(rtb, "Propagation speed (c): the Laplacian order and source frequency")- AppendBody(rtb,- "c (File > Set c-value, in pixels per simulation step) is only a display/estimate value: it is used " &- "solely to compute the estimated wavelength shown next to a source's frequency on the Sources tab " &- "(lambda = c / frequency). The wave speed the simulation actually uses at each point comes from the " &- "scene's refractive index instead, and can vary from point to point - c does not change how the run " &- "itself behaves, only what that wavelength readout says.")- AppendBody(rtb,- "Getting that readout right, however, depends on both the Laplacian order and the source's " &- "frequency, because of numerical dispersion - the standard (3rd order) Laplacian makes longer " &- "wavelengths propagate faster through the grid than shorter ones, purely as a numerical artifact of " &- "the scheme, not a real physical effect.")- AppendBullet(rtb, "4th order Laplacian + sub-sampling (on)", "greatly reduces this dispersion. With it on, set c to 1.00 - the estimate then stays accurate across frequencies.")- AppendBullet(rtb, "Standard 3rd order Laplacian (4th order off)", "dispersion is significant, so the correct c depends strongly on frequency: lower frequencies need a higher c, higher frequencies need a lower c. For example, at a source frequency where the true wavelength is 15 pixels, c must be set to about 0.56 (not 1.00) for the readout to show that; leaving c at 1.00 there would read out roughly 9 pixels instead.")- AppendBody(rtb,- "In short: when 4th order is off, re-check (or reduce) c whenever the source frequency changes " &- "noticeably. The '(Info)' label next to the 4th order checkbox on the Settings tab repeats this " &- "explanation in the program itself.")-- AppendHeading(rtb, "Menu")- AppendBody(rtb,- "File: New, Open, Choose project root, Set c-value, Save, Exit." & vbCrLf &- "Info: this Help page, and About.")-- AppendBody(rtb,- "Enjoy! Jeroen " & vbCrLf)- End Sub-- Private Sub AppendHeading(rtb As RichTextBox, text As String)- rtb.SelectionStart = rtb.TextLength- rtb.SelectionLength = 0- rtb.SelectionFont = New Font(rtb.Font, FontStyle.Bold)- rtb.SelectionColor = Color.FromArgb(20, 20, 20)- rtb.AppendText(vbCrLf & text & vbCrLf)- End Sub-- Private Sub AppendBody(rtb As RichTextBox, text As String)- rtb.SelectionStart = rtb.TextLength- rtb.SelectionLength = 0- rtb.SelectionFont = New Font(rtb.Font, FontStyle.Regular)- rtb.SelectionColor = Color.Black- rtb.AppendText(text & vbCrLf)- End Sub-- ''' <summary>A single indented "- Label: explanation" line, label in bold, explanation regular - used for the- ''' per-control breakdowns within a tab's section.</summary>- Private Sub AppendBullet(rtb As RichTextBox, label As String, explanation As String)- rtb.SelectionStart = rtb.TextLength- rtb.SelectionLength = 0- rtb.SelectionFont = New Font(rtb.Font, FontStyle.Regular)- rtb.SelectionColor = Color.Black- rtb.AppendText(" - ")-- rtb.SelectionStart = rtb.TextLength- rtb.SelectionLength = 0- rtb.SelectionFont = New Font(rtb.Font, FontStyle.Bold)- rtb.AppendText(label & ": ")-- rtb.SelectionStart = rtb.TextLength- rtb.SelectionLength = 0- rtb.SelectionFont = New Font(rtb.Font, FontStyle.Regular)- rtb.AppendText(explanation & vbCrLf)- End Sub-- Private Sub HelpForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load-- End Sub-End Classdiff --git a/2D_wave_sim_V01/My Project/Application.Designer.vb b/2D_wave_sim_V01/My Project/Application.Designer.vbdeleted file mode 100644index 1b89485..0000000--- a/2D_wave_sim_V01/My Project/Application.Designer.vb+++ /dev/null@@ -1,38 +0,0 @@-'-------------------------------------------------------------------------------' <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>-'--------------------------------------------------------------------------------Option Strict On-Option Explicit On---Namespace My-- 'NOTE: This file is auto-generated; do not modify it directly. To make changes,- ' or if you encounter build errors in this file, go to the Project Designer- ' (go to Project Properties or double-click the My Project node in- ' Solution Explorer), and make changes on the Application tab.- '- Partial Friend Class MyApplication-- <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _- Public Sub New()- MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)- Me.IsSingleInstance = false- Me.EnableVisualStyles = true- Me.SaveMySettingsOnExit = true- Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses- End Sub-- <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _- Protected Overrides Sub OnCreateMainForm()- Me.MainForm = Global._2D_wave_sim_V01.Form1- End Sub- End Class-End Namespacediff --git a/2D_wave_sim_V01/My Project/Application.myapp b/2D_wave_sim_V01/My Project/Application.myappdeleted file mode 100644index 1243847..0000000--- a/2D_wave_sim_V01/My Project/Application.myapp+++ /dev/null@@ -1,11 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">- <MySubMain>true</MySubMain>- <MainForm>Form1</MainForm>- <SingleInstance>false</SingleInstance>- <ShutdownMode>0</ShutdownMode>- <EnableVisualStyles>true</EnableVisualStyles>- <AuthenticationMode>0</AuthenticationMode>- <ApplicationType>0</ApplicationType>- <SaveMySettingsOnExit>true</SaveMySettingsOnExit>-</MyApplicationData>diff --git a/2D_wave_sim_V01/My Project/AssemblyInfo.vb b/2D_wave_sim_V01/My Project/AssemblyInfo.vbdeleted file mode 100644index c733073..0000000--- a/2D_wave_sim_V01/My Project/AssemblyInfo.vb+++ /dev/null@@ -1,54 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Imports System-Imports System.Reflection-Imports System.Runtime.InteropServices--' 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.--' Review the values of the assembly attributes--<Assembly: AssemblyTitle("Wave_Dude_2D")>-<Assembly: AssemblyDescription("")>-<Assembly: AssemblyCompany("")>-<Assembly: AssemblyProduct("Wave_Dude_2D")>-<Assembly: AssemblyCopyright("Copyright © 2026 JJM Vleggaar (Huygens Optics)")>-<Assembly: AssemblyTrademark("")>--<Assembly: ComVisible(False)>--'The following GUID is for the ID of the typelib if this project is exposed to COM-<Assembly: Guid("51c8e121-f5ae-493a-bd03-487bca68a6fc")>--' 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/2D_wave_sim_V01/My Project/Resources.Designer.vb b/2D_wave_sim_V01/My Project/Resources.Designer.vbdeleted file mode 100644index b6d7e1d..0000000--- a/2D_wave_sim_V01/My Project/Resources.Designer.vb+++ /dev/null@@ -1,73 +0,0 @@-'-------------------------------------------------------------------------------' <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>-'--------------------------------------------------------------------------------Option Strict On-Option Explicit On--Imports System--Namespace My.Resources-- '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.- '''<summary>- ''' A strongly-typed resource class, for looking up localized strings, etc.- '''</summary>- <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _- Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _- Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _- Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _- Friend Module Resources-- Private resourceMan As Global.System.Resources.ResourceManager-- Private resourceCulture As Global.System.Globalization.CultureInfo-- '''<summary>- ''' Returns the cached ResourceManager instance used by this class.- '''</summary>- <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _- Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager- Get- If Object.ReferenceEquals(resourceMan, Nothing) Then- Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("_2D_wave_sim_V01.Resources", GetType(Resources).Assembly)- resourceMan = temp- End If- Return resourceMan- End Get- End Property-- '''<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)> _- Friend Property Culture() As Global.System.Globalization.CultureInfo- Get- Return resourceCulture- End Get- Set- resourceCulture = value- End Set- End Property-- '''<summary>- ''' Looks up a localized resource of type System.Drawing.Bitmap.- '''</summary>- Friend ReadOnly Property QR_code() As System.Drawing.Bitmap- Get- Dim obj As Object = ResourceManager.GetObject("QR-code", resourceCulture)- Return CType(obj,System.Drawing.Bitmap)- End Get- End Property- End Module-End Namespacediff --git a/2D_wave_sim_V01/My Project/Resources.resx b/2D_wave_sim_V01/My Project/Resources.resxdeleted file mode 100644index cc37485..0000000--- a/2D_wave_sim_V01/My Project/Resources.resx+++ /dev/null@@ -1,124 +0,0 @@-<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />- <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" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </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" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />- <data name="QR-code" type="System.Resources.ResXFileRef, System.Windows.Forms">- <value>..\Resources\QR-code.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>- </data>-</root>\ No newline at end of filediff --git a/2D_wave_sim_V01/My Project/Settings.Designer.vb b/2D_wave_sim_V01/My Project/Settings.Designer.vbdeleted file mode 100644index a3812d0..0000000--- a/2D_wave_sim_V01/My Project/Settings.Designer.vb+++ /dev/null@@ -1,73 +0,0 @@-'-------------------------------------------------------------------------------' <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>-'--------------------------------------------------------------------------------Option Strict On-Option Explicit On---Namespace My-- <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _- Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _- Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _- Partial Friend NotInheritable Class MySettings- Inherits Global.System.Configuration.ApplicationSettingsBase-- Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)--#Region "My.Settings Auto-Save Functionality"-#If _MyType = "WindowsForms" Then- Private Shared addedHandler As Boolean-- Private Shared addedHandlerLockObject As New Object-- <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _- Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)- If My.Application.SaveMySettingsOnExit Then- My.Settings.Save()- End If- End Sub-#End If-#End Region-- Public Shared ReadOnly Property [Default]() As MySettings- Get--#If _MyType = "WindowsForms" Then- If Not addedHandler Then- SyncLock addedHandlerLockObject- If Not addedHandler Then- AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings- addedHandler = True- End If- End SyncLock- End If-#End If- Return defaultInstance- End Get- End Property- End Class-End Namespace--Namespace My-- <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _- Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _- Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _- Friend Module MySettingsProperty-- <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _- Friend ReadOnly Property Settings() As Global._2D_wave_sim_V01.My.MySettings- Get- Return Global._2D_wave_sim_V01.My.MySettings.Default- End Get- End Property- End Module-End Namespacediff --git a/2D_wave_sim_V01/My Project/Settings.settings b/2D_wave_sim_V01/My Project/Settings.settingsdeleted file mode 100644index 85b890b..0000000--- a/2D_wave_sim_V01/My Project/Settings.settings+++ /dev/null@@ -1,7 +0,0 @@-<?xml version='1.0' encoding='utf-8'?>-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">- <Profiles>- <Profile Name="(Default)" />- </Profiles>- <Settings />-</SettingsFile>diff --git a/2D_wave_sim_V01/Projects/AppSettings.vb b/2D_wave_sim_V01/Projects/AppSettings.vbdeleted file mode 100644index a02ea66..0000000--- a/2D_wave_sim_V01/Projects/AppSettings.vb+++ /dev/null@@ -1,91 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.IO-Imports System.Text-Imports System.Web.Script.Serialization--''' <summary>-''' Small per-user settings of the program itself (not of a project): the root folder and the project-''' that were used last. Stored in settings.json in the user's application data folder.-''' Reading and writing never throw; a problem simply means the defaults are used.-''' </summary>-Public NotInheritable Class AppSettings-- Private Const KeyRootFolder As String = "last_root_folder"- Private Const KeyProjectName As String = "last_project_name"- Private Const KeyProjectRoot As String = "project_root"-- Public Property LastRootFolder As String = ""- Public Property LastProjectName As String = ""-- ''' <summary>The root folder browsed on the Configuration tab (lstAllProjects, File > Choose project root) -- ''' distinct from LastRootFolder/LastProjectName, which remember the project that was actually open last, not- ''' necessarily the folder being browsed for other projects to switch to.</summary>- Public Property ProjectRoot As String = ""-- Private Shared Function SettingsFilePath() As String- Return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "2D_wave_sim_V01", "settings.json")- End Function-- Public Shared Function Load() As AppSettings- Dim settings As New AppSettings()- Try- Dim filePath As String = SettingsFilePath()- If File.Exists(filePath) Then- Dim serializer As New JavaScriptSerializer()- Dim root As Dictionary(Of String, Object) = TryCast(serializer.DeserializeObject(File.ReadAllText(filePath, Encoding.UTF8)), Dictionary(Of String, Object))- If root IsNot Nothing Then- settings.LastRootFolder = ReadText(root, KeyRootFolder)- settings.LastProjectName = ReadText(root, KeyProjectName)- settings.ProjectRoot = ReadText(root, KeyProjectRoot)- End If- End If- Catch ex As Exception- ' use the defaults- End Try- Return settings- End Function-- Public Sub Save()- Try- Dim filePath As String = SettingsFilePath()- Directory.CreateDirectory(Path.GetDirectoryName(filePath))- Dim values As New Dictionary(Of String, String)()- values(KeyRootFolder) = LastRootFolder- values(KeyProjectName) = LastProjectName- values(KeyProjectRoot) = ProjectRoot- Dim serializer As New JavaScriptSerializer()- File.WriteAllText(filePath, serializer.Serialize(values), New UTF8Encoding(False))- Catch ex As Exception- ' the settings are a convenience only- End Try- End Sub-- Private Shared Function ReadText(root As Dictionary(Of String, Object), key As String) As String- Dim v As Object = Nothing- If root.TryGetValue(key, v) AndAlso v IsNot Nothing Then Return Convert.ToString(v)- Return ""- End Function--End Classdiff --git a/2D_wave_sim_V01/Projects/Project.vb b/2D_wave_sim_V01/Projects/Project.vbdeleted file mode 100644index 38af606..0000000--- a/2D_wave_sim_V01/Projects/Project.vb+++ /dev/null@@ -1,110 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.IO--''' <summary>-''' An open project: a folder (the folder name is the project name) that contains configuration.json-''' and the standard subfolders. Projects are created and opened with ProjectStore.-''' </summary>-Public NotInheritable Class Project-- Private ReadOnly _folderPath As String- Private ReadOnly _config As ProjectConfig-- Friend Sub New(folderPath As String, config As ProjectConfig)- _folderPath = folderPath- _config = config- ' the folder name is the one and only project name- _config.ProjectName = Name- End Sub-- ''' <summary>The name of the project, which is the name of its folder.</summary>- Public ReadOnly Property Name As String- Get- Return Path.GetFileName(_folderPath)- End Get- End Property-- ''' <summary>Full path of the main folder of the project.</summary>- Public ReadOnly Property FolderPath As String- Get- Return _folderPath- End Get- End Property-- ''' <summary>The folder that contains the project folder (the root folder).</summary>- Public ReadOnly Property RootFolder As String- Get- Dim parent As String = Path.GetDirectoryName(_folderPath)- If parent Is Nothing Then Return ""- Return parent- End Get- End Property-- ''' <summary>The configuration of the project. Changes are written to disk by Save.</summary>- Public ReadOnly Property Config As ProjectConfig- Get- Return _config- End Get- End Property-- ''' <summary>Full path of configuration.json.</summary>- Public ReadOnly Property ConfigFilePath As String- Get- Return Path.Combine(_folderPath, ProjectConfig.FileName)- End Get- End Property-- ''' <summary>Where the user can keep any third-party files used by the project (e.g. the original Photoshop- ''' file of a scene image) - not read or written by the simulator itself.</summary>- Public ReadOnly Property AssetsFolder As String- Get- Return Path.Combine(_folderPath, ProjectStore.AssetsFolderName)- End Get- End Property-- Public ReadOnly Property OutputFramesFolder As String- Get- Return Path.Combine(_folderPath, ProjectStore.OutputFramesFolderName)- End Get- End Property-- Public ReadOnly Property OutputVideoFolder As String- Get- Return Path.Combine(_folderPath, ProjectStore.OutputVideoFolderName)- End Get- End Property-- Public ReadOnly Property SceneImageFolder As String- Get- Return Path.Combine(_folderPath, ProjectStore.SceneImageFolderName)- End Get- End Property-- ''' <summary>Writes the configuration to configuration.json.</summary>- Public Sub Save()- _config.ProjectName = Name- _config.Save(ConfigFilePath)- End Sub--End Classdiff --git a/2D_wave_sim_V01/Projects/ProjectConfig.vb b/2D_wave_sim_V01/Projects/ProjectConfig.vbdeleted file mode 100644index a084b07..0000000--- a/2D_wave_sim_V01/Projects/ProjectConfig.vb+++ /dev/null@@ -1,342 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections-Imports System.Collections.Generic-Imports System.Globalization-Imports System.IO-Imports System.Text-Imports System.Web.Script.Serialization--''' <summary>-''' The configuration of one project, stored as configuration.json in the main folder of the project.-'''-''' The file is a JSON object. The keys below are always present. Every tab that gets functionality later-''' stores its own settings as a section (a nested JSON object), for example:-''' Dim section = project.Config.GetSection("probes")-''' section("count") = 3-''' project.Save()-''' Keys that this version of the program does not know are kept and written back unchanged, so a file-''' written by a newer version is not damaged by an older one (it is refused when its format_version is newer).-''' </summary>-Public NotInheritable Class ProjectConfig-- ''' <summary>Name of the configuration file inside a project folder.</summary>- Public Const FileName As String = "configuration.json"-- ''' <summary>Name of the empty placeholder file that projects had before configuration.json existed.</summary>- Public Const LegacyFileName As String = "Configuration.txt"-- ''' <summary>Version of the file layout. Increase it when a change makes old files incompatible.</summary>- Public Const CurrentFormatVersion As Integer = 1-- Private Const KeyFormatVersion As String = "format_version"- Private Const KeyProjectName As String = "project_name"- Private Const KeyCreated As String = "created"- Private Const KeyModified As String = "modified"- Private Const KeyDescription As String = "description"-- ' insertion ordered in practice, so the file keeps a stable, readable order- Private ReadOnly _values As Dictionary(Of String, Object)-- ''' <summary>A new configuration with the standard keys only.</summary>- Public Sub New(projectName As String)- Dim stamp As String = Timestamp(DateTime.UtcNow)- _values = New Dictionary(Of String, Object)()- _values(KeyFormatVersion) = CurrentFormatVersion- _values(KeyProjectName) = projectName- _values(KeyCreated) = stamp- _values(KeyModified) = stamp- End Sub-- Private Sub New(values As Dictionary(Of String, Object))- _values = values- If Not _values.ContainsKey(KeyFormatVersion) Then _values(KeyFormatVersion) = CurrentFormatVersion- End Sub-- ' ---------------------------------------------------------------- standard values-- Public ReadOnly Property FormatVersion As Integer- Get- Return GetInteger(KeyFormatVersion, CurrentFormatVersion)- End Get- End Property-- ''' <summary>Name of the project. It is always the name of the project folder.</summary>- Public Property ProjectName As String- Get- Return GetString(KeyProjectName, "")- End Get- Set(value As String)- _values(KeyProjectName) = value- End Set- End Property-- ''' <summary>When the project was created (UTC, ISO 8601 text).</summary>- Public ReadOnly Property Created As String- Get- Return GetString(KeyCreated, "")- End Get- End Property-- ''' <summary>When the file was last saved (UTC, ISO 8601 text).</summary>- Public ReadOnly Property Modified As String- Get- Return GetString(KeyModified, "")- End Get- End Property-- ''' <summary>A free-form description of the project (Form1's btnDescription/frmDescription), empty when none was set.</summary>- Public Property Description As String- Get- Return GetString(KeyDescription, "")- End Get- Set(value As String)- _values(KeyDescription) = value- End Set- End Property-- ' ---------------------------------------------------------------- general access (for the tabs)-- Public Function ContainsKey(key As String) As Boolean- Return _values.ContainsKey(key)- End Function-- Public Function GetString(key As String, fallback As String) As String- Dim v As Object = Nothing- If _values.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Return Convert.ToString(v, CultureInfo.InvariantCulture)- End If- Return fallback- End Function-- Public Function GetInteger(key As String, fallback As Integer) As Integer- Dim v As Object = Nothing- If _values.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Try- Return Convert.ToInt32(v, CultureInfo.InvariantCulture)- Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException- Return fallback- End Try- End If- Return fallback- End Function-- ''' <summary>- ''' Sets a value. Allowed values: String, Boolean, numbers, Nothing, a Dictionary(Of String, Object)- ''' or a list or array of these.- ''' </summary>- Public Sub SetValue(key As String, value As Object)- _values(key) = value- End Sub-- ''' <summary>- ''' The nested object with the given name; it is created (empty) when it does not exist yet.- ''' Changes made to the returned dictionary are part of the configuration and are written by Save.- ''' </summary>- Public Function GetSection(name As String) As Dictionary(Of String, Object)- Dim v As Object = Nothing- If _values.TryGetValue(name, v) Then- Dim existing As Dictionary(Of String, Object) = TryCast(v, Dictionary(Of String, Object))- If existing IsNot Nothing Then Return existing- End If- Dim section As New Dictionary(Of String, Object)()- _values(name) = section- Return section- End Function-- ' ---------------------------------------------------------------- file-- ''' <summary>Reads a configuration file. Throws when it cannot be read, is not valid or is from a newer version.</summary>- Public Shared Function Load(filePath As String) As ProjectConfig- Dim text As String = File.ReadAllText(filePath, Encoding.UTF8)-- Dim serializer As New JavaScriptSerializer()- serializer.MaxJsonLength = Integer.MaxValue-- Dim root As Dictionary(Of String, Object) = Nothing- Try- root = TryCast(serializer.DeserializeObject(text), Dictionary(Of String, Object))- Catch ex As Exception When TypeOf ex Is ArgumentException OrElse TypeOf ex Is InvalidOperationException- Throw New InvalidDataException("The file " & Path.GetFileName(filePath) & " is not valid JSON: " & ex.Message, ex)- End Try- If root Is Nothing Then- Throw New InvalidDataException("The file " & Path.GetFileName(filePath) & " is not a project configuration (a JSON object was expected).")- End If-- Dim config As New ProjectConfig(root)- If config.FormatVersion > CurrentFormatVersion Then- Throw New InvalidDataException("The file " & Path.GetFileName(filePath) & " was made by a newer version of the program (format " &- config.FormatVersion.ToString(CultureInfo.InvariantCulture) & ").")- End If- Return config- End Function-- ''' <summary>Writes the configuration to a file (overwriting an existing file) and updates the modified time.</summary>- Public Sub Save(filePath As String)- _values(KeyFormatVersion) = CurrentFormatVersion- _values(KeyModified) = Timestamp(DateTime.UtcNow)-- Dim sb As New StringBuilder()- WriteObject(sb, _values, 0)- sb.AppendLine()-- Dim folderPath As String = Path.GetDirectoryName(filePath)- If Not String.IsNullOrEmpty(folderPath) Then Directory.CreateDirectory(folderPath)-- ' write to a temporary file first so a failed save never leaves a half-written configuration behind- Dim tmp As String = filePath & ".tmp"- File.WriteAllText(tmp, sb.ToString(), New UTF8Encoding(False))- If File.Exists(filePath) Then File.Delete(filePath)- File.Move(tmp, filePath)- End Sub-- ' ---------------------------------------------------------------- JSON writing-- Private Shared Function Timestamp(value As DateTime) As String- Return value.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'", CultureInfo.InvariantCulture)- End Function-- Private Shared Sub WriteValue(sb As StringBuilder, value As Object, level As Integer)- If value Is Nothing Then- sb.Append("null")- Return- End If-- Select Case Type.GetTypeCode(value.GetType())- Case TypeCode.Boolean- sb.Append(If(Convert.ToBoolean(value, CultureInfo.InvariantCulture), "true", "false"))- Case TypeCode.Byte, TypeCode.SByte, TypeCode.Int16, TypeCode.UInt16, TypeCode.Int32,- TypeCode.UInt32, TypeCode.Int64, TypeCode.UInt64, TypeCode.Decimal- sb.Append(Convert.ToString(value, CultureInfo.InvariantCulture))- Case TypeCode.Single, TypeCode.Double- Dim d As Double = Convert.ToDouble(value, CultureInfo.InvariantCulture)- If Double.IsNaN(d) OrElse Double.IsInfinity(d) Then- sb.Append("null")- Else- sb.Append(d.ToString("R", CultureInfo.InvariantCulture))- End If- Case TypeCode.DateTime- sb.Append(Quote(Timestamp(Convert.ToDateTime(value, CultureInfo.InvariantCulture).ToUniversalTime())))- Case TypeCode.String, TypeCode.Char- sb.Append(Quote(Convert.ToString(value, CultureInfo.InvariantCulture)))- Case TypeCode.Object- Dim dict As IDictionary = TryCast(value, IDictionary)- Dim list As IEnumerable = TryCast(value, IEnumerable)- If dict IsNot Nothing Then- WriteObject(sb, dict, level)- ElseIf list IsNot Nothing Then- WriteArray(sb, list, level)- Else- sb.Append(Quote(Convert.ToString(value, CultureInfo.InvariantCulture)))- End If- Case Else- sb.Append("null")- End Select- End Sub-- Private Shared Sub WriteObject(sb As StringBuilder, dict As IDictionary, level As Integer)- If dict.Count = 0 Then- sb.Append("{}")- Return- End If-- sb.AppendLine("{")- Dim index As Integer = 0- For Each entry As DictionaryEntry In dict- index += 1- sb.Append(Indent(level + 1))- sb.Append(Quote(Convert.ToString(entry.Key, CultureInfo.InvariantCulture)))- sb.Append(": ")- WriteValue(sb, entry.Value, level + 1)- If index < dict.Count Then sb.Append(",")- sb.AppendLine()- Next- sb.Append(Indent(level))- sb.Append("}")- End Sub-- Private Shared Sub WriteArray(sb As StringBuilder, list As IEnumerable, level As Integer)- Dim items As New List(Of Object)()- Dim allScalar As Boolean = True- For Each item As Object In list- items.Add(item)- If item IsNot Nothing AndAlso (TypeOf item Is IDictionary OrElse (TypeOf item Is IEnumerable AndAlso Not TypeOf item Is String)) Then- allScalar = False- End If- Next-- If items.Count = 0 Then- sb.Append("[]")- ElseIf allScalar Then- sb.Append("[")- For i As Integer = 0 To items.Count - 1- If i > 0 Then sb.Append(", ")- WriteValue(sb, items(i), level + 1)- Next- sb.Append("]")- Else- sb.AppendLine("[")- For i As Integer = 0 To items.Count - 1- sb.Append(Indent(level + 1))- WriteValue(sb, items(i), level + 1)- If i < items.Count - 1 Then sb.Append(",")- sb.AppendLine()- Next- sb.Append(Indent(level))- sb.Append("]")- End If- End Sub-- Private Shared Function Indent(level As Integer) As String- Return New String(" "c, level * 2)- End Function-- Private Shared Function Quote(text As String) As String- If text Is Nothing Then Return """"""- Dim sb As New StringBuilder()- sb.Append(""""c)- For Each ch As Char In text- Select Case ch- Case """"c- sb.Append("\""")- Case "\"c- sb.Append("\\")- Case ChrW(10)- sb.Append("\n")- Case ChrW(13)- sb.Append("\r")- Case ChrW(9)- sb.Append("\t")- Case Else- If AscW(ch) < 32 Then- sb.Append("\u").Append(AscW(ch).ToString("x4", CultureInfo.InvariantCulture))- Else- sb.Append(ch)- End If- End Select- Next- sb.Append(""""c)- Return sb.ToString()- End Function--End Classdiff --git a/2D_wave_sim_V01/Projects/ProjectStore.vb b/2D_wave_sim_V01/Projects/ProjectStore.vbdeleted file mode 100644index 4a19b38..0000000--- a/2D_wave_sim_V01/Projects/ProjectStore.vb+++ /dev/null@@ -1,232 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.IO-Imports System.Linq--''' <summary>-''' Creates and opens projects. A project is a folder inside the root folder; the folder name is the-''' project name. The main folder of a project contains configuration.json and these subfolders:-''' assets, output_frames, output_video, scene_images-''' (the configuration is entirely in configuration.json; assets is instead where the user can keep any-''' third-party files used by the project, such as the original Photoshop file of a scene image.)-''' </summary>-Public NotInheritable Class ProjectStore-- Public Const AssetsFolderName As String = "assets"- Public Const OutputFramesFolderName As String = "output_frames"- Public Const OutputVideoFolderName As String = "output_video"- Public Const SceneImageFolderName As String = "scene_images"-- Private Const MaxNameLength As Integer = 100-- Private Shared ReadOnly SubFolderNames As String() = {- AssetsFolderName, OutputFramesFolderName, OutputVideoFolderName, SceneImageFolderName}-- ' names that Windows does not allow for a file or folder- Private Shared ReadOnly ReservedNames As String() = {- "CON", "PRN", "AUX", "NUL",- "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",- "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}-- Private Sub New()- End Sub-- ''' <summary>- ''' Checks a project name. Returns an empty string when the name can be used as a folder name,- ''' otherwise a message that says what is wrong. The name is never changed silently.- ''' </summary>- Public Shared Function ValidateName(projectName As String) As String- If String.IsNullOrWhiteSpace(projectName) Then Return "Enter a project name."- If projectName <> projectName.Trim() Then Return "The project name must not start or end with a space."- If projectName.EndsWith(".", StringComparison.Ordinal) Then Return "The project name must not end with a dot."- If projectName.Length > MaxNameLength Then- Return "The project name is too long (at most " & MaxNameLength.ToString() & " characters)."- End If-- Dim invalid As Char() = Path.GetInvalidFileNameChars()- For Each ch As Char In projectName- If Array.IndexOf(invalid, ch) >= 0 Then- If AscW(ch) < 32 Then Return "The project name contains a control character."- Return "The project name contains the character '" & ch & "', which is not allowed in a folder name."- End If- Next-- Dim baseName As String = projectName.Split("."c)(0).ToUpperInvariant()- If Array.IndexOf(ReservedNames, baseName) >= 0 Then- Return "'" & projectName & "' is a reserved name in Windows and cannot be used as a folder name."- End If- Return ""- End Function-- ''' <summary>The full path of the folder of a project with the given name in the root folder.</summary>- Public Shared Function FolderPathFor(rootFolder As String, projectName As String) As String- Return Path.Combine(NormalizeFolder(rootFolder), projectName)- End Function-- ''' <summary>True when the folder is a project folder (it has configuration.json or the old empty Configuration.txt).</summary>- Public Shared Function IsProjectFolder(folderPath As String) As Boolean- If String.IsNullOrWhiteSpace(folderPath) OrElse Not Directory.Exists(folderPath) Then Return False- Return File.Exists(Path.Combine(folderPath, ProjectConfig.FileName)) OrElse- File.Exists(Path.Combine(folderPath, ProjectConfig.LegacyFileName))- End Function-- ''' <summary>- ''' Opens an existing project folder. Throws (with a readable message) when the folder is not a project- ''' or its configuration cannot be read. A project that still has the old empty Configuration.txt is- ''' upgraded: configuration.json is written and the empty placeholder is removed.- ''' </summary>- Public Shared Function Open(folderPath As String) As Project- Dim folder As String = NormalizeFolder(folderPath)- If Not Directory.Exists(folder) Then- Throw New DirectoryNotFoundException("The folder '" & folder & "' does not exist.")- End If-- Dim jsonPath As String = Path.Combine(folder, ProjectConfig.FileName)- Dim legacyPath As String = Path.Combine(folder, ProjectConfig.LegacyFileName)- Dim opened As Project-- If File.Exists(jsonPath) Then- opened = New Project(folder, ProjectConfig.Load(jsonPath))- ElseIf File.Exists(legacyPath) Then- If File.ReadAllText(legacyPath).Trim().Length > 0 Then- Throw New InvalidDataException("The file " & ProjectConfig.LegacyFileName &- " is not empty and has no known format, so it was not replaced.")- End If- opened = New Project(folder, New ProjectConfig(Path.GetFileName(folder)))- opened.Save()- File.Delete(legacyPath)- Else- Throw New InvalidDataException("The folder '" & Path.GetFileName(folder) & "' is not a project folder: it contains no " &- ProjectConfig.FileName & ".")- End If-- EnsureSubFolders(folder)- Return opened- End Function-- ''' <summary>- ''' Creates a new project: the project folder (and the root folder when needed), the standard subfolders- ''' and configuration.json. Throws (with a readable message) when the name is not valid, the project already- ''' exists or the folder already exists and is not empty.- ''' </summary>- Public Shared Function Create(rootFolder As String, projectName As String) As Project- Dim problem As String = ValidateName(projectName)- If problem.Length > 0 Then Throw New ArgumentException(problem, "projectName")- If String.IsNullOrWhiteSpace(rootFolder) Then Throw New ArgumentException("Enter a root folder.", "rootFolder")-- Dim folder As String = FolderPathFor(rootFolder, projectName)- If IsProjectFolder(folder) Then- Throw New IOException("A project named '" & projectName & "' already exists in this root folder. Use 'Open existing' to open it.")- End If- If Directory.Exists(folder) AndAlso Directory.EnumerateFileSystemEntries(folder).Any() Then- Throw New IOException("The folder '" & folder & "' already exists and is not empty, so it cannot be used for a new project.")- End If-- Directory.CreateDirectory(folder)- EnsureSubFolders(folder)-- Dim created As New Project(folder, New ProjectConfig(projectName))- created.Save()- Return created- End Function-- ''' <summary>The names of every project folder directly inside the root folder, sorted alphabetically- ''' (case-insensitive). A subfolder that is not a project folder (IsProjectFolder) is left out. Returns an- ''' empty list when the root folder does not exist, or cannot be listed (removed drive, no permission, ...).</summary>- Public Shared Function ListProjects(rootFolder As String) As List(Of String)- Dim names As New List(Of String)()- If String.IsNullOrWhiteSpace(rootFolder) OrElse Not Directory.Exists(rootFolder) Then Return names-- Try- For Each folder As String In Directory.GetDirectories(rootFolder)- If IsProjectFolder(folder) Then names.Add(Path.GetFileName(folder))- Next- Catch ex As Exception When TypeOf ex Is IOException OrElse TypeOf ex Is UnauthorizedAccessException- Return New List(Of String)()- End Try- names.Sort(Function(a, b) String.Compare(a, b, StringComparison.OrdinalIgnoreCase))- Return names- End Function-- ''' <summary>- ''' Permanently deletes a project folder and everything in it. Throws (with a readable message) when the- ''' folder is not a project folder, so a wrong or unrelated folder can never be removed by mistake.- ''' </summary>- Public Shared Sub Delete(folderPath As String)- Dim folder As String = NormalizeFolder(folderPath)- If Not IsProjectFolder(folder) Then- Throw New InvalidDataException("The folder '" & Path.GetFileName(folder) & "' is not a project folder, so it was not deleted.")- End If- Directory.Delete(folder, True)- End Sub-- ''' <summary>- ''' Renames a project by moving its folder to a new name in the same root folder. Throws (with a readable- ''' message) when the new name is not valid or a project (or any other file/folder) with that name already- ''' exists there. Returns the new folder path.- ''' </summary>- Public Shared Function Rename(folderPath As String, newProjectName As String) As String- Dim folder As String = NormalizeFolder(folderPath)- If Not IsProjectFolder(folder) Then- Throw New InvalidDataException("The folder '" & Path.GetFileName(folder) & "' is not a project folder, so it was not renamed.")- End If-- Dim problem As String = ValidateName(newProjectName)- If problem.Length > 0 Then Throw New ArgumentException(problem, "newProjectName")-- Dim rootFolder As String = Path.GetDirectoryName(folder)- Dim newFolder As String = FolderPathFor(rootFolder, newProjectName)- If String.Equals(folder, newFolder, StringComparison.OrdinalIgnoreCase) Then Return folder ' only a case change, or unchanged-- If Directory.Exists(newFolder) OrElse File.Exists(newFolder) Then- Throw New IOException("'" & newProjectName & "' already exists in this root folder. Choose a different name.")- End If-- Directory.Move(folder, newFolder)- Return newFolder- End Function-- ' ---------------------------------------------------------------- helpers-- Private Shared Sub EnsureSubFolders(folder As String)- Try- For Each subName As String In SubFolderNames- Directory.CreateDirectory(Path.Combine(folder, subName))- Next- Catch ex As Exception When TypeOf ex Is IOException OrElse TypeOf ex Is UnauthorizedAccessException- ' not fatal: a folder that cannot be created is reported when it is needed- End Try- End Sub-- ''' <summary>Full path without a trailing separator (except for a drive root such as C:\).</summary>- Friend Shared Function NormalizeFolder(folderPath As String) As String- Dim full As String = Path.GetFullPath(folderPath.Trim())- Dim pathRoot As String = Path.GetPathRoot(full)- If full.Length > pathRoot.Length Then- full = full.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)- End If- Return full- End Function--End Classdiff --git a/2D_wave_sim_V01/Projects/SceneSettings.vb b/2D_wave_sim_V01/Projects/SceneSettings.vbdeleted file mode 100644index cf9d10a..0000000--- a/2D_wave_sim_V01/Projects/SceneSettings.vb+++ /dev/null@@ -1,191 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Globalization-Imports System.IO--''' <summary>-''' The scene properties of a project (Configuration tab). They are stored in the section "scene" of-''' configuration.json:-''' mode "image" (canvas size = size of the scene image) or "user_defined"-''' image_file the scene image, relative to the project folder when it lies inside it (forward slashes)-''' user_width, user_height canvas size in pixels for the user defined scene-''' damping_edge_enabled, damping_edge_size_px-''' use_sources (the sources in the scene image), image_source_scale (their amplitude factor),-''' use_object_sources-''' The size of a scene image is not stored: it is read from the image itself. There is no scene-level "use probes"-''' switch: each probe has its own "On" checkbox (ProbeSettings.Active) instead.-''' </summary>-Public NotInheritable Class SceneSettings-- Public Const SectionName As String = "scene"-- Public Const ModeImage As String = "image"- Public Const ModeUserDefined As String = "user_defined"-- ' the defaults are those of the Python example (1920 x 1080 canvas, 64 px damping edge)- Public Const DefaultWidth As Integer = 1920- Public Const DefaultHeight As Integer = 1080- Public Const DefaultDampingEdgeSize As Integer = 64-- Public Const MinCanvasSize As Integer = 8- Public Const MaxCanvasSize As Integer = 16384- Public Const MaxDampingEdgeSize As Integer = 8192-- Public Const DefaultImageSourceScale As Double = 1.0- Public Const MaxImageSourceScale As Double = 1000.0-- ''' <summary>The refractive index of a user defined (image-less) scene's background, 1.0 to 2.55 (a red channel value of 100 to 255, as in a scene image).</summary>- Public Const DefaultBackgroundRefractiveIndex As Double = 1.0- Public Const MinBackgroundRefractiveIndex As Double = 1.0- Public Const MaxBackgroundRefractiveIndex As Double = 2.55-- ''' <summary>True: the canvas is the scene image. False: the canvas has the user defined size.</summary>- Public Property UseImage As Boolean = False-- ''' <summary>The scene image as stored: relative to the project folder when inside it, otherwise a full path. Empty when none.</summary>- Public Property ImageFile As String = ""-- Public Property UserWidth As Integer = DefaultWidth- Public Property UserHeight As Integer = DefaultHeight-- ''' <summary>No software-chosen default of its own, the same as SimulationSettings.Steps/TimeDecayFactor - a- ''' new project starts at whatever chkDampingEdge's own Designer Checked value is (see StartNewProject,- ''' Form1.vb). The False below (used by FromConfig) is only the fallback for an existing project saved before- ''' this setting existed.</summary>- Public Property DampingEdgeEnabled As Boolean- Public Property DampingEdgeSize As Integer = DefaultDampingEdgeSize-- ''' <summary>Use the sources in the green channel of the scene image.</summary>- Public Property UseSources As Boolean = False-- ''' <summary>Amplitude factor of the image sources (source_amplitude of StaticImageScene in the Python code).</summary>- Public Property ImageSourceScale As Double = DefaultImageSourceScale-- ''' <summary>Use the source objects of the source list (not implemented yet; only the setting is kept). No- ''' software-chosen default of its own, the same as DampingEdgeEnabled above - a new project starts at- ''' whatever chkUseObjectSources' own Designer Checked value is (see StartNewProject, Form1.vb).</summary>- Public Property UseObjectSources As Boolean-- ''' <summary>The background refractive index of a user defined scene (a scene image has its own value per pixel, from its red channel).</summary>- Public Property BackgroundRefractiveIndex As Double = DefaultBackgroundRefractiveIndex-- ' ---------------------------------------------------------------- configuration file-- ''' <summary>Reads the scene settings from a project configuration; missing or invalid values get their defaults.</summary>- Public Shared Function FromConfig(config As ProjectConfig) As SceneSettings- Dim scene As New SceneSettings()- If Not config.ContainsKey(SectionName) Then Return scene-- Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)- scene.UseImage = (ReadText(section, "mode", ModeUserDefined) = ModeImage)- scene.ImageFile = ReadText(section, "image_file", "")- scene.UserWidth = ReadInt(section, "user_width", DefaultWidth, MinCanvasSize, MaxCanvasSize)- scene.UserHeight = ReadInt(section, "user_height", DefaultHeight, MinCanvasSize, MaxCanvasSize)- scene.DampingEdgeEnabled = ReadBool(section, "damping_edge_enabled", False)- scene.DampingEdgeSize = ReadInt(section, "damping_edge_size_px", DefaultDampingEdgeSize, 1, MaxDampingEdgeSize)- scene.UseSources = ReadBool(section, "use_sources", False)- scene.ImageSourceScale = ReadDouble(section, "image_source_scale", DefaultImageSourceScale, 0.0, MaxImageSourceScale)- scene.UseObjectSources = ReadBool(section, "use_object_sources", False)- scene.BackgroundRefractiveIndex = ReadDouble(section, "background_refractive_index", DefaultBackgroundRefractiveIndex,- MinBackgroundRefractiveIndex, MaxBackgroundRefractiveIndex)- Return scene- End Function-- ''' <summary>Puts the scene settings into a project configuration (call Project.Save to write the file).</summary>- Public Sub ToConfig(config As ProjectConfig)- Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)- section("mode") = If(UseImage, ModeImage, ModeUserDefined)- section("image_file") = ImageFile- section("user_width") = UserWidth- section("user_height") = UserHeight- section("damping_edge_enabled") = DampingEdgeEnabled- section("damping_edge_size_px") = DampingEdgeSize- section("use_sources") = UseSources- section("image_source_scale") = ImageSourceScale- section("use_object_sources") = UseObjectSources- section("background_refractive_index") = BackgroundRefractiveIndex- End Sub-- ' ---------------------------------------------------------------- image paths-- ''' <summary>The path to store for an image: relative to the project folder when the image is inside it.</summary>- Public Shared Function ToStoredPath(projectFolder As String, fullPath As String) As String- If String.IsNullOrEmpty(projectFolder) Then Return fullPath- Dim prefix As String = projectFolder.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) & Path.DirectorySeparatorChar- If fullPath.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) Then- Return fullPath.Substring(prefix.Length).Replace(Path.DirectorySeparatorChar, "/"c)- End If- Return fullPath- End Function-- ''' <summary>The full path of a stored image path.</summary>- Public Shared Function ToFullPath(projectFolder As String, storedPath As String) As String- If String.IsNullOrEmpty(storedPath) Then Return ""- If Path.IsPathRooted(storedPath) Then Return storedPath- Return Path.Combine(projectFolder, storedPath.Replace("/"c, Path.DirectorySeparatorChar))- End Function-- ' ---------------------------------------------------------------- helpers-- Private Shared Function ReadText(section As Dictionary(Of String, Object), key As String, fallback As String) As String- Dim v As Object = Nothing- If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then Return Convert.ToString(v, CultureInfo.InvariantCulture)- Return fallback- End Function-- Private Shared Function ReadBool(section As Dictionary(Of String, Object), key As String, fallback As Boolean) As Boolean- Dim v As Object = Nothing- If section.TryGetValue(key, v) AndAlso TypeOf v Is Boolean Then Return Convert.ToBoolean(v)- Return fallback- End Function-- Private Shared Function ReadDouble(section As Dictionary(Of String, Object), key As String, fallback As Double,- minValue As Double, maxValue As Double) As Double- Dim v As Object = Nothing- If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Try- Dim x As Double = Convert.ToDouble(v, CultureInfo.InvariantCulture)- If x >= minValue AndAlso x <= maxValue Then Return x- Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException- ' use the fallback- End Try- End If- Return fallback- End Function-- Private Shared Function ReadInt(section As Dictionary(Of String, Object), key As String, fallback As Integer,- minValue As Integer, maxValue As Integer) As Integer- Dim v As Object = Nothing- If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Try- Dim n As Integer = Convert.ToInt32(v, CultureInfo.InvariantCulture)- If n >= minValue AndAlso n <= maxValue Then Return n- Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException- ' use the fallback- End Try- End If- Return fallback- End Function--End Classdiff --git a/2D_wave_sim_V01/Projects/inages/QR-code.png b/2D_wave_sim_V01/Projects/inages/QR-code.pngdeleted file mode 100644index 2e99b63..0000000Binary files a/2D_wave_sim_V01/Projects/inages/QR-code.png and /dev/null differdiff --git a/2D_wave_sim_V01/Resources/QR-code.png b/2D_wave_sim_V01/Resources/QR-code.pngdeleted file mode 100644index 2e99b63..0000000Binary files a/2D_wave_sim_V01/Resources/QR-code.png and /dev/null differdiff --git a/2D_wave_sim_V01/Simulation/AviMjpegWriter.vb b/2D_wave_sim_V01/Simulation/AviMjpegWriter.vbdeleted file mode 100644index 0963e71..0000000--- a/2D_wave_sim_V01/Simulation/AviMjpegWriter.vb+++ /dev/null@@ -1,199 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.IO-Imports System.Text--''' <summary>-''' Writes a video as an AVI file with Motion JPEG frames. Every frame is given as an ordinary JPEG image.-''' No codec or external program is needed. VLC and most video editors play the file; a program like-''' ffmpeg can convert it to MP4.-'''-''' File layout (all numbers little endian):-''' RIFF 'AVI ' [ LIST 'hdrl' [ 'avih' (56) LIST 'strl' [ 'strh' (56) 'strf' (40) ] ]-''' LIST 'movi' [ '00dc' frame ... ] 'idx1' index ]-''' The sizes and the frame count are written when the file is closed.-''' </summary>-Friend NotInheritable Class AviMjpegWriter- Implements IDisposable-- ' AVI files are limited to 4 GB (unsigned 32 bit sizes); stop before that- Private Const MaxFileSize As Long = 3900000000L-- ' positions of the numbers that are filled in at the end- Private Const PosRiffSize As Long = 4- Private Const PosTotalFrames As Long = 48- Private Const PosBufferSize As Long = 60- Private Const PosStreamLength As Long = 140- Private Const PosStreamBufferSize As Long = 144- Private Const PosMoviSize As Long = 216- Private Const PosMoviTag As Long = 220-- Private _stream As FileStream- Private _writer As BinaryWriter- Private ReadOnly _offsets As New List(Of Integer)()- Private ReadOnly _sizes As New List(Of Integer)()- Private _largestFrame As Integer- Private _closed As Boolean-- Public Sub New(filePath As String, width As Integer, height As Integer, framesPerSecond As Integer)- _stream = New FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read)- _writer = New BinaryWriter(_stream)-- Dim ascii As Encoding = Encoding.ASCII-- _writer.Write(ascii.GetBytes("RIFF"))- _writer.Write(0UI) ' file size - 8, filled in at the end- _writer.Write(ascii.GetBytes("AVI "))-- _writer.Write(ascii.GetBytes("LIST"))- _writer.Write(192UI) ' 'hdrl' + avih chunk (64) + strl list chunk (124)- _writer.Write(ascii.GetBytes("hdrl"))-- ' main header- _writer.Write(ascii.GetBytes("avih"))- _writer.Write(56UI)- _writer.Write(CUInt(1000000 \ framesPerSecond)) ' microseconds per frame- _writer.Write(0UI) ' maximum bytes per second- _writer.Write(0UI) ' padding granularity- _writer.Write(&H10UI) ' flags: has index- _writer.Write(0UI) ' total frames, filled in at the end- _writer.Write(0UI) ' initial frames- _writer.Write(1UI) ' streams- _writer.Write(0UI) ' suggested buffer size, filled in at the end- _writer.Write(CUInt(width))- _writer.Write(CUInt(height))- For i As Integer = 0 To 3- _writer.Write(0UI) ' reserved- Next-- ' the video stream- _writer.Write(ascii.GetBytes("LIST"))- _writer.Write(116UI) ' 'strl' + strh chunk (64) + strf chunk (48)- _writer.Write(ascii.GetBytes("strl"))-- _writer.Write(ascii.GetBytes("strh"))- _writer.Write(56UI)- _writer.Write(ascii.GetBytes("vids"))- _writer.Write(ascii.GetBytes("MJPG"))- _writer.Write(0UI) ' flags- _writer.Write(0US) ' priority- _writer.Write(0US) ' language- _writer.Write(0UI) ' initial frames- _writer.Write(1UI) ' scale- _writer.Write(CUInt(framesPerSecond)) ' rate: frames per second = rate / scale- _writer.Write(0UI) ' start- _writer.Write(0UI) ' length in frames, filled in at the end- _writer.Write(0UI) ' suggested buffer size, filled in at the end- _writer.Write(&HFFFFFFFFUI) ' quality: default- _writer.Write(0UI) ' sample size- _writer.Write(0US) ' frame rectangle: left, top, right, bottom- _writer.Write(0US)- _writer.Write(CUShort(width))- _writer.Write(CUShort(height))-- _writer.Write(ascii.GetBytes("strf")) ' BITMAPINFOHEADER- _writer.Write(40UI)- _writer.Write(40UI) ' structure size- _writer.Write(width)- _writer.Write(height)- _writer.Write(1US) ' planes- _writer.Write(24US) ' bits per pixel- _writer.Write(ascii.GetBytes("MJPG"))- _writer.Write(CUInt(CLng(width) * height * 3L And &HFFFFFFFFL))- _writer.Write(0) ' pixels per meter- _writer.Write(0)- _writer.Write(0UI) ' colors used- _writer.Write(0UI) ' important colors-- _writer.Write(ascii.GetBytes("LIST"))- _writer.Write(0UI) ' size of the movie list, filled in at the end- _writer.Write(ascii.GetBytes("movi"))- End Sub-- ''' <summary>The number of frames written so far.</summary>- Public ReadOnly Property FrameCount As Integer- Get- Return _offsets.Count- End Get- End Property-- ''' <summary>Adds one frame: the first length bytes of data are a complete JPEG image.</summary>- Public Sub AddFrame(data As Byte(), length As Integer)- If _closed Then Throw New InvalidOperationException("The video file is already closed.")-- ' room for this frame and the index (16 bytes per frame)- If _stream.Position + length + 16L * (_offsets.Count + 2) + 64L > MaxFileSize Then- Throw New IOException("The video file would become larger than 4 GB, which the AVI format does not allow.")- End If-- _offsets.Add(CInt(_stream.Position - PosMoviTag))- _sizes.Add(length)- _writer.Write(Encoding.ASCII.GetBytes("00dc"))- _writer.Write(CUInt(length))- _writer.Write(data, 0, length)- If (length And 1) = 1 Then _writer.Write(CByte(0)) ' chunks are padded to an even size- If length > _largestFrame Then _largestFrame = length- End Sub-- ''' <summary>Writes the index and the sizes and closes the file.</summary>- Public Sub Close()- If _closed Then Return- _closed = True-- Try- Dim moviEnd As Long = _stream.Position-- _writer.Write(Encoding.ASCII.GetBytes("idx1"))- _writer.Write(CUInt(16 * _offsets.Count))- For i As Integer = 0 To _offsets.Count - 1- _writer.Write(Encoding.ASCII.GetBytes("00dc"))- _writer.Write(&H10UI) ' key frame- _writer.Write(CUInt(_offsets(i)))- _writer.Write(CUInt(_sizes(i)))- Next- Dim fileEnd As Long = _stream.Position-- Patch(PosRiffSize, CUInt(fileEnd - 8L))- Patch(PosTotalFrames, CUInt(_offsets.Count))- Patch(PosBufferSize, CUInt(_largestFrame))- Patch(PosStreamLength, CUInt(_offsets.Count))- Patch(PosStreamBufferSize, CUInt(_largestFrame))- Patch(PosMoviSize, CUInt(moviEnd - PosMoviSize))- _writer.Flush()- Finally- _writer.Close()- _stream.Dispose()- End Try- End Sub-- Private Sub Patch(position As Long, value As UInteger)- _stream.Seek(position, SeekOrigin.Begin)- _writer.Write(value)- End Sub-- Public Sub Dispose() Implements IDisposable.Dispose- Close()- End Sub--End Classdiff --git a/2D_wave_sim_V01/Simulation/FrameRenderer.vb b/2D_wave_sim_V01/Simulation/FrameRenderer.vbdeleted file mode 100644index af6f210..0000000--- a/2D_wave_sim_V01/Simulation/FrameRenderer.vb+++ /dev/null@@ -1,197 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.-'-' Portions of this file are based on WaveSimulator2D by 0x23-' <https://github.com/0x23/WaveSimulator2D>.--Option Strict On-Option Explicit On--Imports System.Drawing-Imports System.Drawing.Imaging-Imports System.Runtime.InteropServices-Imports System.Threading.Tasks--''' <summary>-''' Turns the field or the intensity of a wave engine (CPU or GPU) into pixels, like WaveVisualizer.render_field and-''' render_intensity: the value is converted to a table index (see ColorLut) and the index to a color.-''' Without a color table (Nothing) the index itself is used as gray level.-''' The picture can be smaller than the simulation (a preview): every picture pixel then takes the nearest-''' simulation pixel.-''' </summary>-Friend NotInheritable Class FrameRenderer-- Private Sub New()- End Sub-- ''' <summary>Renders the field into pixels (packed ARGB, row by row, dw x dh).</summary>- Public Shared Sub RenderField(sim As IWaveEngine, lut As Integer(), brightness As Single, pixels As Integer(), dw As Integer, dh As Integer)- Dim u As Single() = sim.FieldData- Dim stride As Integer = sim.Stride- Dim sw As Integer = sim.Width- Dim sh As Integer = sim.Height-- Parallel.For(0, dh,- Sub(y As Integer)- Dim srcRow As Integer = (CInt(CLng(y) * sh \ dh) + 1) * stride + 1- Dim dst As Integer = y * dw- For x As Integer = 0 To dw - 1- Dim v As Single = u(srcRow + CInt(CLng(x) * sw \ dw))- pixels(dst + x) = Colorize(ColorLut.FieldIndex(v, brightness), lut)- Next- End Sub)- End Sub-- ''' <summary>Renders the intensity (exponent 0.5, as in the Python code) into pixels (packed ARGB, dw x dh).</summary>- Public Shared Sub RenderIntensity(sim As IWaveEngine, lut As Integer(), brightness As Single, pixels As Integer(), dw As Integer, dh As Integer)- Dim inten As Single() = sim.IntensityData- Dim stride As Integer = sim.Stride- Dim sw As Integer = sim.Width- Dim sh As Integer = sim.Height-- Parallel.For(0, dh,- Sub(y As Integer)- Dim srcRow As Integer = (CInt(CLng(y) * sh \ dh) + 1) * stride + 1- Dim dst As Integer = y * dw- For x As Integer = 0 To dw - 1- Dim v As Single = inten(srcRow + CInt(CLng(x) * sw \ dw))- Dim index As Integer = 0- If v > 0.0F Then- Dim s As Double = Math.Sqrt(v) * brightness- If s > 1.0 Then s = 1.0- index = CInt(Math.Truncate(s * 254.0))- End If- pixels(dst + x) = Colorize(index, lut)- Next- End Sub)- End Sub-- Private Shared Function Colorize(index As Integer, lut As Integer()) As Integer- If lut IsNot Nothing Then Return lut(index)- Return &HFF000000 Or (index << 16) Or (index << 8) Or index- End Function-- ''' <summary>Reads bmp into a flat array of R,G,B byte triplets, row by row, resampled to exactly w x h (bmp is- ''' expected to already be that size in the one place this is used - SimulationJob.GlowOverlay in- ''' SimulationRunner - so this is just a format normalization, not a real resize). Used to additively blend- ''' Form1's "glowing edges" preview overlay into exported video frames - see AddOverlay.</summary>- Public Shared Function ToRgbBytes(bmp As Bitmap, w As Integer, h As Integer) As Byte()- Dim result(w * h * 3 - 1) As Byte- Using normalized As New Bitmap(w, h, PixelFormat.Format24bppRgb)- Using g As Graphics = Graphics.FromImage(normalized)- g.Clear(Color.Black)- g.DrawImageUnscaled(bmp, 0, 0)- End Using- Dim rect As New Rectangle(0, 0, w, h)- Dim data As BitmapData = normalized.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb)- Try- Dim stride As Integer = data.Stride- Dim raw(stride * h - 1) As Byte- Marshal.Copy(data.Scan0, raw, 0, raw.Length)- For y As Integer = 0 To h - 1- Dim rowSrc As Integer = y * stride- Dim rowDst As Integer = y * w * 3- For x As Integer = 0 To w - 1- Dim s As Integer = rowSrc + x * 3- Dim d As Integer = rowDst + x * 3- result(d) = raw(s)- result(d + 1) = raw(s + 1)- result(d + 2) = raw(s + 2)- Next- Next- Finally- normalized.UnlockBits(data)- End Try- End Using- Return result- End Function-- ''' <summary>- ''' overlayRgb (ToRgbBytes) with gain already multiplied into every byte and clamped to 255, so that- ''' AddOverlay's per-frame, per-pixel work is a plain add instead of repeating a floating-point multiply and- ''' a CInt conversion on the same bytes for every single exported frame - gain is fixed for the whole run- ''' (frozen at Start Simulation, like everything else in SimulationJob), so there is no reason to redo this- ''' more than once. Returns Nothing (AddOverlay then does nothing) when gain is 0 or below or there is no- ''' overlay to scale.- ''' </summary>- Public Shared Function ScaleOverlayRgb(overlayRgb As Byte(), gain As Double) As Byte()- If overlayRgb Is Nothing OrElse gain <= 0.0 Then Return Nothing-- Dim scaled(overlayRgb.Length - 1) As Byte- For i As Integer = 0 To overlayRgb.Length - 1- scaled(i) = CByte(Math.Min(255.0, overlayRgb(i) * gain))- Next- Return scaled- End Function-- ''' <summary>- ''' Additively blends a gain-prescaled overlay (ScaleOverlayRgb - B,G,R triplets, same w x h as pixels) into- ''' pixels (packed 0xAARRGGBB, as RenderField/RenderIntensity/Colorize produce), clamped to 255 per channel:- ''' never darkens, never touches the alpha byte, and a black overlay pixel (no edge there) leaves pixels- ''' untouched. Does nothing when there is no (prescaled) overlay. Parallelized by row like RenderField/- ''' RenderIntensity, since this runs once per exported video frame at full simulation resolution and was the- ''' actual cost of the glow-edges overlay on a video export - the live preview (Form1's own- ''' ComposeGlowOverlay, same multiply-then-add idea, kept separate since it runs on the UI thread against a- ''' Bitmap) is comparatively small and only runs a few times a second, so it was never the bottleneck.- ''' </summary>- Public Shared Sub AddOverlay(pixels As Integer(), scaledOverlayRgb As Byte(), w As Integer, h As Integer)- If scaledOverlayRgb Is Nothing Then Return-- Parallel.For(0, h,- Sub(y As Integer)- Dim rowPix As Integer = y * w- Dim rowRgb As Integer = y * w * 3- For x As Integer = 0 To w - 1- Dim o As Integer = rowRgb + x * 3- Dim ob As Integer = scaledOverlayRgb(o)- Dim og As Integer = scaledOverlayRgb(o + 1)- Dim orr As Integer = scaledOverlayRgb(o + 2)- If ob = 0 AndAlso og = 0 AndAlso orr = 0 Then Continue For-- Dim i As Integer = rowPix + x- Dim argb As Integer = pixels(i)- Dim a As Integer = argb And &HFF000000- Dim r As Integer = (argb >> 16) And &HFF- Dim gr As Integer = (argb >> 8) And &HFF- Dim b As Integer = argb And &HFF-- r = Math.Min(255, r + orr)- gr = Math.Min(255, gr + og)- b = Math.Min(255, b + ob)-- pixels(i) = a Or (r << 16) Or (gr << 8) Or b- Next- End Sub)- End Sub-- ''' <summary>Makes a bitmap from packed ARGB pixels. The caller disposes the bitmap.</summary>- Public Shared Function ToBitmap(pixels As Integer(), w As Integer, h As Integer) As Bitmap- Dim bmp As New Bitmap(w, h, PixelFormat.Format32bppArgb)- Dim data As BitmapData = bmp.LockBits(New Rectangle(0, 0, w, h), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb)- Try- For y As Integer = 0 To h - 1- Marshal.Copy(pixels, y * w, IntPtr.Add(data.Scan0, y * data.Stride), w)- Next- Finally- bmp.UnlockBits(data)- End Try- Return bmp- End Function--End Classdiff --git a/2D_wave_sim_V01/Simulation/FrameSink.vb b/2D_wave_sim_V01/Simulation/FrameSink.vbdeleted file mode 100644index 46e0137..0000000--- a/2D_wave_sim_V01/Simulation/FrameSink.vb+++ /dev/null@@ -1,98 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Drawing-Imports System.Drawing.Imaging-Imports System.IO--''' <summary>A video file that receives rendered frames (packed ARGB pixels, row by row).</summary>-Friend Interface IFrameSink- Inherits IDisposable-- ''' <summary>Adds one frame of the size the sink was opened with.</summary>- Sub AddPixels(pixels As Integer())-- ''' <summary>Finishes the file so that it can be played.</summary>- Sub Close()-- ''' <summary>The full path of the file.</summary>- ReadOnly Property FilePath As String-End Interface--''' <summary>-''' Video as an AVI file with Motion JPEG frames (see AviMjpegWriter). Needs no codec on this computer,-''' but Windows' own players do not play it; VLC does.-''' </summary>-Friend NotInheritable Class AviFrameSink- Implements IFrameSink-- Private Shared ReadOnly JpegCodec As ImageCodecInfo = FindJpegCodec()-- Private ReadOnly _jpegQuality As Long- Private ReadOnly _path As String- Private ReadOnly _writer As AviMjpegWriter- Private ReadOnly _width As Integer- Private ReadOnly _height As Integer- Private ReadOnly _buffer As New MemoryStream()-- Public Sub New(filePath As String, width As Integer, height As Integer, framesPerSecond As Integer, quality As Integer)- _jpegQuality = Math.Max(1, Math.Min(100, quality))- _path = filePath- _width = width- _height = height- _writer = New AviMjpegWriter(filePath, width, height, framesPerSecond)- End Sub-- Public ReadOnly Property FilePath As String Implements IFrameSink.FilePath- Get- Return _path- End Get- End Property-- Public Sub AddPixels(pixels As Integer()) Implements IFrameSink.AddPixels- Using bmp As Bitmap = FrameRenderer.ToBitmap(pixels, _width, _height)- _buffer.SetLength(0)- Using parameters As New EncoderParameters(1)- parameters.Param(0) = New EncoderParameter(System.Drawing.Imaging.Encoder.Quality, _jpegQuality)- bmp.Save(_buffer, JpegCodec, parameters)- End Using- _writer.AddFrame(_buffer.GetBuffer(), CInt(_buffer.Length))- End Using- End Sub-- Public Sub Close() Implements IFrameSink.Close- _writer.Close()- End Sub-- Public Sub Dispose() Implements IDisposable.Dispose- _writer.Close()- _buffer.Dispose()- End Sub-- Private Shared Function FindJpegCodec() As ImageCodecInfo- For Each codec As ImageCodecInfo In ImageCodecInfo.GetImageEncoders()- If codec.FormatID = ImageFormat.Jpeg.Guid Then Return codec- Next- Throw New InvalidOperationException("The JPEG encoder is not available on this computer.")- End Function--End Classdiff --git a/2D_wave_sim_V01/Simulation/GpuWaveSimulator.vb b/2D_wave_sim_V01/Simulation/GpuWaveSimulator.vbdeleted file mode 100644index 6ff9d21..0000000--- a/2D_wave_sim_V01/Simulation/GpuWaveSimulator.vb+++ /dev/null@@ -1,1152 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.-'-' Portions of this file are based on WaveSimulator2D by 0x23-' <https://github.com/0x23/WaveSimulator2D>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Text--''' <summary>-''' The 2D wave equation on the graphics card (through OpenCL), the same algorithm as WaveSimulator:-''' new u = u + (u - previous u) * d + laplacian * c^2 (3x3 kernel 0.066 / 0.184 / -1)-''' sources: u = u * 0.9 + sin(frequency * t) * amplitude * 0.1-''' intensity: two cascaded one-pole filters, I1 = I1 * alpha + u^2 * (1 - alpha), I2 = I2 * alpha + I1 * (1 - alpha),-''' blended (IntensityBlend) into what is shown/exported: Iout = (I1 * (1 - blend) + I2 * blend) * scale. alpha-''' is derived once per simulation - see WaveSimulator's class summary (why two stages and the blend, not the-''' single, fixed-0.98 filter shown above) and SimulationSettings.TimeDecayFactor's comment (why alpha); scale is-''' SimulationSettings.IntensityScale (why it exists)-''' The field, the previous field, c^2, d and the intensity stay in the memory of the graphics card; only when a-''' frame is drawn (PrepareFrame) the field and/or intensity are copied back. The arrays have the same layout as-''' those of the CPU engine (a border of one cell), so the same renderer draws both.-'''-''' Optionally (use4thOrderLaplacian), the wave_step kernel instead computes the Laplacian with a 4th order-''' accurate, 5-point "cross" stencil wherever there is room for it, the same as WaveSimulator.UpdateField on the-''' CPU (see that class's summary for why). Which form to use is baked into the generated kernel source as a-''' compile-time #define, not a runtime branch, so there is no extra cost when it is off.-'''-''' The 4th order stencil needs the same time sub-stepping as the CPU engine to stay stable, for the same reason-''' (see WaveSimulator's class summary): AdvanceOneStep launches the wave_step kernel _subSteps times instead of-''' once when _subSteps > 1, with c2 scaled by a c2Scale kernel argument (1.0F / _subSteps^2) and the d buffer-''' pre-scaled (on the host, once, at Build time) to its 1 / _subSteps-th root, so _subSteps kernel launches move-''' the field by exactly the same physical time and damping as one ordinary launch. The intensity buffer is only-''' updated (via the kernel's "track" argument) on the last of the _subSteps launches, so its own exponential-''' averaging still runs once per AdvanceOneStep call, matching the CPU engine and its own earlier calibration.-''' _subSteps is 1 (c2Scale exactly 1.0F, an exact no-op multiply, and the d buffer unchanged) whenever the 3x3-''' kernel is used or this scene's highest c^2 does not need sub-stepping - see ComputeSubSteps.-''' </summary>-Friend NotInheritable Class GpuWaveSimulator- Implements IWaveEngine-- Private ReadOnly _description As String- Private ReadOnly _width As Integer- Private ReadOnly _height As Integer- Private ReadOnly _stride As Integer- Private ReadOnly _cells As Integer- Private ReadOnly _track As Boolean- Private ReadOnly _sourceCount As Integer- Private ReadOnly _amplitude As Single- Private ReadOnly _use4thOrderLaplacian As Boolean- ' see the class summary; 1 (no sub-stepping) unless Use4thOrderLaplacian needs otherwise for this scene's c^2.- ' Set once, in Build (called from New) - not itself ReadOnly because VB.NET only allows a ReadOnly field to be- ' assigned directly inside the declaring class's constructor, not in a method (Build) that constructor calls.- Private _subSteps As Integer- ' 1.0F / _subSteps^2, or exactly 1.0F when _subSteps = 1 (a bit-for-bit no-op multiply in the kernel); see _subSteps- Private _c2Mult As Single- ' the intensity's exponential-average decay factor for this simulation (replaces the old fixed 0.98f in the- ' kernel), set once in Build - see WaveSimulator._intensityAlpha (CPU engine) for the identical computation- Private _intensityAlpha As Single- ' SimulationSettings.IntensityScale - see that property's comment and WaveSimulator._intensityScale (CPU engine)- Private _intensityScale As Single-- Private _context As IntPtr- Private _queue As IntPtr- Private _program As IntPtr-- ' Two field buffers that take turns as "current field" and "previous field"; there is a kernel for each turn- Private ReadOnly _field(1) As IntPtr- Private ReadOnly _stepKernel(1) As IntPtr- Private ReadOnly _sourceKernel(1) As IntPtr- Private _current As Integer-- Private _c2Buffer As IntPtr- Private _dBuffer As IntPtr- ' the second cascaded filter stage's recursive state - see the class summary and WaveSimulator._intensity (CPU- ' engine); used only inside wave_step, never read back - what is read back/probed is _intensityOutBuffer- Private _intensityBuffer As IntPtr- ' the first of the two cascaded exponential-filter stages that make up the intensity - see the class summary- ' and WaveSimulator._intensityStage1 (CPU engine); used only inside wave_step, never read back- Private _intensityStage1Buffer As IntPtr- ' the blend of _intensityStage1Buffer and _intensityBuffer (IntensityBlend) that is actually read back/probed -- ' see the class summary and WaveSimulator._intensityOut (CPU engine)- Private _intensityOutBuffer As IntPtr- Private _indexBuffer As IntPtr- Private _levelBuffer As IntPtr- Private _frequencyBuffer As IntPtr-- ' object sources (Sources tab): the flat list of generated point-source elements that are within the canvas,- ' one entry per element; the frequency table above (_frequencyBuffer, indexed by Level) is shared with the- ' image sources since both use the same level-to-frequency scale- Private ReadOnly _objSourceCount As Integer- Private ReadOnly _objSourceKernel(1) As IntPtr- Private _objIndexBuffer As IntPtr- Private _objLevelBuffer As IntPtr- Private _objAmplitudeBuffer As IntPtr- Private _objPhaseBuffer As IntPtr- Private _objModeBuffer As IntPtr- Private _objPulseShapeBuffer As IntPtr- Private _objOnWidthBuffer As IntPtr- ' the off-width currently in effect for each element, in cycles; read-write on the GPU (see apply_object_sources)- ' since an element with RandomizeOffWidthAmount > 0 redraws it there each time it completes a cycle- Private _objOffWidthBuffer As IntPtr- ' "detach source": the step at which each element stops driving the field (releasing its hold on it), or -1 to never- Private _objDetachStepBuffer As IntPtr- ' runtime state for off-width re-randomization (see SourceElement.RandomizeOffWidthAmount): the un-randomized- ' anchor each redraw is centered on, the per-element +/- spread (0 = never redraw), the cycle-clock value at- ' which each element's current off+on cycle started, and a per-element xorshift32 PRNG seed (kernel-side- ' reinterpreted as uint - only the entropy bits matter, not signedness)- Private _objOffWidthBaseBuffer As IntPtr- Private _objRandomizeOffWidthAmountBuffer As IntPtr- Private _objCycleAnchorBuffer As IntPtr- Private _objRngStateBuffer As IntPtr- Private ReadOnly _objGrid1D(0) As IntPtr-- Private ReadOnly _grid2D(1) As IntPtr- Private ReadOnly _grid1D(0) As IntPtr-- Private _hostField As Single()- Private _hostIntensity As Single()-- Private _time As Double- Private _sinceFinish As Integer- Private _released As Boolean-- ' the probes: a second small program measures them on the card.- ' Point probes: one value per step; the values wait in a history buffer until the next TakeProbeSamples- ' (or until the buffer is full).- Private Const ProbeRows As Integer = 2048- Private _deviceId As IntPtr- Private _probeSampler As ProbeSampler- Private _probeProgram As IntPtr- Private ReadOnly _probeKernel(1) As IntPtr- Private _pixelBuffer As IntPtr- Private _infoBuffer As IntPtr- Private _historyBuffer As IntPtr- Private _probeRow As Integer- Private ReadOnly _probeGrid(0) As IntPtr- Private ReadOnly _probeValues As New List(Of List(Of Single))()-- ' Line probes: the pixels of all lines in one list; the totals (integrated intensity) are kept on the card,- ' the profiles are gathered into a small buffer and copied back when they are asked for- Private ReadOnly _gatherKernel(1) As IntPtr- Private _accumulateKernel As IntPtr- Private _profilePixelBuffer As IntPtr- Private _profileModeBuffer As IntPtr- ' "start recording at step #" for the integrated line probes: one entry per pixel (same layout as _profilePixelBuffer/- ' _profileModeBuffer), so profile_accumulate can skip a pixel's contribution before its probe's start step- Private _profileStartFlagBuffer As IntPtr- Private _profileStartStepBuffer As IntPtr- Private _profileTotalBuffer As IntPtr- Private _profileOutBuffer As IntPtr- Private _profileCount As Integer- Private _profileIntegrates As Boolean- Private _profileStart As Integer()- Private ReadOnly _profileGrid(0) As IntPtr-- ''' <summary>- ''' Tries the GPUs one after the other, the best first. Returns Nothing when none works; <paramref name="problems"/>- ''' then tells why (or, when a later GPU did work, why the earlier ones did not).- ''' Throws DllNotFoundException when there is no OpenCL driver.- ''' </summary>- ''' <param name="use4thOrderLaplacian">See the class summary.</param>- ''' <param name="timeDecayFactor">SimulationSettings.TimeDecayFactor - see that property's comment.</param>- ''' <param name="intensityScale">SimulationSettings.IntensityScale - see that property's comment.</param>- ''' <param name="objectSources">The generated elements of the object sources (Sources tab), or Nothing/empty for none.</param>- Public Shared Function TryCreate(scene As SceneData, sourceFrequencyScale As Double, sourceAmplitude As Double,- trackIntensity As Boolean, use4thOrderLaplacian As Boolean, timeDecayFactor As Double,- intensityScale As Double,- ByRef problems As String,- Optional objectSources As List(Of SourceElement) = Nothing) As GpuWaveSimulator- problems = ""- Dim devices As List(Of GpuDeviceInfo) = GpuDeviceInfo.FindAll()- If devices.Count = 0 Then- problems = "no GPU found through OpenCL" & If(IntPtr.Size = 4, " (this is a 32-bit process; run the 64-bit build)", "")- Return Nothing- End If-- Dim messages As New StringBuilder()- For Each dev As GpuDeviceInfo In devices- Try- Return New GpuWaveSimulator(dev, scene, sourceFrequencyScale, sourceAmplitude, trackIntensity, use4thOrderLaplacian, timeDecayFactor, intensityScale, objectSources)- Catch ex As Exception- If messages.Length > 0 Then messages.Append("; ")- messages.Append(dev.Name).Append(": ").Append(ex.Message)- End Try- Next- problems = messages.ToString()- Return Nothing- End Function-- Private Sub New(device As GpuDeviceInfo, scene As SceneData, sourceFrequencyScale As Double,- sourceAmplitude As Double, trackIntensity As Boolean, use4thOrderLaplacian As Boolean,- timeDecayFactor As Double, intensityScale As Double,- Optional objectSources As List(Of SourceElement) = Nothing)- _description = "GPU: " & device.Name & " (OpenCL)"- _width = scene.Width- _height = scene.Height- _stride = _width + 2- _cells = _stride * (_height + 2)- _track = trackIntensity- _sourceCount = scene.SourceCount- _amplitude = CSng(sourceAmplitude)- _use4thOrderLaplacian = use4thOrderLaplacian-- If device.MaxAllocation > 0 AndAlso CLng(_cells) * 4L > device.MaxAllocation Then- Throw New InvalidOperationException("the scene is too large for this GPU")- End If-- ' object sources: keep only the elements whose position is inside the canvas (a randomized composite- ' element can fall outside), same filtering as the CPU engine (WaveSimulator)- Dim keptObjSources As New List(Of SourceElement)()- If objectSources IsNot Nothing Then- For Each el As SourceElement In objectSources- If el.PosX >= 0 AndAlso el.PosX < _width AndAlso el.PosY >= 0 AndAlso el.PosY < _height Then- keptObjSources.Add(el)- End If- Next- End If- _objSourceCount = keptObjSources.Count-- Try- Build(device, scene, sourceFrequencyScale, timeDecayFactor, intensityScale, keptObjSources)- Catch ex As Exception- ReleaseAll()- Throw- End Try- End Sub-- Private Sub Build(device As GpuDeviceInfo, scene As SceneData, sourceFrequencyScale As Double, timeDecayFactor As Double,- intensityScale As Double, objectSources As List(Of SourceElement))- Dim code As Integer = 0- _deviceId = device.DeviceId- Dim props() As IntPtr = {New IntPtr(OpenClApi.ContextPlatformProperty), device.PlatformId, IntPtr.Zero}- Dim devs() As IntPtr = {device.DeviceId}-- _context = OpenClApi.clCreateContext(props, 1UI, devs, IntPtr.Zero, IntPtr.Zero, code)- OpenClApi.Check(code, "clCreateContext")- _queue = OpenClApi.clCreateCommandQueue(_context, device.DeviceId, 0UL, code)- OpenClApi.Check(code, "clCreateCommandQueue")-- Dim sources() As String = {KernelSource(_use4thOrderLaplacian)}- _program = OpenClApi.clCreateProgramWithSource(_context, 1UI, sources, Nothing, code)- OpenClApi.Check(code, "clCreateProgramWithSource")- code = OpenClApi.clBuildProgram(_program, 1UI, devs, "", IntPtr.Zero, IntPtr.Zero)- If code <> 0 Then- Dim log As String = OpenClApi.BuildLog(_program, device.DeviceId)- Throw New InvalidOperationException("the program for the GPU could not be built (" & OpenClApi.ErrorName(code) & ")" &- If(log.Length > 0, ": " & log, ""))- End If-- ' the scene, with a border of one cell like the CPU engine- Dim c2 As Single() = New Single(_cells - 1) {}- Dim d As Single() = New Single(_cells - 1) {}- For y As Integer = 0 To _height - 1- Array.Copy(scene.C2, y * _width, c2, (y + 1) * _stride + 1, _width)- Array.Copy(scene.D, y * _width, d, (y + 1) * _stride + 1, _width)- Next-- ' see the class summary: sub-stepping keeps the 4th order stencil stable without changing the physical- ' wave speed or damping - _subSteps stays 1 (no sub-stepping) unless the 4th order stencil is in use and- ' this scene's highest c^2 actually needs it. The d buffer uploaded below is pre-scaled to match (its- ' 1 / _subSteps-th root, or unchanged when _subSteps = 1), same as WaveSimulator's _dEffective on the CPU.- Dim maxC2 As Single = 0.0F- If _use4thOrderLaplacian Then- For i As Integer = 0 To c2.Length - 1- If c2(i) > maxC2 Then maxC2 = c2(i)- Next- End If- _subSteps = If(_use4thOrderLaplacian, ComputeSubSteps(maxC2), 1)-- Dim dUpload As Single() = d- If _subSteps > 1 Then- Dim dEff As Single() = New Single(d.Length - 1) {}- Dim invN As Double = 1.0 / _subSteps- For i As Integer = 0 To d.Length - 1- dEff(i) = CSng(Math.Pow(CDbl(d(i)), invN))- Next- dUpload = dEff- _c2Mult = 1.0F / CSng(_subSteps * _subSteps)- Else- _c2Mult = 1.0F- End If-- _c2Buffer = CreateFloatBuffer(c2)- _dBuffer = CreateFloatBuffer(dUpload)-- Dim zeros As Single() = New Single(_cells - 1) {}- _field(0) = CreateFloatBuffer(zeros)- _field(1) = CreateFloatBuffer(zeros)- If _track Then- _intensityBuffer = CreateFloatBuffer(zeros)- _intensityStage1Buffer = CreateFloatBuffer(zeros)- _intensityOutBuffer = CreateFloatBuffer(zeros)- Else- _intensityBuffer = CreateFloatBuffer(New Single(0) {})- _intensityStage1Buffer = CreateFloatBuffer(New Single(0) {})- _intensityOutBuffer = CreateFloatBuffer(New Single(0) {})- End If-- ' the level-to-frequency table (level 0-255 -> frequency), shared by the image sources and the object sources- If _sourceCount > 0 OrElse _objSourceCount > 0 Then- Dim frequency(255) As Single- For l As Integer = 0 To 255- frequency(l) = CSng(l / 255.0 * 0.5 * sourceFrequencyScale)- Next- _frequencyBuffer = CreateFloatBuffer(frequency)- End If-- ' the intensity's averaging time constant scales inversely with the frequency of the slowest active source- ' (image or object; a level of 0 means "no source" and is excluded) - see WaveSimulator's identical- ' computation (CPU engine) and TimeDecayFactor's comment (SimulationSettings.vb) for why- Dim minActiveLevel As Integer = 0- For i As Integer = 0 To _sourceCount - 1- Dim lv As Integer = CInt(scene.SourceLevel(i))- If lv > 0 AndAlso (minActiveLevel = 0 OrElse lv < minActiveLevel) Then minActiveLevel = lv- Next- For Each el As SourceElement In objectSources- If el.Level > 0 AndAlso (minActiveLevel = 0 OrElse el.Level < minActiveLevel) Then minActiveLevel = el.Level- Next- Const NominalDecayLevel As Integer = 100 ' see WaveSimulator.NominalDecayLevel (CPU engine)- If minActiveLevel = 0 Then minActiveLevel = NominalDecayLevel- Dim tauSteps As Double = Math.Max(1.0, timeDecayFactor * NominalDecayLevel / minActiveLevel)- _intensityAlpha = CSng(Math.Exp(-1.0 / tauSteps))- _intensityScale = CSng(intensityScale)-- ' the image sources (from the green channel of the scene image)- If _sourceCount > 0 Then- Dim index(_sourceCount - 1) As Integer- Dim level(_sourceCount - 1) As Integer- For i As Integer = 0 To _sourceCount - 1- index(i) = (scene.SourceY(i) + 1) * _stride + scene.SourceX(i) + 1- level(i) = CInt(scene.SourceLevel(i))- Next- _indexBuffer = CreateIntBuffer(index)- _levelBuffer = CreateIntBuffer(level)- End If-- ' the object sources (Sources tab)- If _objSourceCount > 0 Then- Dim objIndex(_objSourceCount - 1) As Integer- Dim objLevel(_objSourceCount - 1) As Integer- Dim objAmplitude(_objSourceCount - 1) As Single- Dim objPhase(_objSourceCount - 1) As Single- Dim objMode(_objSourceCount - 1) As Integer- Dim objPulseShape(_objSourceCount - 1) As Integer- Dim objOnWidth(_objSourceCount - 1) As Integer- Dim objOffWidth(_objSourceCount - 1) As Integer- Dim objDetachStep(_objSourceCount - 1) As Integer- Dim objOffWidthBase(_objSourceCount - 1) As Integer- Dim objRandomizeOffWidthAmount(_objSourceCount - 1) As Integer- Dim objCycleAnchor(_objSourceCount - 1) As Single- Dim objRngState(_objSourceCount - 1) As Integer- ' a local, host-side RNG just to seed each element's on-GPU xorshift32 generator - xorshift needs a- ' nonzero starting state, so 0 is never allowed- Dim seedRng As New Random()- For i As Integer = 0 To _objSourceCount - 1- Dim el As SourceElement = objectSources(i)- objIndex(i) = (el.PosY + 1) * _stride + el.PosX + 1- objLevel(i) = el.Level- objAmplitude(i) = CSng(el.Amplitude)- objPhase(i) = CSng(el.PhaseRad)- objMode(i) = If(el.Mode = SourceMode.Pulsed, 1, 0)- objPulseShape(i) = If(el.PulseShape = SourcePulseShape.SmoothedSquare, 1, 0)- objOnWidth(i) = el.OnWidthCycles- objOffWidth(i) = el.OffWidthCycles- objDetachStep(i) = el.DetachAfterStep- objOffWidthBase(i) = el.OffWidthBase- objRandomizeOffWidthAmount(i) = el.RandomizeOffWidthAmount- objCycleAnchor(i) = 0.0F- Dim seed As Integer = seedRng.Next(Integer.MinValue, Integer.MaxValue)- If seed = 0 Then seed = 1- objRngState(i) = seed- Next- _objIndexBuffer = CreateIntBuffer(objIndex)- _objLevelBuffer = CreateIntBuffer(objLevel)- _objAmplitudeBuffer = CreateFloatBuffer(objAmplitude)- _objPhaseBuffer = CreateFloatBuffer(objPhase)- _objModeBuffer = CreateIntBuffer(objMode)- _objPulseShapeBuffer = CreateIntBuffer(objPulseShape)- _objOnWidthBuffer = CreateIntBuffer(objOnWidth)- _objOffWidthBuffer = CreateIntBuffer(objOffWidth)- _objDetachStepBuffer = CreateIntBuffer(objDetachStep)- _objOffWidthBaseBuffer = CreateIntBuffer(objOffWidthBase)- _objRandomizeOffWidthAmountBuffer = CreateIntBuffer(objRandomizeOffWidthAmount)- _objCycleAnchorBuffer = CreateFloatBuffer(objCycleAnchor)- _objRngStateBuffer = CreateIntBuffer(objRngState)- End If-- ' the kernels; kernel k reads field buffer k and writes into buffer 1 - k- For k As Integer = 0 To 1- _stepKernel(k) = CreateKernel("wave_step")- SetMem(_stepKernel(k), 0UI, _field(k))- SetMem(_stepKernel(k), 1UI, _field(1 - k))- SetMem(_stepKernel(k), 2UI, _c2Buffer)- SetMem(_stepKernel(k), 3UI, _dBuffer)- SetMem(_stepKernel(k), 4UI, _intensityBuffer)- SetInt(_stepKernel(k), 5UI, _width)- SetInt(_stepKernel(k), 6UI, _height)- SetInt(_stepKernel(k), 7UI, _stride)- SetInt(_stepKernel(k), 8UI, If(_track, 1, 0))- SetFloat(_stepKernel(k), 9UI, _c2Mult)- SetFloat(_stepKernel(k), 10UI, _intensityAlpha)- SetMem(_stepKernel(k), 11UI, _intensityStage1Buffer)- SetMem(_stepKernel(k), 12UI, _intensityOutBuffer)- SetFloat(_stepKernel(k), 13UI, _intensityScale)-- If _sourceCount > 0 Then- _sourceKernel(k) = CreateKernel("apply_sources")- SetMem(_sourceKernel(k), 0UI, _field(k))- SetMem(_sourceKernel(k), 1UI, _indexBuffer)- SetMem(_sourceKernel(k), 2UI, _levelBuffer)- SetMem(_sourceKernel(k), 3UI, _frequencyBuffer)- SetFloat(_sourceKernel(k), 5UI, _amplitude)- SetInt(_sourceKernel(k), 6UI, _sourceCount)- End If-- If _objSourceCount > 0 Then- _objSourceKernel(k) = CreateKernel("apply_object_sources")- SetMem(_objSourceKernel(k), 0UI, _field(k))- SetMem(_objSourceKernel(k), 1UI, _objIndexBuffer)- SetMem(_objSourceKernel(k), 2UI, _objLevelBuffer)- SetMem(_objSourceKernel(k), 3UI, _objAmplitudeBuffer)- SetMem(_objSourceKernel(k), 4UI, _objPhaseBuffer)- SetMem(_objSourceKernel(k), 5UI, _objModeBuffer)- SetMem(_objSourceKernel(k), 6UI, _objPulseShapeBuffer)- SetMem(_objSourceKernel(k), 7UI, _objOnWidthBuffer)- SetMem(_objSourceKernel(k), 8UI, _objOffWidthBuffer)- SetMem(_objSourceKernel(k), 9UI, _objDetachStepBuffer)- SetMem(_objSourceKernel(k), 10UI, _frequencyBuffer)- SetInt(_objSourceKernel(k), 12UI, _objSourceCount)- ' appended at the end rather than renumbering 0-12, so every SetMem/SetInt call above (and the- ' per-call SetFloat for t at index 11 in AdvanceOneStep) keeps its existing, already-correct index- SetMem(_objSourceKernel(k), 13UI, _objOffWidthBaseBuffer)- SetMem(_objSourceKernel(k), 14UI, _objRandomizeOffWidthAmountBuffer)- SetMem(_objSourceKernel(k), 15UI, _objCycleAnchorBuffer)- SetMem(_objSourceKernel(k), 16UI, _objRngStateBuffer)- End If- Next-- _grid2D(0) = New IntPtr(_width)- _grid2D(1) = New IntPtr(_height)- _grid1D(0) = New IntPtr(Math.Max(1, _sourceCount))- _objGrid1D(0) = New IntPtr(Math.Max(1, _objSourceCount))-- _hostField = New Single(_cells - 1) {}- If _track Then _hostIntensity = New Single(_cells - 1) {}- _current = 0- End Sub-- ''' <summary>- ''' The number of smaller time steps (see the class summary) that keep c2 * |lambda max| of the 4th order- ''' stencil under the same target margin as WaveSimulator.ComputeSubSteps on the CPU (identical formula);- ''' 1 when that is already true for the given (highest, in this scene) c^2.- ''' </summary>- Private Shared Function ComputeSubSteps(maxC2 As Single) As Integer- ' the 4th order stencil's largest |eigenvalue| (32/3) and the same stability safety margin (2.0) as- ' WaveSimulator.FourthOrderLambdaMax / SubStepTargetLimit on the CPU - see that class's comments- Const LambdaMax4th As Single = 32.0F / 3.0F- Const TargetLimit As Single = 2.0F- If maxC2 <= 0.0F Then Return 1- Dim n As Double = Math.Ceiling(Math.Sqrt(CDbl(maxC2) * CDbl(LambdaMax4th) / CDbl(TargetLimit)))- Return Math.Max(1, CInt(n))- End Function-- ''' <summary>- ''' The OpenCL C code of the two kernels. use4thOrderLaplacian selects, at compile time (a #define, not a- ''' runtime branch), which form of the Laplacian wave_step uses - see the class summary and- ''' WaveSimulator.UpdateField, whose CPU-side stencils and boundary logic this mirrors exactly. wave_step's- ''' c2Scale argument is the sub-stepping scale (see the class summary), and its intensityAlpha argument is the- ''' intensity's exponential-average decay factor (_intensityAlpha) - both are runtime kernel arguments rather- ''' than a #define, so they need no text formatting/locale handling here.- ''' </summary>- Private Shared Function KernelSource(use4thOrderLaplacian As Boolean) As String- Dim s As New StringBuilder()- s.AppendLine("#define USE_4TH_ORDER " & If(use4thOrderLaplacian, "1", "0"))- s.AppendLine()- s.AppendLine("__kernel void wave_step(__global const float* u, __global float* up, __global const float* c2,")- s.AppendLine(" __global const float* d, __global float* inten,")- s.AppendLine(" const int w, const int h, const int stride, const int track, const float c2Scale,")- s.AppendLine(" const float intensityAlpha, __global float* inten1, __global float* intenOut,")- s.AppendLine(" const float intensityScale)")- s.AppendLine("{")- s.AppendLine(" int x = get_global_id(0);")- s.AppendLine(" int y = get_global_id(1);")- s.AppendLine(" if (x >= w || y >= h) return;")- s.AppendLine(" int i = (y + 1) * stride + x + 1;")- s.AppendLine(" float uc = u[i];")- s.AppendLine(" float lap;")- s.AppendLine("#if USE_4TH_ORDER")- ' the 4th order 5-point "cross" stencil (reaches 2 cells away along x and along y), only where the domain- ' has that much room - the outermost ring (x = 0, x = w - 1, y = 0, y = h - 1) falls back to the 3x3- ' kernel below, the same boundary rule as WaveSimulator.UpdateField on the CPU- s.AppendLine(" if (x >= 1 && x <= w - 2 && y >= 1 && y <= h - 2) {")- s.AppendLine(" lap = (-1.0f / 12.0f) * (u[i - 2] + u[i + 2] + u[i - 2 * stride] + u[i + 2 * stride])")- s.AppendLine(" + (4.0f / 3.0f) * (u[i - 1] + u[i + 1] + u[i - stride] + u[i + stride])")- s.AppendLine(" - 5.0f * uc;")- s.AppendLine(" } else {")- s.AppendLine(" lap = 0.066f * (u[i - stride - 1] + u[i - stride + 1] + u[i + stride - 1] + u[i + stride + 1])")- s.AppendLine(" + 0.184f * (u[i - 1] + u[i + 1] + u[i - stride] + u[i + stride]) - uc;")- s.AppendLine(" }")- s.AppendLine("#else")- s.AppendLine(" lap = 0.066f * (u[i - stride - 1] + u[i - stride + 1] + u[i + stride - 1] + u[i + stride + 1])")- s.AppendLine(" + 0.184f * (u[i - 1] + u[i + 1] + u[i - stride] + u[i + stride]) - uc;")- s.AppendLine("#endif")- s.AppendLine(" float nv = uc + (uc - up[i]) * d[i] + lap * c2[i] * c2Scale;")- s.AppendLine(" up[i] = nv;")- ' two cascaded one-pole stages, blended (0.5f - see WaveSimulator.IntensityBlend, CPU engine) into what is- ' read back/probed (intenOut) instead of using the full 2-stage cascade outright - see the class summary- s.AppendLine(" if (track != 0) {")- s.AppendLine(" float s1 = inten1[i] * intensityAlpha + nv * nv * (1.0f - intensityAlpha);")- s.AppendLine(" inten1[i] = s1;")- s.AppendLine(" float s2 = inten[i] * intensityAlpha + s1 * (1.0f - intensityAlpha);")- s.AppendLine(" inten[i] = s2;")- s.AppendLine(" intenOut[i] = (s1 * 0.5f + s2 * 0.5f) * intensityScale;")- s.AppendLine(" }")- s.AppendLine("}")- s.AppendLine()- s.AppendLine("__kernel void apply_sources(__global float* u, __global const int* idx, __global const int* level,")- s.AppendLine(" __global const float* freq, const float t, const float amp, const int n)")- s.AppendLine("{")- s.AppendLine(" int k = get_global_id(0);")- s.AppendLine(" if (k >= n) return;")- s.AppendLine(" int p = idx[k];")- s.AppendLine(" u[p] = u[p] * 0.9f + sin(freq[level[k]] * t) * amp * 0.1f;")- s.AppendLine("}")- s.AppendLine()- ' xorshift32: OpenCL has no built-in RNG, so object sources that re-randomize their off-width (see- ' SourceElement.RandomizeOffWidthAmount) carry their own per-element state (rngState, seeded host-side,- ' nonzero) through this. Matches WaveSimulator's use of SourceSettings.RandomInt only in spirit (a uniform- ' draw in [-amount, amount]), not bit-for-bit - the two engines are not expected to reproduce each other.- s.AppendLine("inline uint xorshift32(uint x)")- s.AppendLine("{")- s.AppendLine(" x ^= x << 13;")- s.AppendLine(" x ^= x >> 17;")- s.AppendLine(" x ^= x << 5;")- s.AppendLine(" return x;")- s.AppendLine("}")- s.AppendLine()- ' object sources (Sources tab): same math as WaveSimulator.ApplySources/ComputePulsePosition/PulseEnvelope- ' on the CPU, one element per work item; mode 0 = continuous (envelope always 1), 1 = pulsed (Gaussian or- ' smoothed-square envelope, "off" preceding "on" within each onWidth/offWidth cycle of the element's own- ' frequency). offWidth is read-write: for an element with offWidthRandomizeAmount[k] > 0 this kernel redraws- ' it (uniformly within +/- offWidthRandomizeAmount of offWidthBase) every time that element completes a full- ' off+on cycle, advancing its own cycleAnchor[k] to mark where the new cycle started - so, unlike the other- ' object-source buffers, offWidth/cycleAnchor/rngState are genuinely mutated by the GPU across steps.- s.AppendLine("__kernel void apply_object_sources(__global float* u, __global const int* idx, __global const int* level,")- s.AppendLine(" __global const float* amp, __global const float* phase, __global const int* mode,")- s.AppendLine(" __global const int* pulseShape, __global const int* onWidth, __global int* offWidth,")- s.AppendLine(" __global const int* detachStep,")- s.AppendLine(" __global const float* freq, const float t, const int n,")- s.AppendLine(" __global const int* offWidthBase, __global const int* offWidthRandomizeAmount,")- s.AppendLine(" __global float* cycleAnchor, __global int* rngState)")- s.AppendLine("{")- s.AppendLine(" int k = get_global_id(0);")- s.AppendLine(" if (k >= n) return;")- ' "detach source": once the run reaches the element's detach step, its drive is faded out linearly over the- ' next DetachRampSteps steps (rather than cut instantly), then it stops driving the field entirely (not even- ' writing towards 0) so it releases its hold and stops diffracting waves through that point - matching- ' WaveSimulator.ApplySources exactly (SourceElement.DetachRampSteps is the single shared constant).- s.AppendLine(" float detachFade = 1.0f;")- s.AppendLine(" if (detachStep[k] >= 0) {")- s.AppendLine(" float stepsSinceDetach = t - (float)detachStep[k];")- s.AppendLine(" if (stepsSinceDetach >= " & SourceElement.DetachRampSteps.ToString() & ".0f) return;")- s.AppendLine(" if (stepsSinceDetach > 0.0f) detachFade = 1.0f - stepsSinceDetach / " & SourceElement.DetachRampSteps.ToString() & ".0f;")- s.AppendLine(" }")- s.AppendLine(" float f = freq[level[k]];")- s.AppendLine(" float envelope = 1.0f;")- s.AppendLine(" if (mode[k] != 0) {")- s.AppendLine(" int ow = offWidth[k];")- s.AppendLine(" int period = onWidth[k] + ow;")- s.AppendLine(" if (period > 0) {")- s.AppendLine(" float cycleClock = f * t / (2.0f * M_PI_F);")- s.AppendLine(" float pos;")- s.AppendLine(" int isFirstCycle;")- s.AppendLine(" if (offWidthRandomizeAmount[k] <= 0) {")- ' shifted so t = 0 lands at pos = ow (the start of the "on" span), not pos = 0 (the start of an "off" span) -- ' a single/non-randomized source starting silent for its off-width was never the intent (see- ' WaveSimulator.ComputePulsePosition, kept in exact agreement with this kernel)- s.AppendLine(" float adjustedClock = cycleClock + (float)ow;")- s.AppendLine(" isFirstCycle = (floor(adjustedClock / (float)period) == 0.0f) ? 1 : 0;")- s.AppendLine(" pos = adjustedClock - period * floor(adjustedClock / (float)period);")- s.AppendLine(" } else {")- s.AppendLine(" pos = cycleClock - cycleAnchor[k];")- s.AppendLine(" int guard = 0;")- s.AppendLine(" while (pos >= (float)period && guard < 1000) {")- s.AppendLine(" cycleAnchor[k] += (float)period;")- s.AppendLine(" pos -= (float)period;")- s.AppendLine(" uint state = xorshift32((uint)rngState[k]);")- s.AppendLine(" rngState[k] = (int)state;")- s.AppendLine(" int amt = offWidthRandomizeAmount[k];")- s.AppendLine(" int span = 2 * amt + 1;")- s.AppendLine(" int r = (int)(state % (uint)span) - amt;")- s.AppendLine(" ow = offWidthBase[k] + r;")- s.AppendLine(" if (ow < 1) ow = 1;")- s.AppendLine(" offWidth[k] = ow;")- s.AppendLine(" period = onWidth[k] + ow;")- s.AppendLine(" guard++;")- s.AppendLine(" }")- s.AppendLine(" if (pos < 0.0f) pos = 0.0f;")- ' the anchor only ever advances (above) once a cycle has actually completed, so it still reading its initial- ' 0 means no cycle has completed yet - we are still in the element's very first (off-first) cycle- s.AppendLine(" isFirstCycle = (cycleAnchor[k] == 0.0f) ? 1 : 0;")- s.AppendLine(" }")- s.AppendLine(" if (pulseShape[k] == 0) {")- s.AppendLine(" if (pos < (float)ow) {")- s.AppendLine(" envelope = 0.0f;")- s.AppendLine(" } else {")- s.AppendLine(" float onPos = pos - (float)ow;")- s.AppendLine(" float center = onWidth[k] / 2.0f;")- s.AppendLine(" float sigma = max(onWidth[k] / 6.0f, 1.0e-6f);")- s.AppendLine(" float dd = (onPos - center) / sigma;")- s.AppendLine(" envelope = exp(-0.5f * dd * dd);")- s.AppendLine(" }")- s.AppendLine(" } else {")- s.AppendLine(" // a flat-topped pulse (envelope 1 while on, 0 while off) with a short, FIXED-width")- s.AppendLine(" // (in cycles) smoothed edge at the rise and the fall - fixed, so a long off span")- s.AppendLine(" // sits at (very close to) 0 for nearly all of it instead of lingering. The math is")- s.AppendLine(" // exactly the on-first formula, fed a coordinate shifted so the on span starts at 0.")- s.AppendLine(" float shifted = pos - (float)ow;")- ' wrapping shifted forward by a full period makes it continue the falling tail of the on-span that JUST- ' ended - correct from the second off-span onward, where that on-span really happened. The very first- ' off-span (isFirstCycle) has no real preceding on-emission to continue from, so wrapping there would- ' fabricate one: pos = 0 would land exactly on that phantom falling edge and start the run at envelope ~0.5- ' instead of ~0, emitting a spurious one-cycle "blip" before the source actually goes quiet. Left un-wrapped- ' (deeply negative) instead, dRise/dFall below correctly place it far from both edges, keeping the envelope- ' at (very close to) 0 until the real rising edge - matching WaveSimulator.PulseEnvelope exactly.- s.AppendLine(" if (shifted < 0.0f && !isFirstCycle) shifted += (float)period;")- s.AppendLine(" float edgeWidth = 0.35f;")- s.AppendLine(" float dFall = shifted - (float)onWidth[k];")- s.AppendLine(" float dRise = shifted;")- s.AppendLine(" if (dRise > (float)period / 2.0f) dRise -= (float)period;")- s.AppendLine(" float rising = 0.5f + atan(dRise / edgeWidth) / M_PI_F;")- s.AppendLine(" float falling = 0.5f - atan(dFall / edgeWidth) / M_PI_F;")- s.AppendLine(" envelope = rising * falling;")- s.AppendLine(" }")- s.AppendLine(" }")- s.AppendLine(" }")- s.AppendLine(" float v = sin(phase[k] + f * t) * amp[k] * envelope * detachFade;")- s.AppendLine(" int p = idx[k];")- s.AppendLine(" u[p] = u[p] * 0.9f + v * 0.1f;")- s.AppendLine("}")- Return s.ToString()- End Function-- ' ---- small OpenCL helpers-- Private Function CreateFloatBuffer(data As Single()) As IntPtr- Dim bytes As New IntPtr(CLng(data.Length) * 4L)- Dim code As Integer = 0- Dim buffer As IntPtr = OpenClApi.clCreateBuffer(_context, OpenClApi.MemReadWrite, bytes, IntPtr.Zero, code)- OpenClApi.Check(code, "clCreateBuffer")- OpenClApi.Check(OpenClApi.clEnqueueWriteBufferFloat(_queue, buffer, 1UI, IntPtr.Zero, bytes, data, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueWriteBuffer")- Return buffer- End Function-- Private Function CreateIntBuffer(data As Integer()) As IntPtr- Dim bytes As New IntPtr(CLng(data.Length) * 4L)- Dim code As Integer = 0- Dim buffer As IntPtr = OpenClApi.clCreateBuffer(_context, OpenClApi.MemReadWrite, bytes, IntPtr.Zero, code)- OpenClApi.Check(code, "clCreateBuffer")- OpenClApi.Check(OpenClApi.clEnqueueWriteBufferInt(_queue, buffer, 1UI, IntPtr.Zero, bytes, data, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueWriteBuffer")- Return buffer- End Function-- Private Function CreateKernel(name As String) As IntPtr- Return CreateKernelFrom(_program, name)- End Function-- Private Function CreateKernelFrom(program As IntPtr, name As String) As IntPtr- Dim code As Integer = 0- Dim kernel As IntPtr = OpenClApi.clCreateKernel(program, name, code)- OpenClApi.Check(code, "clCreateKernel " & name)- Return kernel- End Function-- Private Shared Sub SetMem(kernel As IntPtr, index As UInteger, value As IntPtr)- OpenClApi.Check(OpenClApi.clSetKernelArgMem(kernel, index, New IntPtr(IntPtr.Size), value), "clSetKernelArg")- End Sub-- Private Shared Sub SetInt(kernel As IntPtr, index As UInteger, value As Integer)- OpenClApi.Check(OpenClApi.clSetKernelArgInt(kernel, index, New IntPtr(4), value), "clSetKernelArg")- End Sub-- Private Shared Sub SetFloat(kernel As IntPtr, index As UInteger, value As Single)- OpenClApi.Check(OpenClApi.clSetKernelArgFloat(kernel, index, New IntPtr(4), value), "clSetKernelArg")- End Sub-- ' ---- IWaveEngine-- Public ReadOnly Property Description As String Implements IWaveEngine.Description- Get- Return _description- End Get- End Property-- Public ReadOnly Property Width As Integer Implements IWaveEngine.Width- Get- Return _width- End Get- End Property-- Public ReadOnly Property Height As Integer Implements IWaveEngine.Height- Get- Return _height- End Get- End Property-- Public ReadOnly Property Stride As Integer Implements IWaveEngine.Stride- Get- Return _stride- End Get- End Property-- Public ReadOnly Property FieldData As Single() Implements IWaveEngine.FieldData- Get- Return _hostField- End Get- End Property-- Public ReadOnly Property IntensityData As Single() Implements IWaveEngine.IntensityData- Get- Return _hostIntensity- End Get- End Property-- Public Sub AdvanceOneStep() Implements IWaveEngine.AdvanceOneStep- Dim k As Integer = _current-- If _sourceCount > 0 Then- SetFloat(_sourceKernel(k), 4UI, CSng(_time))- OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _sourceKernel(k), 1UI, Nothing, _grid1D, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (sources)")- End If- If _objSourceCount > 0 Then- SetFloat(_objSourceKernel(k), 11UI, CSng(_time))- OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _objSourceKernel(k), 1UI, Nothing, _objGrid1D, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (object sources)")- End If-- If _subSteps <= 1 Then- ' unchanged single-launch path: the "track" argument was bound once, at Build time, to If(_track, 1, 0)- OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _stepKernel(k), 2UI, Nothing, _grid2D, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (step)")- k = 1 - k- Else- ' _subSteps smaller launches (see the class summary); only the last one updates the intensity buffer,- ' so its own exponential averaging still runs once per AdvanceOneStep call, not _subSteps times- For subStep As Integer = 1 To _subSteps- Dim trackNow As Integer = If(subStep = _subSteps AndAlso _track, 1, 0)- SetInt(_stepKernel(k), 8UI, trackNow)- OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _stepKernel(k), 2UI, Nothing, _grid2D, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (step)")- k = 1 - k- Next- End If-- ' the buffer that received the new values is now the current field- _current = k- _time += 1.0-- ' now and then wait for the card, so that the commands do not pile up and errors show up in time- _sinceFinish += 1- If _sinceFinish >= 16 Then- _sinceFinish = 0- OpenClApi.Check(OpenClApi.clFinish(_queue), "clFinish")- End If- End Sub-- Public Sub PrepareFrame(needField As Boolean, needIntensity As Boolean) Implements IWaveEngine.PrepareFrame- Dim bytes As New IntPtr(CLng(_cells) * 4L)- If needField Then- OpenClApi.Check(OpenClApi.clEnqueueReadBufferFloat(_queue, _field(_current), 1UI, IntPtr.Zero, bytes, _hostField, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueReadBuffer")- End If- If needIntensity AndAlso _track Then- OpenClApi.Check(OpenClApi.clEnqueueReadBufferFloat(_queue, _intensityOutBuffer, 1UI, IntPtr.Zero, bytes, _hostIntensity, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueReadBuffer")- End If- _sinceFinish = 0- End Sub-- ' ---- probes-- Private Shared Function ProbeKernelSource() As String- Dim s As New StringBuilder()- ' point probes: the value of the pixel of every probe, into row "row" of the history- s.AppendLine("__kernel void probe_sample(__global const float* u, __global const float* inten, __global const int* pix,")- s.AppendLine(" __global const int* info, __global float* hist, const int row, const int n)")- s.AppendLine("{")- s.AppendLine(" int p = get_global_id(0);")- s.AppendLine(" if (p >= n) return;")- s.AppendLine(" int start = info[p * 4];")- s.AppendLine(" int count = info[p * 4 + 1];")- s.AppendLine(" int useI = info[p * 4 + 2];")- s.AppendLine(" int mean = info[p * 4 + 3];")- s.AppendLine(" float s = 0.0f;")- s.AppendLine(" if (useI != 0) {")- s.AppendLine(" for (int k = 0; k < count; k++) s += inten[pix[start + k]];")- s.AppendLine(" } else {")- s.AppendLine(" for (int k = 0; k < count; k++) s += u[pix[start + k]];")- s.AppendLine(" }")- s.AppendLine(" if (mean != 0 && count > 0) s = s / (float)count;")- s.AppendLine(" hist[row * n + p] = s;")- s.AppendLine("}")- s.AppendLine()- ' line probes: mode 0 = field, 1 = intensity, 2 = intensity totals over the steps; pStartFlag/pStartStep are the- ' probe's "start recording at step #" (0/1 and the step): before that step the total is left at zero, so- ' intensity that arrived earlier is purged rather than baked into the total once recording starts- s.AppendLine("__kernel void profile_accumulate(__global const float* inten, __global const int* ppix,")- s.AppendLine(" __global const int* pmode, __global const int* pStartFlag, __global const int* pStartStep,")- s.AppendLine(" __global float* total, const int step, const int n)")- s.AppendLine("{")- s.AppendLine(" int k = get_global_id(0);")- s.AppendLine(" if (k >= n) return;")- s.AppendLine(" if (pmode[k] != 2) return;")- s.AppendLine(" if (pStartFlag[k] != 0 && step < pStartStep[k]) return;")- s.AppendLine(" total[k] += inten[ppix[k]];")- s.AppendLine("}")- s.AppendLine()- s.AppendLine("__kernel void profile_gather(__global const float* u, __global const float* inten, __global const int* ppix,")- s.AppendLine(" __global const int* pmode, __global const float* total, __global float* outv, const int n)")- s.AppendLine("{")- s.AppendLine(" int k = get_global_id(0);")- s.AppendLine(" if (k >= n) return;")- s.AppendLine(" int m = pmode[k];")- s.AppendLine(" float v;")- s.AppendLine(" if (m == 2) v = total[k];")- s.AppendLine(" else if (m == 1) v = inten[ppix[k]];")- s.AppendLine(" else v = u[ppix[k]];")- s.AppendLine(" outv[k] = v;")- s.AppendLine("}")- Return s.ToString()- End Function-- Public Sub SetProbes(sampler As ProbeSampler) Implements IWaveEngine.SetProbes- If sampler Is Nothing OrElse sampler.Count = 0 Then Return-- Try- If sampler.NeedsIntensity AndAlso Not _track Then- Throw New InvalidOperationException("the intensity is not tracked")- End If-- Dim code As Integer = 0- Dim devs() As IntPtr = {_deviceId}-- Dim sources() As String = {ProbeKernelSource()}- _probeProgram = OpenClApi.clCreateProgramWithSource(_context, 1UI, sources, Nothing, code)- OpenClApi.Check(code, "clCreateProgramWithSource (probes)")- code = OpenClApi.clBuildProgram(_probeProgram, 1UI, devs, "", IntPtr.Zero, IntPtr.Zero)- If code <> 0 Then- Dim log As String = OpenClApi.BuildLog(_probeProgram, _deviceId)- Throw New InvalidOperationException("the probe program for the GPU could not be built (" & OpenClApi.ErrorName(code) & ")" &- If(log.Length > 0, ": " & log, ""))- End If-- If sampler.HasSeries Then SetUpSeriesProbes(sampler)- If sampler.HasProfiles Then SetUpProfileProbes(sampler)- _probeSampler = sampler- Catch ex As Exception- Throw New InvalidOperationException("the probes could not be set up on the GPU: " & ex.Message, ex)- End Try- End Sub-- Private Sub SetUpSeriesProbes(sampler As ProbeSampler)- Dim n As Integer = sampler.Count- Dim code As Integer = 0-- ' the pixels of the point probes in one list; info = start, count, uses intensity, average (not sum) per probe- Dim total As Integer = 0- For p As Integer = 0 To n - 1- If Not sampler.IsProfile(p) Then total += sampler.Pixels(p).Length- Next- Dim pix(Math.Max(total, 1) - 1) As Integer- Dim info(n * 4 - 1) As Integer- Dim position As Integer = 0- For p As Integer = 0 To n - 1- If sampler.IsProfile(p) Then Continue For- Dim px As Integer() = sampler.Pixels(p)- Array.Copy(px, 0, pix, position, px.Length)- info(p * 4) = position- info(p * 4 + 1) = px.Length- info(p * 4 + 2) = If(sampler.UseIntensity(p), 1, 0)- info(p * 4 + 3) = 1- position += px.Length- Next- _pixelBuffer = CreateIntBuffer(pix)- _infoBuffer = CreateIntBuffer(info)-- Dim historyBytes As New IntPtr(CLng(ProbeRows) * n * 4L)- _historyBuffer = OpenClApi.clCreateBuffer(_context, OpenClApi.MemReadWrite, historyBytes, IntPtr.Zero, code)- OpenClApi.Check(code, "clCreateBuffer (probes)")-- For k As Integer = 0 To 1- _probeKernel(k) = CreateKernelFrom(_probeProgram, "probe_sample")- SetMem(_probeKernel(k), 0UI, _field(k))- SetMem(_probeKernel(k), 1UI, _intensityOutBuffer)- SetMem(_probeKernel(k), 2UI, _pixelBuffer)- SetMem(_probeKernel(k), 3UI, _infoBuffer)- SetMem(_probeKernel(k), 4UI, _historyBuffer)- SetInt(_probeKernel(k), 5UI, 0)- SetInt(_probeKernel(k), 6UI, n)- Next-- _probeGrid(0) = New IntPtr(n)- _probeValues.Clear()- For i As Integer = 0 To n - 1- _probeValues.Add(New List(Of Single)())- Next- _probeRow = 0- End Sub-- Private Sub SetUpProfileProbes(sampler As ProbeSampler)- Dim n As Integer = sampler.Count-- Dim total As Integer = 0- For p As Integer = 0 To n - 1- If sampler.IsProfile(p) Then total += sampler.Pixels(p).Length- Next- Dim pix(total - 1) As Integer- Dim mode(total - 1) As Integer- Dim startFlag(total - 1) As Integer- Dim startStep(total - 1) As Integer- _profileStart = New Integer(n - 1) {}- _profileIntegrates = False-- Dim position As Integer = 0- For p As Integer = 0 To n - 1- _profileStart(p) = position- If Not sampler.IsProfile(p) Then Continue For-- Dim px As Integer() = sampler.Pixels(p)- Dim m As Integer = If(sampler.Integrate(p), 2, If(sampler.UseIntensity(p), 1, 0))- If m = 2 Then _profileIntegrates = True- Dim useStart As Integer = If(sampler.UseStartAfterStep(p), 1, 0)- Dim afterStep As Integer = sampler.StartAfterStep(p)- For k As Integer = 0 To px.Length - 1- pix(position + k) = px(k)- mode(position + k) = m- startFlag(position + k) = useStart- startStep(position + k) = afterStep- Next- position += px.Length- Next- _profileCount = total-- _profilePixelBuffer = CreateIntBuffer(pix)- _profileModeBuffer = CreateIntBuffer(mode)- _profileTotalBuffer = CreateFloatBuffer(New Single(total - 1) {})- _profileOutBuffer = CreateFloatBuffer(New Single(total - 1) {})-- For k As Integer = 0 To 1- _gatherKernel(k) = CreateKernelFrom(_probeProgram, "profile_gather")- SetMem(_gatherKernel(k), 0UI, _field(k))- SetMem(_gatherKernel(k), 1UI, _intensityOutBuffer)- SetMem(_gatherKernel(k), 2UI, _profilePixelBuffer)- SetMem(_gatherKernel(k), 3UI, _profileModeBuffer)- SetMem(_gatherKernel(k), 4UI, _profileTotalBuffer)- SetMem(_gatherKernel(k), 5UI, _profileOutBuffer)- SetInt(_gatherKernel(k), 6UI, total)- Next-- If _profileIntegrates Then- _profileStartFlagBuffer = CreateIntBuffer(startFlag)- _profileStartStepBuffer = CreateIntBuffer(startStep)- _accumulateKernel = CreateKernelFrom(_probeProgram, "profile_accumulate")- SetMem(_accumulateKernel, 0UI, _intensityOutBuffer)- SetMem(_accumulateKernel, 1UI, _profilePixelBuffer)- SetMem(_accumulateKernel, 2UI, _profileModeBuffer)- SetMem(_accumulateKernel, 3UI, _profileStartFlagBuffer)- SetMem(_accumulateKernel, 4UI, _profileStartStepBuffer)- SetMem(_accumulateKernel, 5UI, _profileTotalBuffer)- SetInt(_accumulateKernel, 7UI, total)- End If-- _profileGrid(0) = New IntPtr(total)- End Sub-- Public Sub SampleProbes() Implements IWaveEngine.SampleProbes- If _probeSampler Is Nothing Then Return-- Dim k As Integer = _current- If _probeSampler.HasSeries Then- If _probeRow >= ProbeRows Then ReadProbeHistory()- SetInt(_probeKernel(k), 5UI, _probeRow)- OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _probeKernel(k), 1UI, Nothing, _probeGrid, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (probes)")- _probeRow += 1- End If-- ' the intensity totals of the lines that are integrated: add the intensity of this step (unless it is before- ' that probe's "start recording at step #", in which case the kernel leaves the total at zero)- If _profileIntegrates Then- SetInt(_accumulateKernel, 6UI, CInt(_time))- OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _accumulateKernel, 1UI, Nothing, _profileGrid, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (totals)")- End If- End Sub-- ''' <summary>Copies the measured values from the graphics memory into the lists.</summary>- Private Sub ReadProbeHistory()- If _probeSampler Is Nothing OrElse _probeRow = 0 Then Return-- Dim n As Integer = _probeSampler.Count- Dim values(_probeRow * n - 1) As Single- OpenClApi.Check(OpenClApi.clEnqueueReadBufferFloat(_queue, _historyBuffer, 1UI, IntPtr.Zero, New IntPtr(CLng(values.Length) * 4L), values, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueReadBuffer (probes)")- For r As Integer = 0 To _probeRow - 1- For p As Integer = 0 To n - 1- If Not _probeSampler.IsProfile(p) Then _probeValues(p).Add(values(r * n + p))- Next- Next- _probeRow = 0- _sinceFinish = 0- End Sub-- Public Function TakeProbeSamples() As Single()() Implements IWaveEngine.TakeProbeSamples- If _probeSampler Is Nothing Then Return New Single()() {}-- Dim n As Integer = _probeSampler.Count- Dim result As Single()() = New Single(n - 1)() {}- If _probeSampler.HasSeries Then ReadProbeHistory()- For p As Integer = 0 To n - 1- If _probeSampler.IsProfile(p) Then- result(p) = New Single(-1) {}- Else- result(p) = _probeValues(p).ToArray()- _probeValues(p).Clear()- End If- Next- Return result- End Function-- Public Function ReadProbeProfiles() As Single()() Implements IWaveEngine.ReadProbeProfiles- If _probeSampler Is Nothing Then Return New Single()() {}-- Dim n As Integer = _probeSampler.Count- Dim result As Single()() = New Single(n - 1)() {}- If Not _probeSampler.HasProfiles Then Return result-- Dim k As Integer = _current- OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _gatherKernel(k), 1UI, Nothing, _profileGrid, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (profiles)")-- Dim values As Single() = New Single(_profileCount - 1) {}- OpenClApi.Check(OpenClApi.clEnqueueReadBufferFloat(_queue, _profileOutBuffer, 1UI, IntPtr.Zero, New IntPtr(CLng(_profileCount) * 4L), values, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueReadBuffer (profiles)")- _sinceFinish = 0-- For p As Integer = 0 To n - 1- If Not _probeSampler.IsProfile(p) Then Continue For- Dim length As Integer = _probeSampler.Pixels(p).Length- Dim profile As Single() = New Single(length - 1) {}- Array.Copy(values, _profileStart(p), profile, 0, length)- result(p) = profile- Next- Return result- End Function-- Public Sub Dispose() Implements IDisposable.Dispose- ReleaseAll()- End Sub-- Private Sub ReleaseAll()- If _released Then Return- _released = True-- Try- If _queue <> IntPtr.Zero Then OpenClApi.clFinish(_queue)- Catch ex As Exception- ' the driver is gone or in trouble; release what can be released- End Try-- For k As Integer = 0 To 1- ReleaseKernel(_stepKernel(k))- ReleaseKernel(_sourceKernel(k))- ReleaseKernel(_objSourceKernel(k))- ReleaseKernel(_probeKernel(k))- ReleaseKernel(_gatherKernel(k))- ReleaseMem(_field(k))- Next- ReleaseKernel(_accumulateKernel)- ReleaseMem(_pixelBuffer)- ReleaseMem(_infoBuffer)- ReleaseMem(_historyBuffer)- ReleaseMem(_profilePixelBuffer)- ReleaseMem(_profileModeBuffer)- ReleaseMem(_profileStartFlagBuffer)- ReleaseMem(_profileStartStepBuffer)- ReleaseMem(_profileTotalBuffer)- ReleaseMem(_profileOutBuffer)- ReleaseMem(_c2Buffer)- ReleaseMem(_dBuffer)- ReleaseMem(_intensityBuffer)- ReleaseMem(_intensityStage1Buffer)- ReleaseMem(_intensityOutBuffer)- ReleaseMem(_indexBuffer)- ReleaseMem(_levelBuffer)- ReleaseMem(_frequencyBuffer)- ReleaseMem(_objIndexBuffer)- ReleaseMem(_objLevelBuffer)- ReleaseMem(_objAmplitudeBuffer)- ReleaseMem(_objPhaseBuffer)- ReleaseMem(_objModeBuffer)- ReleaseMem(_objPulseShapeBuffer)- ReleaseMem(_objOnWidthBuffer)- ReleaseMem(_objOffWidthBuffer)- ReleaseMem(_objDetachStepBuffer)- ReleaseMem(_objOffWidthBaseBuffer)- ReleaseMem(_objRandomizeOffWidthAmountBuffer)- ReleaseMem(_objCycleAnchorBuffer)- ReleaseMem(_objRngStateBuffer)-- Try- If _probeProgram <> IntPtr.Zero Then OpenClApi.clReleaseProgram(_probeProgram)- If _program <> IntPtr.Zero Then OpenClApi.clReleaseProgram(_program)- If _queue <> IntPtr.Zero Then OpenClApi.clReleaseCommandQueue(_queue)- If _context <> IntPtr.Zero Then OpenClApi.clReleaseContext(_context)- Catch ex As Exception- ' nothing more can be done- End Try- _probeProgram = IntPtr.Zero- _program = IntPtr.Zero- _queue = IntPtr.Zero- _context = IntPtr.Zero- End Sub-- Private Shared Sub ReleaseMem(ByRef handle As IntPtr)- Try- If handle <> IntPtr.Zero Then OpenClApi.clReleaseMemObject(handle)- Catch ex As Exception- ' nothing more can be done- End Try- handle = IntPtr.Zero- End Sub-- Private Shared Sub ReleaseKernel(ByRef handle As IntPtr)- Try- If handle <> IntPtr.Zero Then OpenClApi.clReleaseKernel(handle)- Catch ex As Exception- ' nothing more can be done- End Try- handle = IntPtr.Zero- End Sub--End Classdiff --git a/2D_wave_sim_V01/Simulation/IWaveEngine.vb b/2D_wave_sim_V01/Simulation/IWaveEngine.vbdeleted file mode 100644index 01d2145..0000000--- a/2D_wave_sim_V01/Simulation/IWaveEngine.vb+++ /dev/null@@ -1,121 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic--''' <summary>-''' A wave simulation engine: the CPU version (WaveSimulator) or the GPU version (GpuWaveSimulator).-''' Both keep the field and the intensity in arrays with a border of one cell, pixel (x, y) is at-''' (y + 1) * Stride + x + 1, and both are advanced one time step at a time.-''' </summary>-Friend Interface IWaveEngine- Inherits IDisposable-- ''' <summary>Where the simulation runs, for example "CPU (8 threads)" or "GPU: NVIDIA GeForce MX130 (OpenCL)".</summary>- ReadOnly Property Description As String-- ReadOnly Property Width As Integer- ReadOnly Property Height As Integer-- ''' <summary>Distance between two rows in FieldData and IntensityData.</summary>- ReadOnly Property Stride As Integer-- ''' <summary>The field of the last completed step, valid after PrepareFrame(True, ...). Do not change.</summary>- ReadOnly Property FieldData As Single()-- ''' <summary>The averaged intensity, valid after PrepareFrame(..., True); Nothing when it is not tracked. Do not change.</summary>- ReadOnly Property IntensityData As Single()-- ''' <summary>One time step: apply the sources, update the field, update the intensity.</summary>- Sub AdvanceOneStep()-- ''' <summary>- ''' Makes FieldData and/or IntensityData available for drawing. Does nothing on the CPU; on the GPU the data is- ''' copied from the graphics memory, so only ask for what is going to be drawn.- ''' </summary>- Sub PrepareFrame(needField As Boolean, needIntensity As Boolean)-- ''' <summary>Tells the engine which values to measure for the probes (Nothing or no probes: nothing is measured).</summary>- Sub SetProbes(sampler As ProbeSampler)-- ''' <summary>- ''' Measures the probes in the state after the last AdvanceOneStep: one value per step for every point probe, and- ''' the running totals of the line probes that integrate the intensity.- ''' </summary>- Sub SampleProbes()-- ''' <summary>The values measured for the point probes since the last call, per probe (an empty array for a line probe or when there is none).</summary>- Function TakeProbeSamples() As Single()()-- ''' <summary>- ''' The values along the line of every line probe in the current state (Nothing for a point probe): the field, the- ''' intensity, or the intensity totals of the steps so far. On the GPU this waits for the card, so do not call it every step.- ''' </summary>- Function ReadProbeProfiles() As Single()()--End Interface--''' <summary>Makes the engine that a run asks for, with the CPU as the fall back.</summary>-Friend NotInheritable Class WaveEngineFactory-- Private Sub New()- End Sub-- ''' <summary>- ''' Makes the GPU engine when the settings ask for it and that works, otherwise the CPU engine.- ''' <paramref name="note"/> is empty, or tells why the GPU was not used (or that the first choice failed).- ''' Object sources (the Sources tab) run on either engine, the same as the image sources.- ''' </summary>- Public Shared Function Create(scene As SceneData, settings As SimulationSettings, sourceAmplitude As Double,- trackIntensity As Boolean, ByRef note As String,- Optional objectSources As List(Of SourceElement) = Nothing) As IWaveEngine- note = ""-- If settings.UseGpu Then- Dim problems As String = ""- Dim gpu As GpuWaveSimulator = Nothing- Try- gpu = GpuWaveSimulator.TryCreate(scene, settings.SourceFrequencyScale, sourceAmplitude, trackIntensity,- settings.Use4thOrderLaplacian, settings.TimeDecayFactor, settings.IntensityScale,- problems, objectSources)- Catch ex As DllNotFoundException- problems = "no OpenCL driver (OpenCL.dll) found; install the driver of the graphics card"- Catch ex As BadImageFormatException- problems = "the OpenCL driver does not match this 32/64-bit program"- Catch ex As EntryPointNotFoundException- problems = "the OpenCL driver is incomplete"- Catch ex As Exception- problems = ex.Message- End Try-- If gpu IsNot Nothing Then- If problems.Length > 0 Then note = "the first choice failed - " & problems- Return gpu- End If- note = "GPU not used: " & problems- End If-- Return New WaveSimulator(scene, settings.SourceFrequencyScale, sourceAmplitude, trackIntensity,- settings.Use4thOrderLaplacian, settings.TimeDecayFactor, settings.IntensityScale, objectSources)- End Function--End Classdiff --git a/2D_wave_sim_V01/Simulation/MfVideoWriter.vb b/2D_wave_sim_V01/Simulation/MfVideoWriter.vbdeleted file mode 100644index 9cefb11..0000000--- a/2D_wave_sim_V01/Simulation/MfVideoWriter.vb+++ /dev/null@@ -1,359 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Runtime.InteropServices--' ----------------------------------------------------------------------------------------------------------------' The few Media Foundation interfaces that MfVideoWriter needs. Only the order of the methods matters (it is the-' order of the entries in the COM method table); the methods that are not used are placeholders. Every interface-' repeats the methods of IMFAttributes because .NET does not inherit them in COM interfaces.-' -----------------------------------------------------------------------------------------------------------------<ComImport(), Guid("2CD2D921-C447-44A7-A13C-4ADABFC247E3"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>-Friend Interface IMFAttributesNative- <PreserveSig> Function GetItem() As Integer- <PreserveSig> Function GetItemType() As Integer- <PreserveSig> Function CompareItem() As Integer- <PreserveSig> Function Compare() As Integer- <PreserveSig> Function GetUINT32() As Integer- <PreserveSig> Function GetUINT64() As Integer- <PreserveSig> Function GetDouble() As Integer- <PreserveSig> Function GetGUID() As Integer- <PreserveSig> Function GetStringLength() As Integer- <PreserveSig> Function GetString() As Integer- <PreserveSig> Function GetAllocatedString() As Integer- <PreserveSig> Function GetBlobSize() As Integer- <PreserveSig> Function GetBlob() As Integer- <PreserveSig> Function GetAllocatedBlob() As Integer- <PreserveSig> Function GetUnknown() As Integer- <PreserveSig> Function SetItem() As Integer- <PreserveSig> Function DeleteItem() As Integer- <PreserveSig> Function DeleteAllItems() As Integer- <PreserveSig> Function SetUINT32(<MarshalAs(UnmanagedType.LPStruct)> guidKey As Guid, value As Integer) As Integer- <PreserveSig> Function SetUINT64(<MarshalAs(UnmanagedType.LPStruct)> guidKey As Guid, value As ULong) As Integer- <PreserveSig> Function SetDouble() As Integer- <PreserveSig> Function SetGUID(<MarshalAs(UnmanagedType.LPStruct)> guidKey As Guid, <MarshalAs(UnmanagedType.LPStruct)> value As Guid) As Integer- <PreserveSig> Function SetString() As Integer- <PreserveSig> Function SetBlob() As Integer- <PreserveSig> Function SetUnknown() As Integer- <PreserveSig> Function LockStore() As Integer- <PreserveSig> Function UnlockStore() As Integer- <PreserveSig> Function GetCount() As Integer- <PreserveSig> Function GetItemByIndex() As Integer- <PreserveSig> Function CopyAllItems() As Integer-End Interface--<ComImport(), Guid("C40A00F2-B93A-4D80-AE8C-5A1C634F58E4"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>-Friend Interface IMFSampleNative- <PreserveSig> Function A01() As Integer- <PreserveSig> Function A02() As Integer- <PreserveSig> Function A03() As Integer- <PreserveSig> Function A04() As Integer- <PreserveSig> Function A05() As Integer- <PreserveSig> Function A06() As Integer- <PreserveSig> Function A07() As Integer- <PreserveSig> Function A08() As Integer- <PreserveSig> Function A09() As Integer- <PreserveSig> Function A10() As Integer- <PreserveSig> Function A11() As Integer- <PreserveSig> Function A12() As Integer- <PreserveSig> Function A13() As Integer- <PreserveSig> Function A14() As Integer- <PreserveSig> Function A15() As Integer- <PreserveSig> Function A16() As Integer- <PreserveSig> Function A17() As Integer- <PreserveSig> Function A18() As Integer- <PreserveSig> Function A19() As Integer- <PreserveSig> Function A20() As Integer- <PreserveSig> Function A21() As Integer- <PreserveSig> Function A22() As Integer- <PreserveSig> Function A23() As Integer- <PreserveSig> Function A24() As Integer- <PreserveSig> Function A25() As Integer- <PreserveSig> Function A26() As Integer- <PreserveSig> Function A27() As Integer- <PreserveSig> Function A28() As Integer- <PreserveSig> Function A29() As Integer- <PreserveSig> Function A30() As Integer- <PreserveSig> Function GetSampleFlags() As Integer- <PreserveSig> Function SetSampleFlags() As Integer- <PreserveSig> Function GetSampleTime() As Integer- <PreserveSig> Function SetSampleTime(sampleTime As Long) As Integer- <PreserveSig> Function GetSampleDuration() As Integer- <PreserveSig> Function SetSampleDuration(duration As Long) As Integer- <PreserveSig> Function GetBufferCount() As Integer- <PreserveSig> Function GetBufferByIndex() As Integer- <PreserveSig> Function ConvertToContiguousBuffer() As Integer- <PreserveSig> Function AddBuffer(buffer As IntPtr) As Integer- <PreserveSig> Function RemoveBufferByIndex() As Integer- <PreserveSig> Function RemoveAllBuffers() As Integer- <PreserveSig> Function GetTotalLength() As Integer- <PreserveSig> Function CopyToBuffer() As Integer-End Interface--<ComImport(), Guid("045FA593-8799-42B8-BC8D-8968C6453507"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>-Friend Interface IMFMediaBufferNative- <PreserveSig> Function Lock(ByRef data As IntPtr, ByRef maxLength As Integer, ByRef currentLength As Integer) As Integer- <PreserveSig> Function Unlock() As Integer- <PreserveSig> Function GetCurrentLength() As Integer- <PreserveSig> Function SetCurrentLength(length As Integer) As Integer- <PreserveSig> Function GetMaxLength() As Integer-End Interface--<ComImport(), Guid("3137F1CD-FE5E-4805-A5D8-FB477448CB3D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>-Friend Interface IMFSinkWriterNative- <PreserveSig> Function AddStream(mediaType As IntPtr, ByRef streamIndex As Integer) As Integer- <PreserveSig> Function SetInputMediaType(streamIndex As Integer, mediaType As IntPtr, encodingParameters As IntPtr) As Integer- <PreserveSig> Function BeginWriting() As Integer- <PreserveSig> Function WriteSample(streamIndex As Integer, sample As IntPtr) As Integer- <PreserveSig> Function SendStreamTick() As Integer- <PreserveSig> Function PlaceMarker() As Integer- <PreserveSig> Function NotifyEndOfSegment() As Integer- <PreserveSig> Function Flush() As Integer- <PreserveSig> Function FinalizeWriting() As Integer- <PreserveSig> Function GetServiceForStream() As Integer- <PreserveSig> Function GetStatistics() As Integer-End Interface--''' <summary>-''' Writes an H.264 video in an MP4 file with the Media Foundation of Windows (the encoder that is built into Windows),-''' so no codec or other program is needed and every Windows player opens the file.-''' The constructor throws when Media Foundation or its H.264 encoder is not available or the size is not supported;-''' the caller can then use another writer.-''' </summary>-Friend NotInheritable Class MfVideoWriter- Implements IFrameSink-- ' the version of Media Foundation that is asked for (MF_VERSION of the Windows 7 and later SDK)- Private Const MfVersion As Integer = &H20070-- Private Shared ReadOnly MajorType As New Guid("48eba18e-f8c9-4687-bf11-0a74c9f96a8f")- Private Shared ReadOnly SubType As New Guid("f7e34c9a-42e8-4714-b74b-cb29d72c35e5")- Private Shared ReadOnly AvgBitrate As New Guid("20332624-fb0d-4d9e-bd0d-cbf6786c102e")- Private Shared ReadOnly InterlaceMode As New Guid("e2724bb8-e676-4806-b4b2-a8d6efb44ccd")- Private Shared ReadOnly FrameSize As New Guid("1652c33d-d6b2-4012-b834-72030849a37d")- Private Shared ReadOnly FrameRate As New Guid("c459a2e8-3d2c-4e44-b132-fee5156c7bb0")- Private Shared ReadOnly PixelAspectRatio As New Guid("c6376a1e-8d0a-4027-be45-6d9a0ad39bb6")- Private Shared ReadOnly DefaultStride As New Guid("644b4e48-1e02-4516-b0eb-c01ca9d49ac6")- Private Shared ReadOnly VideoType As New Guid("73646976-0000-0010-8000-00AA00389B71")- Private Shared ReadOnly H264Format As New Guid("34363248-0000-0010-8000-00AA00389B71")- Private Shared ReadOnly Rgb32Format As New Guid("00000016-0000-0010-8000-00AA00389B71")-- <DllImport("mfplat.dll", ExactSpelling:=True)>- Private Shared Function MFStartup(version As Integer, flags As Integer) As Integer- End Function-- <DllImport("mfplat.dll", ExactSpelling:=True)>- Private Shared Function MFShutdown() As Integer- End Function-- <DllImport("mfplat.dll", ExactSpelling:=True)>- Private Shared Function MFCreateMediaType(ByRef mediaType As IntPtr) As Integer- End Function-- <DllImport("mfplat.dll", ExactSpelling:=True)>- Private Shared Function MFCreateSample(ByRef sample As IntPtr) As Integer- End Function-- <DllImport("mfplat.dll", ExactSpelling:=True)>- Private Shared Function MFCreateMemoryBuffer(maxLength As Integer, ByRef buffer As IntPtr) As Integer- End Function-- <DllImport("mfreadwrite.dll", ExactSpelling:=True, CharSet:=CharSet.Unicode)>- Private Shared Function MFCreateSinkWriterFromURL(url As String, byteStream As IntPtr, attributes As IntPtr, ByRef writer As IntPtr) As Integer- End Function-- Private ReadOnly _path As String- Private ReadOnly _srcWidth As Integer- Private ReadOnly _srcHeight As Integer- Private ReadOnly _width As Integer ' the encoded size: H.264 needs even sizes- Private ReadOnly _height As Integer- Private ReadOnly _fps As Integer- Private ReadOnly _cropped As Integer()-- Private _started As Boolean- Private _writerPtr As IntPtr- Private _writer As IMFSinkWriterNative- Private _frames As Integer- Private _closed As Boolean-- Public Sub New(filePath As String, width As Integer, height As Integer, framesPerSecond As Integer, quality As Integer)- _path = filePath- _srcWidth = width- _srcHeight = height- _width = width And Not 1- _height = height And Not 1- _fps = framesPerSecond- If _width < 16 OrElse _height < 16 Then Throw New NotSupportedException("The canvas is too small for H.264 video.")- If CLng(_width) * _height > 4096L * 2304L Then Throw New NotSupportedException("The canvas is too large for the H.264 encoder of Windows.")- If _width <> _srcWidth OrElse _height <> _srcHeight Then _cropped = New Integer(_width * _height - 1) {}-- Check(MFStartup(MfVersion, 0))- _started = True- Try- Check(MFCreateSinkWriterFromURL(filePath, IntPtr.Zero, IntPtr.Zero, _writerPtr))- _writer = DirectCast(Marshal.GetObjectForIUnknown(_writerPtr), IMFSinkWriterNative)-- ' the quality (1 to 100) sets the bits per pixel of every frame: 0.01 * 50 ^ (quality / 100),- ' which is 0.01 at quality 1, 0.15 at 70 and 0.5 at 100 (1920 x 1080 at 60 frames/s: 1 to 62 Mbit/s)- Dim q As Integer = Math.Max(1, Math.Min(100, quality))- Dim bitsPerPixel As Double = 0.01 * Math.Pow(50.0, q / 100.0)- Dim bitrate As Long = CLng(_width * CDbl(_height) * _fps * bitsPerPixel)- bitrate = Math.Max(300000L, Math.Min(200000000L, bitrate))-- Dim outputType As IntPtr = MakeType(H264Format, CInt(bitrate), False)- Dim streamIndex As Integer = 0- Try- Check(_writer.AddStream(outputType, streamIndex))- Finally- Marshal.Release(outputType)- End Try-- ' the pictures are given as 32 bit pixels; the sink writer converts them for the encoder- Dim inputType As IntPtr = MakeType(Rgb32Format, 0, True)- Try- Check(_writer.SetInputMediaType(streamIndex, inputType, IntPtr.Zero))- Finally- Marshal.Release(inputType)- End Try-- Check(_writer.BeginWriting())- Catch- Cleanup()- Throw- End Try- End Sub-- Public ReadOnly Property FilePath As String Implements IFrameSink.FilePath- Get- Return _path- End Get- End Property-- ''' <summary>Makes a video media type (an IMFMediaType) and returns its interface pointer. The caller releases it.</summary>- Private Function MakeType(format As Guid, bitrate As Integer, topDown As Boolean) As IntPtr- Dim ptr As IntPtr = IntPtr.Zero- Check(MFCreateMediaType(ptr))- Try- Dim a As IMFAttributesNative = DirectCast(Marshal.GetObjectForIUnknown(ptr), IMFAttributesNative)- Try- Check(a.SetGUID(MajorType, VideoType))- Check(a.SetGUID(SubType, format))- If bitrate > 0 Then Check(a.SetUINT32(AvgBitrate, bitrate))- Check(a.SetUINT32(InterlaceMode, 2)) ' progressive- Check(a.SetUINT64(FrameSize, (CULng(_width) << 32) Or CULng(_height)))- Check(a.SetUINT64(FrameRate, (CULng(_fps) << 32) Or 1UL))- Check(a.SetUINT64(PixelAspectRatio, (1UL << 32) Or 1UL))- If topDown Then Check(a.SetUINT32(DefaultStride, _width * 4)) ' positive stride: the first row is the top row- Finally- Marshal.ReleaseComObject(a)- End Try- Catch- Marshal.Release(ptr)- Throw- End Try- Return ptr- End Function-- Public Sub AddPixels(pixels As Integer()) Implements IFrameSink.AddPixels- If _closed Then Throw New InvalidOperationException("The video file is already closed.")-- Dim source As Integer() = pixels- If _cropped IsNot Nothing Then- For y As Integer = 0 To _height - 1- Array.Copy(pixels, y * _srcWidth, _cropped, y * _width, _width)- Next- source = _cropped- End If-- Dim byteCount As Integer = _width * _height * 4- Dim bufferPtr As IntPtr = IntPtr.Zero- Dim samplePtr As IntPtr = IntPtr.Zero- Dim buffer As IMFMediaBufferNative = Nothing- Dim sample As IMFSampleNative = Nothing- Try- Check(MFCreateMemoryBuffer(byteCount, bufferPtr))- buffer = DirectCast(Marshal.GetObjectForIUnknown(bufferPtr), IMFMediaBufferNative)-- Dim data As IntPtr = IntPtr.Zero- Dim maxLength As Integer = 0- Dim currentLength As Integer = 0- Check(buffer.Lock(data, maxLength, currentLength))- Try- Marshal.Copy(source, 0, data, _width * _height)- Finally- buffer.Unlock()- End Try- Check(buffer.SetCurrentLength(byteCount))-- Check(MFCreateSample(samplePtr))- sample = DirectCast(Marshal.GetObjectForIUnknown(samplePtr), IMFSampleNative)- Check(sample.AddBuffer(bufferPtr))-- ' times are in units of 100 nanoseconds- Check(sample.SetSampleTime(CLng(_frames) * 10000000L \ _fps))- Check(sample.SetSampleDuration(10000000L \ _fps))-- Check(_writer.WriteSample(0, samplePtr))- _frames += 1- Finally- If sample IsNot Nothing Then Marshal.ReleaseComObject(sample)- If samplePtr <> IntPtr.Zero Then Marshal.Release(samplePtr)- If buffer IsNot Nothing Then Marshal.ReleaseComObject(buffer)- If bufferPtr <> IntPtr.Zero Then Marshal.Release(bufferPtr)- End Try- End Sub-- Public Sub Close() Implements IFrameSink.Close- If _closed Then Return- _closed = True- Try- If _writer IsNot Nothing AndAlso _frames > 0 Then Check(_writer.FinalizeWriting())- Finally- Cleanup()- End Try- End Sub-- Private Sub Cleanup()- If _writer IsNot Nothing Then- Marshal.ReleaseComObject(_writer)- _writer = Nothing- End If- If _writerPtr <> IntPtr.Zero Then- Marshal.Release(_writerPtr)- _writerPtr = IntPtr.Zero- End If- If _started Then- _started = False- MFShutdown()- End If- End Sub-- Public Sub Dispose() Implements IDisposable.Dispose- Close()- End Sub-- Private Shared Sub Check(hr As Integer)- If hr < 0 Then Marshal.ThrowExceptionForHR(hr)- End Sub--End Classdiff --git a/2D_wave_sim_V01/Simulation/OpenClApi.vb b/2D_wave_sim_V01/Simulation/OpenClApi.vbdeleted file mode 100644index 0f828d2..0000000--- a/2D_wave_sim_V01/Simulation/OpenClApi.vb+++ /dev/null@@ -1,249 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Runtime.InteropServices-Imports System.Text--''' <summary>-''' The part of the OpenCL 1.2 C interface that the GPU simulation needs, called directly from OpenCL.dll.-''' OpenCL.dll is installed with the driver of the graphics card (NVIDIA, Intel and AMD all install it), so no-''' extra package is needed. Names and parameters follow the C header (cl.h); "size_t" is an IntPtr,-''' "cl_bitfield" a ULong, "cl_uint" a UInteger and "cl_bool" a UInteger.-''' </summary>-Friend Module OpenClApi-- Friend Const DeviceTypeGpu As ULong = 4UL- Friend Const MemReadWrite As ULong = 1UL- Friend Const ContextPlatformProperty As Integer = &H1084-- Friend Const PlatformNameInfo As UInteger = &H902UI- Friend Const DeviceMaxComputeUnits As UInteger = &H1002UI- Friend Const DeviceMaxClockFrequency As UInteger = &H100CUI- Friend Const DeviceMaxMemAllocSize As UInteger = &H1010UI- Friend Const DeviceGlobalMemSize As UInteger = &H101FUI- Friend Const DeviceName As UInteger = &H102BUI- Friend Const DeviceVendor As UInteger = &H102CUI- Friend Const DeviceHostUnifiedMemory As UInteger = &H1035UI- Friend Const ProgramBuildLog As UInteger = &H1183UI-- ' ---- platforms and devices-- Friend Declare Ansi Function clGetPlatformIDs Lib "OpenCL.dll" (numEntries As UInteger, platforms As IntPtr(), ByRef numPlatforms As UInteger) As Integer-- Friend Declare Ansi Function clGetDeviceIDs Lib "OpenCL.dll" (platform As IntPtr, deviceType As ULong, numEntries As UInteger, devices As IntPtr(), ByRef numDevices As UInteger) As Integer-- Friend Declare Ansi Function clGetDeviceInfo Lib "OpenCL.dll" (device As IntPtr, paramName As UInteger, paramSize As IntPtr, paramValue As Byte(), ByRef sizeRet As IntPtr) As Integer-- ' ---- context, queue, program, kernels-- Friend Declare Ansi Function clCreateContext Lib "OpenCL.dll" (properties As IntPtr(), numDevices As UInteger, devices As IntPtr(), notify As IntPtr, userData As IntPtr, ByRef errcode As Integer) As IntPtr-- Friend Declare Ansi Function clCreateCommandQueue Lib "OpenCL.dll" (context As IntPtr, device As IntPtr, properties As ULong, ByRef errcode As Integer) As IntPtr-- Friend Declare Ansi Function clCreateProgramWithSource Lib "OpenCL.dll" (context As IntPtr, count As UInteger, <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.LPStr)> strings As String(), lengths As IntPtr(), ByRef errcode As Integer) As IntPtr-- Friend Declare Ansi Function clBuildProgram Lib "OpenCL.dll" (program As IntPtr, numDevices As UInteger, devices As IntPtr(), options As String, notify As IntPtr, userData As IntPtr) As Integer-- Friend Declare Ansi Function clGetProgramBuildInfo Lib "OpenCL.dll" (program As IntPtr, device As IntPtr, paramName As UInteger, paramSize As IntPtr, paramValue As Byte(), ByRef sizeRet As IntPtr) As Integer-- Friend Declare Ansi Function clCreateKernel Lib "OpenCL.dll" (program As IntPtr, kernelName As String, ByRef errcode As Integer) As IntPtr-- Friend Declare Ansi Function clSetKernelArgMem Lib "OpenCL.dll" Alias "clSetKernelArg" (kernel As IntPtr, argIndex As UInteger, argSize As IntPtr, ByRef argValue As IntPtr) As Integer-- Friend Declare Ansi Function clSetKernelArgInt Lib "OpenCL.dll" Alias "clSetKernelArg" (kernel As IntPtr, argIndex As UInteger, argSize As IntPtr, ByRef argValue As Integer) As Integer-- Friend Declare Ansi Function clSetKernelArgFloat Lib "OpenCL.dll" Alias "clSetKernelArg" (kernel As IntPtr, argIndex As UInteger, argSize As IntPtr, ByRef argValue As Single) As Integer-- ' ---- memory and execution-- Friend Declare Ansi Function clCreateBuffer Lib "OpenCL.dll" (context As IntPtr, flags As ULong, size As IntPtr, hostPtr As IntPtr, ByRef errcode As Integer) As IntPtr-- Friend Declare Ansi Function clEnqueueWriteBufferFloat Lib "OpenCL.dll" Alias "clEnqueueWriteBuffer" (queue As IntPtr, buffer As IntPtr, blocking As UInteger, offset As IntPtr, size As IntPtr, data As Single(), numEvents As UInteger, waitList As IntPtr, evt As IntPtr) As Integer-- Friend Declare Ansi Function clEnqueueWriteBufferInt Lib "OpenCL.dll" Alias "clEnqueueWriteBuffer" (queue As IntPtr, buffer As IntPtr, blocking As UInteger, offset As IntPtr, size As IntPtr, data As Integer(), numEvents As UInteger, waitList As IntPtr, evt As IntPtr) As Integer-- Friend Declare Ansi Function clEnqueueReadBufferFloat Lib "OpenCL.dll" Alias "clEnqueueReadBuffer" (queue As IntPtr, buffer As IntPtr, blocking As UInteger, offset As IntPtr, size As IntPtr, data As Single(), numEvents As UInteger, waitList As IntPtr, evt As IntPtr) As Integer-- Friend Declare Ansi Function clEnqueueNDRangeKernel Lib "OpenCL.dll" (queue As IntPtr, kernel As IntPtr, workDim As UInteger, globalOffset As IntPtr(), globalSize As IntPtr(), localSize As IntPtr(), numEvents As UInteger, waitList As IntPtr, evt As IntPtr) As Integer-- Friend Declare Ansi Function clFinish Lib "OpenCL.dll" (queue As IntPtr) As Integer-- ' ---- release-- Friend Declare Ansi Function clReleaseMemObject Lib "OpenCL.dll" (memObj As IntPtr) As Integer- Friend Declare Ansi Function clReleaseKernel Lib "OpenCL.dll" (kernel As IntPtr) As Integer- Friend Declare Ansi Function clReleaseProgram Lib "OpenCL.dll" (program As IntPtr) As Integer- Friend Declare Ansi Function clReleaseCommandQueue Lib "OpenCL.dll" (queue As IntPtr) As Integer- Friend Declare Ansi Function clReleaseContext Lib "OpenCL.dll" (context As IntPtr) As Integer-- ' ---- helpers-- ''' <summary>Throws when an OpenCL call returned an error code (0 = CL_SUCCESS).</summary>- Friend Sub Check(code As Integer, what As String)- If code <> 0 Then Throw New InvalidOperationException(what & " failed: " & ErrorName(code))- End Sub-- Friend Function ErrorName(code As Integer) As String- Dim name As String- Select Case code- Case -1 : name = "CL_DEVICE_NOT_FOUND"- Case -2 : name = "CL_DEVICE_NOT_AVAILABLE"- Case -3 : name = "CL_COMPILER_NOT_AVAILABLE"- Case -4 : name = "CL_MEM_OBJECT_ALLOCATION_FAILURE (out of GPU memory)"- Case -5 : name = "CL_OUT_OF_RESOURCES"- Case -6 : name = "CL_OUT_OF_HOST_MEMORY"- Case -11 : name = "CL_BUILD_PROGRAM_FAILURE"- Case -30 : name = "CL_INVALID_VALUE"- Case -33 : name = "CL_INVALID_DEVICE"- Case -34 : name = "CL_INVALID_CONTEXT"- Case -36 : name = "CL_INVALID_COMMAND_QUEUE"- Case -38 : name = "CL_INVALID_MEM_OBJECT"- Case -45 : name = "CL_INVALID_PROGRAM_EXECUTABLE"- Case -46 : name = "CL_INVALID_KERNEL_NAME"- Case -48 : name = "CL_INVALID_KERNEL"- Case -49 : name = "CL_INVALID_ARG_INDEX"- Case -50 : name = "CL_INVALID_ARG_VALUE"- Case -51 : name = "CL_INVALID_ARG_SIZE"- Case -52 : name = "CL_INVALID_KERNEL_ARGS"- Case -54 : name = "CL_INVALID_WORK_GROUP_SIZE"- Case -55 : name = "CL_INVALID_WORK_ITEM_SIZE"- Case -61 : name = "CL_INVALID_BUFFER_SIZE"- Case -1001 : name = "no OpenCL platform (CL_PLATFORM_NOT_FOUND_KHR)"- Case Else : name = "error"- End Select- Return name & " (" & code.ToString(System.Globalization.CultureInfo.InvariantCulture) & ")"- End Function-- ''' <summary>The bytes of a device info item, or Nothing when the item is not available.</summary>- Friend Function DeviceInfoBytes(device As IntPtr, paramName As UInteger) As Byte()- Dim needed As IntPtr = IntPtr.Zero- If clGetDeviceInfo(device, paramName, IntPtr.Zero, Nothing, needed) <> 0 Then Return Nothing- Dim n As Integer = needed.ToInt32()- If n <= 0 Then Return Nothing- Dim buffer(n - 1) As Byte- Dim written As IntPtr = IntPtr.Zero- If clGetDeviceInfo(device, paramName, New IntPtr(n), buffer, written) <> 0 Then Return Nothing- Return buffer- End Function-- Friend Function DeviceString(device As IntPtr, paramName As UInteger) As String- Dim buffer As Byte() = DeviceInfoBytes(device, paramName)- If buffer Is Nothing Then Return ""- Return Encoding.ASCII.GetString(buffer).Trim(ChrW(0), " "c)- End Function-- ''' <summary>A number (32 or 64 bits) of a device info item, 0 when it is not available.</summary>- Friend Function DeviceNumber(device As IntPtr, paramName As UInteger) As ULong- Dim buffer As Byte() = DeviceInfoBytes(device, paramName)- If buffer Is Nothing Then Return 0UL- If buffer.Length >= 8 Then Return BitConverter.ToUInt64(buffer, 0)- If buffer.Length >= 4 Then Return BitConverter.ToUInt32(buffer, 0)- Return 0UL- End Function-- ''' <summary>The build log of a program (the compiler messages).</summary>- Friend Function BuildLog(program As IntPtr, device As IntPtr) As String- Try- Dim needed As IntPtr = IntPtr.Zero- If clGetProgramBuildInfo(program, device, ProgramBuildLog, IntPtr.Zero, Nothing, needed) <> 0 Then Return ""- Dim n As Integer = needed.ToInt32()- If n <= 0 Then Return ""- Dim buffer(n - 1) As Byte- Dim written As IntPtr = IntPtr.Zero- If clGetProgramBuildInfo(program, device, ProgramBuildLog, New IntPtr(n), buffer, written) <> 0 Then Return ""- Return Encoding.ASCII.GetString(buffer).Trim(ChrW(0), " "c, ChrW(13), ChrW(10))- Catch ex As Exception- Return ""- End Try- End Function--End Module--''' <summary>A GPU that OpenCL can use.</summary>-Friend NotInheritable Class GpuDeviceInfo-- Public PlatformId As IntPtr- Public DeviceId As IntPtr- Public Name As String = ""- Public Vendor As String = ""-- ''' <summary>True for a card with its own memory (the NVIDIA GeForce), False for the graphics of the processor (Intel UHD).</summary>- Public Discrete As Boolean-- ''' <summary>Compute units times clock (MHz): a rough measure of the speed.</summary>- Public Score As Double-- Public GlobalMemory As Long- Public MaxAllocation As Long-- ''' <summary>- ''' All GPUs that OpenCL knows, the best first: cards with their own memory come before the graphics of the- ''' processor. Throws DllNotFoundException when there is no OpenCL driver at all.- ''' </summary>- Public Shared Function FindAll() As List(Of GpuDeviceInfo)- Dim found As New List(Of GpuDeviceInfo)()-- Dim platformCount As UInteger = 0UI- If OpenClApi.clGetPlatformIDs(0UI, Nothing, platformCount) <> 0 OrElse platformCount = 0UI Then Return found-- Dim platforms(CInt(platformCount) - 1) As IntPtr- Dim returned As UInteger = 0UI- If OpenClApi.clGetPlatformIDs(platformCount, platforms, returned) <> 0 Then Return found-- For Each plat As IntPtr In platforms- Dim deviceCount As UInteger = 0UI- If OpenClApi.clGetDeviceIDs(plat, OpenClApi.DeviceTypeGpu, 0UI, Nothing, deviceCount) <> 0 OrElse deviceCount = 0UI Then Continue For-- Dim ids(CInt(deviceCount) - 1) As IntPtr- Dim got As UInteger = 0UI- If OpenClApi.clGetDeviceIDs(plat, OpenClApi.DeviceTypeGpu, deviceCount, ids, got) <> 0 Then Continue For-- For Each id As IntPtr In ids- found.Add(Describe(plat, id))- Next- Next-- found.Sort(Function(a As GpuDeviceInfo, b As GpuDeviceInfo) As Integer- If a.Discrete <> b.Discrete Then Return If(a.Discrete, -1, 1)- Return b.Score.CompareTo(a.Score)- End Function)- Return found- End Function-- Private Shared Function Describe(plat As IntPtr, id As IntPtr) As GpuDeviceInfo- Dim g As New GpuDeviceInfo()- g.PlatformId = plat- g.DeviceId = id- g.Name = OpenClApi.DeviceString(id, OpenClApi.DeviceName)- g.Vendor = OpenClApi.DeviceString(id, OpenClApi.DeviceVendor)- g.Discrete = (OpenClApi.DeviceNumber(id, OpenClApi.DeviceHostUnifiedMemory) = 0UL)- Dim units As Double = CDbl(OpenClApi.DeviceNumber(id, OpenClApi.DeviceMaxComputeUnits))- Dim clock As Double = CDbl(OpenClApi.DeviceNumber(id, OpenClApi.DeviceMaxClockFrequency))- g.Score = units * Math.Max(1.0, clock)- g.GlobalMemory = CLng(OpenClApi.DeviceNumber(id, OpenClApi.DeviceGlobalMemSize) And &H7FFFFFFFFFFFFFFFUL)- g.MaxAllocation = CLng(OpenClApi.DeviceNumber(id, OpenClApi.DeviceMaxMemAllocSize) And &H7FFFFFFFFFFFFFFFUL)- If g.Name.Length = 0 Then g.Name = "GPU"- Return g- End Function--End Classdiff --git a/2D_wave_sim_V01/Simulation/ProbeGraphPainter.vb b/2D_wave_sim_V01/Simulation/ProbeGraphPainter.vbdeleted file mode 100644index 3128be2..0000000--- a/2D_wave_sim_V01/Simulation/ProbeGraphPainter.vb+++ /dev/null@@ -1,713 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Drawing-Imports System.Drawing.Drawing2D-Imports System.Drawing.Imaging-Imports System.Drawing.Text-Imports System.Globalization-Imports System.Runtime.InteropServices--''' <summary>-''' Draws the probe graphs (a little box with axes and the measured curve) and the probe markers. Used for the live-''' pictures on the screen (with a Graphics of the picture box) and for the exported videos (through ProbeOverlay).-''' Point probe value (Y) against the simulation step (X)-''' Line probe value (Y) against the position on the line A-B in pixels (X), at the current step-''' </summary>-Friend NotInheritable Class ProbeGraphPainter-- Private Sub New()- End Sub-- ''' <summary>The nominal size of the box in scene pixels.</summary>- Public Shared Function NominalBoxSize(boxSize As ProbeBoxSize) As Size- Select Case boxSize- Case ProbeBoxSize.Tiny- Return New Size(200, 100)- Case ProbeBoxSize.Small- Return New Size(300, 150)- Case ProbeBoxSize.Large- Return New Size(500, 250)- Case ProbeBoxSize.ExtraLarge- Return New Size(700, 350)- Case Else- Return New Size(400, 200)- End Select- End Function-- ''' <summary>- ''' The graph box in scene pixels of a canvas of w x h: the nominal size (smaller when the canvas is small: at most- ''' half as wide as the canvas) with its top left corner where the probe says, moved when necessary so that the box stays on the canvas.- ''' </summary>- Public Shared Function BoxInCanvas(probe As ProbeSettings, w As Integer, h As Integer) As Rectangle- Dim nominal As Size = NominalBoxSize(probe.BoxSize)- Dim factor As Double = 1.0- If nominal.Width > w / 2.0 Then factor = Math.Min(factor, (w / 2.0) / nominal.Width)- If nominal.Height > h Then factor = Math.Min(factor, h / CDbl(nominal.Height))-- Dim boxW As Integer = Math.Max(1, CInt(nominal.Width * factor))- Dim boxH As Integer = Math.Max(1, CInt(nominal.Height * factor))- Dim x As Integer = Math.Max(0, Math.Min(w - boxW, probe.BoxX))- Dim y As Integer = Math.Max(0, Math.Min(h - boxH, probe.BoxY))- Return New Rectangle(x, y, boxW, boxH)- End Function-- ' ---------------------------------------------------------------- the axes-- ''' <summary>- ''' The ranges of the graph.- ''' Point probe: X is the simulation step. With a running graph the last RunningWindow steps are shown; with a full- ''' graph the whole run (0 to the last step so far when X is scaled automatically, otherwise 0 to the total number of steps).- ''' Line probe: X is the position on the line, from 0 to the length of the line.- ''' With automatic Y the range follows the values that are shown.- ''' </summary>- Public Shared Sub ComputeRanges(probe As ProbeSettings, trace As ProbeTrace, totalSteps As Integer,- ByRef xMin As Double, ByRef xMax As Double, ByRef yMin As Double, ByRef yMax As Double)- If probe.Kind = ProbeKind.Line Then- ProfileRanges(probe, trace, xMin, xMax, yMin, yMax)- Else- Dim series As ProbeSeries = Nothing- If trace IsNot Nothing Then series = trace.Series- Dim startStep As Double = If(probe.UseStartAfterStep, Math.Max(0, probe.StartAfterStep), 0.0)- SeriesRanges(probe, series, totalSteps, startStep, xMin, xMax, yMin, yMax)- End If- End Sub-- ''' <summary>- ''' The ranges for a point probe. When "start after step" is used, the values from before that step are trimmed off:- ''' xMin never goes below it, so the visible range starts there (with more room for the data that follows, especially- ''' with the full scale, which would otherwise show mostly empty space before the data starts).- ''' </summary>- Private Shared Sub SeriesRanges(probe As ProbeSettings, series As ProbeSeries, totalSteps As Integer, startStep As Double,- ByRef xMin As Double, ByRef xMax As Double, ByRef yMin As Double, ByRef yMax As Double)- Dim count As Integer = If(series Is Nothing, 0, series.Count)- Dim current As Double = count-- If probe.ScaleMode = ProbeScaleMode.Full Then- xMin = startStep- xMax = If(probe.AutoScaleX, Math.Max(current, startStep + 1.0), Math.Max(CDbl(totalSteps), startStep + 1.0))- Else- Dim window As Double = Math.Max(10, probe.RunningWindow)- If probe.AutoScaleX Then- xMax = Math.Max(current, startStep + 1.0)- xMin = Math.Max(startStep, xMax - window)- Else- xMax = Math.Max(current, startStep + window)- xMin = Math.Max(startStep, xMax - window)- End If- End If- If xMax <= xMin Then xMax = xMin + 1.0-- yMin = probe.YMin- yMax = probe.YMax- If Not (yMax > yMin) Then- yMin = -1.0- yMax = 1.0- End If-- If probe.AutoScaleY AndAlso count > 0 Then- Dim i0 As Integer = Math.Max(0, CInt(Math.Floor(xMin)) - 1)- Dim i1 As Integer = Math.Min(count - 1, CInt(Math.Ceiling(xMax)))- Dim lo As Double = Double.MaxValue- Dim hi As Double = Double.MinValue- Dim values As Single() = series.Values- For i As Integer = i0 To i1- Dim v As Single = values(i)- If Not (Single.IsNaN(v) OrElse Single.IsInfinity(v)) Then- If v < lo Then lo = v- If v > hi Then hi = v- End If- Next- If lo <= hi Then FitRange(lo, hi, False, yMin, yMax)- End If- End Sub-- Private Shared Sub ProfileRanges(probe As ProbeSettings, trace As ProbeTrace,- ByRef xMin As Double, ByRef xMax As Double, ByRef yMin As Double, ByRef yMax As Double)- Dim length As Double = 0.0- Dim profile As Single() = Nothing- If trace IsNot Nothing Then- length = trace.ProfileLength- profile = trace.Profile- End If-- xMin = 0.0- xMax = If(length > 0.0, length, 1.0)-- yMin = probe.YMin- yMax = probe.YMax- If Not (yMax > yMin) Then- yMin = -1.0- yMax = 1.0- End If-- If probe.AutoScaleY AndAlso profile IsNot Nothing Then- Dim lo As Double = Double.MaxValue- Dim hi As Double = Double.MinValue- For i As Integer = 0 To profile.Length - 1- Dim v As Single = profile(i)- If Not (Single.IsNaN(v) OrElse Single.IsInfinity(v)) Then- If v < lo Then lo = v- If v > hi Then hi = v- End If- Next- ' an intensity starts at zero- If lo <= hi Then FitRange(lo, hi, probe.Measurement <> ProbeMeasurement.Amplitude AndAlso lo >= 0.0, yMin, yMax)- End If- End Sub-- ''' <summary>A value range with some room around the values (from zero when zeroBased).</summary>- Private Shared Sub FitRange(lo As Double, hi As Double, zeroBased As Boolean, ByRef yMin As Double, ByRef yMax As Double)- Dim span As Double = hi - lo- Dim biggest As Double = Math.Max(Math.Abs(hi), Math.Abs(lo))- Dim pad As Double = span * 0.08- If span < biggest * 0.000000001 OrElse span < 1.0E-30 Then- pad = Math.Max(biggest * 0.1, 0.000001)- End If- yMin = If(zeroBased, 0.0, lo - pad)- yMax = hi + pad- End Sub-- Private Shared Function NiceTicks(lo As Double, hi As Double, target As Integer) As List(Of Double)- Dim ticks As New List(Of Double)()- Dim span As Double = hi - lo- If Not (span > 0.0) OrElse Double.IsInfinity(span) Then Return ticks-- Dim raw As Double = span / Math.Max(1, target)- Dim magnitude As Double = Math.Pow(10.0, Math.Floor(Math.Log10(raw)))- Dim normalized As Double = raw / magnitude- Dim tickStep As Double- If normalized < 1.5 Then- tickStep = 1.0- ElseIf normalized < 3.0 Then- tickStep = 2.0- ElseIf normalized < 7.0 Then- tickStep = 5.0- Else- tickStep = 10.0- End If- tickStep *= magnitude-- Dim v As Double = Math.Ceiling(lo / tickStep) * tickStep- Dim guard As Integer = 0- While v <= hi + tickStep * 0.000000001 AndAlso guard < 40- ticks.Add(If(Math.Abs(v) < tickStep * 0.000000001, 0.0, v))- v += tickStep- guard += 1- End While- Return ticks- End Function-- Private Shared Function FormatTick(v As Double) As String- If v = 0.0 Then Return "0"- Return v.ToString("G3", CultureInfo.InvariantCulture)- End Function-- ''' <summary>A position on the step axis or on the line: a whole number, or with one decimal for a short line.</summary>- Private Shared Function FormatPosition(v As Double, span As Double) As String- If span >= 10.0 Then Return Math.Round(v).ToString("0", CultureInfo.InvariantCulture)- Return v.ToString("0.#", CultureInfo.InvariantCulture)- End Function-- ' ---------------------------------------------------------------- the graph-- ''' <summary>Draws the graph box (background, axes, curve, title and a value) in the given rectangle.</summary>- Public Shared Sub DrawGraph(g As Graphics, bounds As Rectangle, title As String, probe As ProbeSettings,- trace As ProbeTrace, totalSteps As Integer)- If bounds.Width < 40 OrElse bounds.Height < 30 Then Return-- Dim state As GraphicsState = g.Save()- Try- g.SmoothingMode = SmoothingMode.AntiAlias- g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit-- Using background As New SolidBrush(Color.FromArgb(235, 14, 16, 22))- g.FillRectangle(background, bounds)- End Using- Using border As New Pen(Color.FromArgb(170, 200, 200, 210), 1.0F)- g.DrawRectangle(border, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1)- End Using-- Dim fontPx As Single = Math.Max(9.0F, bounds.Height / 14.0F)- Using font As New Font("Segoe UI", fontPx, FontStyle.Regular, GraphicsUnit.Pixel)- Dim labelWidth As Integer = CInt(Math.Ceiling(fontPx * 4.4F))- Dim topMargin As Integer = CInt(fontPx * 2.3F)- Dim bottomMargin As Integer = CInt(fontPx * 1.9F)- Dim plot As New Rectangle(bounds.X + labelWidth + 6, bounds.Y + topMargin,- bounds.Width - labelWidth - 6 - 10, bounds.Height - topMargin - bottomMargin)- If plot.Width < 20 OrElse plot.Height < 15 Then Return-- ' a line probe (a profile of the current instant) has nothing meaningful to show before the start step is- ' reached, so it stays blank until then; a point probe (a series) is trimmed instead, see SeriesRanges- Dim isLine As Boolean = (probe.Kind = ProbeKind.Line)- Dim started As Boolean = Not probe.UseStartAfterStep OrElse trace Is Nothing OrElse trace.StepsSampled >= probe.StartAfterStep- Dim shownTrace As ProbeTrace = If(started, trace, Nothing)-- ' a point probe's own range/autoscale must see the real trace (it is trimmed by "start after step" inside- ' ComputeRanges/SeriesRanges, not hidden); only a line probe uses shownTrace, to stay blank until it starts- Dim xMin, xMax, yMin, yMax As Double- ComputeRanges(probe, If(isLine, shownTrace, trace), totalSteps, xMin, xMax, yMin, yMax)-- DrawAxes(g, font, fontPx, bounds, plot, xMin, xMax, yMin, yMax)- Dim lineWidth As Single = Math.Max(1.2F, bounds.Height / 110.0F)- If isLine Then- If shownTrace IsNot Nothing Then DrawProfile(g, plot, shownTrace.Profile, yMin, yMax, lineWidth)- Else- ' a point probe is trimmed (xMin), not hidden: its curve is drawn up to the current value even before- ' the start step is reached (the range is then just very small)- If trace IsNot Nothing Then DrawCurve(g, plot, trace.Series, xMin, xMax, yMin, yMax, lineWidth)- End If- DrawTitle(g, font, bounds, title, ValueText(isLine, If(isLine, shownTrace, trace)), fontPx)- End Using- Finally- g.Restore(state)- End Try- End Sub-- ''' <summary>The value at the top right of the box: the last value of a point probe, the highest value on the line of a line probe.</summary>- Private Shared Function ValueText(isLine As Boolean, trace As ProbeTrace) As String- If trace Is Nothing Then Return ""-- If isLine Then- Dim profile As Single() = trace.Profile- If profile Is Nothing OrElse profile.Length = 0 Then Return ""- Dim hi As Single = Single.MinValue- For i As Integer = 0 To profile.Length - 1- Dim v As Single = profile(i)- If Not (Single.IsNaN(v) OrElse Single.IsInfinity(v)) AndAlso v > hi Then hi = v- Next- If hi = Single.MinValue Then Return ""- Return "max " & FormatTick(hi)- End If-- If trace.Series.Count = 0 Then Return ""- Dim last As Single = trace.Series.LastValue- If Single.IsNaN(last) OrElse Single.IsInfinity(last) Then Return ""- Return "= " & FormatTick(last)- End Function-- Private Shared Sub DrawAxes(g As Graphics, font As Font, fontPx As Single, bounds As Rectangle, plot As Rectangle,- xMin As Double, xMax As Double, yMin As Double, yMax As Double)- Using gridPen As New Pen(Color.FromArgb(46, 255, 255, 255), 1.0F)- Using zeroPen As New Pen(Color.FromArgb(120, 255, 255, 255), 1.0F)- Using textBrush As New SolidBrush(Color.FromArgb(225, 225, 225, 230))- Using rightAligned As New StringFormat()- Using centered As New StringFormat()- rightAligned.Alignment = StringAlignment.Far- rightAligned.LineAlignment = StringAlignment.Center- rightAligned.FormatFlags = StringFormatFlags.NoWrap- centered.Alignment = StringAlignment.Center- centered.FormatFlags = StringFormatFlags.NoWrap-- ' value axis- For Each v As Double In NiceTicks(yMin, yMax, 4)- Dim y As Single = ToPixelY(v, plot, yMin, yMax)- g.DrawLine(If(v = 0.0, zeroPen, gridPen), plot.Left, y, plot.Right, y)- g.DrawString(FormatTick(v), font, textBrush,- New RectangleF(bounds.X + 1, y - fontPx * 0.7F, plot.Left - bounds.X - 4, fontPx * 1.4F), rightAligned)- Next-- ' step axis (point probe) or position on the line (line probe)- For Each v As Double In NiceTicks(xMin, xMax, 5)- Dim x As Single = CSng(plot.Left + (v - xMin) / (xMax - xMin) * plot.Width)- g.DrawLine(gridPen, x, plot.Top, x, plot.Bottom)- g.DrawString(FormatPosition(v, xMax - xMin), font, textBrush,- New RectangleF(x - fontPx * 2.5F, plot.Bottom + 2, fontPx * 5.0F, fontPx * 1.4F), centered)- Next- End Using- End Using- End Using- End Using-- Using framePen As New Pen(Color.FromArgb(130, 200, 200, 210), 1.0F)- g.DrawRectangle(framePen, plot.X, plot.Y, plot.Width, plot.Height)- End Using- End Using- End Sub-- Private Shared Function ToPixelY(v As Double, plot As Rectangle, yMin As Double, yMax As Double) As Single- Dim y As Double = plot.Bottom - (v - yMin) / (yMax - yMin) * plot.Height- If y < -30000.0 Then y = -30000.0- If y > 30000.0 Then y = 30000.0- Return CSng(y)- End Function-- ''' <summary>The curve of a point probe: the value of every step.</summary>- Private Shared Sub DrawCurve(g As Graphics, plot As Rectangle, series As ProbeSeries,- xMin As Double, xMax As Double, yMin As Double, yMax As Double, lineWidth As Single)- If series Is Nothing OrElse series.Count < 1 Then Return-- Dim values As Single() = series.Values- Dim count As Integer = series.Count- Dim i0 As Integer = Math.Max(0, CInt(Math.Floor(xMin)) - 1)- Dim i1 As Integer = Math.Min(count - 1, CInt(Math.Ceiling(xMax)))- If i1 < i0 Then Return-- Dim points As New List(Of PointF)()- Dim visible As Integer = i1 - i0 + 1- Dim xScale As Double = plot.Width / (xMax - xMin)-- If visible <= plot.Width * 2 Then- ' every value gets its own point (value i belongs to step i + 1)- For i As Integer = i0 To i1- Dim v As Single = values(i)- If Single.IsNaN(v) OrElse Single.IsInfinity(v) Then Continue For- points.Add(New PointF(CSng(plot.Left + (i + 1 - xMin) * xScale), ToPixelY(v, plot, yMin, yMax)))- Next- Else- ' more values than pixels: draw the lowest and the highest value of every pixel column- For column As Integer = 0 To plot.Width - 1- Dim a As Integer = i0 + CInt(CLng(column) * visible \ plot.Width)- Dim b As Integer = i0 + CInt(CLng(column + 1) * visible \ plot.Width) - 1- If b < a Then b = a- Dim lo As Single = Single.MaxValue- Dim hi As Single = Single.MinValue- For i As Integer = a To Math.Min(b, i1)- Dim v As Single = values(i)- If Single.IsNaN(v) OrElse Single.IsInfinity(v) Then Continue For- If v < lo Then lo = v- If v > hi Then hi = v- Next- If lo <= hi Then- Dim x As Single = plot.Left + column + 0.5F- points.Add(New PointF(x, ToPixelY(lo, plot, yMin, yMax)))- points.Add(New PointF(x, ToPixelY(hi, plot, yMin, yMax)))- End If- Next- End If-- StrokePoints(g, plot, points, lineWidth)- End Sub-- ''' <summary>The curve of a line probe: the value at every pixel of the line, from A (left) to B (right).</summary>- Private Shared Sub DrawProfile(g As Graphics, plot As Rectangle, profile As Single(), yMin As Double, yMax As Double, lineWidth As Single)- If profile Is Nothing OrElse profile.Length < 1 Then Return-- Dim n As Integer = profile.Length- Dim points As New List(Of PointF)()-- If n <= plot.Width * 2 Then- For k As Integer = 0 To n - 1- Dim v As Single = profile(k)- If Single.IsNaN(v) OrElse Single.IsInfinity(v) Then Continue For- Dim fraction As Double = If(n > 1, k / (n - 1.0), 0.0)- points.Add(New PointF(CSng(plot.Left + fraction * plot.Width), ToPixelY(v, plot, yMin, yMax)))- Next- Else- ' more pixels on the line than on the screen: the lowest and the highest value of every pixel column- For column As Integer = 0 To plot.Width - 1- Dim a As Integer = CInt(CLng(column) * n \ plot.Width)- Dim b As Integer = CInt(CLng(column + 1) * n \ plot.Width) - 1- If b < a Then b = a- Dim lo As Single = Single.MaxValue- Dim hi As Single = Single.MinValue- For k As Integer = a To Math.Min(b, n - 1)- Dim v As Single = profile(k)- If Single.IsNaN(v) OrElse Single.IsInfinity(v) Then Continue For- If v < lo Then lo = v- If v > hi Then hi = v- Next- If lo <= hi Then- Dim x As Single = plot.Left + column + 0.5F- points.Add(New PointF(x, ToPixelY(lo, plot, yMin, yMax)))- points.Add(New PointF(x, ToPixelY(hi, plot, yMin, yMax)))- End If- Next- End If-- StrokePoints(g, plot, points, lineWidth)- End Sub-- Private Shared Sub StrokePoints(g As Graphics, plot As Rectangle, points As List(Of PointF), lineWidth As Single)- If points.Count < 2 Then- If points.Count = 1 Then- Using dot As New SolidBrush(Color.FromArgb(255, 255, 208, 64))- g.FillEllipse(dot, points(0).X - 2.0F, points(0).Y - 2.0F, 4.0F, 4.0F)- End Using- End If- Return- End If-- Dim clip As Region = g.Clip- Try- g.SetClip(plot)- Using pen As New Pen(Color.FromArgb(255, 255, 208, 64), lineWidth)- pen.LineJoin = LineJoin.Round- g.DrawLines(pen, points.ToArray())- End Using- Finally- g.Clip = clip- clip.Dispose()- End Try- End Sub-- Private Shared Sub DrawTitle(g As Graphics, font As Font, bounds As Rectangle, title As String,- valueText As String, fontPx As Single)- Using textBrush As New SolidBrush(Color.FromArgb(240, 240, 240, 245))- Using valueBrush As New SolidBrush(Color.FromArgb(255, 255, 208, 64))- Using farFormat As New StringFormat()- Using nearFormat As New StringFormat()- farFormat.Alignment = StringAlignment.Far- farFormat.FormatFlags = StringFormatFlags.NoWrap- nearFormat.Alignment = StringAlignment.Near- nearFormat.Trimming = StringTrimming.EllipsisCharacter- nearFormat.FormatFlags = StringFormatFlags.NoWrap-- Dim valueWidth As Single = 0.0F- If valueText.Length > 0 Then- valueWidth = g.MeasureString(valueText, font).Width- g.DrawString(valueText, font, valueBrush,- New RectangleF(bounds.Right - valueWidth - 8, bounds.Y + 3, valueWidth + 4, fontPx * 1.4F), farFormat)- End If- g.DrawString(title, font, textBrush,- New RectangleF(bounds.X + 6, bounds.Y + 3, Math.Max(10.0F, bounds.Width - valueWidth - 16), fontPx * 1.4F), nearFormat)- End Using- End Using- End Using- End Using- End Sub-- ' ---------------------------------------------------------------- the markers-- ''' <summary>- ''' Draws the probe position(s): a cross at A (and B) with the number of the probe, and the line between them.- ''' A simulation pixel (x, y) is drawn at (originX + (x + 0.5) * scaleX, originY + (y + 0.5) * scaleY).- ''' </summary>- Public Shared Sub DrawMarkers(g As Graphics, probe As ProbeSettings, index As Integer, originX As Single, originY As Single,- scaleX As Single, scaleY As Single)- Dim ax As Single = originX + (probe.PosAX + 0.5F) * scaleX- Dim ay As Single = originY + (probe.PosAY + 0.5F) * scaleY- Dim bx As Single = originX + (probe.PosBX + 0.5F) * scaleX- Dim by2 As Single = originY + (probe.PosBY + 0.5F) * scaleY- Dim isLine As Boolean = (probe.Kind = ProbeKind.Line)- Dim number As String = (index + 1).ToString(CultureInfo.InvariantCulture)-- Dim state As GraphicsState = g.Save()- Try- g.SmoothingMode = SmoothingMode.AntiAlias- g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit- Using dark As New Pen(Color.FromArgb(210, 0, 0, 0), 3.5F)- Using light As New Pen(Color.White, 1.5F)- If isLine Then- g.DrawLine(dark, ax, ay, bx, by2)- g.DrawLine(light, ax, ay, bx, by2)- End If- DrawCross(g, dark, light, ax, ay)- If isLine Then DrawCross(g, dark, light, bx, by2)- End Using- End Using-- Using font As New Font("Segoe UI", 13.0F, FontStyle.Bold, GraphicsUnit.Pixel)- Using shadow As New SolidBrush(Color.FromArgb(220, 0, 0, 0))- Using textBrush As New SolidBrush(Color.White)- ' a line probe has two ends, so each is labelled with the probe number and which end it is- If isLine Then- DrawNumber(g, font, shadow, textBrush, number & "A", ax, ay)- DrawNumber(g, font, shadow, textBrush, number & "B", bx, by2)- Else- DrawNumber(g, font, shadow, textBrush, number, ax, ay)- End If- End Using- End Using- End Using- Finally- g.Restore(state)- End Try- End Sub-- Private Shared Sub DrawCross(g As Graphics, dark As Pen, light As Pen, x As Single, y As Single)- Const arm As Single = 7.0F- g.DrawLine(dark, x - arm, y, x + arm, y)- g.DrawLine(dark, x, y - arm, x, y + arm)- g.DrawLine(light, x - arm, y, x + arm, y)- g.DrawLine(light, x, y - arm, x, y + arm)- End Sub-- Private Shared Sub DrawNumber(g As Graphics, font As Font, shadow As Brush, textBrush As Brush, text As String, x As Single, y As Single)- g.DrawString(text, font, shadow, x + 9.0F, y - 18.0F)- g.DrawString(text, font, textBrush, x + 8.0F, y - 19.0F)- End Sub--End Class--''' <summary>Draws the probes into the pixels of an exported video frame.</summary>-Friend NotInheritable Class ProbeOverlay-- Private Sub New()- End Sub-- ''' <summary>- ''' Draws the markers and the graph boxes of the probes that belong on this kind of picture into a frame- ''' (packed ARGB pixels, w x h). The frame is the whole scene, so the box is where the probe says (in scene pixels).- ''' </summary>- Public Shared Sub Burn(pixels As Integer(), w As Integer, h As Integer, probes As IList(Of ProbeSettings),- traces As ProbeTrace(), placeOn As ProbePlaceOn, totalSteps As Integer)- For index As Integer = 0 To probes.Count - 1- Dim probe As ProbeSettings = probes(index)- If probe.PlaceOn <> placeOn OrElse Not probe.Active Then Continue For-- DrawMarkerPixels(pixels, w, h, probe, index)-- Dim rect As Rectangle = ProbeGraphPainter.BoxInCanvas(probe, w, h)- If rect.Width < 60 OrElse rect.Height < 30 Then Continue For-- Using bmp As New Bitmap(rect.Width, rect.Height, PixelFormat.Format32bppPArgb)- Using g As Graphics = Graphics.FromImage(bmp)- g.Clear(Color.Transparent)- ProbeGraphPainter.DrawGraph(g, New Rectangle(0, 0, rect.Width, rect.Height), probe.Title(index), probe, traces(index), totalSteps)- End Using- Blend(pixels, w, h, bmp, rect)- End Using- Next- End Sub-- ''' <summary>Puts a picture with premultiplied alpha over a rectangle of the frame.</summary>- Private Shared Sub Blend(pixels As Integer(), w As Integer, h As Integer, bmp As Bitmap, rect As Rectangle)- Dim data As BitmapData = bmp.LockBits(New Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb)- Try- Dim row(bmp.Width - 1) As Integer- For y As Integer = 0 To bmp.Height - 1- Dim fy As Integer = rect.Y + y- If fy < 0 OrElse fy >= h Then Continue For-- Marshal.Copy(IntPtr.Add(data.Scan0, y * data.Stride), row, 0, bmp.Width)- For x As Integer = 0 To bmp.Width - 1- Dim fx As Integer = rect.X + x- If fx < 0 OrElse fx >= w Then Continue For-- Dim src As Integer = row(x)- Dim a As Integer = (src >> 24) And &HFF- If a = 0 Then Continue For-- Dim idx As Integer = fy * w + fx- If a = 255 Then- pixels(idx) = src Or &HFF000000- Else- Dim dst As Integer = pixels(idx)- Dim inv As Integer = 255 - a- Dim r As Integer = Math.Min(255, ((src >> 16) And &HFF) + (((dst >> 16) And &HFF) * inv + 127) \ 255)- Dim gr As Integer = Math.Min(255, ((src >> 8) And &HFF) + (((dst >> 8) And &HFF) * inv + 127) \ 255)- Dim b As Integer = Math.Min(255, (src And &HFF) + ((dst And &HFF) * inv + 127) \ 255)- pixels(idx) = &HFF000000 Or (r << 16) Or (gr << 8) Or b- End If- Next- Next- Finally- bmp.UnlockBits(data)- End Try- End Sub-- ' ---- markers, drawn pixel by pixel-- Private Shared Sub DrawMarkerPixels(pixels As Integer(), w As Integer, h As Integer, probe As ProbeSettings, index As Integer)- Dim arm As Integer = Math.Max(6, h \ 120)- Dim isLine As Boolean = (probe.Kind = ProbeKind.Line)-- ' black underneath, white on top- For pass As Integer = 0 To 1- Dim color As Integer = If(pass = 0, &HFF000000, &HFFFFFFFF)- Dim radius As Integer = If(pass = 0, 2, 1)-- If isLine Then DrawThickLine(pixels, w, h, probe.PosAX, probe.PosAY, probe.PosBX, probe.PosBY, color, radius)- DrawCrossPixels(pixels, w, h, probe.PosAX, probe.PosAY, arm, color, radius)- If isLine Then DrawCrossPixels(pixels, w, h, probe.PosBX, probe.PosBY, arm, color, radius)- Next-- ' the number of the probe next to the cross; a line probe's two ends are labelled with which end they are- Dim number As String = (index + 1).ToString(CultureInfo.InvariantCulture)- Dim fontPx As Single = Math.Max(12.0F, h / 60.0F)- If isLine Then- BurnLabel(pixels, w, h, number & "A", probe.PosAX + arm + 2, probe.PosAY - arm - CInt(fontPx * 1.4F), fontPx)- BurnLabel(pixels, w, h, number & "B", probe.PosBX + arm + 2, probe.PosBY - arm - CInt(fontPx * 1.4F), fontPx)- Else- BurnLabel(pixels, w, h, number, probe.PosAX + arm + 2, probe.PosAY - arm - CInt(fontPx * 1.4F), fontPx)- End If- End Sub-- Private Shared Sub BurnLabel(pixels As Integer(), w As Integer, h As Integer, text As String, x As Integer, y As Integer, fontPx As Single)- Using font As New Font("Segoe UI", fontPx, FontStyle.Bold, GraphicsUnit.Pixel)- Dim labelWidth As Integer- Dim labelHeight As Integer- Using measure As New Bitmap(1, 1)- Using g As Graphics = Graphics.FromImage(measure)- Dim m As SizeF = g.MeasureString(text, font)- labelWidth = CInt(Math.Ceiling(m.Width)) + 4- labelHeight = CInt(Math.Ceiling(m.Height)) + 4- End Using- End Using-- Using bmp As New Bitmap(labelWidth, labelHeight, PixelFormat.Format32bppPArgb)- Using g As Graphics = Graphics.FromImage(bmp)- g.Clear(Color.Transparent)- g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit- Using shadow As New SolidBrush(Color.FromArgb(220, 0, 0, 0))- Using white As New SolidBrush(Color.White)- g.DrawString(text, font, shadow, 3.0F, 3.0F)- g.DrawString(text, font, white, 2.0F, 2.0F)- End Using- End Using- End Using- Blend(pixels, w, h, bmp, New Rectangle(x, y, labelWidth, labelHeight))- End Using- End Using- End Sub-- Private Shared Sub DrawCrossPixels(pixels As Integer(), w As Integer, h As Integer, x As Integer, y As Integer,- arm As Integer, color As Integer, radius As Integer)- DrawThickLine(pixels, w, h, x - arm, y, x + arm, y, color, radius)- DrawThickLine(pixels, w, h, x, y - arm, x, y + arm, color, radius)- End Sub-- Private Shared Sub DrawThickLine(pixels As Integer(), w As Integer, h As Integer, x0 As Integer, y0 As Integer,- x1 As Integer, y1 As Integer, color As Integer, radius As Integer)- Dim dx As Integer = Math.Abs(x1 - x0)- Dim dy As Integer = -Math.Abs(y1 - y0)- Dim sx As Integer = If(x0 < x1, 1, -1)- Dim sy As Integer = If(y0 < y1, 1, -1)- Dim diff As Integer = dx + dy- Dim guard As Integer = 0-- Do- For oy As Integer = -radius To radius- For ox As Integer = -radius To radius- Dim px As Integer = x0 + ox- Dim py As Integer = y0 + oy- If px >= 0 AndAlso px < w AndAlso py >= 0 AndAlso py < h Then pixels(py * w + px) = color- Next- Next-- If (x0 = x1 AndAlso y0 = y1) OrElse guard > 100000 Then Exit Do- guard += 1- Dim e2 As Integer = 2 * diff- If e2 >= dy Then- diff += dy- x0 += sx- End If- If e2 <= dx Then- diff += dx- y0 += sy- End If- Loop- End Sub--End Classdiff --git a/2D_wave_sim_V01/Simulation/ProbeSampling.vb b/2D_wave_sim_V01/Simulation/ProbeSampling.vbdeleted file mode 100644index 81390e4..0000000--- a/2D_wave_sim_V01/Simulation/ProbeSampling.vb+++ /dev/null@@ -1,352 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic--''' <summary>The measured values of one point probe, one value per simulation step (value i belongs to step i + 1).</summary>-Friend NotInheritable Class ProbeSeries-- Private _values As Single() = New Single(1023) {}- Private _count As Integer-- ''' <summary>The number of values.</summary>- Public ReadOnly Property Count As Integer- Get- Return _count- End Get- End Property-- ''' <summary>The values; only the first Count entries are valid. Do not change.</summary>- Public ReadOnly Property Values As Single()- Get- Return _values- End Get- End Property-- ''' <summary>The last value, or NaN when there is none yet.</summary>- Public ReadOnly Property LastValue As Single- Get- If _count = 0 Then Return Single.NaN- Return _values(_count - 1)- End Get- End Property-- Public Sub Add(items As Single())- If items Is Nothing OrElse items.Length = 0 Then Return- Dim needed As Integer = _count + items.Length- If needed > _values.Length Then- Dim bigger As Single() = New Single(Math.Max(needed, _values.Length * 2) - 1) {}- Array.Copy(_values, bigger, _count)- _values = bigger- End If- Array.Copy(items, 0, _values, _count, items.Length)- _count = needed- End Sub-- Public Sub Clear()- _count = 0- End Sub--End Class--''' <summary>-''' What the graph of one probe shows: for a point probe the series of values (one per step), for a line probe the-''' profile, the values along the line at the last update. The profile array is replaced, never changed, so it can be-''' passed from the simulation thread to the user interface.-''' </summary>-Friend NotInheritable Class ProbeTrace-- Private _profile As Single()- Private _profileLength As Double-- Public ReadOnly Series As New ProbeSeries()-- ''' <summary>The simulation step of the last update (the last SampleProbes/collect that reached this trace). Used to hold- ''' back the graph until "start after step" is reached.</summary>- Public Property StepsSampled As Integer-- ''' <summary>The values along the line from A to B (one per pixel), or Nothing when there is none yet.</summary>- Public ReadOnly Property Profile As Single()- Get- Return _profile- End Get- End Property-- ''' <summary>The length of the line in pixels (the profile is drawn from 0 to this length).</summary>- Public ReadOnly Property ProfileLength As Double- Get- Return _profileLength- End Get- End Property-- Public Sub SetProfile(values As Single(), length As Double)- _profile = values- _profileLength = length- End Sub--End Class--''' <summary>New measurements for the user interface: per probe the new values of a point probe and the last profile of a line probe.</summary>-Friend NotInheritable Class ProbeUpdate-- ''' <summary>The new values of the point probes (empty for a line probe).</summary>- Public ReadOnly Samples As Single()()-- ''' <summary>The last profile of the line probes; Nothing for a point probe or when the profile did not change.</summary>- Public ReadOnly Profiles As Single()()-- ''' <summary>The length in pixels of the line of every probe (0 for a point).</summary>- Public ReadOnly Lengths As Double()-- ''' <summary>The simulation step this update was measured at.</summary>- Public ReadOnly StepsDone As Integer-- Public Sub New(samples As Single()(), profiles As Single()(), lengths As Double(), stepsDone As Integer)- Me.Samples = samples- Me.Profiles = profiles- Me.Lengths = lengths- Me.StepsDone = stepsDone- End Sub--End Class--''' <summary>-''' What a simulation engine has to measure for the probes. For every probe the pixels (as indices into the padded-''' field arrays, see IWaveEngine) and what is read there: the field or the intensity.-''' Point probe one pixel; the engine measures its value at every step (a series).-''' Point, integrated the same, but the values are added up over time (done by ProbeCollector).-''' Line probe the pixels on the line A-B; the engine gives the values along the line when asked (a profile).-''' Line, integrated the engine adds the intensity of every pixel of the line up over the steps.-''' </summary>-Friend NotInheritable Class ProbeSampler-- Public ReadOnly Count As Integer- Public ReadOnly Pixels As Integer()()- Public ReadOnly IsProfile As Boolean()- Public ReadOnly UseIntensity As Boolean()- Public ReadOnly Cumulative As Boolean()- Public ReadOnly Integrate As Boolean()- Public ReadOnly Lengths As Double()- Public ReadOnly NeedsIntensity As Boolean- Public ReadOnly HasSeries As Boolean- Public ReadOnly HasProfiles As Boolean-- ''' <summary>Per probe: whether "start recording at step #" is on, and that step. Used to purge (never accumulate)- ''' the running total of an integrated (cumulative) probe from before that step, so the total shown once recording- ''' starts is not inflated by intensity that arrived before it - see ProbeCollector.Collect, WaveSimulator.SampleProbes- ''' and GpuWaveSimulator's profile_accumulate kernel.</summary>- Public ReadOnly UseStartAfterStep As Boolean()- Public ReadOnly StartAfterStep As Integer()-- Private Sub New(pixels As Integer()(), isProfile As Boolean(), useIntensity As Boolean(), cumulative As Boolean(),- integrate As Boolean(), lengths As Double(), useStartAfterStep As Boolean(), startAfterStep As Integer())- Count = pixels.Length- Me.Pixels = pixels- Me.IsProfile = isProfile- Me.UseIntensity = useIntensity- Me.Cumulative = cumulative- Me.Integrate = integrate- Me.Lengths = lengths- Me.UseStartAfterStep = useStartAfterStep- Me.StartAfterStep = startAfterStep- For i As Integer = 0 To Count - 1- If useIntensity(i) Then NeedsIntensity = True- If isProfile(i) Then- HasProfiles = True- Else- HasSeries = True- End If- Next- End Sub-- ''' <summary>Builds the sampler for a canvas of w x h pixels. Positions outside the canvas are moved onto it.</summary>- Public Shared Function Build(probes As IList(Of ProbeSettings), w As Integer, h As Integer) As ProbeSampler- Dim n As Integer = probes.Count- Dim pixels As Integer()() = New Integer(n - 1)() {}- Dim isProfile(n - 1) As Boolean- Dim useIntensity(n - 1) As Boolean- Dim cumulative(n - 1) As Boolean- Dim integrate(n - 1) As Boolean- Dim lengths(n - 1) As Double- Dim useStartAfterStep(n - 1) As Boolean- Dim startAfterStep(n - 1) As Integer- Dim stride As Integer = w + 2-- For i As Integer = 0 To n - 1- Dim p As ProbeSettings = probes(i)- Dim ax As Integer = Clamp(p.PosAX, w - 1)- Dim ay As Integer = Clamp(p.PosAY, h - 1)- Dim integrated As Boolean = (p.Measurement = ProbeMeasurement.IntegratedIntensity)-- If p.Kind = ProbeKind.Line Then- Dim endX As Integer = Clamp(p.PosBX, w - 1)- Dim endY As Integer = Clamp(p.PosBY, h - 1)- pixels(i) = LinePixels(ax, ay, endX, endY, stride)- isProfile(i) = True- integrate(i) = integrated- Dim dx As Double = endX - ax- Dim dy As Double = endY - ay- lengths(i) = Math.Sqrt(dx * dx + dy * dy)- Else- pixels(i) = New Integer() {(ay + 1) * stride + ax + 1}- cumulative(i) = integrated- End If-- useIntensity(i) = (p.Measurement <> ProbeMeasurement.Amplitude)- useStartAfterStep(i) = p.UseStartAfterStep- startAfterStep(i) = p.StartAfterStep- Next-- Return New ProbeSampler(pixels, isProfile, useIntensity, cumulative, integrate, lengths, useStartAfterStep, startAfterStep)- End Function-- Private Shared Function Clamp(value As Integer, maxValue As Integer) As Integer- If value < 0 Then Return 0- If value > maxValue Then Return maxValue- Return value- End Function-- ''' <summary>The pixels on the line from (x0, y0) to (x1, y1), as indices into the padded arrays.</summary>- Private Shared Function LinePixels(x0 As Integer, y0 As Integer, x1 As Integer, y1 As Integer, stride As Integer) As Integer()- Dim result As New List(Of Integer)()- Dim dx As Integer = Math.Abs(x1 - x0)- Dim dy As Integer = -Math.Abs(y1 - y0)- Dim sx As Integer = If(x0 < x1, 1, -1)- Dim sy As Integer = If(y0 < y1, 1, -1)- Dim diff As Integer = dx + dy-- Do- result.Add((y0 + 1) * stride + x0 + 1)- If x0 = x1 AndAlso y0 = y1 Then Exit Do- Dim e2 As Integer = 2 * diff- If e2 >= dy Then- diff += dy- x0 += sx- End If- If e2 <= dx Then- diff += dx- y0 += sy- End If- Loop- Return result.ToArray()- End Function-- ''' <summary>The value of a point probe in the given data (the field or the intensity array of an engine).</summary>- Public Function Compute(probeIndex As Integer, data As Single()) As Single- If data Is Nothing Then Return 0.0F- Return data(Pixels(probeIndex)(0))- End Function--End Class--''' <summary>-''' Collects the measurements of an engine: the series of the point probes and the profiles of the line probes-''' (for the graphs in the exported videos), and the new values for the user interface.-''' </summary>-Friend NotInheritable Class ProbeCollector-- Public ReadOnly Traces As ProbeTrace()-- Private ReadOnly _sampler As ProbeSampler- Private ReadOnly _totals As Double()- Private ReadOnly _pending As New List(Of List(Of Single))()- Private ReadOnly _fresh As Boolean()- Private _lastStepsDone As Integer-- Public Sub New(sampler As ProbeSampler)- _sampler = sampler- Traces = New ProbeTrace(sampler.Count - 1) {}- _totals = New Double(sampler.Count - 1) {}- _fresh = New Boolean(sampler.Count - 1) {}- For i As Integer = 0 To sampler.Count - 1- Traces(i) = New ProbeTrace()- _pending.Add(New List(Of Single)())- Next- End Sub-- ''' <summary>Takes the values that the engine measured for the point probes since the last call.</summary>- Public Sub Collect(engine As IWaveEngine, stepsDone As Integer)- If Not _sampler.HasSeries Then Return-- Dim raw As Single()() = engine.TakeProbeSamples()- ' the number of steps already processed before this batch, so the absolute step of values(k) can be worked- ' out below (one value per step, in order) - needed to purge a cumulative total from before "start after step"- Dim batchStartStep As Integer = _lastStepsDone- For p As Integer = 0 To _sampler.Count - 1- If _sampler.IsProfile(p) OrElse p >= raw.Length Then Continue For- Dim values As Single() = raw(p)- If values Is Nothing OrElse values.Length = 0 Then Continue For-- If _sampler.Cumulative(p) Then- Dim useStart As Boolean = _sampler.UseStartAfterStep(p)- Dim startStep As Integer = _sampler.StartAfterStep(p)- For k As Integer = 0 To values.Length - 1- If useStart AndAlso (batchStartStep + k + 1) < startStep Then- ' before recording starts: keep the running total at zero, purging any intensity that- ' arrived earlier, so the total does not jump the moment recording starts- _totals(p) = 0.0- values(k) = 0.0F- Else- _totals(p) += values(k)- values(k) = CSng(_totals(p))- End If- Next- End If-- Traces(p).Series.Add(values)- Traces(p).StepsSampled = stepsDone- _pending(p).AddRange(values)- Next- _lastStepsDone = stepsDone- End Sub-- ''' <summary>Takes the profiles of the line probes in the current state of the engine.</summary>- Public Sub CollectProfiles(engine As IWaveEngine, stepsDone As Integer)- If Not _sampler.HasProfiles Then Return-- Dim raw As Single()() = engine.ReadProbeProfiles()- For p As Integer = 0 To _sampler.Count - 1- If Not _sampler.IsProfile(p) OrElse p >= raw.Length OrElse raw(p) Is Nothing Then Continue For- Traces(p).SetProfile(raw(p), _sampler.Lengths(p))- Traces(p).StepsSampled = stepsDone- _fresh(p) = True- Next- _lastStepsDone = stepsDone- End Sub-- ''' <summary>What is new since the last call (for the user interface).</summary>- Public Function TakeForUi() As ProbeUpdate- Dim n As Integer = _sampler.Count- Dim samples As Single()() = New Single(n - 1)() {}- Dim profiles As Single()() = New Single(n - 1)() {}- For p As Integer = 0 To n - 1- samples(p) = _pending(p).ToArray()- _pending(p).Clear()- If _fresh(p) Then- profiles(p) = Traces(p).Profile- _fresh(p) = False- End If- Next- Return New ProbeUpdate(samples, profiles, _sampler.Lengths, _lastStepsDone)- End Function--End Classdiff --git a/2D_wave_sim_V01/Simulation/ProbeSettings.vb b/2D_wave_sim_V01/Simulation/ProbeSettings.vbdeleted file mode 100644index b8eafb2..0000000--- a/2D_wave_sim_V01/Simulation/ProbeSettings.vb+++ /dev/null@@ -1,327 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections-Imports System.Collections.Generic-Imports System.Globalization--''' <summary>The simulation picture the probe and its graph box are drawn on.</summary>-Public Enum ProbePlaceOn- Field = 0- Intensity = 1-End Enum--''' <summary>What a probe measures.</summary>-Public Enum ProbeMeasurement- ''' <summary>The field value (only on the field picture).</summary>- Amplitude = 0- ''' <summary>The averaged intensity (only on the intensity picture).</summary>- Intensity = 1- ''' <summary>The intensity summed over time (the total that has passed the point, or each point of the line, so far).</summary>- IntegratedIntensity = 2-End Enum--Public Enum ProbeKind- ''' <summary>One pixel, position A. The graph shows the value against the simulation step.</summary>- Point = 0- ''' <summary>The pixels on the line from A to B. The graph shows the value against the position on the line, at the current step.</summary>- Line = 1-End Enum--Public Enum ProbeBoxSize- Tiny = 0- Small = 1- Medium = 2- Large = 3- ExtraLarge = 4-End Enum--Public Enum ProbeScaleMode- ''' <summary>The graph shows the last steps and scrolls along.</summary>- Running = 0- ''' <summary>The graph shows the whole run.</summary>- Full = 1-End Enum--''' <summary>-''' One probe: it measures the field or the intensity during the simulation and shows the result in a little graph box-''' in the field or intensity picture. A point probe (A) shows its value against the simulation step; a line probe-''' (A-B) shows the values along the line, against the position on the line, at the current step.-''' The probes are stored in the section "probes" of configuration.json as a list "items".-''' </summary>-Public NotInheritable Class ProbeSettings-- Public Const SectionName As String = "probes"- Public Const DefaultRunningWindow As Integer = 500- Public Const MaxRunningWindow As Integer = 1000000-- Public Property PlaceOn As ProbePlaceOn = ProbePlaceOn.Field- Public Property Measurement As ProbeMeasurement = ProbeMeasurement.Amplitude- Public Property Kind As ProbeKind = ProbeKind.Point-- ''' <summary>Position A and position B in simulation pixels (0, 0 = top left).</summary>- Public Property PosAX As Integer = 100- Public Property PosAY As Integer = 100- Public Property PosBX As Integer = 300- Public Property PosBY As Integer = 100-- Public Property BoxSize As ProbeBoxSize = ProbeBoxSize.Medium-- ''' <summary>The top left corner of the graph box in simulation pixels (picked in the picture).</summary>- Public Property BoxX As Integer = 450- Public Property BoxY As Integer = 20-- ''' <summary>When False, the probe is switched off: not sampled or shown in a simulation, but its settings are- ''' kept ("On" checkbox). Off by default (this property's own default, used for both probes of a new project -- ''' see NewProbeList, Form1.Probes.vb). A probe loaded from a project saved before "active" was written for it- ''' still comes back On (FromDictionary's own separate, hardcoded fallback below), so that project keeps its- ''' exact previous behavior instead of silently picking up the new-project default.</summary>- Public Property Active As Boolean = False-- Public Property ScaleMode As ProbeScaleMode = ProbeScaleMode.Running- Public Property AutoScaleX As Boolean = True- Public Property AutoScaleY As Boolean = True-- ''' <summary>The value axis when it is not scaled automatically.</summary>- Public Property YMin As Double = -1.0- Public Property YMax As Double = 1.0-- ''' <summary>The number of steps that a running graph shows.</summary>- Public Property RunningWindow As Integer = DefaultRunningWindow-- ''' <summary>When True, the graph shows no data from before step StartAfterStep (0 = from the start).</summary>- Public Property UseStartAfterStep As Boolean = False- Public Property StartAfterStep As Integer = 0-- Public Function Clone() As ProbeSettings- Return DirectCast(MemberwiseClone(), ProbeSettings)- End Function-- ''' <summary>Takes over the settings that only change how the graph looks (not what is measured), so that they can be changed during a run.</summary>- Public Sub CopyDisplayFrom(other As ProbeSettings)- Active = other.Active- BoxSize = other.BoxSize- BoxX = other.BoxX- BoxY = other.BoxY- ScaleMode = other.ScaleMode- AutoScaleX = other.AutoScaleX- AutoScaleY = other.AutoScaleY- YMin = other.YMin- YMax = other.YMax- RunningWindow = other.RunningWindow- UseStartAfterStep = other.UseStartAfterStep- StartAfterStep = other.StartAfterStep- End Sub-- ''' <summary>Makes the measurement fit the picture: amplitude on the field, intensity or integrated intensity on the intensity.</summary>- Public Sub Normalize()- If PlaceOn = ProbePlaceOn.Field Then- Measurement = ProbeMeasurement.Amplitude- ElseIf Measurement = ProbeMeasurement.Amplitude Then- Measurement = ProbeMeasurement.Intensity- End If- If Not (YMax > YMin) Then- YMin = -1.0- YMax = 1.0- End If- If RunningWindow < 10 Then RunningWindow = 10- If RunningWindow > MaxRunningWindow Then RunningWindow = MaxRunningWindow- If StartAfterStep < 0 Then StartAfterStep = 0- End Sub-- Public Function MeasurementText() As String- Select Case Measurement- Case ProbeMeasurement.Amplitude- Return "Amplitude"- Case ProbeMeasurement.IntegratedIntensity- Return "Integrated intensity"- Case Else- Return "Intensity"- End Select- End Function-- ''' <summary>The title of the graph, for example "Probe 1 - Amplitude". The number is also drawn at the probe in the picture.</summary>- Public Function Title(index As Integer) As String- Return "Probe " & (index + 1).ToString(CultureInfo.InvariantCulture) & " - " & MeasurementText()- End Function-- ' ---------------------------------------------------------------- configuration file-- ''' <summary>The probes of a project configuration. There is always at least one (a default probe when there is none).</summary>- Public Shared Function ListFromConfig(config As ProjectConfig) As List(Of ProbeSettings)- Dim result As New List(Of ProbeSettings)()-- If config.ContainsKey(SectionName) Then- Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)- Dim items As Object = Nothing- If section.TryGetValue("items", items) Then- Dim list As IEnumerable = TryCast(items, IEnumerable)- If list IsNot Nothing AndAlso Not TypeOf items Is String Then- For Each item As Object In list- Dim d As Dictionary(Of String, Object) = TryCast(item, Dictionary(Of String, Object))- If d IsNot Nothing Then result.Add(FromDictionary(d))- Next- End If- End If- End If-- If result.Count = 0 Then result.Add(New ProbeSettings())- Return result- End Function-- Public Shared Sub ListToConfig(probes As List(Of ProbeSettings), config As ProjectConfig)- Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)- Dim items As New List(Of Object)()- For Each p As ProbeSettings In probes- items.Add(p.ToDictionary())- Next- section("count") = items.Count- section("items") = items- End Sub-- Private Function ToDictionary() As Dictionary(Of String, Object)- Dim d As New Dictionary(Of String, Object)()- d("active") = Active- d("place_on") = If(PlaceOn = ProbePlaceOn.Field, "field", "intensity")- Select Case Measurement- Case ProbeMeasurement.Amplitude- d("measurement") = "amplitude"- Case ProbeMeasurement.IntegratedIntensity- d("measurement") = "integrated_intensity"- Case Else- d("measurement") = "intensity"- End Select- d("probe_type") = If(Kind = ProbeKind.Line, "line", "point")- d("ax") = PosAX- d("ay") = PosAY- d("bx") = PosBX- d("by") = PosBY- Select Case BoxSize- Case ProbeBoxSize.Tiny- d("box_size") = "tiny"- Case ProbeBoxSize.Small- d("box_size") = "small"- Case ProbeBoxSize.Large- d("box_size") = "large"- Case ProbeBoxSize.ExtraLarge- d("box_size") = "extra_large"- Case Else- d("box_size") = "medium"- End Select- d("box_x") = BoxX- d("box_y") = BoxY- d("scale_mode") = If(ScaleMode = ProbeScaleMode.Full, "full", "running")- d("auto_scale_x") = AutoScaleX- d("auto_scale_y") = AutoScaleY- d("y_min") = YMin- d("y_max") = YMax- d("running_window") = RunningWindow- d("use_start_after_step") = UseStartAfterStep- d("start_after_step") = StartAfterStep- Return d- End Function-- Private Shared Function FromDictionary(d As Dictionary(Of String, Object)) As ProbeSettings- Dim p As New ProbeSettings()-- p.Active = ReadBool(d, "active", True)- p.PlaceOn = If(ReadText(d, "place_on", "field") = "intensity", ProbePlaceOn.Intensity, ProbePlaceOn.Field)- Select Case ReadText(d, "measurement", "amplitude")- Case "intensity"- p.Measurement = ProbeMeasurement.Intensity- Case "integrated_intensity"- p.Measurement = ProbeMeasurement.IntegratedIntensity- Case Else- p.Measurement = ProbeMeasurement.Amplitude- End Select- p.Kind = If(ReadText(d, "probe_type", "point") = "line", ProbeKind.Line, ProbeKind.Point)- p.PosAX = ReadInt(d, "ax", 100, 0, 100000)- p.PosAY = ReadInt(d, "ay", 100, 0, 100000)- p.PosBX = ReadInt(d, "bx", 300, 0, 100000)- p.PosBY = ReadInt(d, "by", 100, 0, 100000)- Select Case ReadText(d, "box_size", "medium")- Case "tiny"- p.BoxSize = ProbeBoxSize.Tiny- Case "small"- p.BoxSize = ProbeBoxSize.Small- Case "large"- p.BoxSize = ProbeBoxSize.Large- Case "extra_large"- p.BoxSize = ProbeBoxSize.ExtraLarge- Case Else- p.BoxSize = ProbeBoxSize.Medium- End Select- p.BoxX = ReadInt(d, "box_x", 450, 0, 100000)- p.BoxY = ReadInt(d, "box_y", 20, 0, 100000)- p.ScaleMode = If(ReadText(d, "scale_mode", "running") = "full", ProbeScaleMode.Full, ProbeScaleMode.Running)- p.AutoScaleX = ReadBool(d, "auto_scale_x", True)- p.AutoScaleY = ReadBool(d, "auto_scale_y", True)- p.YMin = ReadDouble(d, "y_min", -1.0, -1.0E+30, 1.0E+30)- p.YMax = ReadDouble(d, "y_max", 1.0, -1.0E+30, 1.0E+30)- p.RunningWindow = ReadInt(d, "running_window", DefaultRunningWindow, 10, MaxRunningWindow)- p.UseStartAfterStep = ReadBool(d, "use_start_after_step", False)- p.StartAfterStep = ReadInt(d, "start_after_step", 0, 0, 1000000000)- p.Normalize()- Return p- End Function-- Private Shared Function ReadText(d As Dictionary(Of String, Object), key As String, fallback As String) As String- Dim v As Object = Nothing- If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then Return Convert.ToString(v, CultureInfo.InvariantCulture)- Return fallback- End Function-- Private Shared Function ReadBool(d As Dictionary(Of String, Object), key As String, fallback As Boolean) As Boolean- Dim v As Object = Nothing- If d.TryGetValue(key, v) AndAlso TypeOf v Is Boolean Then Return Convert.ToBoolean(v)- Return fallback- End Function-- Private Shared Function ReadInt(d As Dictionary(Of String, Object), key As String, fallback As Integer,- minValue As Integer, maxValue As Integer) As Integer- Dim v As Object = Nothing- If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Try- Dim n As Integer = Convert.ToInt32(v, CultureInfo.InvariantCulture)- If n >= minValue AndAlso n <= maxValue Then Return n- Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException- ' use the fallback- End Try- End If- Return fallback- End Function-- Private Shared Function ReadDouble(d As Dictionary(Of String, Object), key As String, fallback As Double,- minValue As Double, maxValue As Double) As Double- Dim v As Object = Nothing- If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Try- Dim x As Double = Convert.ToDouble(v, CultureInfo.InvariantCulture)- If x >= minValue AndAlso x <= maxValue Then Return x- Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException- ' use the fallback- End Try- End If- Return fallback- End Function--End Classdiff --git a/2D_wave_sim_V01/Simulation/SceneData.vb b/2D_wave_sim_V01/Simulation/SceneData.vbdeleted file mode 100644index 836602d..0000000--- a/2D_wave_sim_V01/Simulation/SceneData.vb+++ /dev/null@@ -1,178 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.-'-' Portions of this file are based on WaveSimulator2D by 0x23-' <https://github.com/0x23/WaveSimulator2D>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Drawing-Imports System.Drawing.Imaging-Imports System.Runtime.InteropServices--''' <summary>-''' The per-pixel description of a scene that the wave simulation needs, all row by row (index = y * Width + x):-''' C2 the squared wave speed (1 / refractive index) ^ 2 (the time step is 1)-''' D the damping factor of the velocity, 1 = no damping, 0 = the wave is stopped-''' sources: pixel positions and the value of the green channel, which sets the frequency-'''-''' The rules are those of the Python classes StaticImageScene, StaticRefractiveIndex and StaticDampening:-''' red channel refractive index times 100 (values are limited to 0.9 to 10)-''' green channel every pixel above 0 is a sinusoidal source; the value sets its frequency-''' blue channel damping: the damping factor is 1 - blue / 255-''' damping edge a border of the given thickness, damping factor sqrt(i / thickness) at i pixels from the edge-''' </summary>-Friend NotInheritable Class SceneData-- Public ReadOnly Width As Integer- Public ReadOnly Height As Integer- Public ReadOnly C2 As Single()- Public ReadOnly D As Single()- Public ReadOnly SourceX As Integer()- Public ReadOnly SourceY As Integer()- Public ReadOnly SourceLevel As Byte()-- Private Sub New(w As Integer, h As Integer, c2 As Single(), d As Single(),- srcX As Integer(), srcY As Integer(), srcLevel As Byte())- Width = w- Height = h- Me.C2 = c2- Me.D = d- SourceX = srcX- SourceY = srcY- SourceLevel = srcLevel- End Sub-- Public ReadOnly Property SourceCount As Integer- Get- Return SourceX.Length- End Get- End Property-- ''' <summary>A scene from an image (red = refractive index, green = sources, blue = damping).</summary>- Public Shared Function FromImage(image As Bitmap, useSources As Boolean, dampingEdge As Integer) As SceneData- Dim w As Integer = image.Width- Dim h As Integer = image.Height- Dim c2(w * h - 1) As Single- Dim d(w * h - 1) As Single- Dim sx As New List(Of Integer)()- Dim sy As New List(Of Integer)()- Dim sl As New List(Of Byte)()-- Dim data As BitmapData = image.LockBits(New Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb)- Try- Dim row(w * 4 - 1) As Byte- For y As Integer = 0 To h - 1- Marshal.Copy(IntPtr.Add(data.Scan0, y * data.Stride), row, 0, w * 4)- For x As Integer = 0 To w - 1- Dim o As Integer = x * 4- ' Format32bppArgb is stored as B, G, R, A- Dim blue As Integer = row(o)- Dim green As Integer = row(o + 1)- Dim red As Integer = row(o + 2)-- Dim n As Double = red / 100.0- If n < 0.9 Then n = 0.9- If n > 10.0 Then n = 10.0- Dim c As Double = 1.0 / n-- Dim idx As Integer = y * w + x- c2(idx) = CSng(c * c)- d(idx) = CSng(1.0 - blue / 255.0)-- If useSources AndAlso green > 0 Then- sx.Add(x)- sy.Add(y)- sl.Add(CByte(green))- End If- Next- Next- Finally- image.UnlockBits(data)- End Try-- ApplyBorder(d, w, h, dampingEdge)- Return New SceneData(w, h, c2, d, sx.ToArray(), sy.ToArray(), sl.ToArray())- End Function-- ''' <summary>- ''' An empty, user defined scene (no sources), optionally with a damping edge. The background gets the given- ''' refractive index (1.0 by default, the same rule as a scene image's red channel: index = red / 100).- ''' </summary>- Public Shared Function Empty(w As Integer, h As Integer, dampingEdge As Integer, Optional refractiveIndex As Double = 1.0) As SceneData- Dim n As Double = refractiveIndex- If n < 0.9 Then n = 0.9- If n > 10.0 Then n = 10.0- Dim c As Single = CSng(1.0 / n)-- Dim c2(w * h - 1) As Single- Dim d(w * h - 1) As Single- For i As Integer = 0 To c2.Length - 1- c2(i) = c * c- d(i) = 1.0F- Next- ApplyBorder(d, w, h, dampingEdge)- Return New SceneData(w, h, c2, d, New Integer() {}, New Integer() {}, New Byte() {})- End Function-- ''' <summary>The number of source pixels (green channel above 0) in a scene image.</summary>- Public Shared Function CountSources(image As Bitmap) As Integer- Dim w As Integer = image.Width- Dim h As Integer = image.Height- Dim count As Integer = 0-- Dim data As BitmapData = image.LockBits(New Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb)- Try- Dim row(w * 4 - 1) As Byte- For y As Integer = 0 To h - 1- Marshal.Copy(IntPtr.Add(data.Scan0, y * data.Stride), row, 0, w * 4)- For x As Integer = 0 To w - 1- If row(x * 4 + 1) > 0 Then count += 1- Next- Next- Finally- image.UnlockBits(data)- End Try- Return count- End Function-- ''' <summary>- ''' Damping edge, as in StaticDampening: the ring i pixels from the edge gets the factor sqrt(i / thickness),- ''' so the outermost ring stops the wave completely and the factor rises to 1 inside.- ''' </summary>- Friend Shared Sub ApplyBorder(d As Single(), w As Integer, h As Integer, thickness As Integer)- Dim t As Integer = Math.Min(thickness, Math.Min(w, h) \ 2)- If t <= 0 Then Return-- For i As Integer = 0 To t - 1- Dim v As Single = CSng(Math.Sqrt(i / CDbl(t)))- For x As Integer = i To w - 1 - i- d(i * w + x) = v- d((h - 1 - i) * w + x) = v- Next- For y As Integer = i To h - 1 - i- d(y * w + i) = v- d(y * w + (w - 1 - i)) = v- Next- Next- End Sub--End Classdiff --git a/2D_wave_sim_V01/Simulation/SimulationRunner.vb b/2D_wave_sim_V01/Simulation/SimulationRunner.vbdeleted file mode 100644index c898c23..0000000--- a/2D_wave_sim_V01/Simulation/SimulationRunner.vb+++ /dev/null@@ -1,502 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Diagnostics-Imports System.Drawing-Imports System.Drawing.Imaging-Imports System.IO-Imports System.Threading--''' <summary>Everything a simulation run needs. Filled in by the form; the runner owns the job (and the image in it) afterwards.</summary>-Friend NotInheritable Class SimulationJob-- ''' <summary>The scene image (red = refractive index, green = sources, blue = damping). Nothing for an empty, user defined scene.</summary>- Public Image As Bitmap-- ''' <summary>The canvas size of an empty scene (ignored when there is an image).</summary>- Public Width As Integer- Public Height As Integer-- ''' <summary>The background refractive index of an empty scene (ignored when there is an image).</summary>- Public BackgroundRefractiveIndex As Double = 1.0-- Public UseSources As Boolean-- ''' <summary>Amplitude factor of the sources in the scene image.</summary>- Public SourceAmplitude As Double = 1.0-- Public DampingEdge As Integer-- ''' <summary>A private copy of the simulation settings.</summary>- Public Settings As SimulationSettings-- ''' <summary>Color tables (255 packed ARGB values), or Nothing for gray levels.</summary>- Public FieldLut As Integer()- Public IntensityLut As Integer()-- ''' <summary>Video files to write, normally .mp4; empty = no video of that kind. When H.264 is not available the extension becomes .avi.</summary>- Public FieldVideoPath As String = ""- Public IntensityVideoPath As String = ""-- ''' <summary>The probes to measure (copies), or Nothing for none.</summary>- Public Probes As List(Of ProbeSettings)-- ''' <summary>The generated elements of the object sources to run (Sources tab), or Nothing/empty for none.</summary>- Public ObjectSources As List(Of SourceElement)-- ''' <summary>The size (pixels) of the preview area; previews are made to fit it.</summary>- Public PreviewWidth As Integer- Public PreviewHeight As Integer-- ''' <summary>The Viewer tab's "glowing edges" overlay (Form1's _glowEdgesImage), exactly the size of the- ''' simulation canvas - Nothing when there is none (no scene image), or when both gains below are 0 (the- ''' overlay is switched off for both Field and Intensity). Frozen at the start of the run, the same as- ''' Settings - the runner owns and disposes it. See FrameRenderer.AddOverlay.</summary>- Public GlowOverlay As Bitmap-- ''' <summary>How strongly to blend GlowOverlay into the Field/Intensity video, frozen at the start of the run- ''' from Form1's numBrightnessFieldOverlay/numBrightnessIntensityOverlay and chkDiplayOverlayInField/- ''' chkDiplayOverlayInIntensity (0 when unchecked - see Form1.FieldOverlayGain/IntensityOverlayGain). Only- ''' affects the exported videos - the live preview keeps blending its own copy of the overlay in on the UI- ''' thread (Form1.ShowPreview/ComposeGlowOverlay), which can track the checkbox/brightness box live; a- ''' running export cannot, so it uses whatever these were at the moment Start Simulation was pressed.</summary>- Public FieldOverlayGain As Double- Public IntensityOverlayGain As Double--End Class--Friend Enum SimulationStatus- Completed- Cancelled- Failed-End Enum--Friend NotInheritable Class SimulationResult- Public Status As SimulationStatus- Public Message As String = ""- Public StepsDone As Integer- Public Elapsed As TimeSpan- Public Files As New List(Of String)()-- ''' <summary>The video files that were written (empty when there is none of that kind).</summary>- Public FieldFile As String = ""- Public IntensityFile As String = ""-- ''' <summary>Where the simulation ran ("CPU (8 threads)", "GPU: NVIDIA GeForce MX130 (OpenCL)"), and why the GPU was not used when it was asked for.</summary>- Public Engine As String = ""- Public EngineNote As String = ""-- ''' <summary>A full simulation-resolution snapshot of the field/intensity, rendered right before the engine- ''' was closed down - so a still export (the Preview tab's "Export current Field/Intensity frame" buttons) has- ''' something to save even once the run has fully stopped and the live engine no longer exists. Nothing when- ''' the run failed before an engine was created, or when intensity was not tracked for this run (LastIntensityFrame- ''' only). The receiver owns the bitmap(s).</summary>- Public LastFieldFrame As Bitmap- Public LastIntensityFrame As Bitmap-End Class--''' <summary>-''' Runs a simulation on a background thread, as the loop in main_curr.py: for every step update the scene-''' (sources), update the field and the intensity; every N steps render a frame for the previews and the videos.-''' The events are raised on the background thread; the form must pass them on to the user interface thread.-''' </summary>-Friend NotInheritable Class SimulationRunner-- ''' <summary>Steps done so far and the total, raised about ten times a second.</summary>- Public Event ProgressChanged(stepsDone As Integer, totalSteps As Integer)-- ''' <summary>The engine that runs the simulation (CPU or GPU) was chosen. The note is empty, or tells why the GPU is not used.</summary>- Public Event EngineReady(description As String, note As String)-- ''' <summary>New probe measurements: the new values of the point probes and the last profile of the line probes. The receiver owns the arrays.</summary>- Public Event ProbesUpdated(update As ProbeUpdate)-- ''' <summary>A preview picture is ready. The receiver owns the bitmap and must call PreviewShown when it is done with it.</summary>- Public Event PreviewReady(isField As Boolean, frame As Bitmap)-- ''' <summary>The run is over (completed, stopped or failed). This is the last event.</summary>- Public Event Finished(result As SimulationResult)-- Private Const JpegQuality As Long = 90L-- ''' <summary>Minimum time (ms) between previews - see its use in Run() for why this exists: it keeps a GPU- ''' engine's readback rate steady and independent of how fast the UI thread happens to be at displaying the- ''' previous one (e.g. with/without the "display overlay" checkboxes), rather than implicitly riding on- ''' _previewPending alone. ~30 fps is already faster than a picture box is usefully watchable at.</summary>- Private Const PreviewIntervalMs As Long = 33L-- Private ReadOnly _job As SimulationJob- Private _thread As Thread- Private _cancel As Integer- Private _previewPending As Integer-- ' open = running, closed = paused- Private ReadOnly _gate As New ManualResetEventSlim(True)-- ' the live engine, set once at the start of Run() and cleared just before it is disposed at the end; read from- ' the UI thread (RenderCurrentFrame) only while paused, when the background thread is parked at _gate.Wait()- ' and is not touching it- Private _sim As IWaveEngine-- ' the probe collector for this run (Nothing when there are no probes), set alongside _sim so RenderCurrentFrame- ' can also burn the probe markers/graphs onto a still export - the video export loop in Run() already does- ' this (ProbeOverlay.Burn) but RenderCurrentFrame did not, which left probe data out of exported still frames- Private _collector As ProbeCollector-- Public Sub New(job As SimulationJob)- _job = job- End Sub-- Public Sub Start()- _thread = New Thread(AddressOf Run)- _thread.IsBackground = True- _thread.Name = "Wave simulation"- _thread.Start()- End Sub-- ''' <summary>Asks the run to stop after the current step. The videos are closed properly.</summary>- Public Sub Cancel()- Interlocked.Exchange(_cancel, 1)- _gate.Set() ' a paused run must wake up to stop- End Sub-- ''' <summary>Holds the run before the next step. The videos stay open.</summary>- Public Sub PauseRun()- _gate.Reset()- End Sub-- ''' <summary>Continues a paused run.</summary>- Public Sub ResumeRun()- _gate.Set()- End Sub-- ''' <summary>Tells the runner that a preview picture was shown (or thrown away). When all pictures that were- ''' announced are shown, the next preview is made.</summary>- Public Sub PreviewShown()- Interlocked.Decrement(_previewPending)- End Sub-- ''' <summary>Waits until the thread has ended. Returns False when the time ran out.</summary>- Public Function WaitForExit(milliseconds As Integer) As Boolean- Dim t As Thread = _thread- If t Is Nothing Then Return True- Return t.Join(milliseconds)- End Function-- ''' <summary>- ''' Renders the field or the intensity at full simulation resolution, on demand (for a still-image export) -- ''' only while the run is paused, since only then is the background thread guaranteed not to be touching the- ''' engine's arrays. Returns Nothing when the run is not paused, when the engine is gone (not yet created, or- ''' the run has finished), or when the intensity is asked for but was not tracked for this run.- ''' </summary>- Public Function RenderCurrentFrame(isField As Boolean, lut As Integer(), brightness As Single) As Bitmap- If _gate.IsSet Then Return Nothing ' running (not paused) - unsafe to read- Dim sim As IWaveEngine = _sim- If sim Is Nothing Then Return Nothing- If Not isField AndAlso sim.IntensityData Is Nothing Then Return Nothing-- Dim w As Integer = sim.Width- Dim h As Integer = sim.Height- sim.PrepareFrame(isField, Not isField)- Dim pixels As Integer() = New Integer(w * h - 1) {}- If isField Then- FrameRenderer.RenderField(sim, lut, brightness, pixels, w, h)- If _collector IsNot Nothing Then ProbeOverlay.Burn(pixels, w, h, _job.Probes, _collector.Traces, ProbePlaceOn.Field, _job.Settings.Steps)- Else- FrameRenderer.RenderIntensity(sim, lut, brightness, pixels, w, h)- If _collector IsNot Nothing Then ProbeOverlay.Burn(pixels, w, h, _job.Probes, _collector.Traces, ProbePlaceOn.Intensity, _job.Settings.Steps)- End If- Return FrameRenderer.ToBitmap(pixels, w, h)- End Function-- Private Sub Run()- Dim result As New SimulationResult()- Dim clock As Stopwatch = Stopwatch.StartNew()- Dim fieldWriter As IFrameSink = Nothing- Dim intensityWriter As IFrameSink = Nothing- Dim sim As IWaveEngine = Nothing- ' declared here (not inside Try, unlike most locals below) because Finally also needs them, for the- ' last-frame probe overlay - a Dim inside Try is a compile error in Finally (BC30451): unlike most VB- ' locals, Try/Catch/Finally each have their own block scope- Dim collector As ProbeCollector = Nothing- Dim total As Integer = 0-- Try- Dim settings As SimulationSettings = _job.Settings- Dim exportField As Boolean = _job.FieldVideoPath.Length > 0- Dim exportIntensity As Boolean = _job.IntensityVideoPath.Length > 0- Dim needIntensity As Boolean = exportIntensity OrElse settings.PreviewIntensity-- ' the scene and the simulator- Dim scene As SceneData- If _job.Image IsNot Nothing Then- scene = SceneData.FromImage(_job.Image, _job.UseSources, _job.DampingEdge)- _job.Image.Dispose()- _job.Image = Nothing- Else- scene = SceneData.Empty(_job.Width, _job.Height, _job.DampingEdge, _job.BackgroundRefractiveIndex)- End If- Dim w As Integer = scene.Width- Dim h As Integer = scene.Height-- ' the probes- Dim sampler As ProbeSampler = Nothing- If _job.Probes IsNot Nothing AndAlso _job.Probes.Count > 0 Then- sampler = ProbeSampler.Build(_job.Probes, w, h)- collector = New ProbeCollector(sampler)- If sampler.NeedsIntensity Then needIntensity = True- End If- Dim engineNote As String = ""- sim = WaveEngineFactory.Create(scene, settings, _job.SourceAmplitude, needIntensity, engineNote, _job.ObjectSources)- _sim = sim- _collector = collector- scene = Nothing- result.Engine = sim.Description- result.EngineNote = engineNote- RaiseEvent EngineReady(sim.Description, engineNote)- If sampler IsNot Nothing Then sim.SetProbes(sampler)-- ' videos- If exportField Then- fieldWriter = OpenSink(_job.FieldVideoPath, w, h, settings.VideoFps, settings.VideoQuality, result)- result.Files.Add(fieldWriter.FilePath)- result.FieldFile = fieldWriter.FilePath- End If- If exportIntensity Then- intensityWriter = OpenSink(_job.IntensityVideoPath, w, h, settings.VideoFps, settings.VideoQuality, result)- result.Files.Add(intensityWriter.FilePath)- result.IntensityFile = intensityWriter.FilePath- End If-- Dim fullPixels As Integer() = Nothing- If exportField OrElse exportIntensity Then fullPixels = New Integer(w * h - 1) {}-- ' the "glowing edges" overlay for the videos (FrameRenderer.AddOverlay) - converted to a plain RGB- ' byte array and gain-prescaled (FrameRenderer.ScaleOverlayRgb) once, up front, rather than redoing- ' either on every single exported frame; this was the actual cost of the overlay on a video export- Dim fieldOverlayScaled As Byte() = Nothing- Dim intensityOverlayScaled As Byte() = Nothing- If _job.GlowOverlay IsNot Nothing AndAlso (exportField OrElse exportIntensity) Then- Dim overlayRgb As Byte() = FrameRenderer.ToRgbBytes(_job.GlowOverlay, w, h)- If exportField Then fieldOverlayScaled = FrameRenderer.ScaleOverlayRgb(overlayRgb, _job.FieldOverlayGain)- If exportIntensity Then intensityOverlayScaled = FrameRenderer.ScaleOverlayRgb(overlayRgb, _job.IntensityOverlayGain)- End If- If _job.GlowOverlay IsNot Nothing Then- _job.GlowOverlay.Dispose()- _job.GlowOverlay = Nothing- End If-- ' previews are made small enough to fit the preview area- Dim previewW As Integer = w- Dim previewH As Integer = h- Dim scale As Double = Math.Min(_job.PreviewWidth / CDbl(w), _job.PreviewHeight / CDbl(h))- If scale < 1.0 Then- previewW = Math.Max(1, CInt(Math.Floor(w * scale)))- previewH = Math.Max(1, CInt(Math.Floor(h * scale)))- End If- Dim previewPixels As Integer() = Nothing- If settings.PreviewField OrElse settings.PreviewIntensity Then previewPixels = New Integer(previewW * previewH - 1) {}-- Dim fieldBrightness As Single = CSng(settings.FieldBrightness)- Dim intensityBrightness As Single = CSng(settings.IntensityBrightness)- Dim every As Integer = Math.Max(1, settings.VisualizeEvery)- total = settings.Steps-- Dim lastProgress As Long = 0- Dim lastProbePost As Long = 0- Dim lastPreview As Long = 0-- result.Status = SimulationStatus.Completed- For i As Integer = 0 To total - 1- If Not _gate.IsSet Then- ' paused: the time of the pause does not count- clock.Stop()- RaiseEvent ProgressChanged(result.StepsDone, total)- _gate.Wait()- clock.Start()- End If-- If Thread.VolatileRead(_cancel) <> 0 Then- result.Status = SimulationStatus.Cancelled- Exit For- End If-- sim.AdvanceOneStep()- If sampler IsNot Nothing Then sim.SampleProbes()- result.StepsDone = i + 1-- If (i Mod every) = 0 Then- ' the probe values up to this step (the graphs in the videos need them)- If collector IsNot Nothing Then- collector.Collect(sim, result.StepsDone)- If exportField OrElse exportIntensity Then collector.CollectProfiles(sim, result.StepsDone)- End If-- ' previews are only made when the pictures of the last preview have all been shown, and not- ' more often than roughly PreviewIntervalMs. The second condition is the fix for a real bug:- ' without it, this was gated purely by _previewPending (whether the UI thread has finished- ' showing the last one, via ShowPreview/PreviewShown) - and on a GPU engine, PrepareFrame- ' below is where the actual cost is (a full-resolution GPU->host readback, not just the small- ' preview picture), so the GPU run's speed ended up riding on how fast the UI happened to be.- ' With the "display overlay" checkboxes off, SetPreviewFrame is cheap and _previewPending- ' clears almost immediately, so a readback fired on nearly every eligible step; with them on,- ' ComposeGlowOverlay's per-pixel blend made the UI side slow enough to skip most of those- ' readbacks "by accident", which is why turning the overlay on made the run go faster rather- ' than slower. Pacing previews by elapsed time keeps the readback rate steady and no longer- ' dependent on a checkbox that was never meant to affect simulation throughput. Exporting a- ' video already forces a readback every eligible step regardless (see exportField/- ' exportIntensity below), which is why the slowdown was never visible with video export on.- Dim previewDue As Boolean = clock.ElapsedMilliseconds - lastPreview >= PreviewIntervalMs- Dim doPreview As Boolean = previewPixels IsNot Nothing AndAlso previewDue AndAlso Thread.VolatileRead(_previewPending) <= 0- If doPreview Then lastPreview = clock.ElapsedMilliseconds-- ' a GPU engine copies only the data that is going to be drawn- sim.PrepareFrame(exportField OrElse (doPreview AndAlso settings.PreviewField),- exportIntensity OrElse (doPreview AndAlso settings.PreviewIntensity))-- If exportField Then- FrameRenderer.RenderField(sim, _job.FieldLut, fieldBrightness, fullPixels, w, h)- FrameRenderer.AddOverlay(fullPixels, fieldOverlayScaled, w, h)- If collector IsNot Nothing Then ProbeOverlay.Burn(fullPixels, w, h, _job.Probes, collector.Traces, ProbePlaceOn.Field, total)- fieldWriter.AddPixels(fullPixels)- End If- If exportIntensity Then- FrameRenderer.RenderIntensity(sim, _job.IntensityLut, intensityBrightness, fullPixels, w, h)- FrameRenderer.AddOverlay(fullPixels, intensityOverlayScaled, w, h)- If collector IsNot Nothing Then ProbeOverlay.Burn(fullPixels, w, h, _job.Probes, collector.Traces, ProbePlaceOn.Intensity, total)- intensityWriter.AddPixels(fullPixels)- End If-- If doPreview Then- Dim announced As Integer = If(settings.PreviewField, 1, 0) + If(settings.PreviewIntensity, 1, 0)- Interlocked.Exchange(_previewPending, announced)- If settings.PreviewField Then- FrameRenderer.RenderField(sim, _job.FieldLut, fieldBrightness, previewPixels, previewW, previewH)- RaiseEvent PreviewReady(True, FrameRenderer.ToBitmap(previewPixels, previewW, previewH))- End If- If settings.PreviewIntensity Then- FrameRenderer.RenderIntensity(sim, _job.IntensityLut, intensityBrightness, previewPixels, previewW, previewH)- RaiseEvent PreviewReady(False, FrameRenderer.ToBitmap(previewPixels, previewW, previewH))- End If- End If- End If-- ' the probe values go to the user interface about 20 times a second- If collector IsNot Nothing AndAlso clock.ElapsedMilliseconds - lastProbePost >= 50 Then- lastProbePost = clock.ElapsedMilliseconds- collector.Collect(sim, result.StepsDone)- collector.CollectProfiles(sim, result.StepsDone)- RaiseEvent ProbesUpdated(collector.TakeForUi())- End If-- If clock.ElapsedMilliseconds - lastProgress >= 100 Then- lastProgress = clock.ElapsedMilliseconds- RaiseEvent ProgressChanged(i + 1, total)- End If- Next-- ' the last probe values- If collector IsNot Nothing Then- collector.Collect(sim, result.StepsDone)- collector.CollectProfiles(sim, result.StepsDone)- RaiseEvent ProbesUpdated(collector.TakeForUi())- End If-- Catch ex As OutOfMemoryException- result.Status = SimulationStatus.Failed- result.Message = "There is not enough memory for a simulation of this size. Use a smaller canvas."- Catch ex As Exception- result.Status = SimulationStatus.Failed- result.Message = ex.Message- Finally- ' close the videos, also after a stop or an error, so that the files can be played- Try- If fieldWriter IsNot Nothing Then fieldWriter.Close()- Catch ex As Exception- ' nothing more can be done- End Try- Try- If intensityWriter IsNot Nothing Then intensityWriter.Close()- Catch ex As Exception- ' nothing more can be done- End Try- If sim IsNot Nothing Then- ' one last full-resolution snapshot, so a still export still has something to save once the run- ' has fully stopped and the engine itself is gone (see SimulationResult.LastFieldFrame/LastIntensityFrame)- Try- Dim lastPixels As Integer() = New Integer(sim.Width * sim.Height - 1) {}- Dim needInten As Boolean = sim.IntensityData IsNot Nothing- sim.PrepareFrame(True, needInten)- FrameRenderer.RenderField(sim, _job.FieldLut, CSng(_job.Settings.FieldBrightness), lastPixels, sim.Width, sim.Height)- If collector IsNot Nothing Then ProbeOverlay.Burn(lastPixels, sim.Width, sim.Height, _job.Probes, collector.Traces, ProbePlaceOn.Field, total)- result.LastFieldFrame = FrameRenderer.ToBitmap(lastPixels, sim.Width, sim.Height)- If needInten Then- FrameRenderer.RenderIntensity(sim, _job.IntensityLut, CSng(_job.Settings.IntensityBrightness), lastPixels, sim.Width, sim.Height)- If collector IsNot Nothing Then ProbeOverlay.Burn(lastPixels, sim.Width, sim.Height, _job.Probes, collector.Traces, ProbePlaceOn.Intensity, total)- result.LastIntensityFrame = FrameRenderer.ToBitmap(lastPixels, sim.Width, sim.Height)- End If- Catch ex As Exception- ' no still frame this time - not fatal, the export buttons just won't have anything to save- End Try- Try- sim.Dispose()- Catch ex As Exception- ' nothing more can be done- End Try- _sim = Nothing- _collector = Nothing- End If- If _job.Image IsNot Nothing Then _job.Image.Dispose()- End Try-- clock.Stop()- result.Elapsed = clock.Elapsed- RaiseEvent ProgressChanged(result.StepsDone, _job.Settings.Steps)- RaiseEvent Finished(result)- End Sub-- ''' <summary>- ''' Opens a video file. An .mp4 file is written as H.264 with the encoder of Windows; when that is not possible- ''' (no Media Foundation, size not supported) an .avi file with Motion JPEG frames is written instead.- ''' </summary>- Private Shared Function OpenSink(filePath As String, w As Integer, h As Integer, fps As Integer, quality As Integer, result As SimulationResult) As IFrameSink- If String.Equals(Path.GetExtension(filePath), ".mp4", StringComparison.OrdinalIgnoreCase) Then- Try- Return New MfVideoWriter(filePath, w, h, fps, quality)- Catch ex As Exception- If File.Exists(filePath) Then- Try- File.Delete(filePath)- Catch ex2 As Exception- ' an empty leftover file does no harm- End Try- End If- result.Message = "MP4 (H.264) video could not be made on this computer (" & ex.Message.Trim() &- "). The videos were written as Motion JPEG .avi files instead; play them with VLC."- filePath = Path.ChangeExtension(filePath, ".avi")- End Try- End If- Return New AviFrameSink(filePath, w, h, fps, quality)- End Function--End Classdiff --git a/2D_wave_sim_V01/Simulation/SimulationSettings.vb b/2D_wave_sim_V01/Simulation/SimulationSettings.vbdeleted file mode 100644index 345184f..0000000--- a/2D_wave_sim_V01/Simulation/SimulationSettings.vb+++ /dev/null@@ -1,256 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Globalization--''' <summary>-''' The simulation settings of a project (Configuration tab). They are stored in the section "simulation" of-''' configuration.json:-''' steps, visualize_every number of time steps, and a frame is shown or exported every N steps-''' export_field, export_intensity write a video of the field / of the intensity-''' preview_field, preview_intensity show the field / the intensity in the Preview tab while simulating-''' field_color_scheme, intensity_color_scheme names of the color schemes to use (empty: gray levels)-''' and a few values that have no control on the screen yet but can be edited in the file:-''' field_brightness, intensity_brightness, field_black_level, intensity_black_level,-''' source_frequency_scale, video_fps-''' video_quality 1 to 100, quality of the exported videos (higher = larger files)-''' use_gpu simulate on the graphics card (OpenCL) instead of the processor-''' wave_speed_c "Set c-value" (File menu); see the WaveSpeedC property below-''' time_decay_factor "Intensity decay factor" (Configuration tab); see TimeDecayFactor below-''' intensity_scale "Intensity scale" (Configuration tab); see IntensityScale below-''' The defaults are those of the Python example (main_curr.py).-''' </summary>-Public NotInheritable Class SimulationSettings-- Public Const SectionName As String = "simulation"-- ' DefaultSteps is only the fallback for an existing project saved before "steps" existed (FromConfig below) -- ' Steps itself has no software-chosen default of its own any more, the same as TimeDecayFactor: a new project- ' starts at whatever numSimulationSteps' own Designer value is (see StartNewProject's "New SimulationSettings()").- Public Const DefaultSteps As Integer = 2500- Public Const MaxSteps As Integer = 10000000- Public Const MaxVisualizeEvery As Integer = 1000- Public Const MaxVideoFps As Integer = 240- Public Const DefaultVideoQuality As Integer = 70-- Public Property Steps As Integer- Public Property VisualizeEvery As Integer = 2-- Public Property ExportField As Boolean = False- Public Property ExportIntensity As Boolean = False- Public Property PreviewField As Boolean = True- Public Property PreviewIntensity As Boolean = True-- ''' <summary>The scheme names a new project starts with (FillSchemeCombo, Form1.vb) - selected only when a- ''' scheme with that exact name (case-insensitive) and matching SchemeType exists; otherwise the combo just- ''' shows nothing selected, same as for any other scheme name that is not found.</summary>- Public Property FieldColorScheme As String = "Default_Field"- Public Property IntensityColorScheme As String = "Default_intensity"-- ''' <summary>Brightness scale of the field view (render_field(7) in the Python example; 30.0 here is high- ''' enough to see a single source in the simulation, which is what numFieldScaling's own Designer default- ''' now also shows for a new source).</summary>- Public Property FieldBrightness As Double = 30.0-- ''' <summary>Brightness scale of the intensity view (render_intensity(7) in the Python example; see FieldBrightness).</summary>- Public Property IntensityBrightness As Double = 30.0-- Public Property FieldBlackLevel As Double = -0.05- Public Property IntensityBlackLevel As Double = 0.0-- ''' <summary>Multiplies the frequency of the sources that come from the green channel of the scene image.</summary>- Public Property SourceFrequencyScale As Double = 2.0-- Public Property VideoFps As Integer = 60-- ''' <summary>Quality of the exported videos, 1 (small files) to 100 (best picture, large files).</summary>- Public Property VideoQuality As Integer = DefaultVideoQuality-- ''' <summary>Run the simulation on the graphics card. Falls back to the processor when that is not possible.</summary>- Public Property UseGpu As Boolean = False-- ''' <summary>- ''' Use a 4th order accurate discrete Laplacian (a 5-point "cross" in each of x and y, reaching 2 cells away)- ''' instead of the standard 3x3 kernel, everywhere it is safe to (see WaveSimulator.UpdateField/- ''' GpuWaveSimulator.KernelSource - the outermost ring of the domain still falls back to the 3x3 kernel, since- ''' it does not have 2 cells of margin). This reduces numerical dispersion (short wavelengths, under-resolved by- ''' the grid, are otherwise slowed down relative to long ones - see the "Set c-value" comment on WaveSpeedC,- ''' above, whose default is itself a symptom of this) at the cost of roughly twice the memory reads per step.- ''' On by default for a new project (this property's own default, used by StartNewProject's- ''' "New SimulationSettings()"). An existing project saved before this property existed still loads as Off- ''' (FromConfig's own separate, hardcoded fallback below), so it keeps its exact previous behavior instead of- ''' silently picking up the new project default.- ''' </summary>- Public Property Use4thOrderLaplacian As Boolean = True-- ''' <summary>- ''' The propagation speed of waves through the medium, in simulation pixels per step (lambda = c / frequency).- ''' Set from the "Set c-value" entry on the File menu. This is only used to estimate and display a source's- ''' wavelength (lblLambdaIs on the Sources tab) - it does not affect the simulation itself, which derives the- ''' real, per-pixel wave speed from the scene's refractive index (the red channel of the scene image; see- ''' SceneData.C2) instead, and can vary from pixel to pixel while this single value cannot.- ''' A new project starts at 1.0, the solver's own default speed for a uniform medium (this property's own- ''' default, used by StartNewProject's "New SimulationSettings()"). An existing project saved before this- ''' field existed still loads at 0.563 instead (FromConfig's own separate, hardcoded fallback below) - that- ''' value was found experimentally to be the correct one at around a source frequency of 100, and is kept only- ''' so such a project's displayed wavelength estimate does not change out from under it. Like every other- ''' property here, this belongs to one project's SimulationSettings and is saved/loaded with it (wave_speed_c,- ''' below) - it is not a global/universal setting, so different projects can each keep their own value.- ''' </summary>- Public Property WaveSpeedC As Double = 1.0-- ''' <summary>- ''' "Intensity decay factor" (Configuration tab, numTimeDecayFactor): the intensity shown/exported is not the- ''' raw Sqr(field), it is an exponential running average of it (see WaveSimulator.UpdateField /- ''' GpuWaveSimulator.KernelSource), because a source oscillates every step and the raw squared amplitude would- ''' flicker at twice the source frequency instead of showing a steady intensity. The averaging needs a time- ''' constant of at least a few periods of the slowest active source, or that flicker "prints through"; a fixed- ''' time constant long enough for a low frequency source is unnecessarily long for a high frequency one and- ''' shows as a visible trail behind anything that moves. Both engines now scale the time constant inversely- ''' with the frequency of the slowest active source (image or object) instead of using one fixed value, and- ''' this property is the number of steps that time constant works out to at a nominal medium source (green- ''' level 100). Raising it lengthens the trail on every source (helps a low frequency source avoid- ''' print-through); lowering it shortens the trail (helps a high frequency source look crisp) at the cost of- ''' print-through if a low frequency source is also present in the same scene. This class does not itself pick- ''' a number for a new project - that would just be a second, competing default fighting the one already set on- ''' numTimeDecayFactor (Configuration tab) in the Designer - so StartNewProject (Form1.vb) instead reads the- ''' control's own value right after creating a new SimulationSettings, and that is the only place a new- ''' project's starting value is decided; changing it means changing numTimeDecayFactor's Value in the Designer.- ''' </summary>- Public Property TimeDecayFactor As Double-- ''' <summary>- ''' A plain multiplier on the tracked intensity itself (not just how it is displayed): both engines apply it to- ''' every intensity value they compute, so it changes the actual numbers in the preview, the exported videos,- ''' the probe data and any exported files - unlike FieldBrightness/IntensityBrightness above, which only scale- ''' how an image is drawn from the numbers, leaving the numbers themselves alone. It exists because, with the- ''' filtering TimeDecayFactor controls (see its comment), the raw intensity ends up landing around 1e-5 for- ''' typical scenes - an inconvenient scale for an axis or a data file - and the right multiplier to bring that- ''' into a convenient range depends on the source amplitudes and pulse shapes actually used, which this class- ''' has no way to predict. The default of 1.0 leaves the raw numbers exactly as computed; numIntensityScale- ''' (Configuration tab) lets the value be tuned by eye once the actual scale in use is visible.- ''' </summary>- Public Property IntensityScale As Double = 1.0-- ''' <summary>A copy that a running simulation can keep while the user goes on editing.</summary>- Public Function Clone() As SimulationSettings- Return DirectCast(MemberwiseClone(), SimulationSettings)- End Function-- ' ---------------------------------------------------------------- configuration file-- Public Shared Function FromConfig(config As ProjectConfig) As SimulationSettings- Dim s As New SimulationSettings()- If Not config.ContainsKey(SectionName) Then Return s-- Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)- s.Steps = ReadInt(section, "steps", DefaultSteps, 1, MaxSteps)- s.VisualizeEvery = ReadInt(section, "visualize_every", 2, 1, MaxVisualizeEvery)- s.ExportField = ReadBool(section, "export_field", False)- s.ExportIntensity = ReadBool(section, "export_intensity", False)- s.PreviewField = ReadBool(section, "preview_field", True)- s.PreviewIntensity = ReadBool(section, "preview_intensity", True)- s.FieldColorScheme = ReadText(section, "field_color_scheme", "Default_Field")- s.IntensityColorScheme = ReadText(section, "intensity_color_scheme", "Default_intensity")- s.FieldBrightness = ReadDouble(section, "field_brightness", 30.0, 0.0001, 100000.0)- s.IntensityBrightness = ReadDouble(section, "intensity_brightness", 30.0, 0.0001, 100000.0)- s.FieldBlackLevel = ReadDouble(section, "field_black_level", -0.05, -10.0, 1.0)- s.IntensityBlackLevel = ReadDouble(section, "intensity_black_level", 0.0, -10.0, 1.0)- s.SourceFrequencyScale = ReadDouble(section, "source_frequency_scale", 2.0, 0.0, 1000.0)- s.VideoFps = ReadInt(section, "video_fps", 60, 1, MaxVideoFps)- s.VideoQuality = ReadInt(section, "video_quality", DefaultVideoQuality, 1, 100)- s.UseGpu = ReadBool(section, "use_gpu", False)- s.Use4thOrderLaplacian = ReadBool(section, "use_4th_order_laplacian", False)- s.WaveSpeedC = ReadDouble(section, "wave_speed_c", 0.563, 0.000001, 1000000.0)- s.TimeDecayFactor = ReadDouble(section, "time_decay_factor", 10.0, 1.0, 100.0)- s.IntensityScale = ReadDouble(section, "intensity_scale", 1.0, 0.0000001, 1000000.0)- Return s- End Function-- Public Sub ToConfig(config As ProjectConfig)- Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)- section("steps") = Steps- section("visualize_every") = VisualizeEvery- section("export_field") = ExportField- section("export_intensity") = ExportIntensity- section("preview_field") = PreviewField- section("preview_intensity") = PreviewIntensity- section("field_color_scheme") = FieldColorScheme- section("intensity_color_scheme") = IntensityColorScheme- section("field_brightness") = FieldBrightness- section("intensity_brightness") = IntensityBrightness- section("field_black_level") = FieldBlackLevel- section("intensity_black_level") = IntensityBlackLevel- section("source_frequency_scale") = SourceFrequencyScale- section("video_fps") = VideoFps- section("video_quality") = VideoQuality- section("use_gpu") = UseGpu- section("use_4th_order_laplacian") = Use4thOrderLaplacian- section("wave_speed_c") = WaveSpeedC- section("time_decay_factor") = TimeDecayFactor- section("intensity_scale") = IntensityScale- End Sub-- ' ---------------------------------------------------------------- helpers-- Private Shared Function ReadText(section As Dictionary(Of String, Object), key As String, fallback As String) As String- Dim v As Object = Nothing- If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then Return Convert.ToString(v, CultureInfo.InvariantCulture)- Return fallback- End Function-- Private Shared Function ReadBool(section As Dictionary(Of String, Object), key As String, fallback As Boolean) As Boolean- Dim v As Object = Nothing- If section.TryGetValue(key, v) AndAlso TypeOf v Is Boolean Then Return Convert.ToBoolean(v)- Return fallback- End Function-- Private Shared Function ReadInt(section As Dictionary(Of String, Object), key As String, fallback As Integer,- minValue As Integer, maxValue As Integer) As Integer- Dim v As Object = Nothing- If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Try- Dim n As Integer = Convert.ToInt32(v, CultureInfo.InvariantCulture)- If n >= minValue AndAlso n <= maxValue Then Return n- Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException- ' use the fallback- End Try- End If- Return fallback- End Function-- Private Shared Function ReadDouble(section As Dictionary(Of String, Object), key As String, fallback As Double,- minValue As Double, maxValue As Double) As Double- Dim v As Object = Nothing- If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Try- Dim d As Double = Convert.ToDouble(v, CultureInfo.InvariantCulture)- If d >= minValue AndAlso d <= maxValue Then Return d- Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException- ' use the fallback- End Try- End If- Return fallback- End Function--End Classdiff --git a/2D_wave_sim_V01/Simulation/SourceSettings.vb b/2D_wave_sim_V01/Simulation/SourceSettings.vbdeleted file mode 100644index eb8689c..0000000--- a/2D_wave_sim_V01/Simulation/SourceSettings.vb+++ /dev/null@@ -1,474 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--Imports System.Collections-Imports System.Collections.Generic-Imports System.Globalization--''' <summary>Whether a source is one point (or line, in a future version) or an X-Y array of points.</summary>-Public Enum SourceMainType- ''' <summary>One point source. Named Simple (not Single) because Single is a reserved VB keyword (the floating-point type).</summary>- Simple = 0- Composite = 1-End Enum--''' <summary>Whether a source (or an element of a composite source) is always on, or switches on and off in cycles of its own frequency.</summary>-Public Enum SourceMode- Continuous = 0- Pulsed = 1-End Enum--''' <summary>The shape of the amplitude envelope of a pulsed source while it is "on".</summary>-Public Enum SourcePulseShape- Gaussian = 0- SmoothedSquare = 1-End Enum--''' <summary>How the elements of a composite source get their frequency/phase/off-width/position: all the same as the-''' single source, or randomized around it.</summary>-Public Enum SourceCompositeMode- InheritFromSingle = 0- InheritAndRandomize = 1-End Enum--''' <summary>-''' One concrete point source, as it is actually run by the simulation: the result of "Generate composite source" for-''' every element of the array (or the only element of a simple source). Generating rolls the randomization once, so-''' a run is reproducible: the engine never re-randomizes.-''' </summary>-Public NotInheritable Class SourceElement- Public Property PosX As Integer- Public Property PosY As Integer-- ''' <summary>The frequency, expressed the same way as an image source's green level (1-255): frequency = level / 255 * 0.5 * SourceFrequencyScale.</summary>- Public Property Level As Integer = 100-- ''' <summary>0 (silent) to 1 (full scale).</summary>- Public Property Amplitude As Double = 0.5-- Public Property PhaseRad As Double = 0.0-- Public Property Mode As SourceMode = SourceMode.Continuous- Public Property PulseShape As SourcePulseShape = SourcePulseShape.Gaussian-- ''' <summary>The number of cycles (of the source's own frequency) that it is off, then on, then off again, ...</summary>- Public Property OnWidthCycles As Integer = 10- Public Property OffWidthCycles As Integer = 10-- ''' <summary>The un-randomized off-width (the composite source's own OffStateCycles at generate time), used as- ''' the anchor every time OffWidthCycles is re-randomized at runtime. Equal to OffWidthCycles unless- ''' RandomizeOffWidthAmount > 0.</summary>- Public Property OffWidthBase As Integer = 10-- ''' <summary>When greater than 0, the engine redraws OffWidthCycles (uniformly within +/- this amount of- ''' OffWidthBase) every time this element completes a full off+on cycle, so sources don't stay in lockstep or- ''' permanently favor one extreme. 0 means the off-width set at generate time is never changed again.</summary>- Public Property RandomizeOffWidthAmount As Integer = 0-- ''' <summary>The simulation step at which this element stops driving the field (releasing its hold on it, so it- ''' no longer diffracts waves passing through its position), or -1 to never detach. Copied from the parent- ''' SourceSettings' DetachSource/DetachAfterSteps at generate time.</summary>- Public Property DetachAfterStep As Integer = -1-- ''' <summary>- ''' The number of simulation steps over which a detaching element's drive is faded out (linearly, down to 0),- ''' rather than cut instantly at DetachAfterStep - an abrupt cutoff otherwise leaves a small kink in the forcing- ''' at that point, which can ring. Shared by both engines (WaveSimulator.ApplySources and the- ''' apply_object_sources GPU kernel in GpuWaveSimulator), so the two stay in exact agreement.- ''' </summary>- Public Const DetachRampSteps As Integer = 30-- Public Function Clone() As SourceElement- Return DirectCast(MemberwiseClone(), SourceElement)- End Function-End Class--''' <summary>-''' One source of the project: either a single point source, or a composite source (an X-Y array of point sources-''' built from the same base parameters, optionally randomized). "Generate composite source" resolves the current-''' parameters (and, for a composite source, a fresh random draw) into a fixed list of SourceElement, which is what-''' the simulation actually runs; "Save source" keeps both the authoring parameters (so the source can be reopened-''' and edited or regenerated) and that generated list (so a saved project runs exactly what was generated, even-''' before it is regenerated again). The sources are stored in the section "object_sources" of configuration.json.-''' </summary>-Public NotInheritable Class SourceSettings-- Public Const SectionName As String = "object_sources"-- Public Property Name As String = "Source 1"- Public Property MainType As SourceMainType = SourceMainType.Simple-- ''' <summary>The position of a simple source, or the center of a composite source's array, in simulation pixels.- ''' PosX/PosY only hold a meaningful value once HasPosition is True (picked in the picture, or typed) - until- ''' then they are just the unset default, and the Sources tab must not draw a marker for it.</summary>- Public Property PosX As Integer = 100- Public Property PosY As Integer = 100-- ''' <summary>Whether PosX/PosY have actually been assigned (by picking a position in the picture, or by typing- ''' one) rather than still holding the default. Sources loaded from a project saved before this flag existed- ''' default to True (see FromDictionary), since they were positioned under the old rules.</summary>- Public Property HasPosition As Boolean = False-- ''' <summary>Whether the source interacts with the simulation at all. Off by default is never true - a new- ''' source starts on. Switching it off keeps every parameter (it can still be edited, and switched back on)- ''' but the source takes no part in a run: SourcesForRun leaves it out entirely, so it neither drives the- ''' field nor gets in the way of waves passing through its position.</summary>- Public Property SourceOn As Boolean = True-- ''' <summary>When True, the source stops driving the field after DetachAfterSteps simulation steps (it runs- ''' normally up to that point). A source that keeps driving the field also holds it at a fixed value there,- ''' which diffracts waves that later pass through that point; detaching releases that hold once the source- ''' has done its job, so the field becomes free of it again for the rest of the run.</summary>- Public Property DetachSource As Boolean = False-- ''' <summary>The simulation step (0-based) at which the source detaches, when DetachSource is True.</summary>- Public Property DetachAfterSteps As Integer = 1000-- ' ---- single source (base) properties-- ''' <summary>1-255, the same scale as an image source's green level.</summary>- Public Property Frequency As Integer = 100-- ''' <summary>0-100 (%) of the source amplitude; 100 matches numAmplitude's own Designer default for a new source.</summary>- Public Property Amplitude As Integer = 100-- ''' <summary>-180 to 180 degrees.</summary>- Public Property PhaseDeg As Integer = 0-- Public Property Mode As SourceMode = SourceMode.Continuous- Public Property PulseShape As SourcePulseShape = SourcePulseShape.Gaussian- Public Property PulseWidthCycles As Integer = 10- Public Property OffStateCycles As Integer = 10-- ' ---- composite source properties-- Public Property ArraySizeX As Integer = 1- Public Property ArraySizeY As Integer = 1- Public Property SpacingX As Integer = 10- Public Property SpacingY As Integer = 10- Public Property CompositeMode As SourceCompositeMode = SourceCompositeMode.InheritFromSingle-- Public Property RandomizeFrequency As Boolean = False- Public Property RandomizeFrequencyAmount As Integer = 0- Public Property RandomizePhase As Boolean = False- Public Property RandomizePhaseAmount As Integer = 0- Public Property RandomizeOffWidth As Boolean = False- Public Property RandomizeOffWidthAmount As Integer = 0- Public Property RandomizePosition As Boolean = False- Public Property RandomizePositionAmount As Integer = 0-- ''' <summary>The concrete elements produced by the last "Generate composite source" (one element for a simple source). Empty until generated.</summary>- Public Property Elements As New List(Of SourceElement)()-- Public Function Clone() As SourceSettings- Dim c As SourceSettings = DirectCast(MemberwiseClone(), SourceSettings)- c.Elements = New List(Of SourceElement)()- For Each e As SourceElement In Elements- c.Elements.Add(e.Clone())- Next- Return c- End Function-- Public Sub Normalize()- If Frequency < 1 Then Frequency = 1- If Frequency > 255 Then Frequency = 255- If Amplitude < 0 Then Amplitude = 0- If Amplitude > 100 Then Amplitude = 100- If PhaseDeg < -180 Then PhaseDeg = -180- If PhaseDeg > 180 Then PhaseDeg = 180- If PulseWidthCycles < 1 Then PulseWidthCycles = 1- If OffStateCycles < 1 Then OffStateCycles = 1- If ArraySizeX < 1 Then ArraySizeX = 1- If ArraySizeY < 1 Then ArraySizeY = 1- If DetachAfterSteps < 0 Then DetachAfterSteps = 0- End Sub-- ''' <summary>Rebuilds Elements from the current parameters: one element for a simple source, or an ArraySizeX x- ''' ArraySizeY grid centered on (PosX, PosY) for a composite source, randomized once per element when- ''' CompositeMode is InheritAndRandomize and the matching "Randomize" check box is on.</summary>- Public Sub GenerateElements(rng As Random)- Normalize()- Dim result As New List(Of SourceElement)()-- If MainType = SourceMainType.Simple Then- result.Add(MakeBaseElement(PosX, PosY))- Else- Dim cols As Integer = ArraySizeX- Dim rows As Integer = ArraySizeY- Dim randomize As Boolean = (CompositeMode = SourceCompositeMode.InheritAndRandomize)-- For row As Integer = 0 To rows - 1- For col As Integer = 0 To cols - 1- ' the array is centered on (PosX, PosY), not anchored at a corner- Dim ex As Integer = PosX + CInt(Math.Round((col - (cols - 1) / 2.0) * SpacingX))- Dim ey As Integer = PosY + CInt(Math.Round((row - (rows - 1) / 2.0) * SpacingY))-- If randomize AndAlso RandomizePosition AndAlso RandomizePositionAmount > 0 Then- ex += RandomInt(rng, RandomizePositionAmount)- ey += RandomInt(rng, RandomizePositionAmount)- End If-- Dim el As SourceElement = MakeBaseElement(ex, ey)-- If randomize AndAlso RandomizeFrequency AndAlso RandomizeFrequencyAmount > 0 Then- el.Level = Clamp(Frequency + RandomInt(rng, RandomizeFrequencyAmount), 1, 255)- End If- If randomize AndAlso RandomizePhase AndAlso RandomizePhaseAmount > 0 Then- Dim deg As Integer = Clamp(PhaseDeg + RandomInt(rng, RandomizePhaseAmount), -180, 180)- el.PhaseRad = deg * Math.PI / 180.0- End If- If randomize AndAlso RandomizeOffWidth AndAlso RandomizeOffWidthAmount > 0 Then- el.OffWidthCycles = Math.Max(1, OffStateCycles + RandomInt(rng, RandomizeOffWidthAmount))- el.RandomizeOffWidthAmount = RandomizeOffWidthAmount- End If-- result.Add(el)- Next- Next- End If-- Elements = result- End Sub-- Private Function MakeBaseElement(x As Integer, y As Integer) As SourceElement- Dim el As New SourceElement()- el.PosX = x- el.PosY = y- el.Level = Frequency- el.Amplitude = Amplitude / 100.0- el.PhaseRad = PhaseDeg * Math.PI / 180.0- el.Mode = Mode- el.PulseShape = PulseShape- el.OnWidthCycles = PulseWidthCycles- el.OffWidthCycles = OffStateCycles- el.OffWidthBase = OffStateCycles- el.RandomizeOffWidthAmount = 0- el.DetachAfterStep = If(DetachSource, DetachAfterSteps, -1)- Return el- End Function-- ''' <summary>A uniform random integer in [-amount, amount].</summary>- Friend Shared Function RandomInt(rng As Random, amount As Integer) As Integer- If amount <= 0 Then Return 0- Return rng.Next(-amount, amount + 1)- End Function-- Private Shared Function Clamp(value As Integer, minValue As Integer, maxValue As Integer) As Integer- Return Math.Max(minValue, Math.Min(maxValue, value))- End Function-- ' ---------------------------------------------------------------- configuration file-- Public Shared Function ListFromConfig(config As ProjectConfig) As List(Of SourceSettings)- Dim result As New List(Of SourceSettings)()-- If config.ContainsKey(SectionName) Then- Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)- Dim items As Object = Nothing- If section.TryGetValue("items", items) Then- Dim list As IEnumerable = TryCast(items, IEnumerable)- If list IsNot Nothing AndAlso Not TypeOf items Is String Then- For Each item As Object In list- Dim d As Dictionary(Of String, Object) = TryCast(item, Dictionary(Of String, Object))- If d IsNot Nothing Then result.Add(FromDictionary(d))- Next- End If- End If- End If-- Return result- End Function-- Public Shared Sub ListToConfig(sources As List(Of SourceSettings), config As ProjectConfig)- Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)- Dim items As New List(Of Object)()- For Each s As SourceSettings In sources- items.Add(s.ToDictionary())- Next- section("count") = items.Count- section("items") = items- End Sub-- Private Function ToDictionary() As Dictionary(Of String, Object)- Dim d As New Dictionary(Of String, Object)()- d("name") = Name- d("main_type") = If(MainType = SourceMainType.Composite, "composite", "single")- d("x") = PosX- d("y") = PosY- d("has_position") = HasPosition- d("source_on") = SourceOn- d("detach_source") = DetachSource- d("detach_after_steps") = DetachAfterSteps- d("frequency") = Frequency- d("amplitude") = Amplitude- d("phase_deg") = PhaseDeg- d("mode") = If(Mode = SourceMode.Pulsed, "pulsed", "continuous")- d("pulse_shape") = If(PulseShape = SourcePulseShape.SmoothedSquare, "smoothed_square", "gaussian")- d("pulse_width_cycles") = PulseWidthCycles- d("off_state_cycles") = OffStateCycles- d("array_size_x") = ArraySizeX- d("array_size_y") = ArraySizeY- d("spacing_x") = SpacingX- d("spacing_y") = SpacingY- d("composite_mode") = If(CompositeMode = SourceCompositeMode.InheritAndRandomize, "randomize", "inherit")- d("randomize_frequency") = RandomizeFrequency- d("randomize_frequency_amount") = RandomizeFrequencyAmount- d("randomize_phase") = RandomizePhase- d("randomize_phase_amount") = RandomizePhaseAmount- d("randomize_off_width") = RandomizeOffWidth- d("randomize_off_width_amount") = RandomizeOffWidthAmount- d("randomize_position") = RandomizePosition- d("randomize_position_amount") = RandomizePositionAmount-- Dim elementList As New List(Of Object)()- For Each el As SourceElement In Elements- Dim ed As New Dictionary(Of String, Object)()- ed("x") = el.PosX- ed("y") = el.PosY- ed("level") = el.Level- ed("amplitude") = el.Amplitude- ed("phase_rad") = el.PhaseRad- ed("mode") = If(el.Mode = SourceMode.Pulsed, "pulsed", "continuous")- ed("pulse_shape") = If(el.PulseShape = SourcePulseShape.SmoothedSquare, "smoothed_square", "gaussian")- ed("on_width_cycles") = el.OnWidthCycles- ed("off_width_cycles") = el.OffWidthCycles- ed("off_width_base") = el.OffWidthBase- ed("randomize_off_width_amount") = el.RandomizeOffWidthAmount- ed("detach_after_step") = el.DetachAfterStep- elementList.Add(ed)- Next- d("elements") = elementList-- Return d- End Function-- Private Shared Function FromDictionary(d As Dictionary(Of String, Object)) As SourceSettings- Dim s As New SourceSettings()-- s.Name = ReadText(d, "name", s.Name)- s.MainType = If(ReadText(d, "main_type", "single") = "composite", SourceMainType.Composite, SourceMainType.Simple)- s.PosX = ReadInt(d, "x", s.PosX, -1000000, 1000000)- s.PosY = ReadInt(d, "y", s.PosY, -1000000, 1000000)- ' a project saved before HasPosition existed has no "has_position" entry - default to True, since its- ' sources were positioned under the old rules (there was no "unset" state back then)- s.HasPosition = ReadBool(d, "has_position", True)- ' a project saved before SourceOn/DetachSource existed has no entries for them either - default to the- ' same behavior it always had: on, and never detaching- s.SourceOn = ReadBool(d, "source_on", True)- s.DetachSource = ReadBool(d, "detach_source", False)- s.DetachAfterSteps = ReadInt(d, "detach_after_steps", s.DetachAfterSteps, 0, 1000000000)- s.Frequency = ReadInt(d, "frequency", s.Frequency, 1, 255)- s.Amplitude = ReadInt(d, "amplitude", s.Amplitude, 0, 100)- s.PhaseDeg = ReadInt(d, "phase_deg", s.PhaseDeg, -180, 180)- s.Mode = If(ReadText(d, "mode", "continuous") = "pulsed", SourceMode.Pulsed, SourceMode.Continuous)- s.PulseShape = If(ReadText(d, "pulse_shape", "gaussian") = "smoothed_square", SourcePulseShape.SmoothedSquare, SourcePulseShape.Gaussian)- s.PulseWidthCycles = ReadInt(d, "pulse_width_cycles", s.PulseWidthCycles, 1, 1000000)- s.OffStateCycles = ReadInt(d, "off_state_cycles", s.OffStateCycles, 1, 1000000)- s.ArraySizeX = ReadInt(d, "array_size_x", s.ArraySizeX, 1, 100000)- s.ArraySizeY = ReadInt(d, "array_size_y", s.ArraySizeY, 1, 100000)- s.SpacingX = ReadInt(d, "spacing_x", s.SpacingX, -1000000, 1000000)- s.SpacingY = ReadInt(d, "spacing_y", s.SpacingY, -1000000, 1000000)- s.CompositeMode = If(ReadText(d, "composite_mode", "inherit") = "randomize", SourceCompositeMode.InheritAndRandomize, SourceCompositeMode.InheritFromSingle)- s.RandomizeFrequency = ReadBool(d, "randomize_frequency", False)- s.RandomizeFrequencyAmount = ReadInt(d, "randomize_frequency_amount", 0, 0, 1000000)- s.RandomizePhase = ReadBool(d, "randomize_phase", False)- s.RandomizePhaseAmount = ReadInt(d, "randomize_phase_amount", 0, 0, 1000000)- s.RandomizeOffWidth = ReadBool(d, "randomize_off_width", False)- s.RandomizeOffWidthAmount = ReadInt(d, "randomize_off_width_amount", 0, 0, 1000000)- s.RandomizePosition = ReadBool(d, "randomize_position", False)- s.RandomizePositionAmount = ReadInt(d, "randomize_position_amount", 0, 0, 1000000)-- Dim elements As New List(Of SourceElement)()- Dim elementsObj As Object = Nothing- If d.TryGetValue("elements", elementsObj) Then- Dim list As IEnumerable = TryCast(elementsObj, IEnumerable)- If list IsNot Nothing AndAlso Not TypeOf elementsObj Is String Then- For Each item As Object In list- Dim ed As Dictionary(Of String, Object) = TryCast(item, Dictionary(Of String, Object))- If ed Is Nothing Then Continue For- Dim el As New SourceElement()- el.PosX = ReadInt(ed, "x", 0, -1000000, 1000000)- el.PosY = ReadInt(ed, "y", 0, -1000000, 1000000)- el.Level = ReadInt(ed, "level", 100, 1, 255)- el.Amplitude = ReadDouble(ed, "amplitude", 0.5, 0.0, 1.0)- el.PhaseRad = ReadDouble(ed, "phase_rad", 0.0, -1000.0, 1000.0)- el.Mode = If(ReadText(ed, "mode", "continuous") = "pulsed", SourceMode.Pulsed, SourceMode.Continuous)- el.PulseShape = If(ReadText(ed, "pulse_shape", "gaussian") = "smoothed_square", SourcePulseShape.SmoothedSquare, SourcePulseShape.Gaussian)- el.OnWidthCycles = ReadInt(ed, "on_width_cycles", 10, 1, 1000000)- el.OffWidthCycles = ReadInt(ed, "off_width_cycles", 10, 1, 1000000)- ' a project saved before off-width re-randomization existed has no "off_width_base" entry -- ' default to this element's own off_width_cycles (already read above), which is exactly its- ' anchor under the old, always-static behavior- el.OffWidthBase = ReadInt(ed, "off_width_base", el.OffWidthCycles, 1, 1000000)- el.RandomizeOffWidthAmount = ReadInt(ed, "randomize_off_width_amount", 0, 0, 1000000)- el.DetachAfterStep = ReadInt(ed, "detach_after_step", -1, -1, 1000000000)- elements.Add(el)- Next- End If- End If- s.Elements = elements-- s.Normalize()- Return s- End Function-- Private Shared Function ReadText(d As Dictionary(Of String, Object), key As String, fallback As String) As String- Dim v As Object = Nothing- If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then Return Convert.ToString(v, CultureInfo.InvariantCulture)- Return fallback- End Function-- Private Shared Function ReadBool(d As Dictionary(Of String, Object), key As String, fallback As Boolean) As Boolean- Dim v As Object = Nothing- If d.TryGetValue(key, v) AndAlso TypeOf v Is Boolean Then Return Convert.ToBoolean(v)- Return fallback- End Function-- Private Shared Function ReadInt(d As Dictionary(Of String, Object), key As String, fallback As Integer,- minValue As Integer, maxValue As Integer) As Integer- Dim v As Object = Nothing- If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Try- Dim n As Integer = Convert.ToInt32(v, CultureInfo.InvariantCulture)- If n >= minValue AndAlso n <= maxValue Then Return n- Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException- ' use the fallback- End Try- End If- Return fallback- End Function-- Private Shared Function ReadDouble(d As Dictionary(Of String, Object), key As String, fallback As Double,- minValue As Double, maxValue As Double) As Double- Dim v As Object = Nothing- If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then- Try- Dim x As Double = Convert.ToDouble(v, CultureInfo.InvariantCulture)- If x >= minValue AndAlso x <= maxValue Then Return x- Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException- ' use the fallback- End Try- End If- Return fallback- End Function--End Classdiff --git a/2D_wave_sim_V01/Simulation/WaveSimulator.vb b/2D_wave_sim_V01/Simulation/WaveSimulator.vbdeleted file mode 100644index ca1ee5e..0000000--- a/2D_wave_sim_V01/Simulation/WaveSimulator.vb+++ /dev/null@@ -1,653 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.-'-' Portions of this file are based on WaveSimulator2D by 0x23-' <https://github.com/0x23/WaveSimulator2D>.--Option Strict On-Option Explicit On--Imports System.Collections.Generic-Imports System.Threading.Tasks--''' <summary>-''' The 2D wave equation on the CPU, a port of the Python class WaveSimulator2D (which runs on the GPU with CuPy):-''' laplacian = 3x3 convolution with [[0.066, 0.184, 0.066], [0.184, -1, 0.184], [0.066, 0.184, 0.066]]-''' new u = u + (u - previous u) * d + laplacian * c^2-''' with the field outside the domain fixed at 0. The sources are applied before each step as in-''' update_scene / StaticImageScene.update_field:-''' u = u * 0.9 + sin(frequency * t) * 0.1-''' The intensity is no longer a single exponential average of WaveVisualizer.update (I = I * 0.98 + u^2 * 0.02):-''' a single-pole filter like that only rolls off at 6 dB/octave, so it never fully removes the ripple at the-''' source's own oscillation frequency, just delays it - lengthening its time constant mostly adds trail without-''' buying much extra ripple suppression. Instead the same one-pole filter (I = I * alpha + x * (1 - alpha)) is run-''' twice in a row (_intensityStage1, then _intensity), a critically-damped 2-pole low-pass that rolls off at-''' 12 dB/octave, so for the same responsiveness it suppresses the ripple far more without needing to know the-''' local frequency at every pixel. Two full stages turned out to add more delay than wanted at low frequencies-''' (a short pulse can come and go before the second stage has caught up, understating its peak) for not that-''' much extra benefit over one, so what is actually shown/exported (_intensityOut) is a blend of the one-stage-''' and two-stage outputs (IntensityBlend) - roughly the middle ground between the two (about 9, not 6 or 12,-''' dB/octave), still well ahead of a single stage at rejecting the ripple but reacting closer to as fast.-''' alpha (_intensityAlpha) is derived once per simulation so the time constant of each stage scales inversely-''' with the frequency of the slowest active source, times the user's TimeDecayFactor - see that property's-''' comment (SimulationSettings.vb) for why.-'''-''' The arrays have a border of one cell (which always stays 0) so that the step needs no edge tests.-''' The rows are divided over all processor cores.-'''-''' Optionally (Use4thOrderLaplacian), the Laplacian is instead computed with a 4th order accurate, 5-point-''' "cross" stencil (reaching 2 cells away along x and along y) wherever there is room for it - see UpdateField.-''' This reduces numerical dispersion (short, under-resolved wavelengths otherwise travel slower than long ones --''' see the SimulationSettings.WaveSpeedC comment) at roughly twice the memory reads per step. The outermost ring-''' of the domain still uses the original 3x3 kernel, since it only has the usual one cell of border to read from,-''' not the two the wider stencil needs.-'''-''' The 4th order stencil's coefficients (-1/12, 4/3, -5) reach much further from zero than the 3x3 kernel's-''' (0.066, 0.184, -1) - about 7 times further at the highest spatial frequency the grid can represent - so the-''' same c^2 that is safely stable with the 3x3 kernel can be wildly unstable with the 4th order one (the field-''' blows up: everywhere saturates except at object edges, which is what an invalid/unstable Laplacian looks like).-''' To stay stable without changing the physical wave speed, AdvanceOneStep instead takes _subSteps smaller time-''' steps per call when the 4th order stencil is used: c^2 is scaled by 1 / _subSteps^2 (matching a time step-''' _subSteps times smaller) and the damping factor d by its _subSteps-th root (so _subSteps applications of it-''' compound back to the original d), so the net effect after _subSteps steps is exactly the same physical-''' propagation and damping as one ordinary step - just spread over more, individually stable, time steps.-''' _subSteps is computed once per scene from its highest c^2 (ComputeSubSteps) and is 1 (no sub-stepping, and a-''' multiply by the exact literal 1.0F) whenever the 3x3 kernel is used or the scene's c^2 does not need it.-''' </summary>-Friend NotInheritable Class WaveSimulator- Implements IWaveEngine-- Private Const KernelCorner As Single = 0.066F- Private Const KernelEdge As Single = 0.184F- Private Const SourceOpacity As Single = 0.9F- ' nominal source level (of 255) that TimeDecayFactor's steps count is calibrated against - see the property's- ' comment (SimulationSettings.vb) and _intensityAlpha's computation below- Private Const NominalDecayLevel As Integer = 100- ' how much of the fully cascaded (2-stage, 12 dB/octave) intensity is blended into the shown/exported value- ' versus the 1-stage (6 dB/octave) intensity - see the class summary; 0.5 is the middle ground, about 9 dB/octave- Private Const IntensityBlend As Single = 0.5F-- ' the 4th order "cross" stencil's coefficients: (-f(-2) + 16f(-1) - 30f(0) + 16f(+1) - f(+2)) / 12 per axis,- ' the two axes' center terms combined into one (-60/12 = -5) since both apply to the same center pixel- Private Const FourthOrderNear As Single = 4.0F / 3.0F ' 16 / 12- Private Const FourthOrderFar As Single = -1.0F / 12.0F- Private Const FourthOrderCenter As Single = -5.0F ' -60 / 12-- ' the 4th order stencil's largest |eigenvalue| (at the grid's highest spatial frequency, kx = ky = pi):- ' 2 * (-1/12 * cos(2k) + 4/3 * cos(k) - 5/2)|k=pi per axis, summed over x and y = -32/3- Private Const FourthOrderLambdaMax As Single = 32.0F / 3.0F- ' how far below the hard stability limit (c^2 * |lambda max| <= 4) sub-stepping aims to stay - chosen to give- ' roughly the same safety margin the 3x3 kernel already has in practice (its own c^2 * |lambda max| is about- ' 1.8 at the highest c^2 the app allows, i.e. about 2.2 times under the limit of 4)- Private Const SubStepTargetLimit As Single = 2.0F-- Private ReadOnly _width As Integer- Private ReadOnly _height As Integer- Private ReadOnly _stride As Integer- Private ReadOnly _use4thOrderLaplacian As Boolean- ' see the class summary; 1 (no sub-stepping) unless Use4thOrderLaplacian needs otherwise for this scene's c^2- Private ReadOnly _subSteps As Integer- ' the d array used by UpdateField: the original _d itself when _subSteps = 1 (same reference, so multiplying by- ' it is bit-for-bit identical to before), otherwise a separate array of _d raised to the power 1 / _subSteps- Private ReadOnly _dEffective As Single()- ' 1.0F / _subSteps^2 (or exactly 1.0F when _subSteps = 1, a bit-for-bit no-op multiply)- Private ReadOnly _c2Mult As Single- ' the intensity's exponential-average decay factor for this simulation (replaces the old fixed 0.98F) - see- ' TimeDecayFactor's comment (SimulationSettings.vb) and its computation at the end of the constructor- Private ReadOnly _intensityAlpha As Single- ' SimulationSettings.IntensityScale - see that property's comment- Private ReadOnly _intensityScale As Single-- Private _u As Single()- Private _uPrev As Single()- Private ReadOnly _c2 As Single()- Private ReadOnly _d As Single()- ' the 2-stage cascade's internal recursive state (12 dB/octave) - no longer what is shown/exported, see- ' _intensityOut below and the class summary- Private ReadOnly _intensity As Single()- ' the first of the two cascaded exponential-filter stages that make up the intensity (see the class summary);- ' Nothing when the intensity is not tracked, same as _intensity- Private ReadOnly _intensityStage1 As Single()- ' the blend of _intensityStage1 and _intensity (IntensityBlend) that is actually shown/exported - see the class- ' summary; Nothing when the intensity is not tracked, same as _intensity- Private ReadOnly _intensityOut As Single()-- Private ReadOnly _sourceIndex As Integer()- Private ReadOnly _sourceLevel As Byte()- Private ReadOnly _levelFrequency(255) As Double- Private ReadOnly _levelUsed(255) As Boolean- Private ReadOnly _levelValue(255) As Single- Private ReadOnly _sourceAmplitude As Double-- ' object sources (Sources tab): the flat list of generated point-source elements that are within the canvas- Private ReadOnly _objSources As SourceElement()- Private ReadOnly _objIndex As Integer()-- ' per-object-source runtime state for pulsed sources whose off-width is re-randomized at runtime (see- ' SourceElement.RandomizeOffWidthAmount): _objCycleAnchor(i) is the cycle-clock value (in cycles of the- ' element's own frequency) at which its current off+on cycle started, and _objCurrentOffWidth(i) is the- ' off-width (in cycles) currently in effect for it. Both are parallel arrays to _objSources/_objIndex.- ' Elements that never re-randomize (RandomizeOffWidthAmount <= 0, the common case) never touch this state:- ' their position within the cycle is still computed as a pure function of _time, exactly as before.- Private ReadOnly _objRandom As New Random()- Private ReadOnly _objCycleAnchor As Double()- Private ReadOnly _objCurrentOffWidth As Integer()-- ''' <summary>Safety cap on how many off+on cycles ComputePulsePosition will advance through in a single call, so a- ''' pathological configuration (e.g. an off-width collapsing towards 0) can never turn into an infinite loop.</summary>- Private Const CycleAdvanceGuard As Integer = 1000-- Private _time As Double-- ' the probes: the values of the point probes per step, the intensity totals (per pixel of the line) of the integrating line probes- Private _sampler As ProbeSampler- Private ReadOnly _probeValues As New List(Of List(Of Single))()- Private _profileTotals As Double()()-- ''' <param name="scene">The scene (its arrays are copied).</param>- ''' <param name="sourceFrequencyScale">Frequency of a source = green value / 255 * 0.5 * this value.</param>- ''' <param name="sourceAmplitude">Amplitude of the sources (1 = the value of the Python code).</param>- ''' <param name="trackIntensity">True when the intensity is needed (it costs extra time in every step).</param>- ''' <param name="use4thOrderLaplacian">See the class summary (Use4thOrderLaplacian).</param>- ''' <param name="timeDecayFactor">SimulationSettings.TimeDecayFactor - see that property's comment.</param>- ''' <param name="intensityScale">SimulationSettings.IntensityScale - see that property's comment.</param>- ''' <param name="objectSources">The generated elements of the object sources (Sources tab), or Nothing/empty for none.</param>- Public Sub New(scene As SceneData, sourceFrequencyScale As Double, sourceAmplitude As Double, trackIntensity As Boolean,- use4thOrderLaplacian As Boolean, timeDecayFactor As Double, intensityScale As Double,- Optional objectSources As List(Of SourceElement) = Nothing)- _sourceAmplitude = sourceAmplitude- _use4thOrderLaplacian = use4thOrderLaplacian- _intensityScale = CSng(intensityScale)- _width = scene.Width- _height = scene.Height- _stride = _width + 2- Dim size As Integer = _stride * (_height + 2)-- _u = New Single(size - 1) {}- _uPrev = New Single(size - 1) {}- _c2 = New Single(size - 1) {}- _d = New Single(size - 1) {}- If trackIntensity Then- _intensity = New Single(size - 1) {}- _intensityStage1 = New Single(size - 1) {}- _intensityOut = New Single(size - 1) {}- End If-- For y As Integer = 0 To _height - 1- Array.Copy(scene.C2, y * _width, _c2, (y + 1) * _stride + 1, _width)- Array.Copy(scene.D, y * _width, _d, (y + 1) * _stride + 1, _width)- Next-- ' see the class summary: sub-stepping keeps the 4th order stencil stable without changing the physical- ' wave speed or damping - _subSteps stays 1 (no sub-stepping) unless the 4th order stencil is in use and- ' this scene's highest c^2 actually needs it- If use4thOrderLaplacian Then- Dim maxC2 As Single = 0.0F- For i As Integer = 0 To _c2.Length - 1- If _c2(i) > maxC2 Then maxC2 = _c2(i)- Next- _subSteps = ComputeSubSteps(maxC2)- Else- _subSteps = 1- End If-- If _subSteps > 1 Then- Dim dEff As Single() = New Single(_d.Length - 1) {}- Dim invN As Double = 1.0 / _subSteps- For i As Integer = 0 To _d.Length - 1- dEff(i) = CSng(Math.Pow(CDbl(_d(i)), invN))- Next- _dEffective = dEff- _c2Mult = 1.0F / CSng(_subSteps * _subSteps)- Else- _dEffective = _d- _c2Mult = 1.0F- End If-- Dim n As Integer = scene.SourceCount- _sourceIndex = New Integer(n - 1) {}- _sourceLevel = New Byte(n - 1) {}- For i As Integer = 0 To n - 1- _sourceIndex(i) = (scene.SourceY(i) + 1) * _stride + scene.SourceX(i) + 1- _sourceLevel(i) = scene.SourceLevel(i)- _levelUsed(scene.SourceLevel(i)) = True- Next- For level As Integer = 0 To 255- _levelFrequency(level) = level / 255.0 * 0.5 * sourceFrequencyScale- Next-- ' object sources: keep only the elements whose position is inside the canvas (a randomized composite element can fall outside)- If objectSources Is Nothing Then- _objSources = Array.Empty(Of SourceElement)()- _objIndex = Array.Empty(Of Integer)()- Else- Dim keptEl As New List(Of SourceElement)()- Dim keptIdx As New List(Of Integer)()- For Each el As SourceElement In objectSources- If el.PosX >= 0 AndAlso el.PosX < _width AndAlso el.PosY >= 0 AndAlso el.PosY < _height Then- keptEl.Add(el)- keptIdx.Add((el.PosY + 1) * _stride + el.PosX + 1)- End If- Next- _objSources = keptEl.ToArray()- _objIndex = keptIdx.ToArray()- End If-- ' the intensity's averaging time constant scales inversely with the frequency of the slowest active- ' source (image or object; a level of 0 means "no source" and is excluded) - see TimeDecayFactor's comment- ' (SimulationSettings.vb) for why, and NominalDecayLevel's comment for the calibration this reproduces- Dim minActiveLevel As Integer = 0- For level As Integer = 1 To 255- If _levelUsed(level) Then- minActiveLevel = level- Exit For- End If- Next- For Each el As SourceElement In _objSources- If el.Level > 0 AndAlso (minActiveLevel = 0 OrElse el.Level < minActiveLevel) Then minActiveLevel = el.Level- Next- If minActiveLevel = 0 Then minActiveLevel = NominalDecayLevel- Dim tauSteps As Double = Math.Max(1.0, timeDecayFactor * NominalDecayLevel / minActiveLevel)- _intensityAlpha = CSng(Math.Exp(-1.0 / tauSteps))-- _objCycleAnchor = New Double(_objSources.Length - 1) {}- _objCurrentOffWidth = New Integer(_objSources.Length - 1) {}- For i As Integer = 0 To _objSources.Length - 1- ' the very first cycle uses the off-width already rolled once at "Generate composite source" time;- ' later cycles (for elements that opt into it) redraw from OffWidthBase - see ComputePulsePosition- _objCurrentOffWidth(i) = _objSources(i).OffWidthCycles- Next- End Sub-- Public ReadOnly Property Width As Integer Implements IWaveEngine.Width- Get- Return _width- End Get- End Property-- Public ReadOnly Property Height As Integer Implements IWaveEngine.Height- Get- Return _height- End Get- End Property-- ''' <summary>Distance between two rows in FieldData and IntensityData. Pixel (x, y) is at (y + 1) * Stride + x + 1.</summary>- Public ReadOnly Property Stride As Integer Implements IWaveEngine.Stride- Get- Return _stride- End Get- End Property-- ''' <summary>The field of the last completed step (with a border of one cell). Do not change.</summary>- Public ReadOnly Property FieldData As Single() Implements IWaveEngine.FieldData- Get- Return _u- End Get- End Property-- ''' <summary>The averaged intensity (with a border of one cell), or Nothing when it is not tracked. Do not change.</summary>- Public ReadOnly Property IntensityData As Single() Implements IWaveEngine.IntensityData- Get- Return _intensityOut- End Get- End Property-- Public ReadOnly Property Description As String Implements IWaveEngine.Description- Get- Return "CPU (" & Environment.ProcessorCount.ToString(System.Globalization.CultureInfo.InvariantCulture) & " threads)"- End Get- End Property-- ''' <summary>Nothing to do: the field and the intensity are always in memory.</summary>- Public Sub PrepareFrame(needField As Boolean, needIntensity As Boolean) Implements IWaveEngine.PrepareFrame- End Sub-- Public Sub Dispose() Implements IDisposable.Dispose- End Sub-- Public Sub SetProbes(sampler As ProbeSampler) Implements IWaveEngine.SetProbes- _probeValues.Clear()- _profileTotals = Nothing- If sampler Is Nothing OrElse sampler.Count = 0 Then- _sampler = Nothing- Return- End If- If sampler.NeedsIntensity AndAlso _intensityOut Is Nothing Then- Throw New InvalidOperationException("the intensity is not tracked")- End If-- _sampler = sampler- _profileTotals = New Double(sampler.Count - 1)() {}- For i As Integer = 0 To sampler.Count - 1- _probeValues.Add(New List(Of Single)())- If sampler.Integrate(i) Then _profileTotals(i) = New Double(sampler.Pixels(i).Length - 1) {}- Next- End Sub-- Public Sub SampleProbes() Implements IWaveEngine.SampleProbes- If _sampler Is Nothing Then Return- Dim currentStep As Integer = CInt(_time)- For p As Integer = 0 To _sampler.Count - 1- If Not _sampler.IsProfile(p) Then- Dim data As Single() = If(_sampler.UseIntensity(p), _intensityOut, _u)- _probeValues(p).Add(_sampler.Compute(p, data))- ElseIf _sampler.Integrate(p) Then- ' before "start after step" the totals are simply never added to, so they stay at zero: any intensity- ' that arrived earlier is purged rather than being baked into the total once recording starts- If _sampler.UseStartAfterStep(p) AndAlso currentStep < _sampler.StartAfterStep(p) Then Continue For-- ' the intensity that has passed every point of the line, added up over the steps- Dim px As Integer() = _sampler.Pixels(p)- Dim totals As Double() = _profileTotals(p)- Dim inten As Single() = _intensityOut- For k As Integer = 0 To px.Length - 1- totals(k) += inten(px(k))- Next- End If- Next- End Sub-- Public Function TakeProbeSamples() As Single()() Implements IWaveEngine.TakeProbeSamples- If _sampler Is Nothing Then Return New Single()() {}- Dim result As Single()() = New Single(_sampler.Count - 1)() {}- For p As Integer = 0 To _sampler.Count - 1- result(p) = _probeValues(p).ToArray()- _probeValues(p).Clear()- Next- Return result- End Function-- Public Function ReadProbeProfiles() As Single()() Implements IWaveEngine.ReadProbeProfiles- If _sampler Is Nothing Then Return New Single()() {}- Dim result As Single()() = New Single(_sampler.Count - 1)() {}- For p As Integer = 0 To _sampler.Count - 1- If Not _sampler.IsProfile(p) Then Continue For-- Dim px As Integer() = _sampler.Pixels(p)- Dim values As Single() = New Single(px.Length - 1) {}- If _sampler.Integrate(p) Then- Dim totals As Double() = _profileTotals(p)- For k As Integer = 0 To px.Length - 1- values(k) = CSng(totals(k))- Next- Else- Dim data As Single() = If(_sampler.UseIntensity(p), _intensityOut, _u)- For k As Integer = 0 To px.Length - 1- values(k) = data(px(k))- Next- End If- result(p) = values- Next- Return result- End Function-- ''' <summary>The number of steps done so far (the time in steps).</summary>- Public ReadOnly Property Time As Double- Get- Return _time- End Get- End Property-- ''' <summary>- ''' The number of smaller time steps (see the class summary) that keep c2 * |lambda max| of the 4th order- ''' stencil under SubStepTargetLimit for the given (highest, in this scene) c^2; 1 when that is already true.- ''' </summary>- Private Shared Function ComputeSubSteps(maxC2 As Single) As Integer- If maxC2 <= 0.0F Then Return 1- Dim n As Double = Math.Ceiling(Math.Sqrt(CDbl(maxC2) * CDbl(FourthOrderLambdaMax) / CDbl(SubStepTargetLimit)))- Return Math.Max(1, CInt(n))- End Function-- ''' <summary>One time step: apply the sources, then update the field (and the intensity) _subSteps times.</summary>- Public Sub AdvanceOneStep() Implements IWaveEngine.AdvanceOneStep- ApplySources()- For subStep As Integer = 1 To _subSteps- UpdateField(_dEffective, _c2Mult, subStep = _subSteps)- Next- _time += 1.0- End Sub-- Private Sub ApplySources()- Dim u As Single() = _u-- If _sourceIndex.Length > 0 Then- ' sin(phase + frequency * t) * amplitude is the same for all sources with the same green value- For level As Integer = 1 To 255- If _levelUsed(level) Then- _levelValue(level) = CSng(Math.Sin(_levelFrequency(level) * _time) * _sourceAmplitude)- End If- Next-- For i As Integer = 0 To _sourceIndex.Length - 1- Dim idx As Integer = _sourceIndex(i)- u(idx) = u(idx) * SourceOpacity + _levelValue(_sourceLevel(i)) * (1.0F - SourceOpacity)- Next- End If-- For i As Integer = 0 To _objSources.Length - 1- Dim el As SourceElement = _objSources(i)- ' "detach source": once the run reaches the source's detach step, its drive is faded out linearly over- ' the next DetachRampSteps steps (rather than cut instantly), then it stops driving the field entirely- ' (not even towards 0) so it releases its hold and stops diffracting waves through that point. A hard- ' cutoff would otherwise leave a small kink in the forcing right at the detach step, which can ring.- Dim detachFade As Single = 1.0F- If el.DetachAfterStep >= 0 Then- Dim stepsSinceDetach As Double = _time - el.DetachAfterStep- If stepsSinceDetach >= SourceElement.DetachRampSteps Then Continue For- If stepsSinceDetach > 0.0 Then- detachFade = CSng(1.0 - stepsSinceDetach / SourceElement.DetachRampSteps)- End If- End If- Dim freq As Double = _levelFrequency(el.Level)- Dim envelope As Double- If el.Mode = SourceMode.Continuous Then- envelope = 1.0- Else- Dim offWidth As Integer- Dim isFirstCycle As Boolean- Dim pos As Double = ComputePulsePosition(i, el, freq, offWidth, isFirstCycle)- envelope = PulseEnvelope(el, pos, offWidth, isFirstCycle)- End If- Dim v As Single = CSng(Math.Sin(el.PhaseRad + freq * _time) * el.Amplitude * envelope) * detachFade- Dim idx As Integer = _objIndex(i)- u(idx) = u(idx) * SourceOpacity + v * (1.0F - SourceOpacity)- Next- End Sub-- ''' <summary>- ''' Returns the element's position within its current off+on cycle (0 = the very start of the "off" span, up to- ''' but not including its current period), and reports the off-width in effect for that cycle via offWidth.- ''' For most elements (RandomizeOffWidthAmount <= 0) the off-width never changes, so this is a pure, stateless- ''' function of _time - except that the cycle clock is shifted by the off-width, so the run starts already at the- ''' beginning of the "on" span (pos = offWidth) instead of at the start of an off span: a single/non-randomized- ''' source sitting silent for its off-width at the very start of a run was never the intent, only ever a side- ''' effect of the cycle position formula happening to start at 0. An element with RandomizeOffWidthAmount > 0- ''' (only ever a composite source with "Randomize off-width" ticked) keeps the original start-in-off-state- ''' behavior instead, since there the elements are meant to desynchronize from a common starting point rather- ''' than all begin already mid-pulse. For an element that opted into runtime re-randomization, this also owns- ''' that element's runtime state: each time _time has advanced far enough to complete the current cycle, it- ''' advances the element's cycle anchor and redraws a fresh off-width (uniformly within +/- RandomizeOffWidthAmount- ''' of OffWidthBase) before computing the position - so every source keeps its own, independently-drifting rhythm- ''' instead of staying locked to whatever it rolled once at generate time.- ''' isFirstCycle reports whether pos falls within the element's very first off+on cycle since the run began -- ''' see PulseEnvelope for why that matters for the SmoothedSquare pulse shape.- ''' </summary>- Private Function ComputePulsePosition(i As Integer, el As SourceElement, freq As Double, ByRef offWidth As Integer, ByRef isFirstCycle As Boolean) As Double- ' cycles of the source's own frequency elapsed since t = 0 (not folding in the phase, so the on/off timing- ' does not shift when only the phase of the wave itself is changed)- Dim cycleClock As Double = freq * _time / (2.0 * Math.PI)-- If el.RandomizeOffWidthAmount <= 0 Then- offWidth = el.OffWidthCycles- Dim period As Integer = el.OnWidthCycles + offWidth- If period <= 0 Then- isFirstCycle = True- Return 0.0- End If- ' shifted so cycleClock = 0 lands at pos = offWidth (the start of the "on" span), not pos = 0 (the start- ' of an "off" span) - see the summary above- Dim adjustedClock As Double = cycleClock + offWidth- isFirstCycle = (Math.Floor(adjustedClock / period) = 0.0)- Return adjustedClock - period * Math.Floor(adjustedClock / period) ' 0 .. period- End If-- offWidth = _objCurrentOffWidth(i)- Dim dynPeriod As Integer = el.OnWidthCycles + offWidth- If dynPeriod <= 0 Then- isFirstCycle = True- Return 0.0- End If-- Dim pos As Double = cycleClock - _objCycleAnchor(i)- Dim guard As Integer = 0- While pos >= dynPeriod AndAlso guard < CycleAdvanceGuard- _objCycleAnchor(i) += dynPeriod- pos -= dynPeriod- offWidth = Math.Max(1, el.OffWidthBase + SourceSettings.RandomInt(_objRandom, el.RandomizeOffWidthAmount))- _objCurrentOffWidth(i) = offWidth- dynPeriod = el.OnWidthCycles + offWidth- guard += 1- End While- If pos < 0.0 Then pos = 0.0 ' should not happen (_time only increases), guarded for safety- ' the anchor only ever advances (above) once a cycle has actually completed, so it still reading its initial- ' 0 means no cycle has completed yet - we are still in the element's very first (off-first) cycle- isFirstCycle = (_objCycleAnchor(i) = 0.0)- Return pos- End Function-- ''' <summary>- ''' For a pulsed source, the source is "off" for offWidth cycles of its own frequency, then "on" for- ''' OnWidthCycles cycles, repeating (off precedes on so that, at the start of a run, every source is silent for- ''' its own off-width before its first pulse, rather than every source firing simultaneously at t = 0). Within- ''' the "on" span the amplitude is shaped by PulseShape: Gaussian tapers smoothly to (about) 0 at both ends of the- ''' "on" span, and SmoothedSquare rises and falls quickly (an atan-smoothed square wave, avoiding a hard on/off- ''' step that would ring the field). pos and offWidth come from ComputePulsePosition, as does isFirstCycle - see- ''' the SmoothedSquare branch below for why that one matters.- ''' </summary>- Private Function PulseEnvelope(el As SourceElement, pos As Double, offWidth As Integer, isFirstCycle As Boolean) As Double- Dim onWidth As Integer = el.OnWidthCycles- Dim period As Integer = onWidth + offWidth- If period <= 0 Then Return 1.0-- If el.PulseShape = SourcePulseShape.Gaussian Then- If pos < offWidth Then Return 0.0- Dim onPos As Double = pos - offWidth ' 0 .. onWidth, position within the "on" span- Dim center As Double = onWidth / 2.0- Dim sigma As Double = Math.Max(onWidth / 6.0, 1.0E-6)- Dim d As Double = (onPos - center) / sigma- Return Math.Exp(-0.5 * d * d)- Else- ' a flat-topped pulse (envelope 1 while "on", 0 while "off") with a short, FIXED-width (in cycles, not a- ' fraction of the on/off span) smoothed edge at the rise and the fall (see the on-first version's comment- ' for why a fixed edge width matters for a large off-width). The math below is exactly the original- ' on-first formula, just fed a coordinate shifted so the "on" span starts at 0 (folding around the period- ' the same way the original did), which keeps the already-verified edge-smoothing behavior unchanged.- Dim shifted As Double = pos - offWidth- If shifted < 0.0 Then- ' wrapping shifted forward by a full period makes it continue the falling tail of the on-span that- ' JUST ended - correct from the second off-span onward, where that on-span really happened. A- ' source's very first off-span (isFirstCycle) has no real preceding on-emission to continue from, so- ' wrapping there would fabricate one: pos = 0 would land exactly on that phantom falling edge and- ' start the run at envelope ~0.5 instead of ~0, emitting a spurious one-cycle "blip" before the- ' source actually goes quiet. Left un-wrapped (deeply negative) instead, dRise/dFall below correctly- ' place it far from both edges, so the envelope is (very close to) 0 until the real rising edge.- If Not isFirstCycle Then shifted += period- End If- Const EdgeWidth As Double = 0.35- Dim dFall As Double = shifted - onWidth ' 0 at the falling edge, grows past it- Dim dRise As Double = shifted ' 0 at the rising edge- If dRise > period / 2.0 Then dRise -= period ' signed distance to the *nearest* rising edge-- Dim rising As Double = 0.5 + Math.Atan(dRise / EdgeWidth) / Math.PI- Dim falling As Double = 0.5 - Math.Atan(dFall / EdgeWidth) / Math.PI- Return rising * falling- End If- End Function-- ''' <summary>- ''' One time step of size 1 / _subSteps: dArray is _d itself (_subSteps = 1) or its 1 / _subSteps-th root- ''' (see the class summary); c2Mult is 1.0F (_subSteps = 1, an exact no-op) or 1.0F / _subSteps^2; the- ''' intensity (if tracked) is only updated when updateIntensity is True, so that its own exponential- ''' averaging still runs once per AdvanceOneStep call, from the field after all of its sub-steps, matching- ''' its calibration (_intensityAlpha) regardless of how many sub-steps that call takes.- ''' </summary>- Private Sub UpdateField(dArray As Single(), c2Mult As Single, updateIntensity As Boolean)- Dim u As Single() = _u- Dim uPrev As Single() = _uPrev- Dim c2 As Single() = _c2- Dim d As Single() = dArray- Dim intensity As Single() = _intensity- Dim stage1 As Single() = _intensityStage1- Dim intensityOut As Single() = _intensityOut- Dim track As Boolean = (intensity IsNot Nothing) AndAlso updateIntensity- Dim stride As Integer = _stride- Dim w As Integer = _width- Dim h As Integer = _height- Dim use4th As Boolean = _use4thOrderLaplacian- Dim mult As Single = c2Mult- Dim alpha As Single = _intensityAlpha- Dim blend As Single = IntensityBlend- Dim scale As Single = _intensityScale-- Dim bands As Integer = Math.Min(h, Environment.ProcessorCount * 4)- Parallel.For(0, bands,- Sub(band As Integer)- Dim y0 As Integer = CInt(CLng(h) * band \ bands)- Dim y1 As Integer = CInt(CLng(h) * (band + 1) \ bands) - 1- For y As Integer = y0 To y1- Dim idx As Integer = (y + 1) * stride + 1- ' the 4th order stencil reaches 2 cells away, so it is only safe for domain rows/columns that- ' have that much room before the (1 cell wide) border - the outermost ring of the domain (y = 0,- ' y = h - 1, and, per column below, x = 0, x = w - 1) falls back to the original 3x3 kernel- Dim rowInterior As Boolean = use4th AndAlso y >= 1 AndAlso y <= h - 2- For x As Integer = 0 To w - 1- Dim uc As Single = u(idx)- Dim laplacian As Single- If rowInterior AndAlso x >= 1 AndAlso x <= w - 2 Then- laplacian = FourthOrderFar * (u(idx - 2) + u(idx + 2) + u(idx - 2 * stride) + u(idx + 2 * stride)) +- FourthOrderNear * (u(idx - 1) + u(idx + 1) + u(idx - stride) + u(idx + stride)) +- FourthOrderCenter * uc- Else- laplacian = KernelCorner * (u(idx - stride - 1) + u(idx - stride + 1) + u(idx + stride - 1) + u(idx + stride + 1)) +- KernelEdge * (u(idx - 1) + u(idx + 1) + u(idx - stride) + u(idx + stride)) - uc- End If- ' the new value replaces the previous one (each cell only reads its own previous value)- Dim nv As Single = uc + (uc - uPrev(idx)) * d(idx) + laplacian * c2(idx) * mult- uPrev(idx) = nv- If track Then- ' two cascaded one-pole stages (see the class summary), blended with the 1-stage- ' result (IntensityBlend) for the shown/exported intensity rather than using the full- ' 2-stage cascade outright- Dim s1 As Single = stage1(idx) * alpha + nv * nv * (1.0F - alpha)- stage1(idx) = s1- Dim s2 As Single = intensity(idx) * alpha + s1 * (1.0F - alpha)- intensity(idx) = s2- intensityOut(idx) = (s1 * (1.0F - blend) + s2 * blend) * scale- End If- idx += 1- Next- Next- End Sub)-- ' the array that received the new values is now the current field- _uPrev = u- _u = uPrev- End Sub--End Classdiff --git a/2D_wave_sim_V01/frmDescription.Designer.vb b/2D_wave_sim_V01/frmDescription.Designer.vbdeleted file mode 100644index eb2f525..0000000--- a/2D_wave_sim_V01/frmDescription.Designer.vb+++ /dev/null@@ -1,78 +0,0 @@-<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _-Partial Class frmDescription- Inherits System.Windows.Forms.Form-- 'Form overrides dispose to clean up the component list.- <System.Diagnostics.DebuggerNonUserCode()> _- Protected Overrides Sub Dispose(ByVal disposing As Boolean)- Try- If disposing AndAlso components IsNot Nothing Then- components.Dispose()- End If- Finally- MyBase.Dispose(disposing)- End Try- End Sub-- 'Required by the Windows Form Designer- Private components As System.ComponentModel.IContainer-- 'NOTE: The following procedure is required by the Windows Form Designer- 'It can be modified using the Windows Form Designer.- 'Do not modify it using the code editor.- <System.Diagnostics.DebuggerStepThrough()> _- Private Sub InitializeComponent()- Me.TextBox1 = New System.Windows.Forms.TextBox()- Me.btnSaveDescription = New System.Windows.Forms.Button()- Me.btnCancelDescription = New System.Windows.Forms.Button()- Me.SuspendLayout()- '- 'TextBox1- '- Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle- Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.TextBox1.Location = New System.Drawing.Point(22, 23)- Me.TextBox1.Multiline = True- Me.TextBox1.Name = "TextBox1"- Me.TextBox1.Size = New System.Drawing.Size(662, 267)- Me.TextBox1.TabIndex = 0- '- 'btnSaveDescription- '- Me.btnSaveDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnSaveDescription.Location = New System.Drawing.Point(575, 305)- Me.btnSaveDescription.Name = "btnSaveDescription"- Me.btnSaveDescription.Size = New System.Drawing.Size(109, 32)- Me.btnSaveDescription.TabIndex = 1- Me.btnSaveDescription.Text = "OK"- Me.btnSaveDescription.UseVisualStyleBackColor = True- '- 'btnCancelDescription- '- Me.btnCancelDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))- Me.btnCancelDescription.Location = New System.Drawing.Point(460, 305)- Me.btnCancelDescription.Name = "btnCancelDescription"- Me.btnCancelDescription.Size = New System.Drawing.Size(109, 32)- Me.btnCancelDescription.TabIndex = 1- Me.btnCancelDescription.Text = "Cancel"- Me.btnCancelDescription.UseVisualStyleBackColor = True- '- 'frmDescription- '- Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)- Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font- Me.ClientSize = New System.Drawing.Size(705, 349)- Me.Controls.Add(Me.btnCancelDescription)- Me.Controls.Add(Me.btnSaveDescription)- Me.Controls.Add(Me.TextBox1)- Me.Name = "frmDescription"- Me.Text = "Edit project description"- Me.ResumeLayout(False)- Me.PerformLayout()-- End Sub-- Friend WithEvents TextBox1 As TextBox- Friend WithEvents btnSaveDescription As Button- Friend WithEvents btnCancelDescription As Button-End Classdiff --git a/2D_wave_sim_V01/frmDescription.resx b/2D_wave_sim_V01/frmDescription.resxdeleted file mode 100644index 1af7de1..0000000--- a/2D_wave_sim_V01/frmDescription.resx+++ /dev/null@@ -1,120 +0,0 @@-<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />- <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" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </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" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>-</root>\ No newline at end of filediff --git a/2D_wave_sim_V01/frmDescription.vb b/2D_wave_sim_V01/frmDescription.vbdeleted file mode 100644index 629e58b..0000000--- a/2D_wave_sim_V01/frmDescription.vb+++ /dev/null@@ -1,52 +0,0 @@-' Wave Dude 2D - interactive 2D wave simulator-' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)-' SPDX-License-Identifier: GPL-3.0-or-later-'-' This file is part of Wave Dude 2D.-'-' Wave Dude 2D is free software: you can redistribute it and/or modify-' it under the terms of the GNU General Public License as published by-' the Free Software Foundation, either version 3 of the License, or-' (at your option) any later version.-'-' Wave Dude 2D is distributed in the hope that it will be useful,-' but WITHOUT ANY WARRANTY; without even the implied warranty of-' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-' GNU General Public License for more details.-'-' You should have received a copy of the GNU General Public License-' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.--Option Strict On-Option Explicit On--''' <summary>-''' Lets the user type or edit a free-form description of the current project. Opened modally from Form1's-''' btnDescription_Click, which sets DescriptionText before ShowDialog and reads it back (and saves it to-''' the project) only when the dialog returns DialogResult.OK (btnSaveDescription); btnCancelDescription-''' discards any typing.-''' </summary>-Public Class frmDescription-- ''' <summary>The text being edited. Form1 sets this before showing the dialog and reads it back after- ''' a DialogResult.OK.</summary>- Public Property DescriptionText As String- Get- Return TextBox1.Text- End Get- Set(value As String)- TextBox1.Text = value- End Set- End Property-- Private Sub btnSaveDescription_Click(sender As Object, e As EventArgs) Handles btnSaveDescription.Click- Me.DialogResult = DialogResult.OK- Me.Close()- End Sub-- Private Sub btnCancelDescription_Click(sender As Object, e As EventArgs) Handles btnCancelDescription.Click- Me.DialogResult = DialogResult.Cancel- Me.Close()- End Sub--End Classdiff --git a/CLAUDE.md b/CLAUDE.mdindex 8103740..969dff7 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1,27 +1,30 @@-# Wave Dude 2D — project notes for Claude+# WaveDude Next — project notes for Claude-Last updated 2026-10-14. Update this file when the facts below change.+Last updated 2026-10-15. Update this file when the facts below change.## What this is-**Wave Dude 2D v0.29** — a 2D wave-equation simulator (field + accumulated intensity views,-refractive-index scenes from images, point/composite sources, probes with live graphs, video export).-Educational tool by Huygens Optics (`[email protected]`, patreon `huygens_optics`).-Licence: **GPL-3.0-or-later, Copyright (C) 2026 JJM Vleggaar (Huygens Optics)** per the headers in the-author's VB source; the C# files do not carry the header yet (see `_tools/VB_SOURCE_AUDIT.md`).+**WaveDude Next** — a 2D wave-equation simulator (field + accumulated intensity views, refractive-index+scenes from images, point/composite sources, probes with live graphs, video export), the successor of+Jeroen Vleggaar's (Huygens Optics) **Wave Dude 2D v0.29**, rebuilt as a .NET 10 library plus a WPF app with a+live, scrubbable preview. Licence **GPL-3.0-or-later** (see "Rebrand and licensing" below for the people,+the header and LICENSE.md).-`2D_wave_sim_V01/` is the **author's original VB.NET source**, supplied after the C# port was made. It-is newer than the binary that was decompiled (GPL headers and a GPL Help disclaimer were added after-that build). Treat it as the authority for intent, comments and constant names; `_tools/VB_SOURCE_AUDIT.md`-(2026-10-08) lists everything the decompile lost, file by file, with the C# line each item belongs at.+**The old sources are gone from the tree** (2026-10-15, the first rebrand step): the author's VB.NET+source (`2D_wave_sim_V01/`) and the C# port made from the decompiled binary (`Wave_Dude_2D/`), with the+harnesses and one-off scripts that only served them (`_tools/engine_check`, `avi_check`,+`VB_SOURCE_AUDIT.md`, `CLEANUP_GUIDE.md`, `DOC_GUIDE.md`, the `fix_*`/`modernize`/`split_form1`/+`replace_method` scripts). They stay in git history (every commit up to the removal, e.g. `d3ac0d8`);+the author's original program will be published separately as preserved assets. The library's engines,+probes, colour schemes and renderer descend from his code (ported 2026-10-09 and reworked since); the+model's documented defaults and the JSON importer (`Model/LegacyProject`) keep his semantics.-`Wave_Dude_2D.sln` holds three projects:+`Wave_Dude_2D.sln` (the name is still the old one; renaming it is a later rebrand step) holds two projects:| project | what | state ||---|---|---|-| `Wave_Dude_2D/` | the original WinForms app, **.NET Framework 4.6.1**, legacy csproj, namespace `_2D_wave_sim_V01` | all the real code; builds and runs; **reference implementation, not the future** |-| `WaveDude/` | SDK class library, `net10.0`, nullable + implicit usings; packages NLog and `System.Numerics.Tensors` (Microsoft, MIT: vectorised float↔Half) | the model (`Model/`), the engines (`Engine/`), probes, rendering, the run driver and frame store (`Runs/`); see "Architecture (WaveDude library)" |-| `WaveDude.WPF/` | SDK WPF app, `net10.0-windows`, references `WaveDude` | **the replacement UI**; docking shell, editors, preview with live simulation; builds clean (0 warnings) |+| `WaveDude/` | SDK class library, `net10.0`, nullable + implicit usings; packages NLog and `System.Numerics.Tensors` (Microsoft, MIT: vectorised float↔Half) | the model (`Model/`), the engines (`Engine/`), probes, rendering, the run driver and frame store (`Runs/`), export; see "Architecture (WaveDude library)" |+| `WaveDude.WPF/` | SDK WPF app, `net10.0-windows`, references `WaveDude` | **the UI**; docking shell, editors, preview with live simulation; builds clean (0 warnings) |WPF shell as it stands:- `MainWindow` = menu + the in-house `Docking/DockHost` (Project tree pane left, Preview document@@ -226,8 +229,9 @@ WPF shell as it stands:`MainWindow.OpenFile` routes any `.json` there (Open dialog, drag and drop, command line; the filter lists"Wave Dude 2D projects (configuration.json)"); the result is unsaved and Save As proposes`<project_name>.wdproj` beside the original (`_suggestedFileName`). Checked in `library_check` on- Examples 12, 5 and 3 and the `Project/Test` file (skipped when `Wave_Dude_Examples` is not found above- the harness binary), including an XML round trip and the refusal of a newer `format_version`.+ Examples 12, 5 and 3 (skipped when `Wave_Dude_Examples` is not found above the harness binary),+ including an XML round trip and the refusal of a newer `format_version`. The check that a source+ without a position comes in disabled went with the `Project/Test` sample on 2026-10-15.- **Array rotation** (2026-10-14, the user's request): `SourceArray.Angle` in degrees, counter-clockwise onthe screen (y points down, so x' = x cos + y sin, y' = y cos − x sin about the source position),normalised into (−180, 180]; applied in `Source.GenerateElements` before the random offsets, edited in the@@ -525,41 +529,29 @@ WPF shell as it stands:install, or a plain copy with no installer, must win over a global installation for that user.`assoc`/`ftype` in cmd do not see HKCU registrations; test with a real launch.-History: the C# in `Wave_Dude_2D/` started as ILSpy-decompiled output of a VB.NET binary. It has-since been made to compile, cleaned to idiomatic C#, documented, and partly refactored (details-below). Baseline commit `1266f10` is the first compiling, cleaned, documented state; everything-after it (AVI fix, style pass, engine refactor, WPF shell) is uncommitted at the time of writing.+History: the port began 2026-10-07 as ILSpy-decompiled output of the author's VB.NET binary, was cleaned,+documented and audited against his real source (supplied 2026-10-08), the engines were copied into the+library 2026-10-09, and the two legacy trees were removed 2026-10-15 (see "What this is").The shipped colour schemes live in `WaveDude/ColorSchemes/` (`*.wdscheme` XML since 2026-10-13, in thelibrary project since 2026-10-15; **embedded into `WaveDude.dll`** as resources `ColorSchemes/<file>` by thelibrary's csproj, loaded by `ColorSchemeStore.LoadBuiltIn`; the user's own schemes come from`%LOCALAPPDATA%\WaveDude\ColorSchemes` and shadow built-ins of the same name; agreed 2026-10-10, no-external files). The repo root also holds `Project/` (a sample project root), tracked on purpose. `.vs/`,-`bin/`, `obj/` are ignored.+external files). `.vs/`, `bin/`, `obj/` are ignored.No automated tests in the solution; standalone harnesses exist under `_tools/` (see Verification).## Build- Visual Studio 18 (2026) Community and the .NET 10 SDK are installed.-- Whole solution (the legacy csproj needs full MSBuild):- ```- "C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\MSBuild.exe" Wave_Dude_2D.sln -restore -p:Configuration=Debug -v:minimal -nologo -m- ```+- Whole solution: `dotnet build Wave_Dude_2D.sln` (both projects are SDK-style; no full MSBuild needed since+ the legacy csproj went, 2026-10-15).- WPF + library only: `dotnet build WaveDude.WPF/WaveDude.WPF.csproj` (the UI harnesses run the Debug exe).- Publish: `dotnet publish WaveDude.WPF/WaveDude.WPF.csproj -p:PublishProfile=SingleFile` →`WaveDude.WPF/bin/Publish/`: one framework-dependent win-x64 `WaveDude.WPF.exe`, nothing else needed.The profile takes the framework from the project.-- Expected result: 0 errors; 6 warnings in `Wave_Dude_2D` that are known and harmless- (`components` never assigned in the four generated Designer files, unused `Form1._hasRun`, one- sign-extension in `MfVideoWriter`). `DocumentationFile` is on, so malformed `///` XML or a wrong+- Expected result: 0 errors, 0 warnings. `DocumentationFile` is on, so malformed `///` XML or a wrong`<param>` name is a build warning — keep it at zero.-- Smoke test: launch `Wave_Dude_2D/bin/Debug/Wave_Dude_2D.exe`; the main window must appear with- title `2D wave simulation - (new project) *`.-- Standalone compile check that does not touch `bin/obj` (safe while other work is in flight):- ```- cd Wave_Dude_2D && "C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\Roslyn\csc.exe" -nologo -target:winexe -out:%TEMP%\check.exe -langversion:7.3 -r:System.dll -r:System.Core.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:Microsoft.VisualBasic.dll -r:System.Web.Extensions.dll -nowarn:0168,0649,0414,0675 *.cs My/*.cs My/Resources/*.cs Properties/*.cs- ```## Verification harnesses (`_tools/`)@@ -608,17 +600,6 @@ passing harnesses for comfort, never all of them after an edit.`skip GPU: …` when no OpenCL device works. `dotnet run --project _tools/library_check -c Release-- bench [w h]` prints the per-step cost table above for this machine.-The two legacy harnesses are console programs compiled with `csc` against the `Wave_Dude_2D` sources-(same reference list as above, `-target:exe`, `-nowarn:...,1591`):--- `_tools/engine_check/Program.cs` — add `-main:EngineCheck.Program` and all `Wave_Dude_2D` sources.- Runs `WaveSimulator` and `GpuWaveSimulator` over one scene (image source, continuous / Gaussian-pulsed /- detaching smoothed-square object sources, an out-of-canvas source that must be dropped, point and- integrated-line probes with a start step), with both stencils, and requires field, intensity, probe- samples and line profiles to agree within 1e-3 relative (actual: ~1e-7). Also exercises probe- re-install, `SetProbes(null)` and double dispose. Prints `skip GPU: …` when no OpenCL device works.-- `_tools/avi_check/Program.cs` — compile with `AviMjpegWriter.cs` only. Writes a 3-frame MJPEG AVI and- walks the RIFF tree (44 structural checks: header offsets, strh dwQuality = -1, movi size, idx1 offsets, EOF).- `_tools/ui_check/PreviewCheck.ps1` drives the WPF preview pane end to end on the default project(43 checks: play/pause at the 60 fps clock, speed incl. locale spelling, timeline keys, frame@@ -747,9 +728,9 @@ FrameStore (temporary file in %LOCALAPPDATA%\WaveDude\cache, DeleteOnClose, pre-reading/writing XML, built-in schemes embedded, `FrameRenderer`),`WaveDude.Runs` (`RunSpec`, `SimulationRun`, `RunState`, `FrameStore`, `FrameLayer(s)`,`FrameCache`, `ScenePixels`), `WaveDude.Export` (2026-10-14: `IFrameSink`, `ExportJob`, `ExportFormat(s)`,- the encoders and writers, `BitWriter`, `YuvPlanes` + `Dct8x8` shared by JPEG and MPEG-1, `Crc32`). All copied- from `Wave_Dude_2D` and adapted; the legacy app keeps its own copies and does not reference the library. Not- ported: the legacy video sinks (`MfVideoWriter` was rewritten as `Mp4Writer`, `AviMjpegWriter` replaced by+ the encoders and writers, `BitWriter`, `YuvPlanes` + `Dct8x8` shared by JPEG and MPEG-1, `Crc32`). All ported+ from the author's program and adapted. Not+ ported: his video sinks (`MfVideoWriter` was rewritten as `Mp4Writer`, `AviMjpegWriter` replaced bythe OpenDML `AviWriter`), GDI+ painters (`ProbeGraphPainter` exists anew in WPF, `ProbeOverlay`), the glowoverlay (now ported as `GlowingEdges`).- **The engine choice is not in the project** (2026-10-09, the user's call: the old app's flag was an@@ -777,7 +758,7 @@ FrameStore (temporary file in %LOCALAPPDATA%\WaveDude\cache, DeleteOnClose, pre-- **Determinism**: every emitter gets a non-zero `RngSeed` from `Pcg32(projectSeed,StableHash(name) ^ GapStream)`; both engines redraw the per-period off-width with the samexorshift32 (`Emitter.Xorshift32`, the GPU kernel's generator), so a run reproduces from the- project file and CPU = GPU bit-for-bit on the gap sequence. The legacy engines used unseeded+ project file and CPU = GPU bit-for-bit on the gap sequence. The author's engines used unseeded`Random` and disagreed with each other.- **Frames vs. steps**: a frame is recorded after step `i` when `i % VisualizeEvery == 0`, so framek shows the state after 0-based step `k × VisualizeEvery` (what the readout's `step` prints);@@ -847,109 +828,30 @@ FrameStore (temporary file in %LOCALAPPDATA%\WaveDude\cache, DeleteOnClose, pre-made the CPU preview unusable from the app. Flip it locally to step through engine code. Theconversions go through `TensorPrimitives` for the same reason.-## Architecture (Wave_Dude_2D)--```-My/MyApplication.Main -> MyProject.Forms.Form1 (VB "My" application framework; to be replaced by Program.Main)-Form1 (partial, 8 files) -> SimulationRunner (own Thread; events ProgressChanged/EngineReady/ProbesUpdated/PreviewReady/Finished,- all raised on the worker thread; Form1.PostToUi marshals via BeginInvoke)- |- WaveEngineFactory -> IWaveEngine (Width/Height/Stride, FieldData, IntensityData, AdvanceOneStep,- | | PrepareFrame, SetProbes/SampleProbes/TakeProbeSamples/ReadProbeProfiles)- | |- WaveSimulator CPU, Parallel.For over row bands; IDisposable is a no-op- | '- GpuWaveSimulator OpenCL via OpenClApi (P/Invoke OpenCL.dll); kernels are C# string literals- |- FrameRenderer + ColorLut/ColorScheme float field -> ARGB pixels- |- IFrameSink -> MfVideoWriter (Media Foundation SinkWriter P/Invoke, .mp4)- | AviFrameSink/AviMjpegWriter (.avi fallback)- '- Probe* (Sampler/Collector/Series/Trace/Update sampled on the worker; GraphPainter/Overlay paint on the UI thread)-Persistence: ProjectStore / ProjectConfig / Project (JSON via System.Web.Extensions JavaScriptSerializer, snake_case keys)- AppSettings -> %AppData%\2D_wave_sim_V01\settings.json- ColorSchemeStore -> *.json colour schemes in a user-chosen folder (ColorSchemeList/ ships the defaults;- FindDefaultFolder walks up from the exe looking for a *.sln, so a dev build edits the repo copy)-Project folder layout: <root>/<project>/configuration.json (+ legacy Configuration.txt), assets/, output_frames/, output_video/-Model classes (plain POCOs): SceneSettings, SimulationSettings, SourceSettings(+SourceElement, enums), ProbeSettings(+enums), ColorScheme-```+## Engine numerics (from the author's engines, verified by `library_check`)-### Engines (refactored 2026-10-07, verified by `engine_check`)--- `IWaveEngine` does **not** extend `IDisposable`; implementations decide, and `SimulationRunner`- disposes via `(engine as IDisposable)?.Dispose()`. Both engines have no thread affinity and no- internal synchronisation: exactly one thread may drive an engine at a time (today the runner's- worker; the UI thread only reads `FieldData`/`IntensityData` while the run is paused). That is the- contract to keep when the driving loop becomes `Task`-based.+- Both engines have no thread affinity and no internal synchronisation: exactly one thread may drive an+ engine at a time (the run's worker, or the scratch runner's). `IWaveEngine` does **not** extend+ `IDisposable`; implementations decide.- Numerics shared through `WaveSimulator`'s `internal static` helpers: `ComputeSubSteps`,`LowestSourceLevel`, `IntensityRetention`, `MaxOf`, `NominalDecayLevel`. Units: dx = dt = 1, c incells/step, `c2 = 1/n²`, frequencies in radians/step (`level/255 × 0.5 × scale`), `Time` in steps.Scheme: leapfrog, 9-point Laplacian (0.066/0.184/−1) or 4th-order 5-point-per-axis with sub-stepping,soft source blending (`u = 0.9u + 0.1v`), two-stage EMA intensity. The docs in both files spell it out.-- `GpuWaveSimulator` keeps device handles in two `Resources` groups (`_scene`: program + kernels +- buffers for the run; `_probes`: everything `SetProbes` creates, released and rebuilt on every call).- Kernel arguments are bound at build time; only time (arg 4/11) and the per-sub-step track flag- (`wave_step` arg 8) change per launch. The object-source kernel has 17 arguments — the table in+- `GpuWaveSimulator` keeps device handles in `Resources` groups (the scene's program, kernels and buffers;+ the emitters'; the probes'). Kernel arguments are bound at build time; only time and the per-sub-step+ track flag change per launch. The object-source kernel has 17 arguments — the table in`BuildObjectSourceKernels` is indexed by argument number; an off-by-one there shows up as`CL_INVALID_ARG_SIZE`, which the harness catches.- `WaveSimulator` swaps its two field arrays every sub-step, so `FieldData` must be re-read per frame;`GpuWaveSimulator.FieldData` is a stable host array refreshed only by `PrepareFrame`.--### What stayed in Wave_Dude_2D--The engines, probes, colour schemes and renderer were **copied** into `WaveDude/` on 2026-10-09 (see-"Architecture (WaveDude library)"); `Wave_Dude_2D/` is untouched, keeps its own copies and does not-reference the library. Still only there: `SimulationRunner`/`SimulationJob`/`SimulationResult`-(replaced by `RunSpec`/`SimulationRun`), the video sinks (`MfVideoWriter` + `IMF*Native`,-`AviMjpegWriter`, `AviFrameSink`), the GDI+ painters (`ProbeGraphPainter`, `ProbeOverlay`), the glow-overlay, the JSON project/settings persistence (`ProjectStore`, `ProjectConfig`, `AppSettings`,-`JavaScriptSerializer`; the WPF app uses `.wdproj` XML instead). The library stays `net10.0` without-`System.Drawing`: pixels are BGRA byte arrays (`ScenePixels`) and packed `int` BGRA32 buffers.--## The WinForms UI (reference implementation)--`Form1` is a partial class split along feature seams (~6,500 lines of logic, ~347 methods, 161 event-handlers, 78 `MessageBox.Show` calls):--| file | owns |-|---|---|-| `Form1.cs` | ctor, load/close, menu, project open/save/new, title, **all fields and nested types** (`ProjectListEntry`, `NativeSize`, `ThumbnailOptions`, `ProbeControlSet`) |-| `Form1.Projects.cs` | "Projects in current root" list on the Settings tab |-| `Form1.Output.cs` | Manage-output tab (scene/image/video lists, thumbnails, shell interop) |-| `Form1.Scene.cs` | scene properties, scene image, glow-edge overlay |-| `Form1.Colors.cs` | colour-scheme tab and stop editor |-| `Form1.Simulation.cs` | simulation settings, run/pause/stop, preview, export, Explorer view-mode COM hack |-| `Form1.Probes.cs` | probes tab (2 hard-wired probes via `ProbeControlSet[]`) |-| `Form1.Sources.cs` | sources tab |--Controls are private fields at the bottom of `Form1.Designer.cs`; handlers are attached in-`InitializeComponent` under `// event wiring (was VB WithEvents/Handles)`. The Designer files are-decompiled output with `global::` prefixes and have not been opened in the VS designer — do not-expect round-tripping. `Form1.Designer.cs` has 318 controls on a fixed 1781×989 form with absolute-positions, no `Dock`/`Anchor`, Microsoft Sans Serif in seven sizes, no DPI manifest — the reason the-UI is being rebuilt in WPF rather than restyled. Six tabs: Settings, Sources, Probes, Preview, Manage-output, Colors; a persistent bottom strip with Start/Pause, share-image and quick-navigate buttons.-`HelpForm.cs` holds the user-facing description of every control and is the closest thing to a-functional spec for the WPF UI.+- The importer's per-key fallbacks differ from the model's constructor defaults on purpose (steps 2500 vs+ 0, 4th-order off vs on, c 0.563 vs 1.0, decay 10 vs 0): the author documented that old projects keep+ their exact behaviour while new projects take the designer values.## Known issues (open)-- `Wave_Dude_2D.WaveEngineFactory.Create`: the "first choice failed" branch is dead- (`GpuWaveSimulator.TryCreate` never returns an engine together with a message). Fixed in the- library's copy only.-- `SimulationSettings.FromConfig` per-key fallbacks differ from the constructor defaults- (steps 2500 vs 0, 4th-order false vs true, c 0.563 vs 1.0, decay 10 vs 0). **Not a bug**: the VB- docs (`SimulationSettings.vb:47-49, 92-119`) say old projects must keep their exact behaviour while new- projects take the Designer values via `StartNewProject`. The C# `<remarks>` now says so.-- Still from the VB audit, not done: no GPL headers in the C# (deliberately deferred; the C# tree is- temporary); `AssemblyCopyright` lacks the author's name; decompiler artefacts remain (`MessageBoxIcon`- aliases, `Keys.Return`, `VBByRefStr ref string` on two OpenCL P/Invokes and `OpenClApi` not `static`- (both fixed in the library's copy only),- nested `*EventHandler` delegates in `SimulationRunner`, `colCreatedOn2` declared in `Form1.Simulation.cs`- instead of the Designer); the csproj does not copy `ColorSchemeList/` to the output as the vbproj did.-- `btnRenameProject_Click` re-opens the project from disk, silently discarding unsaved edits.-- `AboutForm` code says "Version 0.27", designer says 0.29; `HelpForm` text has typos ("everly").-- Unused members: `Form1._hasRun`, `SimulationRunner.JpegQuality`,- `AppSettings.LastRootFolder/LastProjectName` (written, never read).-- `My/*` + `WindowsFormsApplicationBase` startup is the only remaining `Microsoft.VisualBasic` use;- replace with `Program.Main` (`EnableVisualStyles`, `SetCompatibleTextRenderingDefault`) when convenient.-- Private `ref` parameters that are really `out` remain outside the engines (`TryPictureToCanvas`,- `TryParseInt`, `DampingProblem`, `PromptForCValue`, `ComputeRanges`, `RgbToHsv`, …).+- WPF: no progress bar for a run (status text only; the export has one); the Simulation menu has no About/Help; the probesignal lane is not drawn yet (the graph boxes are); the preview skips frames at1080p (see the numbers in the library architecture section).@@ -959,21 +861,6 @@ functional spec for the WPF UI."why is step twice the frame". Undecided (2026-10-09): label it `step 1546 of 2500`, drop thestep from the bar, or label the timeline ticks in steps. Do not change on your own.-Fixed on 2026-10-07 (kept here so nobody re-reports them): `AviMjpegWriter` header/offset mismatch-(header was 236 bytes vs. 224 assumed; now spec-exact, see `avi_check`); `GpuWaveSimulator.SetProbes`-leaking the previous probe set and ignoring `null`; GPU engine carrying 28 buffer fields that existed-only to be released, plus a hand-copied `ComputeSubSteps`; `SourceElement.DetachRampSteps` now used by-both engines instead of a literal 30.--Fixed on 2026-10-08 from the VB audit (`_tools/VB_SOURCE_AUDIT.md`): the author's rationale comments,-Python-provenance notes and wrong C# docs ported into every C# file; folded constants restored-(`ColorScheme.StopCount/EntryCount`, `SceneSettings.Max*`, `Thumb*`, `FVM_*`, hex OpenCL constants,-`4f/3f`-style fractions, local consts); locals renamed where the VB name was clearer. Behaviour-restored to the author's: `AviMjpegWriter` strh `dwQuality` = -1 (new `avi_check` check);-`WaveSimulator.ApplySources` reuses `_levelValue` instead of allocating per step; `ColorSchemeStore`-probes for `*.sln` (was `*.vbproj`, which never matched above the C# exe); NaN-safe `!(a > b)` checks in-`ProbeGraphPainter`/`ProbeSettings`; `ProbeSampler` uses `!= Amplitude`; `Form1.StopRole` parity test;-`HelpForm` disclaimer is the author's GPL wording.## Author feedback (Jeroen Vleggaar, e-mail of 2026-10-10)@@ -1029,7 +916,7 @@ PreviewCheck 12 s, LanguageCheck 17 s, `library_check` about 20 s). The next ses`Measurement` (amplitude | value | integrated value), `BoxSize`, `BoxX/BoxY` (canvas pixels),`ScaleMode` (running window / full run), `Window` (steps), `AutoScaleX/Y`, `YMin/YMax`,`StartAfter`. The handles on the pictures exist (`SceneOverlay`, ids `Probe:<name>:A|B`).-- Spec: the author's `ProbeGraphPainter.cs` / `ProbeOverlay.cs` in `Wave_Dude_2D/` (GDI+), now ported+- Spec: the author's GDI+ `ProbeGraphPainter` / `ProbeOverlay` (in git history), now portedas geometry to `WaveDude.Probes.ProbeGraph` and drawn by `ProbeGraphOverlay`. Still to do: the**probe signal lane** under the timeline on the same time axis (roadmap item 5), drawn from the sametraces (`ProbeGraph.ComputeRanges` and its binning can be reused), and the box in exports (the layout is@@ -1049,9 +936,8 @@ pan (roadmap); Help > About has no content; dock pane titles are not exposed to## Roadmap1. ~~Make it compile~~ · 2. ~~clean up / document~~ · 2b. ~~AVI fix, style pass, engine refactor~~-3. ~~**Extract the engine into `WaveDude/`**~~ (done 2026-10-09 as a copy; the WinForms app stays- legacy and is not changed). Still open from this item: real test projects (the user chose to- keep the `dotnet run` harness for now).+3. ~~**Extract the engine into `WaveDude/`**~~ (done 2026-10-09 as a copy). Still open from this item:+ real test projects (the user chose to keep the `dotnet run` harness for now).4. ~~**Make the engine loop `Task`-based**~~ (`SimulationRun`, 2026-10-09).5. **WPF UI** in `WaveDude.WPF`: the preview shows a live run and replays it from the frame store(done 2026-10-09); editors, colour schemes, scene image and outline, languages (done 2026-10-14,@@ -1073,14 +959,17 @@ pan (roadmap); Help > About has no content; dock pane titles are not exposed tothin overview bar shows the visible window; needed once tracks exist, since 2500 steps atone pixel per frame do not fit.Deferred, possibly never: filmstrip thumbnails behind the bar (needs cached frames).-6. Retire `Wave_Dude_2D` once the WPF app covers it.+6. ~~Retire `Wave_Dude_2D`~~ (removed 2026-10-15 together with the VB source; the solution file still carries the old name).## Rebrand and licensing (designed 2026-10-15, **not applied yet**)The WPF app becomes **WaveDude Next** (agreed with Jeroen Vleggaar by mail 2026-10-15; he proposed"Pro", the user chose "Next" since Pro/Plus suggests a paid tier). Project, namespaces, the GitHub-repo, About and installer take that name. The new icon is `Branding/Icons/05_rainbow_rings.svg`,-installed as `WaveDude.WPF/App.svg|png|ico` (the candidates and `make_icons.py` stay in `Branding/Icons/`).+repo, About and installer take that name. The new icon is `WaveDude.WPF/App.svg`+(a damped circular wave, its magnitude coloured through the "Default intensity" scheme, chosen 2026-10-15+from eleven candidates; the candidates and their generator were deleted the same day), with `App.png`+(128 px) and `App.ico` (16 to 256 px as PNG entries) rendered from it; the csproj's `ApplicationIcon` and+the window's `Icon` both use `App.ico`.**People**: Alexander Graef (author of WaveDude Next; "Gräf" in his mail signature, "Graef" in code);JJM (Jeroen) Vleggaar, Huygens Optics (author of Wave Dude 2D, GPL-3.0-or-later, Copyright (C) 2026);@@ -1113,7 +1002,7 @@ licence to his repo). Private addresses stay out of files.Jeroen's line carries his copyright so the GPL's notice-preservation rule (sections 4 and 5) is meton the files that descend from his code without a separate notice. The author's own VB tree-(`2D_wave_sim_V01/`) keeps his header and is not touched.+was removed from the repo on 2026-10-15; his headers live on in git history.**LICENSE.md** (written 2026-10-15, the user's call): a short attribution block on top (the projectname, the copyright line, the same "Based on the work of" list as the header, one GPL sentence, a@@ -1142,10 +1031,7 @@ running on the source today.(canvas pixels vs picture-box pixels; steps vs seconds; radians vs degrees). Keep that up.- Formatting: tabs in `.cs`, Allman braces, governed by `.editorconfig`. In Git Bash `grep -P` isbroken (locale); use `grep -E`.-- Namespace stays `_2D_wave_sim_V01` in `Wave_Dude_2D` (settings path and resources depend on it).-- `ColorScheme.StopCount` is 9 and `Form1` asserts the nine `btnColorN` buttons match it.-- Probe count is hard-wired to 2 in the UI (`ProbeCount`, duplicated `*2` controls); the engines and- `ProbeSampler` take any number.+- Video export needs Media Foundation (Windows N: Media Feature Pack); AVI/MJPEG is the fallback.GPU path needs an OpenCL ICD (`OpenCL.dll`); the CPU engine is the fallback. This machine has an- RTX 2080 with working OpenCL, so `engine_check` exercises both paths here.+ RTX 2080 with working OpenCL, so `library_check` exercises both paths here.diff --git a/LICENSE.md b/LICENSE.mdnew file mode 100644index 0000000..7df08c2--- /dev/null+++ b/LICENSE.md@@ -0,0 +1,693 @@+# WaveDude Next++Copyright (C) 2026 Alexander Graef <[email protected]>++Based on the work of++- JJM Vleggaar (Huygens Optics), author of Wave Dude 2D, Copyright (C) 2026:+ <https://www.youtube.com/@HuygensOptics>, <https://www.huygensoptics.com>+- Manuel (0x23, Diffraction Limited), author of WaveSimulator2D:+ <https://www.youtube.com/@DiffractionLimited>, <https://github.com/0x23/WaveSimulator2D>++WaveDude Next is free software: you can redistribute it and/or modify it under the terms of the+GNU General Public License as published by the Free Software Foundation, either version 3 of the+License, or (at your option) any later version. It is distributed WITHOUT ANY WARRANTY. The full+licence text follows.++---++# GNU GENERAL PUBLIC LICENSE++Version 3, 29 June 2007++Copyright (C) 2007 Free Software Foundation, Inc.+<https://fsf.org/>++Everyone is permitted to copy and distribute verbatim copies of this+license document, but changing it is not allowed.++## Preamble++The GNU General Public License is a free, copyleft license for+software and other kinds of works.++The licenses for most software and other practical works are designed+to take away your freedom to share and change the works. By contrast,+the GNU General Public License is intended to guarantee your freedom+to share and change all versions of a program--to make sure it remains+free software for all its users. We, the Free Software Foundation, use+the GNU General Public License for most of our software; it applies+also to any other work released this way by its authors. You can apply+it to your programs, too.++When we speak of free software, we are referring to freedom, not+price. Our General Public Licenses are designed to make sure that you+have the freedom to distribute copies of free software (and charge for+them if you wish), that you receive source code or can get it if you+want it, that you can change the software or use pieces of it in new+free programs, and that you know you can do these things.++To protect your rights, we need to prevent others from denying you+these rights or asking you to surrender the rights. Therefore, you+have certain responsibilities if you distribute copies of the+software, or if you modify it: responsibilities to respect the freedom+of others.++For example, if you distribute copies of such a program, whether+gratis or for a fee, you must pass on to the recipients the same+freedoms that you received. You must make sure that they, too, receive+or can get the source code. And you must show them these terms so they+know their rights.++Developers that use the GNU GPL protect your rights with two steps:+(1) assert copyright on the software, and (2) offer you this License+giving you legal permission to copy, distribute and/or modify it.++For the developers' and authors' protection, the GPL clearly explains+that there is no warranty for this free software. For both users' and+authors' sake, the GPL requires that modified versions be marked as+changed, so that their problems will not be attributed erroneously to+authors of previous versions.++Some devices are designed to deny users access to install or run+modified versions of the software inside them, although the+manufacturer can do so. This is fundamentally incompatible with the+aim of protecting users' freedom to change the software. The+systematic pattern of such abuse occurs in the area of products for+individuals to use, which is precisely where it is most unacceptable.+Therefore, we have designed this version of the GPL to prohibit the+practice for those products. If such problems arise substantially in+other domains, we stand ready to extend this provision to those+domains in future versions of the GPL, as needed to protect the+freedom of users.++Finally, every program is threatened constantly by software patents.+States should not allow patents to restrict development and use of+software on general-purpose computers, but in those that do, we wish+to avoid the special danger that patents applied to a free program+could make it effectively proprietary. To prevent this, the GPL+assures that patents cannot be used to render the program non-free.++The precise terms and conditions for copying, distribution and+modification follow.++## TERMS AND CONDITIONS++### 0. Definitions.++"This License" refers to version 3 of the GNU General Public License.++"Copyright" also means copyright-like laws that apply to other kinds+of works, such as semiconductor masks.++"The Program" refers to any copyrightable work licensed under this+License. Each licensee is addressed as "you". "Licensees" and+"recipients" may be individuals or organizations.++To "modify" a work means to copy from or adapt all or part of the work+in a fashion requiring copyright permission, other than the making of+an exact copy. The resulting work is called a "modified version" of+the earlier work or a work "based on" the earlier work.++A "covered work" means either the unmodified Program or a work based+on the Program.++To "propagate" a work means to do anything with it that, without+permission, would make you directly or secondarily liable for+infringement under applicable copyright law, except executing it on a+computer or modifying a private copy. Propagation includes copying,+distribution (with or without modification), making available to the+public, and in some countries other activities as well.++To "convey" a work means any kind of propagation that enables other+parties to make or receive copies. Mere interaction with a user+through a computer network, with no transfer of a copy, is not+conveying.++An interactive user interface displays "Appropriate Legal Notices" to+the extent that it includes a convenient and prominently visible+feature that (1) displays an appropriate copyright notice, and (2)+tells the user that there is no warranty for the work (except to the+extent that warranties are provided), that licensees may convey the+work under this License, and how to view a copy of this License. If+the interface presents a list of user commands or options, such as a+menu, a prominent item in the list meets this criterion.++### 1. Source Code.++The "source code" for a work means the preferred form of the work for+making modifications to it. "Object code" means any non-source form of+a work.++A "Standard Interface" means an interface that either is an official+standard defined by a recognized standards body, or, in the case of+interfaces specified for a particular programming language, one that+is widely used among developers working in that language.++The "System Libraries" of an executable work include anything, other+than the work as a whole, that (a) is included in the normal form of+packaging a Major Component, but which is not part of that Major+Component, and (b) serves only to enable use of the work with that+Major Component, or to implement a Standard Interface for which an+implementation is available to the public in source code form. A+"Major Component", in this context, means a major essential component+(kernel, window system, and so on) of the specific operating system+(if any) on which the executable work runs, or a compiler used to+produce the work, or an object code interpreter used to run it.++The "Corresponding Source" for a work in object code form means all+the source code needed to generate, install, and (for an executable+work) run the object code and to modify the work, including scripts to+control those activities. However, it does not include the work's+System Libraries, or general-purpose tools or generally available free+programs which are used unmodified in performing those activities but+which are not part of the work. For example, Corresponding Source+includes interface definition files associated with source files for+the work, and the source code for shared libraries and dynamically+linked subprograms that the work is specifically designed to require,+such as by intimate data communication or control flow between those+subprograms and other parts of the work.++The Corresponding Source need not include anything that users can+regenerate automatically from other parts of the Corresponding Source.++The Corresponding Source for a work in source code form is that same+work.++### 2. Basic Permissions.++All rights granted under this License are granted for the term of+copyright on the Program, and are irrevocable provided the stated+conditions are met. This License explicitly affirms your unlimited+permission to run the unmodified Program. The output from running a+covered work is covered by this License only if the output, given its+content, constitutes a covered work. This License acknowledges your+rights of fair use or other equivalent, as provided by copyright law.++You may make, run and propagate covered works that you do not convey,+without conditions so long as your license otherwise remains in force.+You may convey covered works to others for the sole purpose of having+them make modifications exclusively for you, or provide you with+facilities for running those works, provided that you comply with the+terms of this License in conveying all material for which you do not+control copyright. Those thus making or running the covered works for+you must do so exclusively on your behalf, under your direction and+control, on terms that prohibit them from making any copies of your+copyrighted material outside their relationship with you.++Conveying under any other circumstances is permitted solely under the+conditions stated below. Sublicensing is not allowed; section 10 makes+it unnecessary.++### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.++No covered work shall be deemed part of an effective technological+measure under any applicable law fulfilling obligations under article+11 of the WIPO copyright treaty adopted on 20 December 1996, or+similar laws prohibiting or restricting circumvention of such+measures.++When you convey a covered work, you waive any legal power to forbid+circumvention of technological measures to the extent such+circumvention is effected by exercising rights under this License with+respect to the covered work, and you disclaim any intention to limit+operation or modification of the work as a means of enforcing, against+the work's users, your or third parties' legal rights to forbid+circumvention of technological measures.++### 4. Conveying Verbatim Copies.++You may convey verbatim copies of the Program's source code as you+receive it, in any medium, provided that you conspicuously and+appropriately publish on each copy an appropriate copyright notice;+keep intact all notices stating that this License and any+non-permissive terms added in accord with section 7 apply to the code;+keep intact all notices of the absence of any warranty; and give all+recipients a copy of this License along with the Program.++You may charge any price or no price for each copy that you convey,+and you may offer support or warranty protection for a fee.++### 5. Conveying Modified Source Versions.++You may convey a work based on the Program, or the modifications to+produce it from the Program, in the form of source code under the+terms of section 4, provided that you also meet all of these+conditions:++- a) The work must carry prominent notices stating that you modified+ it, and giving a relevant date.+- b) The work must carry prominent notices stating that it is+ released under this License and any conditions added under+ section 7. This requirement modifies the requirement in section 4+ to "keep intact all notices".+- c) You must license the entire work, as a whole, under this+ License to anyone who comes into possession of a copy. This+ License will therefore apply, along with any applicable section 7+ additional terms, to the whole of the work, and all its parts,+ regardless of how they are packaged. This License gives no+ permission to license the work in any other way, but it does not+ invalidate such permission if you have separately received it.+- d) If the work has interactive user interfaces, each must display+ Appropriate Legal Notices; however, if the Program has interactive+ interfaces that do not display Appropriate Legal Notices, your+ work need not make them do so.++A compilation of a covered work with other separate and independent+works, which are not by their nature extensions of the covered work,+and which are not combined with it such as to form a larger program,+in or on a volume of a storage or distribution medium, is called an+"aggregate" if the compilation and its resulting copyright are not+used to limit the access or legal rights of the compilation's users+beyond what the individual works permit. Inclusion of a covered work+in an aggregate does not cause this License to apply to the other+parts of the aggregate.++### 6. Conveying Non-Source Forms.++You may convey a covered work in object code form under the terms of+sections 4 and 5, provided that you also convey the machine-readable+Corresponding Source under the terms of this License, in one of these+ways:++- a) Convey the object code in, or embodied in, a physical product+ (including a physical distribution medium), accompanied by the+ Corresponding Source fixed on a durable physical medium+ customarily used for software interchange.+- b) Convey the object code in, or embodied in, a physical product+ (including a physical distribution medium), accompanied by a+ written offer, valid for at least three years and valid for as+ long as you offer spare parts or customer support for that product+ model, to give anyone who possesses the object code either (1) a+ copy of the Corresponding Source for all the software in the+ product that is covered by this License, on a durable physical+ medium customarily used for software interchange, for a price no+ more than your reasonable cost of physically performing this+ conveying of source, or (2) access to copy the Corresponding+ Source from a network server at no charge.+- c) Convey individual copies of the object code with a copy of the+ written offer to provide the Corresponding Source. This+ alternative is allowed only occasionally and noncommercially, and+ only if you received the object code with such an offer, in accord+ with subsection 6b.+- d) Convey the object code by offering access from a designated+ place (gratis or for a charge), and offer equivalent access to the+ Corresponding Source in the same way through the same place at no+ further charge. You need not require recipients to copy the+ Corresponding Source along with the object code. If the place to+ copy the object code is a network server, the Corresponding Source+ may be on a different server (operated by you or a third party)+ that supports equivalent copying facilities, provided you maintain+ clear directions next to the object code saying where to find the+ Corresponding Source. Regardless of what server hosts the+ Corresponding Source, you remain obligated to ensure that it is+ available for as long as needed to satisfy these requirements.+- e) Convey the object code using peer-to-peer transmission,+ provided you inform other peers where the object code and+ Corresponding Source of the work are being offered to the general+ public at no charge under subsection 6d.++A separable portion of the object code, whose source code is excluded+from the Corresponding Source as a System Library, need not be+included in conveying the object code work.++A "User Product" is either (1) a "consumer product", which means any+tangible personal property which is normally used for personal,+family, or household purposes, or (2) anything designed or sold for+incorporation into a dwelling. In determining whether a product is a+consumer product, doubtful cases shall be resolved in favor of+coverage. For a particular product received by a particular user,+"normally used" refers to a typical or common use of that class of+product, regardless of the status of the particular user or of the way+in which the particular user actually uses, or expects or is expected+to use, the product. A product is a consumer product regardless of+whether the product has substantial commercial, industrial or+non-consumer uses, unless such uses represent the only significant+mode of use of the product.++"Installation Information" for a User Product means any methods,+procedures, authorization keys, or other information required to+install and execute modified versions of a covered work in that User+Product from a modified version of its Corresponding Source. The+information must suffice to ensure that the continued functioning of+the modified object code is in no case prevented or interfered with+solely because modification has been made.++If you convey an object code work under this section in, or with, or+specifically for use in, a User Product, and the conveying occurs as+part of a transaction in which the right of possession and use of the+User Product is transferred to the recipient in perpetuity or for a+fixed term (regardless of how the transaction is characterized), the+Corresponding Source conveyed under this section must be accompanied+by the Installation Information. But this requirement does not apply+if neither you nor any third party retains the ability to install+modified object code on the User Product (for example, the work has+been installed in ROM).++The requirement to provide Installation Information does not include a+requirement to continue to provide support service, warranty, or+updates for a work that has been modified or installed by the+recipient, or for the User Product in which it has been modified or+installed. Access to a network may be denied when the modification+itself materially and adversely affects the operation of the network+or violates the rules and protocols for communication across the+network.++Corresponding Source conveyed, and Installation Information provided,+in accord with this section must be in a format that is publicly+documented (and with an implementation available to the public in+source code form), and must require no special password or key for+unpacking, reading or copying.++### 7. Additional Terms.++"Additional permissions" are terms that supplement the terms of this+License by making exceptions from one or more of its conditions.+Additional permissions that are applicable to the entire Program shall+be treated as though they were included in this License, to the extent+that they are valid under applicable law. If additional permissions+apply only to part of the Program, that part may be used separately+under those permissions, but the entire Program remains governed by+this License without regard to the additional permissions.++When you convey a copy of a covered work, you may at your option+remove any additional permissions from that copy, or from any part of+it. (Additional permissions may be written to require their own+removal in certain cases when you modify the work.) You may place+additional permissions on material, added by you to a covered work,+for which you have or can give appropriate copyright permission.++Notwithstanding any other provision of this License, for material you+add to a covered work, you may (if authorized by the copyright holders+of that material) supplement the terms of this License with terms:++- a) Disclaiming warranty or limiting liability differently from the+ terms of sections 15 and 16 of this License; or+- b) Requiring preservation of specified reasonable legal notices or+ author attributions in that material or in the Appropriate Legal+ Notices displayed by works containing it; or+- c) Prohibiting misrepresentation of the origin of that material,+ or requiring that modified versions of such material be marked in+ reasonable ways as different from the original version; or+- d) Limiting the use for publicity purposes of names of licensors+ or authors of the material; or+- e) Declining to grant rights under trademark law for use of some+ trade names, trademarks, or service marks; or+- f) Requiring indemnification of licensors and authors of that+ material by anyone who conveys the material (or modified versions+ of it) with contractual assumptions of liability to the recipient,+ for any liability that these contractual assumptions directly+ impose on those licensors and authors.++All other non-permissive additional terms are considered "further+restrictions" within the meaning of section 10. If the Program as you+received it, or any part of it, contains a notice stating that it is+governed by this License along with a term that is a further+restriction, you may remove that term. If a license document contains+a further restriction but permits relicensing or conveying under this+License, you may add to a covered work material governed by the terms+of that license document, provided that the further restriction does+not survive such relicensing or conveying.++If you add terms to a covered work in accord with this section, you+must place, in the relevant source files, a statement of the+additional terms that apply to those files, or a notice indicating+where to find the applicable terms.++Additional terms, permissive or non-permissive, may be stated in the+form of a separately written license, or stated as exceptions; the+above requirements apply either way.++### 8. Termination.++You may not propagate or modify a covered work except as expressly+provided under this License. Any attempt otherwise to propagate or+modify it is void, and will automatically terminate your rights under+this License (including any patent licenses granted under the third+paragraph of section 11).++However, if you cease all violation of this License, then your license+from a particular copyright holder is reinstated (a) provisionally,+unless and until the copyright holder explicitly and finally+terminates your license, and (b) permanently, if the copyright holder+fails to notify you of the violation by some reasonable means prior to+60 days after the cessation.++Moreover, your license from a particular copyright holder is+reinstated permanently if the copyright holder notifies you of the+violation by some reasonable means, this is the first time you have+received notice of violation of this License (for any work) from that+copyright holder, and you cure the violation prior to 30 days after+your receipt of the notice.++Termination of your rights under this section does not terminate the+licenses of parties who have received copies or rights from you under+this License. If your rights have been terminated and not permanently+reinstated, you do not qualify to receive new licenses for the same+material under section 10.++### 9. Acceptance Not Required for Having Copies.++You are not required to accept this License in order to receive or run+a copy of the Program. Ancillary propagation of a covered work+occurring solely as a consequence of using peer-to-peer transmission+to receive a copy likewise does not require acceptance. However,+nothing other than this License grants you permission to propagate or+modify any covered work. These actions infringe copyright if you do+not accept this License. Therefore, by modifying or propagating a+covered work, you indicate your acceptance of this License to do so.++### 10. Automatic Licensing of Downstream Recipients.++Each time you convey a covered work, the recipient automatically+receives a license from the original licensors, to run, modify and+propagate that work, subject to this License. You are not responsible+for enforcing compliance by third parties with this License.++An "entity transaction" is a transaction transferring control of an+organization, or substantially all assets of one, or subdividing an+organization, or merging organizations. If propagation of a covered+work results from an entity transaction, each party to that+transaction who receives a copy of the work also receives whatever+licenses to the work the party's predecessor in interest had or could+give under the previous paragraph, plus a right to possession of the+Corresponding Source of the work from the predecessor in interest, if+the predecessor has it or can get it with reasonable efforts.++You may not impose any further restrictions on the exercise of the+rights granted or affirmed under this License. For example, you may+not impose a license fee, royalty, or other charge for exercise of+rights granted under this License, and you may not initiate litigation+(including a cross-claim or counterclaim in a lawsuit) alleging that+any patent claim is infringed by making, using, selling, offering for+sale, or importing the Program or any portion of it.++### 11. Patents.++A "contributor" is a copyright holder who authorizes use under this+License of the Program or a work on which the Program is based. The+work thus licensed is called the contributor's "contributor version".++A contributor's "essential patent claims" are all patent claims owned+or controlled by the contributor, whether already acquired or+hereafter acquired, that would be infringed by some manner, permitted+by this License, of making, using, or selling its contributor version,+but do not include claims that would be infringed only as a+consequence of further modification of the contributor version. For+purposes of this definition, "control" includes the right to grant+patent sublicenses in a manner consistent with the requirements of+this License.++Each contributor grants you a non-exclusive, worldwide, royalty-free+patent license under the contributor's essential patent claims, to+make, use, sell, offer for sale, import and otherwise run, modify and+propagate the contents of its contributor version.++In the following three paragraphs, a "patent license" is any express+agreement or commitment, however denominated, not to enforce a patent+(such as an express permission to practice a patent or covenant not to+sue for patent infringement). To "grant" such a patent license to a+party means to make such an agreement or commitment not to enforce a+patent against the party.++If you convey a covered work, knowingly relying on a patent license,+and the Corresponding Source of the work is not available for anyone+to copy, free of charge and under the terms of this License, through a+publicly available network server or other readily accessible means,+then you must either (1) cause the Corresponding Source to be so+available, or (2) arrange to deprive yourself of the benefit of the+patent license for this particular work, or (3) arrange, in a manner+consistent with the requirements of this License, to extend the patent+license to downstream recipients. "Knowingly relying" means you have+actual knowledge that, but for the patent license, your conveying the+covered work in a country, or your recipient's use of the covered work+in a country, would infringe one or more identifiable patents in that+country that you have reason to believe are valid.++If, pursuant to or in connection with a single transaction or+arrangement, you convey, or propagate by procuring conveyance of, a+covered work, and grant a patent license to some of the parties+receiving the covered work authorizing them to use, propagate, modify+or convey a specific copy of the covered work, then the patent license+you grant is automatically extended to all recipients of the covered+work and works based on it.++A patent license is "discriminatory" if it does not include within the+scope of its coverage, prohibits the exercise of, or is conditioned on+the non-exercise of one or more of the rights that are specifically+granted under this License. You may not convey a covered work if you+are a party to an arrangement with a third party that is in the+business of distributing software, under which you make payment to the+third party based on the extent of your activity of conveying the+work, and under which the third party grants, to any of the parties+who would receive the covered work from you, a discriminatory patent+license (a) in connection with copies of the covered work conveyed by+you (or copies made from those copies), or (b) primarily for and in+connection with specific products or compilations that contain the+covered work, unless you entered into that arrangement, or that patent+license was granted, prior to 28 March 2007.++Nothing in this License shall be construed as excluding or limiting+any implied license or other defenses to infringement that may+otherwise be available to you under applicable patent law.++### 12. No Surrender of Others' Freedom.++If conditions are imposed on you (whether by court order, agreement or+otherwise) that contradict the conditions of this License, they do not+excuse you from the conditions of this License. If you cannot convey a+covered work so as to satisfy simultaneously your obligations under+this License and any other pertinent obligations, then as a+consequence you may not convey it at all. For example, if you agree to+terms that obligate you to collect a royalty for further conveying+from those to whom you convey the Program, the only way you could+satisfy both those terms and this License would be to refrain entirely+from conveying the Program.++### 13. Use with the GNU Affero General Public License.++Notwithstanding any other provision of this License, you have+permission to link or combine any covered work with a work licensed+under version 3 of the GNU Affero General Public License into a single+combined work, and to convey the resulting work. The terms of this+License will continue to apply to the part which is the covered work,+but the special requirements of the GNU Affero General Public License,+section 13, concerning interaction through a network will apply to the+combination as such.++### 14. Revised Versions of this License.++The Free Software Foundation may publish revised and/or new versions+of the GNU General Public License from time to time. Such new versions+will be similar in spirit to the present version, but may differ in+detail to address new problems or concerns.++Each version is given a distinguishing version number. If the Program+specifies that a certain numbered version of the GNU General Public+License "or any later version" applies to it, you have the option of+following the terms and conditions either of that numbered version or+of any later version published by the Free Software Foundation. If the+Program does not specify a version number of the GNU General Public+License, you may choose any version ever published by the Free+Software Foundation.++If the Program specifies that a proxy can decide which future versions+of the GNU General Public License can be used, that proxy's public+statement of acceptance of a version permanently authorizes you to+choose that version for the Program.++Later license versions may give you additional or different+permissions. However, no additional obligations are imposed on any+author or copyright holder as a result of your choosing to follow a+later version.++### 15. Disclaimer of Warranty.++THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT+WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND+PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE+DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR+CORRECTION.++### 16. Limitation of Liability.++IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR+CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES+ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT+NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR+LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM+TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER+PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.++### 17. Interpretation of Sections 15 and 16.++If the disclaimer of warranty and limitation of liability provided+above cannot be given local legal effect according to their terms,+reviewing courts shall apply local law that most closely approximates+an absolute waiver of all civil liability in connection with the+Program, unless a warranty or assumption of liability accompanies a+copy of the Program in return for a fee.++END OF TERMS AND CONDITIONS++## How to Apply These Terms to Your New Programs++If you develop a new program, and you want it to be of the greatest+possible use to the public, the best way to achieve this is to make it+free software which everyone can redistribute and change under these+terms.++To do so, attach the following notices to the program. It is safest to+attach them to the start of each source file to most effectively state+the exclusion of warranty; and each file should have at least the+"copyright" line and a pointer to where the full notice is found.++ <one line to give the program's name and a brief idea of what it does.>+ Copyright (C) <year> <name of author>++ This program is free software: you can redistribute it and/or modify+ it under the terms of the GNU General Public License as published by+ the Free Software Foundation, either version 3 of the License, or+ (at your option) any later version.++ This program is distributed in the hope that it will be useful,+ but WITHOUT ANY WARRANTY; without even the implied warranty of+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ GNU General Public License for more details.++ You should have received a copy of the GNU General Public License+ along with this program. If not, see <https://www.gnu.org/licenses/>.++Also add information on how to contact you by electronic and paper+mail.++If the program does terminal interaction, make it output a short+notice like this when it starts in an interactive mode:++ <program> Copyright (C) <year> <name of author>+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.+ This is free software, and you are welcome to redistribute it+ under certain conditions; type `show c' for details.++The hypothetical commands \`show w' and \`show c' should show the+appropriate parts of the General Public License. Of course, your+program's commands might be different; for a GUI interface, you would+use an "about box".++You should also get your employer (if you work as a programmer) or+school, if any, to sign a "copyright disclaimer" for the program, if+necessary. For more information on this, and how to apply and follow+the GNU GPL, see <https://www.gnu.org/licenses/>.++The GNU General Public License does not permit incorporating your+program into proprietary programs. If your program is a subroutine+library, you may consider it more useful to permit linking proprietary+applications with the library. If this is what you want to do, use the+GNU Lesser General Public License instead of this License. But first,+please read <https://www.gnu.org/licenses/why-not-lgpl.html>.diff --git a/Project/Test/configuration.json b/Project/Test/configuration.jsondeleted file mode 100644index 6221a7f..0000000--- a/Project/Test/configuration.json+++ /dev/null@@ -1,138 +0,0 @@-{- "format_version": 1,- "project_name": "Test",- "created": "2026-10-07T01:10:19Z",- "modified": "2026-10-07T01:13:45Z",- "scene": {- "mode": "user_defined",- "image_file": "",- "user_width": 1920,- "user_height": 1080,- "damping_edge_enabled": true,- "damping_edge_size_px": 64,- "use_sources": false,- "image_source_scale": 1,- "use_object_sources": true,- "background_refractive_index": 1- },- "simulation": {- "steps": 3000,- "visualize_every": 2,- "export_field": false,- "export_intensity": false,- "preview_field": true,- "preview_intensity": true,- "field_color_scheme": "Default_Field",- "intensity_color_scheme": "Default_intensity",- "field_brightness": 30,- "intensity_brightness": 30,- "field_black_level": -0.05,- "intensity_black_level": 0,- "source_frequency_scale": 2,- "video_fps": 60,- "video_quality": 70,- "use_gpu": true,- "use_4th_order_laplacian": true,- "wave_speed_c": 1,- "time_decay_factor": 5,- "intensity_scale": 1- },- "probes": {- "count": 2,- "items": [- {- "active": false,- "place_on": "field",- "measurement": "amplitude",- "probe_type": "point",- "ax": 100,- "ay": 100,- "bx": 300,- "by": 100,- "box_size": "medium",- "box_x": 450,- "box_y": 20,- "scale_mode": "running",- "auto_scale_x": true,- "auto_scale_y": true,- "y_min": -1,- "y_max": 1,- "running_window": 500,- "use_start_after_step": false,- "start_after_step": 0- },- {- "active": false,- "place_on": "field",- "measurement": "amplitude",- "probe_type": "point",- "ax": 100,- "ay": 100,- "bx": 300,- "by": 100,- "box_size": "medium",- "box_x": 450,- "box_y": 20,- "scale_mode": "running",- "auto_scale_x": true,- "auto_scale_y": true,- "y_min": -1,- "y_max": 1,- "running_window": 500,- "use_start_after_step": false,- "start_after_step": 0- }- ]- },- "object_sources": {- "count": 1,- "items": [- {- "name": "Source 1",- "main_type": "single",- "x": 100,- "y": 100,- "has_position": false,- "source_on": true,- "detach_source": false,- "detach_after_steps": 1000,- "frequency": 100,- "amplitude": 100,- "phase_deg": 0,- "mode": "continuous",- "pulse_shape": "gaussian",- "pulse_width_cycles": 10,- "off_state_cycles": 10,- "array_size_x": 1,- "array_size_y": 1,- "spacing_x": 10,- "spacing_y": 10,- "composite_mode": "inherit",- "randomize_frequency": false,- "randomize_frequency_amount": 0,- "randomize_phase": false,- "randomize_phase_amount": 0,- "randomize_off_width": false,- "randomize_off_width_amount": 0,- "randomize_position": false,- "randomize_position_amount": 0,- "elements": [- {- "x": 100,- "y": 100,- "level": 100,- "amplitude": 1,- "phase_rad": 0,- "mode": "continuous",- "pulse_shape": "gaussian",- "on_width_cycles": 10,- "off_width_cycles": 10,- "off_width_base": 10,- "randomize_off_width_amount": 0,- "detach_after_step": -1- }- ]- }- ]- }-}diff --git a/Project/test1.wdproj b/Project/test1.wdprojdeleted file mode 100644index 7119584..0000000--- a/Project/test1.wdproj+++ /dev/null@@ -1,12 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<Project Version="1" Seed="1706750886">- <Scene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AAAAAAAMJEA7NmBDAAAAMAgf+t7fKWRAAYAAAAAAACYSAAB2LMDGQAAAIBB/tb3+EojAQwAAAAAAAAwkQDs2YEMAAAAwCB/63t8pZEABgAAAAAAAJhIAAHYswMZAAAAgEH+1vf4SiMBDAAAAAAAADCRAOzZgQwAAADAIH/re3ylkQAGAAAAAAAAmEgAAdizAxkAAACAQf7W9/hKIwEMAAAAAAAAMJEA7NmBDAAAAMAgf+t7fKWRAAYAAAAAAACYSAAB2LMDGQAAAIBB/tb3+EojAQwAAAAAAAAwkQDs2YEMAAAAwCB/63t8pZEABgAAAAAAAJhIAAEGAA7gmgRYdrGPAAAAAElFTkSuQmCC</ImageData>- </Scene>- <Display>- <Field ColorScheme="Default field" BlackLevel="-0.05" />- <Intensity ColorScheme="Default intensity" />- </Display>- <Source Name="Source 1" X="429" Y="614" />- <Probe Name="Probe 1" AX="1626" AY="603" BoxSize="Custom" BoxX="541" BoxY="23" BoxWidth="777" BoxHeight="454" />-</Project>\ No newline at end of filediff --git a/WaveDude.WPF/App.ico b/WaveDude.WPF/App.icoindex daf72c8..a856909 100644Binary files a/WaveDude.WPF/App.ico and b/WaveDude.WPF/App.ico differdiff --git a/WaveDude.WPF/App.png b/WaveDude.WPF/App.pngnew file mode 100644index 0000000..b353cfeBinary files /dev/null and b/WaveDude.WPF/App.png differdiff --git a/WaveDude.WPF/App.svg b/WaveDude.WPF/App.svgnew file mode 100644index 0000000..1c5886a--- /dev/null+++ b/WaveDude.WPF/App.svg@@ -0,0 +1,66 @@+<?xml version="1.0" encoding="UTF-8"?>+<!-- 05_rainbow_rings: damped circular wave, scheme "Default_Intensity" (magnitude), period 17.0, decay 22.0. Generated by make_icons.py. -->+<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128">+ <defs>+ <radialGradient id="wave" gradientUnits="userSpaceOnUse" cx="64" cy="64" r="96">+ <stop offset="0.0000" stop-color="#FF0000"/>+ <stop offset="0.0168" stop-color="#FF0000"/>+ <stop offset="0.0209" stop-color="#F04D1D"/>+ <stop offset="0.0246" stop-color="#EAB348"/>+ <stop offset="0.0281" stop-color="#F2F94D"/>+ <stop offset="0.0314" stop-color="#21F63D"/>+ <stop offset="0.0346" stop-color="#20E0D3"/>+ <stop offset="0.0378" stop-color="#21ACDE"/>+ <stop offset="0.0410" stop-color="#0E4494"/>+ <stop offset="0.0476" stop-color="#0E4494"/>+ <stop offset="0.0511" stop-color="#21ACDE"/>+ <stop offset="0.0548" stop-color="#20E0D3"/>+ <stop offset="0.0589" stop-color="#21F63D"/>+ <stop offset="0.0636" stop-color="#F2F94D"/>+ <stop offset="0.0696" stop-color="#EAB348"/>+ <stop offset="0.0800" stop-color="#F04D1D"/>+ <stop offset="0.0885" stop-color="#F1481B"/>+ <stop offset="0.0903" stop-color="#F04D1D"/>+ <stop offset="0.1014" stop-color="#EAB348"/>+ <stop offset="0.1080" stop-color="#F2F94D"/>+ <stop offset="0.1136" stop-color="#21F63D"/>+ <stop offset="0.1186" stop-color="#20E0D3"/>+ <stop offset="0.1234" stop-color="#21ACDE"/>+ <stop offset="0.1281" stop-color="#0E4494"/>+ <stop offset="0.1378" stop-color="#0E4494"/>+ <stop offset="0.1432" stop-color="#21ACDE"/>+ <stop offset="0.1493" stop-color="#20E0D3"/>+ <stop offset="0.1573" stop-color="#21F63D"/>+ <stop offset="0.1771" stop-color="#C9F84A"/>+ <stop offset="0.1908" stop-color="#21F63D"/>+ <stop offset="0.1999" stop-color="#20E0D3"/>+ <stop offset="0.2074" stop-color="#21ACDE"/>+ <stop offset="0.2144" stop-color="#0E4494"/>+ <stop offset="0.2288" stop-color="#0E4494"/>+ <stop offset="0.2375" stop-color="#21ACDE"/>+ <stop offset="0.2506" stop-color="#20E0D3"/>+ <stop offset="0.2656" stop-color="#20E6AC"/>+ <stop offset="0.2742" stop-color="#20E0D3"/>+ <stop offset="0.2889" stop-color="#21ACDE"/>+ <stop offset="0.2997" stop-color="#0E4494"/>+ <stop offset="0.3212" stop-color="#0E4494"/>+ <stop offset="0.3380" stop-color="#21ACDE"/>+ <stop offset="0.3542" stop-color="#21B7DC"/>+ <stop offset="0.3639" stop-color="#21ACDE"/>+ <stop offset="0.3833" stop-color="#0E4494"/>+ <stop offset="0.4163" stop-color="#0E4494"/>+ <stop offset="0.4427" stop-color="#1879BA"/>+ <stop offset="0.4640" stop-color="#0E4494"/>+ <stop offset="0.5348" stop-color="#0E4494"/>+ <stop offset="0.6198" stop-color="#0A2F67"/>+ <stop offset="0.7083" stop-color="#072046"/>+ <stop offset="0.7969" stop-color="#041630"/>+ <stop offset="0.8854" stop-color="#030F20"/>+ <stop offset="0.9740" stop-color="#020A16"/>+ <stop offset="1.0000" stop-color="#01050C"/>+ </radialGradient>+ <filter id="soften" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="1.0"/></filter>+ </defs>+ <rect width="128" height="128" fill="#000000"/>+ <rect width="128" height="128" fill="url(#wave)" filter="url(#soften)"/>+</svg>diff --git a/Wave_Dude_2D.sln b/Wave_Dude_2D.slnindex bfa3aab..394ce20 100644--- a/Wave_Dude_2D.sln+++ b/Wave_Dude_2D.sln@@ -3,14 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00# Visual Studio Version 18VisualStudioVersion = 18.10.12224.181 stableMinimumVisualStudioVersion = 10.0.40219.1-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wave_Dude_2D", "Wave_Dude_2D\Wave_Dude_2D.csproj", "{C3F63FB8-2009-4631-AB8D-4E176E131C5F}"-EndProjectProject("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WaveDude", "WaveDude\WaveDude.csproj", "{5F15EA39-6EA9-4352-87C4-B0870C2B9CE5}"EndProjectProject("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WaveDude.WPF", "WaveDude.WPF\WaveDude.WPF.csproj", "{0EACDED4-F7E3-4BCF-B82D-55401711BDAA}"EndProject-Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "2D_wave_sim_V01", "2D_wave_sim_V01\2D_wave_sim_V01.vbproj", "{BF62C6CF-8723-482A-A1E9-784946CFD426}"-EndProjectGlobalGlobalSection(SolutionConfigurationPlatforms) = preSolutionDebug|Any CPU = Debug|Any CPU@@ -21,18 +17,6 @@ GlobalRelease|x86 = Release|x86EndGlobalSectionGlobalSection(ProjectConfigurationPlatforms) = postSolution- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Debug|Any CPU.Build.0 = Debug|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Debug|x64.ActiveCfg = Debug|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Debug|x64.Build.0 = Debug|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Debug|x86.ActiveCfg = Debug|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Debug|x86.Build.0 = Debug|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Release|Any CPU.ActiveCfg = Release|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Release|Any CPU.Build.0 = Release|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Release|x64.ActiveCfg = Release|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Release|x64.Build.0 = Release|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Release|x86.ActiveCfg = Release|Any CPU- {C3F63FB8-2009-4631-AB8D-4E176E131C5F}.Release|x86.Build.0 = Release|Any CPU{5F15EA39-6EA9-4352-87C4-B0870C2B9CE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU{5F15EA39-6EA9-4352-87C4-B0870C2B9CE5}.Debug|Any CPU.Build.0 = Debug|Any CPU{5F15EA39-6EA9-4352-87C4-B0870C2B9CE5}.Debug|x64.ActiveCfg = Debug|Any CPU@@ -57,18 +41,6 @@ Global{0EACDED4-F7E3-4BCF-B82D-55401711BDAA}.Release|x64.Build.0 = Release|Any CPU{0EACDED4-F7E3-4BCF-B82D-55401711BDAA}.Release|x86.ActiveCfg = Release|Any CPU{0EACDED4-F7E3-4BCF-B82D-55401711BDAA}.Release|x86.Build.0 = Release|Any CPU- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Debug|Any CPU.ActiveCfg = Debug|Any CPU- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Debug|Any CPU.Build.0 = Debug|Any CPU- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Debug|x64.ActiveCfg = Debug|x64- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Debug|x64.Build.0 = Debug|x64- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Debug|x86.ActiveCfg = Debug|Any CPU- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Debug|x86.Build.0 = Debug|Any CPU- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Release|Any CPU.ActiveCfg = Release|Any CPU- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Release|Any CPU.Build.0 = Release|Any CPU- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Release|x64.ActiveCfg = Release|x64- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Release|x64.Build.0 = Release|x64- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Release|x86.ActiveCfg = Release|Any CPU- {BF62C6CF-8723-482A-A1E9-784946CFD426}.Release|x86.Build.0 = Release|Any CPUEndGlobalSectionGlobalSection(SolutionProperties) = preSolutionHideSolutionNode = FALSEdiff --git a/Wave_Dude_2D/AboutForm.Designer.cs b/Wave_Dude_2D/AboutForm.Designer.csdeleted file mode 100644index 2ecf4fd..0000000--- a/Wave_Dude_2D/AboutForm.Designer.cs+++ /dev/null@@ -1,167 +0,0 @@-using System;-using System.ComponentModel;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- public partial class AboutForm : global::System.Windows.Forms.Form- {- /// <summary>Releases the designer-managed components when <paramref name="disposing"/> is true, then the form itself.</summary>- /// <param name="disposing">True when called from <see cref="System.ComponentModel.Component.Dispose()"/>; false from the finalizer.</param>- [global::System.Diagnostics.DebuggerNonUserCode]- protected override void Dispose(bool disposing)- {- try- {- bool flag = disposing && this.components != null;- if (flag)- {- this.components.Dispose();- }- }- finally- {- base.Dispose(disposing);- }- }-- [global::System.Diagnostics.DebuggerStepThrough]- private void InitializeComponent()- {- this.picIcon = new global::System.Windows.Forms.PictureBox();- this.lblTitle = new global::System.Windows.Forms.Label();- this.lblVersion = new global::System.Windows.Forms.Label();- this.lblDescription = new global::System.Windows.Forms.Label();- this.lblCopyright = new global::System.Windows.Forms.Label();- this.btnClose = new global::System.Windows.Forms.Button();- this.Label1 = new global::System.Windows.Forms.Label();- this.Label2 = new global::System.Windows.Forms.Label();- this.Label3 = new global::System.Windows.Forms.Label();- this.Label4 = new global::System.Windows.Forms.Label();- this.picPaypallQR = new global::System.Windows.Forms.PictureBox();- this.Label5 = new global::System.Windows.Forms.Label();- ((global::System.ComponentModel.ISupportInitialize)this.picIcon).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.picPaypallQR).BeginInit();- base.SuspendLayout();- this.picIcon.Location = new global::System.Drawing.Point(20, 20);- this.picIcon.Name = "picIcon";- this.picIcon.Size = new global::System.Drawing.Size(48, 48);- this.picIcon.SizeMode = global::System.Windows.Forms.PictureBoxSizeMode.Zoom;- this.picIcon.TabIndex = 0;- this.picIcon.TabStop = false;- this.lblTitle.AutoSize = true;- this.lblTitle.Font = new global::System.Drawing.Font("Segoe UI", 14f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblTitle.Location = new global::System.Drawing.Point(82, 18);- this.lblTitle.Name = "lblTitle";- this.lblTitle.Size = new global::System.Drawing.Size(143, 25);- this.lblTitle.TabIndex = 1;- this.lblTitle.Text = "Wave Dude 2D";- this.lblVersion.AutoSize = true;- this.lblVersion.Location = new global::System.Drawing.Point(84, 54);- this.lblVersion.Name = "lblVersion";- this.lblVersion.Size = new global::System.Drawing.Size(90, 18);- this.lblVersion.TabIndex = 2;- this.lblVersion.Text = "Version 0.29";- this.lblDescription.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblDescription.Location = new global::System.Drawing.Point(15, 90);- this.lblDescription.Name = "lblDescription";- this.lblDescription.Size = new global::System.Drawing.Size(461, 28);- this.lblDescription.TabIndex = 3;- this.lblDescription.Text = "Build a scene and watch waves do their thing!";- this.lblCopyright.AutoSize = true;- this.lblCopyright.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblCopyright.Location = new global::System.Drawing.Point(15, 507);- this.lblCopyright.Name = "lblCopyright";- this.lblCopyright.Size = new global::System.Drawing.Size(71, 18);- this.lblCopyright.TabIndex = 4;- this.lblCopyright.Text = "Copyright";- this.btnClose.Anchor = global::System.Windows.Forms.AnchorStyles.Bottom | global::System.Windows.Forms.AnchorStyles.Right;- this.btnClose.DialogResult = global::System.Windows.Forms.DialogResult.OK;- this.btnClose.Location = new global::System.Drawing.Point(319, 495);- this.btnClose.Name = "btnClose";- this.btnClose.Size = new global::System.Drawing.Size(90, 30);- this.btnClose.TabIndex = 5;- this.btnClose.Text = "OK";- this.btnClose.UseVisualStyleBackColor = true;- this.Label1.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label1.Location = new global::System.Drawing.Point(13, 254);- this.Label1.Name = "Label1";- this.Label1.Size = new global::System.Drawing.Size(392, 68);- this.Label1.TabIndex = 3;- this.Label1.Text = "If you use this software and found it useful, consider making a donation to support future projects.\r\n\r\n";- this.Label2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label2.Location = new global::System.Drawing.Point(15, 128);- this.Label2.Name = "Label2";- this.Label2.Size = new global::System.Drawing.Size(394, 58);- this.Label2.TabIndex = 3;- this.Label2.Text = "Developed by Huygens Optics / JJM Vleggaar with support of Claude Sonnet 5 (meaning Claude did most of the heavy lifting and I get the credits). ";- this.Label3.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label3.Location = new global::System.Drawing.Point(12, 301);- this.Label3.Name = "Label3";- this.Label3.Size = new global::System.Drawing.Size(387, 46);- this.Label3.TabIndex = 3;- this.Label3.Text = "Patreon: www.patreon.com/c/huygens_optics";- this.Label4.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label4.Location = new global::System.Drawing.Point(16, 341);- this.Label4.Name = "Label4";- this.Label4.Size = new global::System.Drawing.Size(81, 46);- this.Label4.TabIndex = 3;- this.Label4.Text = "Paypal:";- this.picPaypallQR.Image = global::_2D_wave_sim_V01.My.Resources.Resources.QR_code;- this.picPaypallQR.Location = new global::System.Drawing.Point(121, 341);- this.picPaypallQR.Name = "picPaypallQR";- this.picPaypallQR.Size = new global::System.Drawing.Size(139, 135);- this.picPaypallQR.SizeMode = global::System.Windows.Forms.PictureBoxSizeMode.Zoom;- this.picPaypallQR.TabIndex = 6;- this.picPaypallQR.TabStop = false;- this.Label5.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label5.Location = new global::System.Drawing.Point(15, 199);- this.Label5.Name = "Label5";- this.Label5.Size = new global::System.Drawing.Size(392, 42);- this.Label5.TabIndex = 3;- this.Label5.Text = "Send bugs or suggestions for improvement to : [email protected]";- base.AcceptButton = this.btnClose;- base.CancelButton = this.btnClose;- base.ClientSize = new global::System.Drawing.Size(429, 545);- base.Controls.Add(this.picPaypallQR);- base.Controls.Add(this.btnClose);- base.Controls.Add(this.lblCopyright);- base.Controls.Add(this.Label2);- base.Controls.Add(this.Label4);- base.Controls.Add(this.Label3);- base.Controls.Add(this.Label5);- base.Controls.Add(this.Label1);- base.Controls.Add(this.lblDescription);- base.Controls.Add(this.lblVersion);- base.Controls.Add(this.lblTitle);- base.Controls.Add(this.picIcon);- this.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- base.FormBorderStyle = global::System.Windows.Forms.FormBorderStyle.FixedDialog;- base.MaximizeBox = false;- base.MinimizeBox = false;- base.Name = "AboutForm";- base.ShowIcon = false;- base.ShowInTaskbar = false;- base.StartPosition = global::System.Windows.Forms.FormStartPosition.CenterParent;- this.Text = "About 2D Wave Dude ";- ((global::System.ComponentModel.ISupportInitialize)this.picIcon).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.picPaypallQR).EndInit();- base.ResumeLayout(false);- base.PerformLayout();- }-- private PictureBox picIcon;- private Label lblTitle;- private Label lblVersion;- private Label lblDescription;- private Label lblCopyright;- private Button btnClose;- private Label Label1;- private Label Label2;- private Label Label3;- private Label Label4;- private PictureBox picPaypallQR;- private Label Label5;- private global::System.ComponentModel.IContainer components;- }-}diff --git a/Wave_Dude_2D/AboutForm.cs b/Wave_Dude_2D/AboutForm.csdeleted file mode 100644index 264d9ac..0000000--- a/Wave_Dude_2D/AboutForm.cs+++ /dev/null@@ -1,57 +0,0 @@-using System;-using System.Drawing;-using System.Windows.Forms;-using _2D_wave_sim_V01.My;--namespace _2D_wave_sim_V01-{- /// <summary>- /// The Info > About window: program name, version and a one-paragraph description.- /// Designer-editable: the layout lives in <c>AboutForm.Designer.cs</c>; this file only fills in- /// the two pieces of text that are not fixed at design time (the version, from- /// <see cref="DisplayVersion"/>, and the copyright string, read from the assembly) and loads the- /// application icon. Opened modally from <see cref="Form1.AboutToolStripMenuItem_Click"/>.- /// </summary>- public partial class AboutForm : Form- {- /// <summary>- /// Fills in the version and copyright labels and the icon associated with the running- /// executable. The icon is optional: when none is available (e.g. running outside a normal- /// exe) the failure is swallowed and the picture box just stays empty.- /// </summary>- public AboutForm()- {- base.Load += AboutForm_Load;- InitializeComponent();- lblVersion.Text = "Version " + DisplayVersion;- lblCopyright.Text = MyProject.Application.Info.Copyright;- try- {- using (Icon icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath))- {- if (icon != null)- {- picIcon.Image = icon.ToBitmap();- }- }- }- catch- {- // no icon available (e.g. running outside a normal exe) - the picture box just stays empty- }- }-- /// <summary>Does nothing; still wired to <see cref="Form.Load"/> by the constructor.</summary>- private void AboutForm_Load(object sender, EventArgs e)- {- }-- /// <summary>- /// Version text shown in the dialog. A hand-maintained literal, meant to be kept in sync by- /// hand with the version in <see cref="Form1"/>'s title bar ("Wave Dude 2D V0.29", set in- /// <c>Form1.Designer.cs</c>), since <c>AssemblyInfo.cs</c>'s <c>AssemblyVersion</c> is left at- /// the generic 1.0.0.0 and does not track it. It currently lags behind the title bar.- /// </summary>- private const string DisplayVersion = "0.27";- }-}diff --git a/Wave_Dude_2D/AboutForm.resx b/Wave_Dude_2D/AboutForm.resxdeleted file mode 100644index 7c72981..0000000--- a/Wave_Dude_2D/AboutForm.resx+++ /dev/null@@ -1,61 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<root>- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />- <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" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </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" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>-</root>\ No newline at end of filediff --git a/Wave_Dude_2D/AppSettings.cs b/Wave_Dude_2D/AppSettings.csdeleted file mode 100644index e7fcb98..0000000--- a/Wave_Dude_2D/AppSettings.cs+++ /dev/null@@ -1,130 +0,0 @@-using System;-using System.Collections.Generic;-using System.IO;-using System.Text;-using System.Web.Script.Serialization;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Per-user application settings, persisted as a small JSON object in- /// <c>%AppData%\2D_wave_sim_V01\settings.json</c>. <see cref="Form1"/> loads one copy at- /// start-up with <see cref="Load"/> and calls <see cref="Save"/> whenever the project root- /// or the open project changes. Loading and saving never throw: on any error the defaults- /// are used or the write is silently skipped.- /// </summary>- public sealed class AppSettings- {- /// <summary>Starts with all three values empty (no root chosen, no project remembered).</summary>- public AppSettings()- {- LastRootFolder = "";- LastProjectName = "";- ProjectRoot = "";- }-- /// <summary>- /// Root folder of the project opened most recently. Written on every project open and- /// persisted, but not read back by the application at present.- /// </summary>- public string LastRootFolder { get; set; }-- /// <summary>- /// Name (folder name) of the project opened most recently. Written on every project open- /// and persisted, but not read back by the application at present.- /// </summary>- public string LastProjectName { get; set; }-- /// <summary>- /// The root folder browsed on the Configuration tab (<c>lstAllProjects</c>, File > Choose project- /// root), i.e. the folder that contains the user's project folders. Distinct from- /// <see cref="LastRootFolder"/> / <see cref="LastProjectName"/>, which remember the project that was- /// actually open last, not necessarily the folder being browsed for other projects to switch to.- /// Empty until the user has chosen one; <see cref="Form1"/> keeps most of the UI disabled- /// while it is empty.- /// </summary>- public string ProjectRoot { get; set; }-- /// <summary>Full path of the settings file under the roaming application-data folder.</summary>- private static string SettingsFilePath()- {- return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "2D_wave_sim_V01", "settings.json");- }-- /// <summary>- /// Reads the settings file. Missing file, unreadable JSON or missing keys all yield the- /// corresponding default (empty string); nothing is thrown.- /// </summary>- /// <returns>A new instance; never null.</returns>- public static AppSettings Load()- {- AppSettings settings = new AppSettings();- try- {- string path = AppSettings.SettingsFilePath();- if (File.Exists(path))- {- JavaScriptSerializer serializer = new JavaScriptSerializer();- Dictionary<string, object> values = serializer.DeserializeObject(File.ReadAllText(path, Encoding.UTF8)) as Dictionary<string, object>;- if (values != null)- {- settings.LastRootFolder = AppSettings.ReadText(values, KeyRootFolder);- settings.LastProjectName = AppSettings.ReadText(values, KeyProjectName);- settings.ProjectRoot = AppSettings.ReadText(values, KeyProjectRoot);- }- }- }- catch- {- // use the defaults- }- return settings;- }-- /// <summary>- /// Writes the three values as a flat JSON object (UTF-8 without BOM), creating the folder- /// if needed. Any I/O or serialisation error is swallowed.- /// </summary>- public void Save()- {- try- {- string path = AppSettings.SettingsFilePath();- Directory.CreateDirectory(Path.GetDirectoryName(path));- Dictionary<string, string> values = new Dictionary<string, string>();- values[KeyRootFolder] = LastRootFolder;- values[KeyProjectName] = LastProjectName;- values[KeyProjectRoot] = ProjectRoot;- JavaScriptSerializer serializer = new JavaScriptSerializer();- File.WriteAllText(path, serializer.Serialize(values), new UTF8Encoding(false));- }- catch- {- // the settings are a convenience only- }- }-- /// <summary>- /// Returns the value stored under <paramref name="key"/> as text, or an empty string when- /// the key is absent or null. Non-string JSON values are converted with the current culture.- /// </summary>- private static string ReadText(Dictionary<string, object> root, string key)- {- object value;- if (root.TryGetValue(key, out value) && value != null)- {- return Convert.ToString(value);- }- return "";- }-- /// <summary>JSON key of <see cref="LastRootFolder"/>.</summary>- private const string KeyRootFolder = "last_root_folder";-- /// <summary>JSON key of <see cref="LastProjectName"/>.</summary>- private const string KeyProjectName = "last_project_name";-- /// <summary>JSON key of <see cref="ProjectRoot"/>.</summary>- private const string KeyProjectRoot = "project_root";- }-}diff --git a/Wave_Dude_2D/AviFrameSink.cs b/Wave_Dude_2D/AviFrameSink.csdeleted file mode 100644index 436a826..0000000--- a/Wave_Dude_2D/AviFrameSink.cs+++ /dev/null@@ -1,101 +0,0 @@-using System;-using System.Drawing;-using System.Drawing.Imaging;-using System.IO;--namespace _2D_wave_sim_V01-{- /// <summary>- /// <see cref="IFrameSink"/> that JPEG-encodes each frame with the GDI+ encoder and appends it to a Motion-JPEG- /// AVI through <see cref="AviMjpegWriter"/>. Fallback used by <see cref="SimulationRunner"/> when MP4 is not- /// requested or Media Foundation is unavailable: needs no codec on this computer, but Windows' own players do not- /// play it; VLC does. Used from the worker thread only.- /// </summary>- internal sealed class AviFrameSink : IFrameSink- {- /// <summary>Creates the AVI file immediately (header written); <paramref name="quality"/> is clamped to 1..100.</summary>- /// <param name="filePath">Output .avi path (created or overwritten).</param>- /// <param name="width">Frame width in pixels.</param>- /// <param name="height">Frame height in pixels.</param>- /// <param name="framesPerSecond">Playback frame rate.</param>- /// <param name="quality">JPEG quality 1..100 passed to the GDI+ encoder.</param>- public AviFrameSink(string filePath, int width, int height, int framesPerSecond, int quality)- {- _buffer = new MemoryStream();- _jpegQuality = Math.Max(1, Math.Min(100, quality));- _path = filePath;- _width = width;- _height = height;- _writer = new AviMjpegWriter(filePath, width, height, framesPerSecond);- }-- /// <summary>The AVI path given to the constructor.</summary>- public string FilePath => _path;-- /// <summary>- /// Wraps the ARGB buffer in a temporary bitmap, JPEG-encodes it into the reusable <see cref="_buffer"/>- /// and appends the bytes as one AVI frame.- /// </summary>- public void AddPixels(int[] pixels)- {- using (Bitmap bitmap = FrameRenderer.ToBitmap(pixels, _width, _height))- {- _buffer.SetLength(0L);- using (EncoderParameters encoderParameters = new EncoderParameters(1))- {- encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, _jpegQuality);- bitmap.Save(_buffer, AviFrameSink.JpegCodec, encoderParameters);- }- _writer.AddFrame(_buffer.GetBuffer(), (int)_buffer.Length);- }- }-- /// <summary>Writes the AVI index and header patches and closes the file (idempotent).</summary>- public void Close()- {- _writer.Close();- }-- /// <summary>Closes the AVI (if not already) and releases the encode buffer.</summary>- public void Dispose()- {- _writer.Close();- _buffer.Dispose();- }-- /// <summary>Finds the GDI+ JPEG encoder; runs once in the static initializer.</summary>- /// <exception cref="InvalidOperationException">No JPEG encoder is installed.</exception>- private static ImageCodecInfo FindJpegCodec()- {- foreach (ImageCodecInfo codec in ImageCodecInfo.GetImageEncoders())- {- if (codec.FormatID == ImageFormat.Jpeg.Guid)- {- return codec;- }- }- throw new InvalidOperationException("The JPEG encoder is not available on this computer.");- }-- /// <summary>The GDI+ JPEG encoder, resolved once per process (a missing encoder surfaces as a type-initializer exception).</summary>- private static readonly ImageCodecInfo JpegCodec = AviFrameSink.FindJpegCodec();-- /// <summary>JPEG quality 1..100 as a long, the type <see cref="EncoderParameter"/> expects.</summary>- private readonly long _jpegQuality;-- /// <summary>Output file path.</summary>- private readonly string _path;-- /// <summary>The underlying RIFF/AVI container writer; owns the file stream.</summary>- private readonly AviMjpegWriter _writer;-- /// <summary>Frame width in pixels.</summary>- private readonly int _width;-- /// <summary>Frame height in pixels.</summary>- private readonly int _height;-- /// <summary>Reused in-memory target for each JPEG encode; its backing array is handed to the writer directly.</summary>- private readonly MemoryStream _buffer;- }-}diff --git a/Wave_Dude_2D/AviMjpegWriter.cs b/Wave_Dude_2D/AviMjpegWriter.csdeleted file mode 100644index f973870..0000000--- a/Wave_Dude_2D/AviMjpegWriter.cs+++ /dev/null@@ -1,244 +0,0 @@-using System;-using System.Collections.Generic;-using System.IO;-using System.Text;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Minimal Motion-JPEG AVI (RIFF) writer, single video stream, no audio. Every frame is given as an- /// ordinary JPEG image, so no codec or external program is needed; VLC and most video editors play the- /// file, and a program like ffmpeg can convert it to MP4. The constructor writes the fixed-size header,- /// <see cref="AddFrame"/> appends one <c>00dc</c> chunk per JPEG to the <c>movi</c> list and- /// <see cref="Close"/> appends the <c>idx1</c> index and patches the size/count fields in the header.- /// Used by <see cref="AviFrameSink"/>. All values are little-endian.- /// </summary>- /// <remarks>- /// Layout (byte offsets), which is what the <c>Pos*</c> constants encode:- /// <list type="table">- /// <item><term>0</term><description><c>RIFF</c>, file size - 8 (patched at <see cref="PosRiffSize"/>), <c>AVI </c></description></item>- /// <item><term>12</term><description><c>LIST</c> 192 <c>hdrl</c></description></item>- /// <item><term>24</term><description><c>avih</c> 56: MainAVIHeader (microseconds/frame, flags = AVIF_HASINDEX, total frames at <see cref="PosTotalFrames"/>, 1 stream, suggested buffer at <see cref="PosBufferSize"/>, width, height)</description></item>- /// <item><term>88</term><description><c>LIST</c> 116 <c>strl</c></description></item>- /// <item><term>100</term><description><c>strh</c> 56: AVISTREAMHEADER (<c>vids</c>/<c>MJPG</c>, scale/rate, length at <see cref="PosStreamLength"/>, suggested buffer at <see cref="PosStreamBufferSize"/>, rcFrame)</description></item>- /// <item><term>164</term><description><c>strf</c> 40: BITMAPINFOHEADER (24 bpp, compression <c>MJPG</c>)</description></item>- /// <item><term>212</term><description><c>LIST</c> movi size (patched at <see cref="PosMoviSize"/>) <c>movi</c> at <see cref="PosMoviTag"/>, then the frame chunks</description></item>- /// <item><term>end</term><description><c>idx1</c>: one 16-byte entry per frame (<c>00dc</c>, flags = AVIIF_KEYFRAME, offset relative to <see cref="PosMoviTag"/>, size)</description></item>- /// </list>- /// </remarks>- internal sealed class AviMjpegWriter : IDisposable- {- /// <summary>Creates (overwrites) the file and writes the complete header up to and including the <c>movi</c> tag.</summary>- /// <param name="filePath">Output path; an existing file is truncated.</param>- /// <param name="width">Frame width in pixels.</param>- /// <param name="height">Frame height in pixels.</param>- /// <param name="framesPerSecond">Playback rate; stored as microseconds per frame in <c>avih</c> and as the rate in <c>strh</c>.</param>- public AviMjpegWriter(string filePath, int width, int height, int framesPerSecond)- {- _stream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read);- _writer = new BinaryWriter(_stream);- Encoding ascii = Encoding.ASCII;- // RIFF header- _writer.Write(ascii.GetBytes("RIFF"));- _writer.Write(0U); // file size - 8, patched in Close- _writer.Write(ascii.GetBytes("AVI "));- // LIST hdrl- _writer.Write(ascii.GetBytes("LIST"));- _writer.Write(192U); // 'hdrl' + avih chunk (64) + strl list chunk (124)- _writer.Write(ascii.GetBytes("hdrl"));- // avih (MainAVIHeader, 56 bytes)- _writer.Write(ascii.GetBytes("avih"));- _writer.Write(56U);- _writer.Write((uint)(1000000 / framesPerSecond)); // dwMicroSecPerFrame- _writer.Write(0U); // dwMaxBytesPerSec- _writer.Write(0U); // dwPaddingGranularity- _writer.Write(AvifHasIndex); // dwFlags- _writer.Write(0U); // dwTotalFrames, patched in Close- _writer.Write(0U); // dwInitialFrames- _writer.Write(1U); // dwStreams- _writer.Write(0U); // dwSuggestedBufferSize, patched in Close- _writer.Write((uint)width);- _writer.Write((uint)height);- for (int i = 0; i < 4; i++)- {- _writer.Write(0U); // dwReserved[4]- }- // LIST strl- _writer.Write(ascii.GetBytes("LIST"));- _writer.Write(116U); // 'strl' + strh chunk (64) + strf chunk (48)- _writer.Write(ascii.GetBytes("strl"));- // strh (AVISTREAMHEADER, 56 bytes)- _writer.Write(ascii.GetBytes("strh"));- _writer.Write(56U);- _writer.Write(ascii.GetBytes("vids")); // fccType- _writer.Write(ascii.GetBytes("MJPG")); // fccHandler- _writer.Write(0U); // dwFlags- _writer.Write((ushort)0); // wPriority- _writer.Write((ushort)0); // wLanguage- _writer.Write(0U); // dwInitialFrames- _writer.Write(1U); // dwScale- _writer.Write((uint)framesPerSecond); // dwRate (frames per second = dwRate / dwScale)- _writer.Write(0U); // dwStart- _writer.Write(0U); // dwLength, patched in Close- _writer.Write(0U); // dwSuggestedBufferSize, patched in Close- _writer.Write(0xFFFFFFFFU); // dwQuality: -1 = default- _writer.Write(0U); // dwSampleSize (0 = variable, one frame per chunk)- _writer.Write((ushort)0); // rcFrame.left- _writer.Write((ushort)0); // rcFrame.top- _writer.Write((ushort)width); // rcFrame.right- _writer.Write((ushort)height); // rcFrame.bottom- // strf (BITMAPINFOHEADER, 40 bytes)- _writer.Write(ascii.GetBytes("strf"));- _writer.Write(40U);- _writer.Write(40U); // biSize- _writer.Write(width); // biWidth- _writer.Write(height); // biHeight- _writer.Write((ushort)1); // biPlanes- _writer.Write((ushort)24); // biBitCount- _writer.Write(ascii.GetBytes("MJPG")); // biCompression- _writer.Write((uint)(((long)width * height * 3L) & 0xFFFFFFFFL)); // biSizeImage- _writer.Write(0); // biXPelsPerMeter- _writer.Write(0); // biYPelsPerMeter- _writer.Write(0U); // biClrUsed- _writer.Write(0U); // biClrImportant- // LIST movi; frames follow- _writer.Write(ascii.GetBytes("LIST"));- _writer.Write(0U); // movi size, patched in Close- _writer.Write(ascii.GetBytes("movi"));- }-- /// <summary>Number of frames appended so far.</summary>- public int FrameCount => _offsets.Count;-- /// <summary>- /// Appends one JPEG frame as a <c>00dc</c> chunk and records its offset/size for the index. Odd lengths- /// are followed by one RIFF pad byte.- /// </summary>- /// <param name="data">Buffer holding the JPEG; only the first <paramref name="length"/> bytes are used.</param>- /// <param name="length">Number of JPEG bytes.</param>- /// <exception cref="InvalidOperationException">The file is already closed.</exception>- /// <exception cref="IOException">The frame plus the index that would follow would push the file past <see cref="MaxAviBytes"/>.</exception>- public void AddFrame(byte[] data, int length)- {- if (_closed)- {- throw new InvalidOperationException("The video file is already closed.");- }- // Reserve room for the idx1 that Close() will append (16 bytes per frame plus slack).- if (_stream.Position + length + 16L * (_offsets.Count + 2) + 64L > MaxAviBytes)- {- throw new IOException("The video file would become larger than 4 GB, which the AVI format does not allow.");- }- _offsets.Add((int)(_stream.Position - PosMoviTag));- _sizes.Add(length);- _writer.Write(Encoding.ASCII.GetBytes("00dc"));- _writer.Write((uint)length);- _writer.Write(data, 0, length);- if ((length & 1) == 1)- {- _writer.Write((byte)0); // RIFF chunks are word-aligned- }- if (length > _largestFrame)- {- _largestFrame = length;- }- }-- /// <summary>- /// Appends the <c>idx1</c> chunk, patches the RIFF size, frame counts, buffer sizes and movi size in the- /// header, then closes the stream. Idempotent; the stream is closed even if a write fails.- /// </summary>- public void Close()- {- if (_closed)- {- return;- }- _closed = true;- try- {- long indexPosition = _stream.Position;- _writer.Write(Encoding.ASCII.GetBytes("idx1"));- _writer.Write((uint)(16 * _offsets.Count));- for (int i = 0; i < _offsets.Count; i++)- {- _writer.Write(Encoding.ASCII.GetBytes("00dc"));- _writer.Write(AviifKeyframe);- _writer.Write((uint)_offsets[i]);- _writer.Write((uint)_sizes[i]);- }- long endPosition = _stream.Position;- Patch(PosRiffSize, (uint)(endPosition - 8L));- Patch(PosTotalFrames, (uint)_offsets.Count);- Patch(PosBufferSize, (uint)_largestFrame);- Patch(PosStreamLength, (uint)_offsets.Count);- Patch(PosStreamBufferSize, (uint)_largestFrame);- Patch(PosMoviSize, (uint)(indexPosition - PosMoviTag)); // LIST size counts from its fourcc- _writer.Flush();- }- finally- {- _writer.Close();- _stream.Dispose();- }- }-- /// <summary>Seeks to <paramref name="position"/> and overwrites one DWORD; leaves the stream positioned after it.</summary>- private void Patch(long position, uint value)- {- _stream.Seek(position, SeekOrigin.Begin);- _writer.Write(value);- }-- /// <summary>Same as <see cref="Close"/>.</summary>- public void Dispose() => Close();-- /// <summary>Hard cap on the file size in bytes. AVI files are limited to 4 GB (unsigned 32 bit sizes); this stops safely before that.</summary>- private const long MaxAviBytes = 3900000000L;-- /// <summary>avih.dwFlags: the file has an <c>idx1</c> index.</summary>- private const uint AvifHasIndex = 0x10;-- /// <summary>idx1 entry flag: the chunk is a key frame (every MJPEG frame is).</summary>- private const uint AviifKeyframe = 0x10;-- /// <summary>Offset of the RIFF size DWORD (file size - 8).</summary>- private const long PosRiffSize = 4L;-- /// <summary>Offset of avih.dwTotalFrames.</summary>- private const long PosTotalFrames = 48L;-- /// <summary>Offset of avih.dwSuggestedBufferSize (largest frame).</summary>- private const long PosBufferSize = 60L;-- /// <summary>Offset of strh.dwLength (frame count).</summary>- private const long PosStreamLength = 140L;-- /// <summary>Offset of strh.dwSuggestedBufferSize (largest frame).</summary>- private const long PosStreamBufferSize = 144L;-- /// <summary>Offset of the movi LIST size DWORD.</summary>- private const long PosMoviSize = 216L;-- /// <summary>Offset of the <c>movi</c> fourcc; idx1 chunk offsets are relative to this.</summary>- private const long PosMoviTag = 220L;-- /// <summary>The output file; disposed by <see cref="Close"/>.</summary>- private readonly FileStream _stream;-- /// <summary>Little-endian writer over <see cref="_stream"/>.</summary>- private readonly BinaryWriter _writer;-- /// <summary>Per frame: chunk offset relative to <see cref="PosMoviTag"/>, for idx1.</summary>- private readonly List<int> _offsets = new List<int>();-- /// <summary>Per frame: JPEG byte count, for idx1.</summary>- private readonly List<int> _sizes = new List<int>();-- /// <summary>Largest JPEG so far, in bytes; becomes the suggested buffer size.</summary>- private int _largestFrame;-- /// <summary>True once <see cref="Close"/> has run; further <see cref="AddFrame"/> calls throw.</summary>- private bool _closed;- }-}diff --git a/Wave_Dude_2D/ColorLut.cs b/Wave_Dude_2D/ColorLut.csdeleted file mode 100644index de46d50..0000000--- a/Wave_Dude_2D/ColorLut.cs+++ /dev/null@@ -1,175 +0,0 @@-using System;-using System.Drawing;--namespace _2D_wave_sim_V01-{- /// <summary>- /// An immutable palette of <see cref="Size"/> opaque ARGB entries built from a- /// <see cref="ColorScheme"/> by <see cref="Build"/> plus the display options of the Python- /// function <c>get_colormap_lut</c> (invert, black level, make symmetric), and the static- /// value-to-index mappings used when colouring frames, which convert field and intensity- /// values to table indices exactly like <c>WaveVisualizer.render_field</c> /- /// <c>render_intensity</c>. Built on the UI thread when a simulation is started; the- /// <see cref="Argb"/> array is then handed to <see cref="SimulationRunner"/> and read from- /// <see cref="FrameRenderer"/>'s parallel loops without locking (it is never modified after- /// construction).- /// </summary>- /// <remarks>- /// The options belong to how a scheme is used in a simulation (field or intensity), not to- /// the scheme itself, so they are not saved in the scheme file; they live in- /// <see cref="SimulationSettings"/> and are applied here at run start.- /// </remarks>- public sealed class ColorLut- {- private ColorLut(int[] argb)- {- _argb = argb;- }-- /// <summary>- /// The palette as packed opaque ARGB ints (<see cref="Color.ToArgb"/> layout), indices- /// 0..<see cref="Size"/>-1. Returns the internal array, not a copy; callers must not modify it.- /// </summary>- public int[] Argb => _argb;-- /// <summary>Returns entry <paramref name="index"/> (0..<see cref="Size"/>-1) as a <see cref="Color"/>.</summary>- public Color ColorAt(int index)- {- return Color.FromArgb(_argb[index]);- }-- /// <summary>- /// Builds a palette from the <see cref="Size"/> entries of <paramref name="scheme"/>.- /// Transformations are applied in the same order as in Python: <paramref name="reverse"/>- /// (new, optional; entry i is read from entry <c>Size-1-i</c>), <paramref name="invert"/>- /// (each channel becomes <c>1 - channel</c>), <paramref name="makeSymmetric"/> (entry i is- /// read from entry <c>2 * min(i, Size-1-i)</c>, so the palette runs from entry 0 at both- /// ends up to entry 254 in the middle), then <paramref name="blackLevel"/> maps every- /// channel linearly as <c>c * (1 - b) + b</c>, so 0 becomes <paramref name="blackLevel"/>- /// and 1 stays 1. Values are limited to 0..1 and converted to 8 bit by truncation, like- /// the Python code. Alpha is always 255.- /// </summary>- /// <param name="scheme">Source colours; must have at least <see cref="Size"/> entries.</param>- /// <param name="invert">Replaces every colour by its complement (1 - colour), like the Python option.</param>- /// <param name="blackLevel">Lifts (positive) or lowers (negative) the darkest level; 0 = unchanged.</param>- /// <param name="makeSymmetric">Squeezes the whole scheme into each half and mirrors it around the centre.</param>- /// <param name="reverse">Reverses the order of the scheme (like matplotlib's <c>_r</c> maps).</param>- /// <exception cref="ArgumentNullException"><paramref name="scheme"/> is null.</exception>- public static ColorLut Build(ColorScheme scheme, bool invert = false, double blackLevel = 0.0, bool makeSymmetric = false, bool reverse = false)- {- if (scheme == null)- {- throw new ArgumentNullException("scheme");- }- double[,] rgb = new double[Size, 3];- for (int i = 0; i < Size; i++)- {- Color entry = scheme.GetEntry(reverse ? (Size - 1 - i) : i);- rgb[i, 0] = entry.R / 255.0;- rgb[i, 1] = entry.G / 255.0;- rgb[i, 2] = entry.B / 255.0;- }- if (invert)- {- for (int i = 0; i < Size; i++)- {- for (int channel = 0; channel < 3; channel++)- {- rgb[i, channel] = 1.0 - rgb[i, channel];- }- }- }- int[] argb = new int[Size];- for (int i = 0; i < Size; i++)- {- // Python: entries 0..127 = src[0::2] and entries 127..254 = the same list mirrored,- // which is entry i = src[2 * min(i, 254 - i)]- int sourceIndex = i;- if (makeSymmetric)- {- sourceIndex = 2 * Math.Min(i, Size - 1 - i);- }- int[] components = new int[3];- for (int channel = 0; channel < 3; channel++)- {- double level = rgb[sourceIndex, channel] * (1.0 - blackLevel) + blackLevel;- if (level < 0.0)- {- level = 0.0;- }- if (level > 1.0)- {- level = 1.0;- }- int component = (int)(level * 255.0);- if (component > 255)- {- component = 255;- }- components[channel] = component;- }- argb[i] = Color.FromArgb(255, components[0], components[1], components[2]).ToArgb();- }- return new ColorLut(argb);- }-- /// <summary>- /// Maps a signed field sample to a palette index, like <c>render_field</c>:- /// <c>clip(value * brightness, -1, 1) * 127 + 127</c>, so the result is 0..254 and a zero- /// field gives index 127 (the centre colour). NaN gives 127. Called per pixel from- /// <see cref="FrameRenderer.RenderField"/> on worker threads.- /// </summary>- /// <param name="value">Raw field amplitude from the engine.</param>- /// <param name="brightness">Gain applied before clamping.</param>- public static int FieldIndex(float value, float brightness)- {- float scaled = value * brightness;- if (float.IsNaN(scaled))- {- return 127;- }- if (scaled > 1f)- {- scaled = 1f;- }- if (scaled < -1f)- {- scaled = -1f;- }- return (int)(scaled * 127f + 127f);- }-- /// <summary>- /// Maps a non-negative intensity to a palette index 0..254, like <c>render_intensity</c>:- /// <c>clip(intensity ^ exponent * brightness, 0, 1) * 254</c>. NaN or non-positive- /// intensity gives 0. Not currently called; <see cref="FrameRenderer.RenderIntensity"/>- /// inlines the equivalent square-root mapping.- /// </summary>- /// <param name="intensity">Accumulated intensity from the engine.</param>- /// <param name="brightness">Gain applied after compression.</param>- /// <param name="exponent">Compression exponent; 0.5 (square root) is the Python default.</param>- public static int IntensityIndex(float intensity, float brightness, float exponent = 0.5f)- {- if (float.IsNaN(intensity) || intensity <= 0f)- {- return 0;- }- double scaled = Math.Pow(intensity, exponent) * brightness;- if (double.IsNaN(scaled) || scaled < 0.0)- {- return 0;- }- if (scaled > 1.0)- {- scaled = 1.0;- }- return (int)(scaled * 254.0);- }-- /// <summary>Number of entries in a palette: <see cref="ColorScheme.EntryCount"/> (255).</summary>- public const int Size = ColorScheme.EntryCount;-- /// <summary>The packed opaque ARGB entries; never modified after construction.</summary>- private readonly int[] _argb;- }-}diff --git a/Wave_Dude_2D/ColorPickerControl.cs b/Wave_Dude_2D/ColorPickerControl.csdeleted file mode 100644index ff683f5..0000000--- a/Wave_Dude_2D/ColorPickerControl.cs+++ /dev/null@@ -1,582 +0,0 @@-using System;-using System.ComponentModel;-using System.Drawing;-using System.Drawing.Drawing2D;-using System.Drawing.Imaging;-using System.Globalization;-using System.Runtime.InteropServices;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- /// <summary>- /// HSV colour picker used by the colour-scheme tab (created in code by <see cref="Form1"/> and- /// docked into a panel): a saturation/value square, a vertical hue strip, "New" / "Old" swatches- /// (clicking "Old" restores <see cref="OriginalColor"/>), a hex text box, an RGB read-out and a- /// "More..." button that opens the standard <see cref="ColorDialog"/>. The layout is fixed for a- /// 423 x 411 client area. <see cref="ColorChanged"/> is raised for user edits only, not when- /// <see cref="SelectedColor"/> is assigned from code. UI thread only.- /// It is built completely in code, so it has no designer file (hence <c>DesignerCategory("Code")</c>).- /// </summary>- [DesignerCategory("Code")]- public class ColorPickerControl : UserControl- {- /// <summary>- /// Raised after the user changes the colour (dragging, a complete hex entry, the dialog or a click- /// on the "Old" swatch). Not raised when <see cref="SelectedColor"/> or <see cref="OriginalColor"/> is set from code.- /// </summary>- public event EventHandler ColorChanged;-- /// <summary>- /// Creates the child controls at fixed positions, enables double-buffered owner painting and- /// starts with red selected and grey as the original colour.- /// </summary>- public ColorPickerControl()- {- _svRect = new Rectangle(10, 10, 300, 300);- _hueRect = new Rectangle(326, 10, 28, 300);- _newRect = new Rectangle(10, 324, 150, 36);- _oldRect = new Rectangle(160, 324, 150, 36);- _lblHex = new Label();- _txtHex = new TextBox();- _lblRgb = new Label();- _btnDialog = new Button();- _color = Color.Red;- _original = Color.Gray;- _svHue = -1.0;- base.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);- base.Size = new Size(423, 411);- _lblHex.Text = "Hex";- _lblHex.AutoSize = true;- _lblHex.Location = new Point(10, 377);- _txtHex.Location = new Point(48, 373);- _txtHex.Width = 90;- _txtHex.MaxLength = 7;- _lblRgb.AutoSize = true;- _lblRgb.Location = new Point(152, 377);- _btnDialog.Text = "More...";- _btnDialog.Location = new Point(326, 324);- _btnDialog.Size = new Size(90, 36);- base.Controls.Add(_lblHex);- base.Controls.Add(_txtHex);- base.Controls.Add(_lblRgb);- base.Controls.Add(_btnDialog);- _txtHex.TextChanged += HexTextChanged;- _btnDialog.Click += DialogButtonClick;- ApplyColor(Color.Red, false, false);- }-- /// <summary>- /// Gets the current colour (always opaque). Setting it updates the HSV state, texts and swatch- /// without raising <see cref="ColorChanged"/>.- /// </summary>- public Color SelectedColor- {- get => _color;- set => ApplyColor(value, false, false);- }-- /// <summary>The reference colour shown in the "Old" swatch and restored when it is clicked; alpha is discarded.</summary>- public Color OriginalColor- {- get => _original;- set- {- _original = Color.FromArgb(value.R, value.G, value.B);- base.Invalidate();- }- }-- /// <summary>- /// Makes <paramref name="c"/> (alpha discarded) the current colour and derives H/S/V from it. The- /// hue is left unchanged for greys and black (saturation or value 0) so the hue marker does not- /// jump to 0. Updates the texts, repaints and optionally raises <see cref="ColorChanged"/>.- /// </summary>- /// <param name="c">The new colour; its alpha is ignored.</param>- /// <param name="raiseChanged">Raise <see cref="ColorChanged"/> (true for user edits only).</param>- /// <param name="fromHexBox">Leave the hex box untouched because the user is typing in it.</param>- private void ApplyColor(Color c, bool raiseChanged, bool fromHexBox)- {- _color = Color.FromArgb(c.R, c.G, c.B);- double hue = 0.0;- double saturation = 0.0;- double value = 0.0;- ColorPickerControl.RgbToHsv(_color, ref hue, ref saturation, ref value);- if (saturation > 0.0 && value > 0.0)- {- _h = hue;- }- _s = saturation;- _v = value;- UpdateTexts(fromHexBox);- base.Invalidate();- if (raiseChanged)- {- EventHandler colorChangedEvent = ColorChanged;- if (colorChangedEvent != null)- {- colorChangedEvent(this, EventArgs.Empty);- }- }- }-- /// <summary>Recomputes the colour from <see cref="_h"/>/<see cref="_s"/>/<see cref="_v"/> after a drag, updates the texts, repaints and raises <see cref="ColorChanged"/>.</summary>- private void SyncFromHsv()- {- _color = ColorPickerControl.HsvToColor(_h, _s, _v);- UpdateTexts(false);- base.Invalidate();- EventHandler colorChangedEvent = ColorChanged;- if (colorChangedEvent != null)- {- colorChangedEvent(this, EventArgs.Empty);- }- }-- /// <summary>- /// Writes "#RRGGBB" into the hex box (unless <paramref name="skipHexBox"/>) and "R G B" into the- /// read-out label, with <see cref="_updatingText"/> set so <see cref="HexTextChanged"/> ignores the programmatic change.- /// </summary>- private void UpdateTexts(bool skipHexBox)- {- _updatingText = true;- try- {- if (!skipHexBox)- {- _txtHex.Text = "#" + _color.R.ToString("X2", CultureInfo.InvariantCulture) + _color.G.ToString("X2", CultureInfo.InvariantCulture) + _color.B.ToString("X2", CultureInfo.InvariantCulture);- }- _lblRgb.Text = string.Format(CultureInfo.InvariantCulture, "R {0} G {1} B {2}", _color.R, _color.G, _color.B);- }- finally- {- _updatingText = false;- }- }-- /// <summary>Typing a complete 6-digit hex colour (optional leading '#') applies it and raises <see cref="ColorChanged"/>; incomplete or invalid text is ignored.</summary>- private void HexTextChanged(object sender, EventArgs e)- {- if (_updatingText)- {- return;- }- string hex = _txtHex.Text.Trim().TrimStart('#');- if (hex.Length != 6)- {- return;- }- int rgb;- if (int.TryParse(hex, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out rgb))- {- ApplyColor(Color.FromArgb((rgb >> 16) & 255, (rgb >> 8) & 255, rgb & 255), true, true);- }- }-- /// <summary>"More..." opens the standard colour dialog (custom-colour panel expanded) preset to the current colour and applies the chosen colour.</summary>- private void DialogButtonClick(object sender, EventArgs e)- {- using (ColorDialog colorDialog = new ColorDialog())- {- colorDialog.FullOpen = true;- colorDialog.Color = _color;- if (colorDialog.ShowDialog(this) == DialogResult.OK)- {- ApplyColor(colorDialog.Color, true, false);- }- }- }-- /// <summary>- /// Left button: starts a drag in the S/V square (<see cref="_drag"/> = 1) or the hue strip- /// (<see cref="_drag"/> = 2) and applies the pressed point immediately; a click on the "Old"- /// swatch restores <see cref="OriginalColor"/>.- /// </summary>- protected override void OnMouseDown(MouseEventArgs e)- {- base.OnMouseDown(e);- if (e.Button != MouseButtons.Left)- {- return;- }- if (_svRect.Contains(e.Location))- {- _drag = 1;- UpdateFromMouse(e.Location);- }- else if (_hueRect.Contains(e.Location))- {- _drag = 2;- UpdateFromMouse(e.Location);- }- else if (_oldRect.Contains(e.Location))- {- ApplyColor(_original, true, false);- }- }-- /// <summary>Continues an active drag; positions outside the square / strip are clamped to its edge.</summary>- protected override void OnMouseMove(MouseEventArgs e)- {- base.OnMouseMove(e);- if (_drag != 0)- {- UpdateFromMouse(e.Location);- }- }-- /// <summary>Ends any drag.</summary>- protected override void OnMouseUp(MouseEventArgs e)- {- base.OnMouseUp(e);- _drag = 0;- }-- /// <summary>- /// Converts a mouse position in control client pixels into S/V (square: saturation 0..1 left to- /// right, value 1..0 top to bottom) or hue (strip: 0..360 degrees top to bottom) depending on- /// <see cref="_drag"/>, clamped to the rectangle, and then calls <see cref="SyncFromHsv"/>.- /// </summary>- private void UpdateFromMouse(Point p)- {- if (_drag == 1)- {- _s = ColorPickerControl.Clamp01((p.X - _svRect.X) / (double)(_svRect.Width - 1));- _v = 1.0 - ColorPickerControl.Clamp01((p.Y - _svRect.Y) / (double)(_svRect.Height - 1));- }- else if (_drag == 2)- {- _h = ColorPickerControl.Clamp01((p.Y - _hueRect.Y) / (double)(_hueRect.Height - 1)) * 360.0;- }- else- {- return;- }- SyncFromHsv();- }-- /// <summary>- /// Paints the S/V square (bilinear upscale of the <see cref="SvResolution"/> cache), the hue strip,- /// the two markers, the swatches with contrasting captions and, when the control is disabled, a- /// translucent veil in the background colour over everything.- /// </summary>- protected override void OnPaint(PaintEventArgs e)- {- base.OnPaint(e);- Graphics g = e.Graphics;- g.Clear(BackColor);-- // saturation / brightness square- EnsureSvBitmap();- g.InterpolationMode = InterpolationMode.HighQualityBilinear;- g.PixelOffsetMode = PixelOffsetMode.Half;- g.DrawImage(_svBitmap, _svRect);- g.DrawRectangle(Pens.Black, _svRect.X - 1, _svRect.Y - 1, _svRect.Width + 1, _svRect.Height + 1);-- // hue bar- EnsureHueBitmap();- g.InterpolationMode = InterpolationMode.NearestNeighbor;- g.DrawImage(_hueBitmap, _hueRect);- g.DrawRectangle(Pens.Black, _hueRect.X - 1, _hueRect.Y - 1, _hueRect.Width + 1, _hueRect.Height + 1);-- g.SmoothingMode = SmoothingMode.AntiAlias;-- // marker in the square- float svX = (float)(_svRect.X + _s * (_svRect.Width - 1));- float svY = (float)(_svRect.Y + (1.0 - _v) * (_svRect.Height - 1));- g.DrawEllipse(Pens.Black, svX - 7f, svY - 7f, 14f, 14f);- g.DrawEllipse(Pens.White, svX - 6f, svY - 6f, 12f, 12f);-- // marker on the hue bar- float hueY = (float)(_hueRect.Y + _h / 360.0 * (_hueRect.Height - 1));- g.DrawRectangle(Pens.Black, _hueRect.X - 3, hueY - 3f, _hueRect.Width + 5, 6f);- g.DrawRectangle(Pens.White, _hueRect.X - 2, hueY - 2f, _hueRect.Width + 3, 4f);-- g.SmoothingMode = SmoothingMode.Default;-- // swatches- using (SolidBrush newBrush = new SolidBrush(_color))- {- g.FillRectangle(newBrush, _newRect);- }- using (SolidBrush oldBrush = new SolidBrush(_original))- {- g.FillRectangle(oldBrush, _oldRect);- }- g.DrawRectangle(Pens.Black, _newRect.X, _newRect.Y, _newRect.Width - 1, _newRect.Height - 1);- g.DrawRectangle(Pens.Black, _oldRect.X, _oldRect.Y, _oldRect.Width - 1, _oldRect.Height - 1);- TextRenderer.DrawText(g, "New", Font, _newRect, ColorPickerControl.ContrastColor(_color), TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);- TextRenderer.DrawText(g, "Old (click to restore)", Font, _oldRect, ColorPickerControl.ContrastColor(_original), TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);-- if (!base.Enabled)- {- using (SolidBrush veil = new SolidBrush(Color.FromArgb(150, BackColor)))- {- g.FillRectangle(veil, base.ClientRectangle);- }- }- }-- /// <summary>Repaints so the disabled veil appears or disappears.</summary>- protected override void OnEnabledChanged(EventArgs e)- {- base.OnEnabledChanged(e);- base.Invalidate();- }-- /// <summary>- /// Rebuilds the <see cref="SvResolution"/>-square saturation/value bitmap for the current hue- /// when it has never been built or the hue moved by 0.0001 degrees or more; otherwise keeps the- /// cached bitmap. Pixels are written in one block via <c>LockBits</c>.- /// </summary>- private void EnsureSvBitmap()- {- if (_svBitmap != null && Math.Abs(_svHue - _h) < 0.0001)- {- return;- }- if (_svBitmap == null)- {- _svBitmap = new Bitmap(SvResolution, SvResolution, PixelFormat.Format32bppArgb);- }- Color pure = ColorPickerControl.HsvToColor(_h, 1.0, 1.0);- double pureR = pure.R / 255.0;- double pureG = pure.G / 255.0;- double pureB = pure.B / 255.0;- int[] pixels = new int[SvResolution * SvResolution];- for (int y = 0; y < SvResolution; y++)- {- double value = 1.0 - y / (SvResolution - 1.0);- for (int x = 0; x < SvResolution; x++)- {- double saturation = x / (SvResolution - 1.0);- int r = (int)Math.Round(255.0 * value * (1.0 - saturation + saturation * pureR));- int g = (int)Math.Round(255.0 * value * (1.0 - saturation + saturation * pureG));- int b = (int)Math.Round(255.0 * value * (1.0 - saturation + saturation * pureB));- pixels[y * SvResolution + x] = Color.FromArgb(255, r, g, b).ToArgb();- }- }- BitmapData bitmapData = _svBitmap.LockBits(new Rectangle(0, 0, SvResolution, SvResolution), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);- try- {- Marshal.Copy(pixels, 0, bitmapData.Scan0, pixels.Length);- }- finally- {- _svBitmap.UnlockBits(bitmapData);- }- _svHue = _h;- }-- /// <summary>Creates the 1-pixel-wide hue gradient bitmap (hue 0 at the top, 360 at the bottom) on first use; it never changes afterwards.</summary>- private void EnsureHueBitmap()- {- if (_hueBitmap != null)- {- return;- }- _hueBitmap = new Bitmap(1, _hueRect.Height, PixelFormat.Format32bppArgb);- for (int y = 0; y < _hueRect.Height; y++)- {- _hueBitmap.SetPixel(0, y, ColorPickerControl.HsvToColor(y / (double)(_hueRect.Height - 1) * 360.0, 1.0, 1.0));- }- }-- /// <summary>Disposes the cached square and hue bitmaps; the child controls are disposed by the base class.</summary>- protected override void Dispose(bool disposing)- {- if (disposing)- {- if (_svBitmap != null)- {- _svBitmap.Dispose();- }- if (_hueBitmap != null)- {- _hueBitmap.Dispose();- }- }- base.Dispose(disposing);- }-- /// <summary>Clamps <paramref name="x"/> to 0..1.</summary>- private static double Clamp01(double x)- {- if (x < 0.0)- {- return 0.0;- }- if (x > 1.0)- {- return 1.0;- }- return x;- }-- /// <summary>Black or white, whichever reads better on <paramref name="c"/> (Rec. 601 luma, threshold 140 of 255).</summary>- private static Color ContrastColor(Color c)- {- double luma = 0.299 * c.R + 0.587 * c.G + 0.114 * c.B;- return luma > 140.0 ? Color.Black : Color.White;- }-- /// <summary>Converts HSV to an opaque <see cref="Color"/>.</summary>- /// <param name="h">Hue in degrees; any value, wrapped into 0..360.</param>- /// <param name="s">Saturation 0..1.</param>- /// <param name="v">Value 0..1.</param>- public static Color HsvToColor(double h, double s, double v)- {- double hue = h % 360.0;- if (hue < 0.0)- {- hue += 360.0;- }- double chroma = v * s;- double sector = hue / 60.0;- double x = chroma * (1.0 - Math.Abs(sector % 2.0 - 1.0));- double r;- double g;- double b;- switch ((int)Math.Floor(sector))- {- case 0:- r = chroma;- g = x;- b = 0.0;- break;- case 1:- r = x;- g = chroma;- b = 0.0;- break;- case 2:- r = 0.0;- g = chroma;- b = x;- break;- case 3:- r = 0.0;- g = x;- b = chroma;- break;- case 4:- r = x;- g = 0.0;- b = chroma;- break;- default:- r = chroma;- g = 0.0;- b = x;- break;- }- double m = v - chroma;- return Color.FromArgb(ColorPickerControl.ToByte(r + m), ColorPickerControl.ToByte(g + m), ColorPickerControl.ToByte(b + m));- }-- /// <summary>Scales 0..1 to 0..255 with rounding and clamping.</summary>- private static int ToByte(double v)- {- int value = (int)Math.Round(v * 255.0);- if (value < 0)- {- value = 0;- }- if (value > 255)- {- value = 255;- }- return value;- }-- /// <summary>Converts <paramref name="c"/> to hue in degrees 0..360 (0 for greys), saturation 0..1 and value 0..1.</summary>- private static void RgbToHsv(Color c, ref double h, ref double s, ref double v)- {- double r = c.R / 255.0;- double g = c.G / 255.0;- double b = c.B / 255.0;- double max = Math.Max(r, Math.Max(g, b));- double min = Math.Min(r, Math.Min(g, b));- double delta = max - min;- v = max;- s = max <= 0.0 ? 0.0 : delta / max;- if (delta <= 0.0)- {- h = 0.0;- }- else if (max == r)- {- h = 60.0 * ((g - b) / delta % 6.0);- }- else if (max == g)- {- h = 60.0 * ((b - r) / delta + 2.0);- }- else- {- h = 60.0 * ((r - g) / delta + 4.0);- }- if (h < 0.0)- {- h += 360.0;- }- }-- /// <summary>Pixel size of the cached saturation/value square; it is upscaled to <see cref="_svRect"/> when drawn.</summary>- private const int SvResolution = 150;-- /// <summary>Bounds of the saturation/value square in client pixels.</summary>- private readonly Rectangle _svRect;-- /// <summary>Bounds of the vertical hue strip in client pixels.</summary>- private readonly Rectangle _hueRect;-- /// <summary>Bounds of the "New" (current colour) swatch.</summary>- private readonly Rectangle _newRect;-- /// <summary>Bounds of the "Old" (original colour) swatch; clicking it restores the original.</summary>- private readonly Rectangle _oldRect;-- /// <summary>"Hex" caption next to the hex box.</summary>- private readonly Label _lblHex;-- /// <summary>Editable "#RRGGBB" box; see <see cref="HexTextChanged"/>.</summary>- private readonly TextBox _txtHex;-- /// <summary>Read-only "R G B" decimal read-out.</summary>- private readonly Label _lblRgb;-- /// <summary>"More..." button that opens the standard colour dialog.</summary>- private readonly Button _btnDialog;-- /// <summary>Hue in degrees 0..360; preserved when the colour becomes grey or black.</summary>- private double _h;-- /// <summary>Saturation 0..1.</summary>- private double _s;-- /// <summary>Value (brightness) 0..1.</summary>- private double _v;-- /// <summary>Current colour, always opaque.</summary>- private Color _color;-- /// <summary>Original colour shown in the "Old" swatch, always opaque.</summary>- private Color _original;-- /// <summary>Cached S/V square built for <see cref="_svHue"/>; null until first paint; owned and disposed here.</summary>- private Bitmap _svBitmap;-- /// <summary>Hue the cached S/V square was built for; -1 forces a build on the first paint.</summary>- private double _svHue;-- /// <summary>Cached 1-pixel-wide hue strip; null until first paint; owned and disposed here.</summary>- private Bitmap _hueBitmap;-- /// <summary>Active drag target: 0 = none, 1 = S/V square, 2 = hue strip.</summary>- private int _drag;-- /// <summary>True while <see cref="UpdateTexts"/> writes the hex box, so <see cref="HexTextChanged"/> ignores the change.</summary>- private bool _updatingText;- }-}diff --git a/Wave_Dude_2D/ColorScheme.cs b/Wave_Dude_2D/ColorScheme.csdeleted file mode 100644index 8eb6bd3..0000000--- a/Wave_Dude_2D/ColorScheme.cs+++ /dev/null@@ -1,303 +0,0 @@-using System;-using System.Collections.Generic;-using System.Drawing;--namespace _2D_wave_sim_V01-{- /// <summary>- /// A color scheme: a lookup table of exactly <see cref="EntryCount"/> (255) RGB colors, the same table- /// size the Python simulator uses, optionally backed by <see cref="StopCount"/> editable gradient stops.- /// A scheme can be used for the field view or for the intensity view.- /// </summary>- /// <remarks>- /// Entry 0 is the start of the scale (field -1 / intensity 0), entry 254 the end (+1 / max), entry 127- /// the centre of a field scheme. Schemes made in the stop editor also keep their anchor colors- /// ("stops") so they can be edited again. The stops sit at fixed, equally spaced positions on the- /// scale: stop 1 is the first entry, the last stop is the last entry and, with an odd number of stops,- /// the middle stop is exactly the centre entry 127 (the zero-field color); with 9 stops that is- /// Color 5. All other entries are interpolated linearly in RGB between neighbouring stops. Imported- /// schemes (matplotlib, seaborn, Python tables) have no stops and are used as they are.- /// Instances are created by <see cref="ColorSchemeStore.Load"/> and the editor on the color scheme- /// tab, live on the UI thread, and are turned into an <c>int[]</c> palette by- /// <see cref="ColorLut.Build"/> before a simulation starts; the worker thread never touches them.- /// The <see cref="Entries"/> and <see cref="Stops"/> getters return defensive copies, so the only way to- /// change the table is <see cref="SetStop"/>. All colors are opaque RGB; alpha is ignored.- /// </remarks>- public class ColorScheme- {- /// <summary>Display name; also the JSON "name" and the basis of the file name (see <see cref="ColorSchemeStore.SafeFileName"/>).</summary>- public string Name { get; set; }-- /// <summary>Free-text provenance of the colors (JSON "origin"), e.g. the matplotlib map it was sampled from.</summary>- public string Origin { get; set; }-- /// <summary>Free-text grouping such as "sequential" or "custom" (JSON "category"); empty when unknown.</summary>- public string Category { get; set; }-- /// <summary>- /// What the scheme is meant for: <see cref="SchemeTypeField"/>, <see cref="SchemeTypeIntensity"/>- /// or "" when not specified. This is only a label saved in the file (it decides which combo box on- /// the simulation tab offers the scheme); any scheme can technically be used for either.- /// </summary>- public string SchemeType { get; set; }-- /// <summary>Full path of the JSON file the scheme was loaded from or last saved to; "" (or null) for an unsaved scheme.</summary>- public string FilePath { get; set; }-- /// <summary>- /// Creates a table-only scheme (no stops) by resampling <paramref name="colors"/> to- /// <see cref="EntryCount"/> entries; the text properties start out empty.- /// </summary>- /// <param name="schemeName">Value for <see cref="Name"/>.</param>- /// <param name="colors">At least two colors, in scale order; copied, not kept.</param>- /// <exception cref="ArgumentNullException"><paramref name="colors"/> is null.</exception>- /// <exception cref="ArgumentException">Fewer than two colors.</exception>- public ColorScheme(string schemeName, IList<Color> colors)- {- if (colors == null)- {- throw new ArgumentNullException("colors");- }- Name = schemeName;- Origin = "";- Category = "";- SchemeType = "";- FilePath = "";- _entries = ColorScheme.Resample(colors, EntryCount);- }-- /// <summary>A fresh copy of the full <see cref="EntryCount"/>-entry table (allocates on every call; use <see cref="GetEntry"/> in loops).</summary>- public Color[] Entries => (Color[])_entries.Clone();-- /// <summary>Returns table entry <paramref name="index"/> (0..254) without copying the table.</summary>- public Color GetEntry(int index)- {- return _entries[index];- }-- /// <summary>True when the scheme carries <see cref="StopCount"/> editable stops, i.e. <see cref="SetStop"/> may be called.</summary>- public bool HasStops => _stops != null;-- /// <summary>A fresh copy of the <see cref="StopCount"/> stops, or null for a table-only scheme.</summary>- public Color[] Stops => _stops == null ? null : (Color[])_stops.Clone();-- /// <summary>Linearly interpolates between the table entries at a fractional position 0..254.</summary>- /// <param name="position">Position on the entry scale; clamped to the first/last entry outside 0..254.</param>- public Color SampleAt(double position)- {- if (position <= 0.0)- {- return _entries[0];- }- if (position >= EntryCount - 1)- {- return _entries[EntryCount - 1];- }- int index = (int)Math.Floor(position);- return ColorScheme.Lerp(_entries[index], _entries[index + 1], position - index);- }-- /// <summary>Returns <see cref="Name"/>, which is what the scheme combo boxes display.</summary>- public override string ToString()- {- return Name;- }-- /// <summary>- /// Creates a stop scheme from exactly <see cref="StopCount"/> stops, given in scale order (stop 1- /// first, the middle stop in the centre, the last stop last): the table is interpolated from them,- /// <see cref="Origin"/> says it was made in the editor and <see cref="Category"/> is "custom".- /// </summary>- /// <exception cref="ArgumentException"><paramref name="stops"/> is null or not <see cref="StopCount"/> long.</exception>- public static ColorScheme FromStops(string schemeName, IList<Color> stops)- {- ColorScheme scheme = new ColorScheme(schemeName, ColorScheme.InterpolateStops(stops));- scheme.AttachStops(stops);- scheme.Origin = StopCount.ToString() + "-stop gradient made in the color scheme editor";- scheme.Category = "custom";- return scheme;- }-- /// <summary>- /// Stores a copy of <paramref name="stops"/> as the editable stops without regenerating the- /// table. Used by <see cref="ColorSchemeStore.Load"/> when a file has both "colors" and "stops", so the- /// table may differ from the stops until the first <see cref="SetStop"/>.- /// </summary>- /// <exception cref="ArgumentException"><paramref name="stops"/> is null or not <see cref="StopCount"/> long.</exception>- internal void AttachStops(IList<Color> stops)- {- if (stops == null || stops.Count != StopCount)- {- throw new ArgumentException("Exactly " + StopCount.ToString() + " stops are required.");- }- Color[] copy = new Color[StopCount];- stops.CopyTo(copy, 0);- _stops = copy;- }-- /// <summary>- /// Replaces stop <paramref name="stopIndex"/> with the RGB part of <paramref name="value"/> (alpha dropped)- /// and rebuilds the whole table from the stops.- /// </summary>- /// <param name="stopIndex">0..<see cref="StopCount"/>-1.</param>- /// <param name="value">New stop color; only R, G and B are used.</param>- /// <exception cref="InvalidOperationException">The scheme has no stops (<see cref="HasStops"/> is false).</exception>- /// <exception cref="ArgumentOutOfRangeException"><paramref name="stopIndex"/> is outside 0..<see cref="StopCount"/>-1.</exception>- public void SetStop(int stopIndex, Color value)- {- if (_stops == null)- {- throw new InvalidOperationException("This scheme has no editable stops. Use ToStopScheme first.");- }- if (stopIndex < 0 || stopIndex >= StopCount)- {- throw new ArgumentOutOfRangeException("stopIndex");- }- _stops[stopIndex] = Color.FromArgb(value.R, value.G, value.B);- _entries = ColorScheme.InterpolateStops(_stops);- }-- /// <summary>- /// Makes an editable <see cref="StopCount"/>-stop scheme from any scheme by sampling it at the stop- /// positions (k/(StopCount-1) of the 0..254 range). This is lossy: the copy is a smooth- /// approximation of the original. The result keeps this <see cref="SchemeType"/>, gets an- /// <see cref="Origin"/> naming this scheme, <see cref="Category"/> "custom" and no file path.- /// </summary>- public ColorScheme ToStopScheme(string newName)- {- Color[] stops = new Color[StopCount];- for (int i = 0; i < StopCount; i++)- {- stops[i] = SampleAt((i * (EntryCount - 1)) / (double)(StopCount - 1));- }- ColorScheme scheme = ColorScheme.FromStops(newName, stops);- scheme.Origin = StopCount.ToString() + "-stop copy of scheme '" + Name + "'";- scheme.SchemeType = SchemeType;- return scheme;- }-- /// <summary>- /// Deep copy with a new name: table, stops (if any), <see cref="Origin"/>, <see cref="Category"/> and- /// <see cref="SchemeType"/> are copied; <see cref="FilePath"/> is not (the copy is "unsaved").- /// </summary>- public ColorScheme Clone(string newName)- {- ColorScheme scheme = new ColorScheme(newName, _entries);- scheme.Origin = Origin;- scheme.Category = Category;- scheme.SchemeType = SchemeType;- if (_stops != null)- {- scheme.AttachStops(_stops);- }- return scheme;- }-- /// <summary>- /// Builds the <see cref="EntryCount"/> entries from the <see cref="StopCount"/> stops at fixed, equally- /// spaced positions (linear in RGB); stop k lands on entry k*(EntryCount-1)/(StopCount-1).- /// </summary>- /// <exception cref="ArgumentException"><paramref name="stops"/> is null or not <see cref="StopCount"/> long.</exception>- public static Color[] InterpolateStops(IList<Color> stops)- {- if (stops == null || stops.Count != StopCount)- {- throw new ArgumentException("Exactly " + StopCount.ToString() + " stops are required.");- }- Color[] entries = new Color[EntryCount];- for (int i = 0; i < EntryCount; i++)- {- // position on the stop scale: 0.0 (first stop) to StopCount - 1 (last stop);- // with 9 stops entry 127 is exactly 4.0, the middle stop.- // The last entry must stay in the last segment (StopCount - 2).- double position = (i * (StopCount - 1)) / (double)(EntryCount - 1);- int segment = (int)Math.Floor(position);- if (segment > StopCount - 2)- {- segment = StopCount - 2;- }- entries[i] = ColorScheme.Lerp(stops[segment], stops[segment + 1], position - segment);- }- return entries;- }-- /// <summary>- /// Resamples an arbitrary-length color list to exactly <paramref name="count"/> entries by linear RGB- /// interpolation (a plain copy when the lengths already match).- /// </summary>- /// <param name="source">At least two colors.</param>- /// <param name="count">Number of entries wanted; must be at least 2.</param>- /// <exception cref="ArgumentException"><paramref name="source"/> is null or has fewer than two colors.</exception>- public static Color[] Resample(IList<Color> source, int count)- {- if (source == null || source.Count < 2)- {- throw new ArgumentException("A color scheme needs at least 2 colors.");- }- Color[] result = new Color[count];- if (source.Count == count)- {- source.CopyTo(result, 0);- return result;- }- for (int i = 0; i < count; i++)- {- double position = (double)(i * (source.Count - 1)) / (count - 1);- int index = (int)Math.Floor(position);- if (index >= source.Count - 1)- {- result[i] = source[source.Count - 1];- }- else- {- result[i] = ColorScheme.Lerp(source[index], source[index + 1], position - index);- }- }- return result;- }-- /// <summary>Per-channel linear blend of two opaque colors; <paramref name="t"/> = 0 gives <paramref name="a"/>, 1 gives <paramref name="b"/>.</summary>- private static Color Lerp(Color a, Color b, double t)- {- return Color.FromArgb(ColorScheme.LerpChannel(a.R, b.R, t), ColorScheme.LerpChannel(a.G, b.G, t), ColorScheme.LerpChannel(a.B, b.B, t));- }-- /// <summary>Blends one 0..255 channel, rounding halves away from zero and clamping to 0..255.</summary>- private static int LerpChannel(int a, int b, double t)- {- int value = (int)Math.Round(a + (b - a) * t, MidpointRounding.AwayFromZero);- if (value < 0)- {- value = 0;- }- if (value > 255)- {- value = 255;- }- return value;- }-- /// <summary>Number of entries in the color table (indices 0..254).</summary>- public const int EntryCount = 255;-- /// <summary>- /// Number of fixed anchor colors in the stop editor (one Color button each, so this is tied to the- /// <c>btnColorN</c> buttons in the Form1 Designer): 9 since the Color 8/9 buttons were added to the- /// Designer (previously upgraded from 5 to 7 the same way). Odd on purpose, so the middle stop is- /// exactly the centre entry 127; see the class remarks.- /// </summary>- public const int StopCount = 9;-- /// <summary>The <see cref="EntryCount"/> table entries; replaced wholesale by <see cref="SetStop"/>, never null.</summary>- private Color[] _entries;-- /// <summary>The <see cref="StopCount"/> editable stops, or null for a table-only scheme.</summary>- private Color[] _stops;-- /// <summary><see cref="SchemeType"/> value for schemes that color the signed field (-1..+1).</summary>- public const string SchemeTypeField = "field";-- /// <summary><see cref="SchemeType"/> value for schemes that color the accumulated intensity (0..max).</summary>- public const string SchemeTypeIntensity = "intensity";- }-}diff --git a/Wave_Dude_2D/ColorSchemeStore.cs b/Wave_Dude_2D/ColorSchemeStore.csdeleted file mode 100644index 6f8fafc..0000000--- a/Wave_Dude_2D/ColorSchemeStore.cs+++ /dev/null@@ -1,403 +0,0 @@-using System;-using System.Collections;-using System.Collections.Generic;-using System.Drawing;-using System.Globalization;-using System.IO;-using System.Text;-using System.Web.Script.Serialization;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Reads and writes <see cref="ColorScheme"/> objects as JSON files (one file per scheme, e.g. in the- /// scheme folder).- /// </summary>- /// <remarks>- /// Static-only helper (private constructor). File format, the same as the files exported from Python- /// (e.g. in its <c>color_schemes</c> folder): an object with "name", "origin", optional "category" and- /// "scheme_type" ("field" or "intensity"), "bits_per_channel" (always 8), "entry_count"- /// (<see cref="ColorScheme.EntryCount"/>) and a "colors" list of <c>[r,g,b]</c> triplets, plus, only- /// for schemes made in the stop editor, a "stops" list of <see cref="ColorScheme.StopCount"/> triplets.- /// Reading uses <see cref="JavaScriptSerializer"/>; writing emits the text by hand so the file stays- /// human-readable. Called only from the UI thread (color scheme tab and start-up).- /// </remarks>- public sealed class ColorSchemeStore- {- /// <summary>Prevents instantiation; all members are static.</summary>- private ColorSchemeStore()- {- }-- /// <summary>- /// The program's own color scheme folder. While developing (the exe runs from <c>bin\Debug</c>- /// inside the solution) this is the <see cref="SchemeFolderName"/> folder of the repository itself,- /// so edits end up in the project; in a deployed program it is the <see cref="SchemeFolderName"/>- /// folder next to the exe. The folder is created when it does not exist.- /// </summary>- /// <returns>- /// The folder path. It walks up to five directory levels from the base directory looking for a- /// <c>*.sln</c> (the solution file at the repository root, which is where the tracked- /// <see cref="SchemeFolderName"/> lives; the original looked for its <c>*.vbproj</c>, which no- /// longer exists above the C# exe) and prefers a <see cref="SchemeFolderName"/> folder beside it.- /// From <c>Wave_Dude_2D\bin\Debug</c> that is three levels up. Any I/O error is swallowed and the- /// default path is returned, possibly uncreated: the caller checks whether the folder exists.- /// </returns>- public static string FindDefaultFolder()- {- string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;- string folder = Path.Combine(baseDirectory, SchemeFolderName);- try- {- DirectoryInfo probe = new DirectoryInfo(baseDirectory);- for (int level = 0; level <= 4 && probe != null; level++)- {- if (probe.GetFiles("*.sln").Length > 0)- {- string candidate = Path.Combine(probe.FullName, SchemeFolderName);- if (Directory.Exists(candidate))- {- folder = candidate;- }- break;- }- probe = probe.Parent;- }- if (!Directory.Exists(folder))- {- Directory.CreateDirectory(folder);- }- }- catch- {- // the caller checks whether the folder exists- }- return folder;- }-- /// <summary>- /// Reads one scheme file. The table comes from "colors" (resampled to 255 entries) when that list has at- /// least two entries, otherwise it is interpolated from "stops"; a "stops" list is attached as editable- /// stops only if it has exactly <see cref="ColorScheme.StopCount"/> entries (otherwise it is ignored).- /// "name" falls back to the file name, "scheme_type" is normalised (see <see cref="NormalizeSchemeType"/>),- /// and <see cref="ColorScheme.FilePath"/> is set to <paramref name="filePath"/>.- /// </summary>- /// <param name="filePath">Full path of the JSON file.</param>- /// <exception cref="InvalidDataException">The file is not a JSON object, has no usable color list or contains malformed triplets.</exception>- public static ColorScheme Load(string filePath)- {- string json = File.ReadAllText(filePath, Encoding.UTF8);- Dictionary<string, object> root = new JavaScriptSerializer- {- MaxJsonLength = int.MaxValue- }.DeserializeObject(json) as Dictionary<string, object>;- if (root == null)- {- throw new InvalidDataException("Not a color scheme file (a JSON object was expected).");- }- string schemeName = ColorSchemeStore.GetString(root, "name", Path.GetFileNameWithoutExtension(filePath));- List<Color> colors = null;- if (root.ContainsKey("colors"))- {- colors = ColorSchemeStore.ParseColorList(root["colors"]);- }- List<Color> stops = null;- if (root.ContainsKey("stops"))- {- stops = ColorSchemeStore.ParseColorList(root["stops"]);- }- if (stops != null && stops.Count != ColorScheme.StopCount)- {- stops = null;- }- ColorScheme scheme;- if (colors != null && colors.Count >= 2)- {- scheme = new ColorScheme(schemeName, colors);- }- else if (stops != null)- {- scheme = ColorScheme.FromStops(schemeName, stops);- }- else- {- throw new InvalidDataException("The file contains no usable 'colors' list.");- }- if (stops != null)- {- scheme.AttachStops(stops);- }- scheme.Origin = ColorSchemeStore.GetString(root, "origin", scheme.Origin);- scheme.Category = ColorSchemeStore.GetString(root, "category", scheme.Category);- scheme.SchemeType = ColorSchemeStore.NormalizeSchemeType(ColorSchemeStore.GetString(root, "scheme_type", scheme.SchemeType));- scheme.FilePath = filePath;- return scheme;- }-- /// <summary>- /// Loads every <c>*.json</c> file in <paramref name="folder"/>, in case-insensitive file name order.- /// Files that fail to load are skipped and reported as "file: message" lines in <paramref name="errors"/>.- /// </summary>- /// <param name="folder">Folder to scan; a null, empty or missing folder yields an empty list.</param>- /// <param name="errors">Receives one line per unreadable file; may be null to discard them.</param>- /// <returns>The schemes that loaded successfully (never null).</returns>- public static List<ColorScheme> LoadFolder(string folder, List<string> errors)- {- List<ColorScheme> schemes = new List<ColorScheme>();- if (string.IsNullOrEmpty(folder) || !Directory.Exists(folder))- {- return schemes;- }- List<string> files = new List<string>(Directory.GetFiles(folder, "*.json"));- files.Sort(StringComparer.OrdinalIgnoreCase);- foreach (string file in files)- {- try- {- schemes.Add(ColorSchemeStore.Load(file));- }- catch (Exception ex)- {- if (errors != null)- {- errors.Add(Path.GetFileName(file) + ": " + ex.Message);- }- }- }- return schemes;- }-- /// <summary>- /// Writes <paramref name="scheme"/> as a UTF-8 (no BOM) JSON file, eight color triplets per line, with- /// "category" / "scheme_type" omitted when empty and "stops" present only for stop schemes. Creates the- /// target directory, writes to <c><filePath>.tmp</c> first and then replaces the target, and finally- /// sets <see cref="ColorScheme.FilePath"/> on the scheme.- /// </summary>- /// <param name="scheme">Scheme to write.</param>- /// <param name="filePath">Destination file path (usually from <see cref="PathFor"/>).</param>- /// <exception cref="ArgumentNullException"><paramref name="scheme"/> is null.</exception>- public static void Save(ColorScheme scheme, string filePath)- {- if (scheme == null)- {- throw new ArgumentNullException("scheme");- }- StringBuilder json = new StringBuilder();- json.AppendLine("{");- json.AppendLine(" \"name\": " + ColorSchemeStore.Quote(scheme.Name) + ",");- json.AppendLine(" \"origin\": " + ColorSchemeStore.Quote(scheme.Origin) + ",");- if (!string.IsNullOrEmpty(scheme.Category))- {- json.AppendLine(" \"category\": " + ColorSchemeStore.Quote(scheme.Category) + ",");- }- if (!string.IsNullOrEmpty(scheme.SchemeType))- {- json.AppendLine(" \"scheme_type\": " + ColorSchemeStore.Quote(scheme.SchemeType) + ",");- }- json.AppendLine(" \"bits_per_channel\": 8,");- json.AppendLine(" \"entry_count\": " + ColorScheme.EntryCount.ToString(CultureInfo.InvariantCulture) + ",");- if (scheme.HasStops)- {- List<string> stopTriplets = new List<string>();- foreach (Color stop in scheme.Stops)- {- stopTriplets.Add(ColorSchemeStore.FormatRgb(stop));- }- json.AppendLine(" \"stops\": [" + string.Join(", ", stopTriplets) + "],");- }- Color[] entries = scheme.Entries;- json.AppendLine(" \"colors\": [");- for (int rowStart = 0; rowStart < entries.Length; rowStart += 8)- {- int rowEnd = Math.Min(rowStart + 7, entries.Length - 1);- List<string> rowTriplets = new List<string>();- for (int k = rowStart; k <= rowEnd; k++)- {- rowTriplets.Add(ColorSchemeStore.FormatRgb(entries[k]));- }- json.Append(" ");- json.Append(string.Join(", ", rowTriplets));- if (rowEnd < entries.Length - 1)- {- json.Append(",");- }- json.AppendLine();- }- json.AppendLine(" ]");- json.AppendLine("}");- string directoryName = Path.GetDirectoryName(filePath);- if (!string.IsNullOrEmpty(directoryName))- {- Directory.CreateDirectory(directoryName);- }- // write to a temporary file first so a failed save never leaves a half-written scheme behind- string tempPath = filePath + ".tmp";- File.WriteAllText(tempPath, json.ToString(), new UTF8Encoding(false));- if (File.Exists(filePath))- {- File.Delete(filePath);- }- File.Move(tempPath, filePath);- scheme.FilePath = filePath;- }-- /// <summary>- /// Turns a scheme name into a file name (without extension): invalid file name characters become- /// '_', surrounding whitespace and trailing dots are removed.- /// </summary>- /// <returns>The sanitised name, or "color_scheme" when nothing usable is left.</returns>- public static string SafeFileName(string schemeName)- {- if (string.IsNullOrEmpty(schemeName))- {- return "color_scheme";- }- char[] invalidChars = Path.GetInvalidFileNameChars();- StringBuilder safeName = new StringBuilder();- foreach (char c in schemeName.Trim())- {- safeName.Append(Array.IndexOf(invalidChars, c) >= 0 ? '_' : c);- }- string result = safeName.ToString().Trim().TrimEnd('.');- return result.Length == 0 ? "color_scheme" : result;- }-- /// <summary>The file path a scheme named <paramref name="schemeName"/> is stored at in <paramref name="folder"/>: <see cref="SafeFileName"/> plus ".json".</summary>- public static string PathFor(string folder, string schemeName)- {- return Path.Combine(folder, ColorSchemeStore.SafeFileName(schemeName) + ".json");- }-- /// <summary>Maps a raw "scheme_type" value to <see cref="ColorScheme.SchemeTypeField"/> or <see cref="ColorScheme.SchemeTypeIntensity"/> (trimmed, case-insensitive); anything else, including null, becomes "".</summary>- private static string NormalizeSchemeType(string value)- {- if (value == null)- {- return "";- }- string normalized = value.Trim().ToLowerInvariant();- if (normalized == ColorScheme.SchemeTypeField || normalized == ColorScheme.SchemeTypeIntensity)- {- return normalized;- }- return "";- }-- /// <summary>- /// Reads <paramref name="key"/> from the JSON object as a string (non-string scalars are converted with- /// the invariant culture), or <paramref name="fallback"/> when the key is missing or null.- /// </summary>- private static string GetString(Dictionary<string, object> root, string key, string fallback)- {- object value;- if (root.TryGetValue(key, out value) && value != null)- {- return Convert.ToString(value, CultureInfo.InvariantCulture);- }- return fallback;- }-- /// <summary>- /// Converts a deserialised JSON list of <c>[r,g,b]</c> lists into colors. Each inner list needs at least- /// three numbers (extra values are ignored); non-integers are rounded and every channel is clamped to- /// 0..255. Strings are rejected even though they enumerate as characters.- /// </summary>- /// <param name="node">The value of "colors" or "stops" as returned by <see cref="JavaScriptSerializer"/>.</param>- /// <exception cref="InvalidDataException">The node or one of its items is not a list, or a triplet is too short.</exception>- private static List<Color> ParseColorList(object node)- {- IEnumerable items = node as IEnumerable;- if (items == null || node is string)- {- throw new InvalidDataException("Expected a list of [r,g,b] triplets.");- }- List<Color> colors = new List<Color>();- foreach (object item in items)- {- IEnumerable channels = item as IEnumerable;- if (channels == null || item is string)- {- throw new InvalidDataException("Expected a list of [r,g,b] triplets.");- }- List<int> values = new List<int>();- foreach (object channel in channels)- {- values.Add(Convert.ToInt32(channel, CultureInfo.InvariantCulture));- }- if (values.Count < 3)- {- throw new InvalidDataException("A color needs three values [r,g,b].");- }- colors.Add(Color.FromArgb(ColorSchemeStore.Clamp255(values[0]), ColorSchemeStore.Clamp255(values[1]), ColorSchemeStore.Clamp255(values[2])));- }- return colors;- }-- /// <summary>Clamps a channel value to 0..255.</summary>- private static int Clamp255(int v)- {- if (v < 0)- {- return 0;- }- if (v > 255)- {- return 255;- }- return v;- }-- /// <summary>Formats a color as the JSON triplet <c>[r,g,b]</c> (no spaces, alpha dropped).</summary>- private static string FormatRgb(Color c)- {- return string.Format(CultureInfo.InvariantCulture, "[{0},{1},{2}]", c.R, c.G, c.B);- }-- /// <summary>Returns <paramref name="text"/> as a double-quoted JSON string literal (null becomes <c>""</c>); escapes quotes, backslashes and control characters, leaves non-ASCII as UTF-8.</summary>- private static string Quote(string text)- {- if (text == null)- {- return "\"\"";- }- StringBuilder quoted = new StringBuilder();- quoted.Append('"');- foreach (char c in text)- {- switch (c)- {- case '"':- quoted.Append("\\\"");- break;- case '\\':- quoted.Append("\\\\");- break;- case '\t':- quoted.Append("\\t");- break;- case '\n':- quoted.Append("\\n");- break;- case '\r':- quoted.Append("\\r");- break;- default:- if (c < ' ')- {- quoted.Append("\\u").Append(((int)c).ToString("x4", CultureInfo.InvariantCulture));- }- else- {- quoted.Append(c);- }- break;- }- }- quoted.Append('"');- return quoted.ToString();- }-- /// <summary>Name of the folder with the color schemes that belongs to the program, looked for next to the executable / solution: "ColorSchemeList".</summary>- public const string SchemeFolderName = "ColorSchemeList";- }-}diff --git a/Wave_Dude_2D/Form1.Colors.cs b/Wave_Dude_2D/Form1.Colors.csdeleted file mode 100644index 9f91755..0000000--- a/Wave_Dude_2D/Form1.Colors.cs+++ /dev/null@@ -1,764 +0,0 @@-using System;-using System.Collections.Generic;-using System.Drawing;-using System.Drawing.Drawing2D;-using System.Drawing.Imaging;-using System.IO;-using System.Windows.Forms;-using Microsoft.VisualBasic;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Color scheme tab: scheme list, stop editor and preview bar.- /// </summary>- /// <remarks>- /// Two schemes matter here: <c>_previewScheme</c> is the (read-only) list selection and <c>_current</c>- /// is the editable copy loaded from it. The editor always shows the preview when one is selected,- /// otherwise the current scheme (<see cref="DisplayedScheme"/>). Everything in this file runs on- /// the UI thread; the simulation never sees these objects, only the <see cref="ColorLut"/> built- /// from them when a run starts.- /// </remarks>- public partial class Form1- {- /// <summary>Lets the user pick a scheme folder in a folder dialog and reloads the list from it.</summary>- private void btbChooseFFolder_Click(object sender, EventArgs e)- {- using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())- {- folderBrowserDialog.Description = "Choose the folder that contains the color scheme (.json) files";- if (Directory.Exists(txtSchemeFolder.Text))- {- folderBrowserDialog.SelectedPath = txtSchemeFolder.Text;- }- if (folderBrowserDialog.ShowDialog(this) == DialogResult.OK)- {- txtSchemeFolder.Text = folderBrowserDialog.SelectedPath;- LoadSchemeList();- }- }- }-- /// <summary>Enter in the folder box reloads the scheme list from the typed folder (and swallows the beep).</summary>- private void txtSchemeFolder_KeyDown(object sender, KeyEventArgs e)- {- if (e.KeyCode == Keys.Return)- {- e.SuppressKeyPress = true;- LoadSchemeList();- }- }-- /// <summary>- /// Reloads all scheme files from the folder in <c>txtSchemeFolder</c> and rebuilds the list view.- /// Also sorts by the current column, regenerates the thumbnails (disposing the old bitmaps),- /// refills the field/intensity combo boxes on the simulation tab, reports unreadable files in one- /// message box and clears the preview selection. The current (editable) scheme is left alone.- /// </summary>- private void LoadSchemeList()- {- string folder = txtSchemeFolder.Text.Trim();- if (!Directory.Exists(folder))- {- MessageBox.Show(this, "The folder '" + folder + "' does not exist.", "Color schemes", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- return;- }- List<string> errors = new List<string>();- _schemes = ColorSchemeStore.LoadFolder(folder, errors);- SortSchemes(_schemes, _schemeSortColumn, _schemeSortAscending);- ListView1.BeginUpdate();- try- {- ListView1.Items.Clear();- _thumbs.Images.Clear();- foreach (Bitmap thumb in _thumbBitmaps)- {- thumb.Dispose();- }- _thumbBitmaps.Clear();- foreach (ColorScheme scheme in _schemes)- {- Bitmap thumb = Form1.MakeThumbnail(scheme);- _thumbBitmaps.Add(thumb);- _thumbs.Images.Add(thumb);- ListViewItem item = new ListViewItem(scheme.Name, _thumbs.Images.Count - 1);- item.SubItems.Add(scheme.HasStops ? (ColorScheme.StopCount.ToString() + "-stop") : "table");- item.SubItems.Add(string.IsNullOrEmpty(scheme.SchemeType) ? "-" : scheme.SchemeType);- item.Tag = scheme;- ListView1.Items.Add(item);- }- }- finally- {- ListView1.EndUpdate();- }- UpdateSchemeListSortHeaders();- if (errors.Count > 0)- {- // Show at most 8 file errors; the rest is summarised as a count.- int shown = Math.Min(errors.Count, 8);- string message = string.Join("\r\n", errors.GetRange(0, shown));- if (errors.Count > shown)- {- message = message + "\r\n... and " + (errors.Count - shown).ToString() + " more";- }- MessageBox.Show(this, "Some files could not be read as color schemes:\r\n\r\n" + message, "Color schemes", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- RefreshSchemeCombos();- _previewScheme = null;- RefreshEditorState();- }-- /// <summary>- /// Sorts <paramref name="schemes"/> in place, case-insensitively: column 0 by name, any other- /// column by scheme type and then name. <paramref name="ascending"/> false reverses the result.- /// </summary>- /// <param name="schemes">The list to sort.</param>- /// <param name="sortColumn">List view column index; 0 = name, otherwise type then name.</param>- /// <param name="ascending">False reverses the sorted order.</param>- private void SortSchemes(List<ColorScheme> schemes, int sortColumn, bool ascending)- {- if (sortColumn == 0)- {- schemes.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));- }- else- {- schemes.Sort((a, b) =>- {- int byType = string.Compare(a.SchemeType, b.SchemeType, StringComparison.OrdinalIgnoreCase);- return byType != 0 ? byType : string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase);- });- }- if (!ascending)- {- schemes.Reverse();- }- }-- /// <summary>- /// Clicking the Scheme (0) or Type (2) header sorts by that column, or flips the direction when it- /// is already the sort column; the Kind column is ignored. Sorting re-reads the folder from disk.- /// </summary>- private void ListView1_ColumnClick(object sender, ColumnClickEventArgs e)- {- if (e.Column != 0 && e.Column != 2)- {- return;- }- if (e.Column == _schemeSortColumn)- {- _schemeSortAscending = !_schemeSortAscending;- }- else- {- _schemeSortColumn = e.Column;- _schemeSortAscending = true;- }- LoadSchemeList();- }-- /// <summary>Appends a " ^" / " v" direction marker to the header of the column the list is sorted by.</summary>- private void UpdateSchemeListSortHeaders()- {- if (ListView1.Columns.Count < 3)- {- return;- }- string arrow = _schemeSortAscending ? " ^" : " v";- ListView1.Columns[0].Text = "Scheme" + (_schemeSortColumn == 0 ? arrow : "");- ListView1.Columns[2].Text = "Type" + (_schemeSortColumn == 2 ? arrow : "");- }-- /// <summary>Selecting a list row previews that scheme in the editor; clearing the selection shows the current scheme again.</summary>- private void ListView1_SelectedIndexChanged(object sender, EventArgs e)- {- _previewScheme = ListView1.SelectedItems.Count == 0 ? null : (ColorScheme)ListView1.SelectedItems[0].Tag;- RefreshEditorState();- }-- /// <summary>Double-clicking a row loads it as the current scheme.</summary>- private void ListView1_DoubleClick(object sender, EventArgs e)- {- LoadPreviewedScheme();- }-- /// <summary>Loads the previewed scheme as the current one, or asks the user to select a row first.</summary>- private void btnLoadScheme_Click(object sender, EventArgs e)- {- if (_previewScheme == null)- {- MessageBox.Show(this, "Select a scheme in the list first.", "Load scheme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- }- else- {- LoadPreviewedScheme();- }- }-- /// <summary>Escape in the list clears the selection, which ends the preview.</summary>- private void ListView1_KeyDown(object sender, KeyEventArgs e)- {- if (e.KeyCode == Keys.Escape)- {- ListView1.SelectedItems.Clear();- e.Handled = true;- }- }-- /// <summary>- /// Makes a copy of the previewed scheme the current (editable) one, after asking to discard unsaved- /// changes. The copy keeps the file path of the original (<see cref="ColorScheme.Clone"/> does not),- /// so a later Save overwrites that file. Clears the stop selection and the list selection.- /// </summary>- /// <returns>False if there is no preview or the user kept the unsaved current scheme.</returns>- private bool LoadPreviewedScheme()- {- if (_previewScheme == null)- {- return false;- }- if (!ConfirmDiscardChanges())- {- return false;- }- ColorScheme previewScheme = _previewScheme;- _current = previewScheme.Clone(previewScheme.Name);- _current.FilePath = previewScheme.FilePath;- _dirty = false;- _selectedStop = -1;- ListView1.SelectedItems.Clear(); // ends the preview; also refreshes the display- RefreshEditorState();- return true;- }-- /// <summary>Asks whether unsaved edits of the current scheme may be thrown away.</summary>- /// <returns>True if there are no unsaved changes or the user answered Yes.</returns>- private bool ConfirmDiscardChanges()- {- if (!_dirty)- {- return true;- }- DialogResult answer = MessageBox.Show(this, "The current color scheme '" + _current.Name + "' has unsaved changes. Discard them?", "Unsaved changes", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);- return answer == DialogResult.Yes;- }-- /// <summary>- /// Clicking one of the <see cref="ColorScheme.StopCount"/> Color buttons selects that stop for editing and- /// loads its color into the picker. While previewing, the preview is first loaded as the current scheme- /// (may be cancelled). A table-only scheme is converted to an unsaved- /// <see cref="ColorScheme.StopCount"/>-stop approximation after confirmation.- /// </summary>- private void StopButton_Click(object sender, EventArgs e)- {- int stopIndex = Array.IndexOf(_stopButtons, (Button)sender);- if (stopIndex < 0)- {- return;- }- // clicking a Color button while a list item is only previewed loads that scheme first- if (_previewScheme != null && !LoadPreviewedScheme())- {- return;- }- if (_current == null)- {- return;- }- // an imported scheme is a full table without stops: editing it means making a stop-based approximation- if (!_current.HasStops)- {- DialogResult answer = MessageBox.Show(this, "The scheme '" + _current.Name + "' is a full table of 255 colors without " + ColorScheme.StopCount.ToString() + " editable stops.\r\n\r\nEditing it creates a smooth " + ColorScheme.StopCount.ToString() + "-stop approximation as a new, unsaved scheme (the original file stays unchanged). Continue?", "Edit scheme", MessageBoxButtons.YesNo, MessageBoxIcon.Question);- if (answer != DialogResult.Yes)- {- return;- }- _current = _current.ToStopScheme(_current.Name + " (" + ColorScheme.StopCount.ToString() + "-stop)");- _dirty = true;- }- _selectedStop = stopIndex;- Color color = _current.Stops[stopIndex];- _picker.OriginalColor = color;- _picker.SelectedColor = color;- RefreshEditorState();- }-- /// <summary>- /// A color change in the picker writes the new color into the selected stop of the current scheme- /// (which regenerates its whole table), marks it dirty and repaints. Raised by- /// <see cref="ColorPickerControl.ColorChanged"/>; ignored when no editable stop is selected.- /// </summary>- private void Picker_ColorChanged(object sender, EventArgs e)- {- if (_current == null || !_current.HasStops || _selectedStop < 0)- {- return;- }- _current.SetStop(_selectedStop, _picker.SelectedColor);- _dirty = true;- RefreshEditorState();- }-- /// <summary>- /// Saves the current scheme to its own file, or behaves like Save As when it has never been saved.- /// Reloads the list afterwards so the list reflects the file.- /// </summary>- private void btnSaveCurrentScheme_Click(object sender, EventArgs e)- {- if (_current == null)- {- return;- }- if (string.IsNullOrEmpty(_current.FilePath))- {- SaveAsNew();- return;- }- try- {- ColorSchemeStore.Save(_current, _current.FilePath);- _dirty = false;- }- catch (Exception ex)- {- MessageBox.Show(this, "The scheme could not be saved:\r\n" + ex.Message, "Save scheme", MessageBoxButtons.OK, MessageBoxIcon.Hand);- return;- }- ReloadListAfterSave();- }-- /// <summary>Saves the current scheme under a new name (see <see cref="SaveAsNew"/>).</summary>- private void btnSaveAsColorScheme_Click(object sender, EventArgs e)- {- SaveAsNew();- }-- /// <summary>- /// Asks for a name (VB <see cref="Interaction.InputBox"/>), writes a copy of the current scheme as- /// <c><folder>/<safe name>.json</c> in the scheme folder (confirming an overwrite) and makes- /// that copy the current scheme. A stop scheme without a category is saved as "custom".- /// </summary>- private void SaveAsNew()- {- if (_current == null)- {- return;- }- string folder = txtSchemeFolder.Text.Trim();- if (!Directory.Exists(folder))- {- MessageBox.Show(this, "Choose an existing scheme folder first.", "Save scheme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- string newName = Interaction.InputBox("Name for the new color scheme:", "Save as new scheme", _current.Name, -1, -1).Trim();- if (newName.Length == 0)- {- return;- }- string targetPath = ColorSchemeStore.PathFor(folder, newName);- if (File.Exists(targetPath))- {- DialogResult answer = MessageBox.Show(this, "A scheme file named '" + Path.GetFileName(targetPath) + "' already exists. Overwrite it?", "Save scheme", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);- if (answer != DialogResult.Yes)- {- return;- }- }- try- {- ColorScheme copy = _current.Clone(newName);- if (copy.HasStops && string.IsNullOrEmpty(copy.Category))- {- copy.Category = "custom";- }- ColorSchemeStore.Save(copy, targetPath);- _current = copy;- _dirty = false;- }- catch (Exception ex)- {- MessageBox.Show(this, "The scheme could not be saved:\r\n" + ex.Message, "Save scheme", MessageBoxButtons.OK, MessageBoxIcon.Hand);- return;- }- ReloadListAfterSave();- }-- /// <summary>Re-reads the scheme folder after a save so the list and combo boxes show the new file.</summary>- private void ReloadListAfterSave()- {- LoadSchemeList();- }-- /// <summary>- /// Renames the previewed scheme: prompts for a new name, saves the scheme under the new file name,- /// deletes the old file and, if the current scheme was loaded from that file, renames it too.- /// Refuses to overwrite a different existing file. Reloads the list and reselects the renamed row.- /// </summary>- private void btnRenameColorScheme_Click(object sender, EventArgs e)- {- if (_previewScheme == null)- {- MessageBox.Show(this, "Select a scheme in the list first.", "Rename color scheme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- ColorScheme previewScheme = _previewScheme;- string oldName = previewScheme.Name;- string oldPath = previewScheme.FilePath;- string newName = oldName;- if (!PromptForText("Rename color scheme", "New name for '" + oldName + "':", oldName, ref newName))- {- return;- }- newName = newName.Trim();- if (newName.Length == 0 || newName == oldName)- {- return;- }- string folder = string.IsNullOrEmpty(oldPath) ? txtSchemeFolder.Text.Trim() : Path.GetDirectoryName(oldPath);- string newPath = ColorSchemeStore.PathFor(folder, newName);- if (!string.Equals(newPath, oldPath, StringComparison.OrdinalIgnoreCase) && File.Exists(newPath))- {- MessageBox.Show(this, "A scheme file named '" + Path.GetFileName(newPath) + "' already exists.", "Rename color scheme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- return;- }- try- {- previewScheme.Name = newName;- ColorSchemeStore.Save(previewScheme, newPath);- if (!string.IsNullOrEmpty(oldPath) && !string.Equals(oldPath, newPath, StringComparison.OrdinalIgnoreCase) && File.Exists(oldPath))- {- File.Delete(oldPath);- }- if (_current != null && !string.IsNullOrEmpty(oldPath) && string.Equals(_current.FilePath, oldPath, StringComparison.OrdinalIgnoreCase))- {- _current.Name = newName;- _current.FilePath = newPath;- }- }- catch (Exception ex)- {- MessageBox.Show(this, "The scheme could not be renamed:\r\n" + ex.Message, "Rename color scheme", MessageBoxButtons.OK, MessageBoxIcon.Hand);- return;- }- LoadSchemeList();- SelectSchemeInList(newName);- ToolStripStatusLabel1.Text = "Color scheme '" + oldName + "' renamed to '" + newName + "'.";- }-- /// <summary>- /// Deletes the previewed scheme's file from disk after confirmation. If the current scheme came from- /// that file it stays loaded but loses its path (the next Save becomes Save As). Reloads the list.- /// </summary>- private void btnDeleteColorScheme_Click(object sender, EventArgs e)- {- if (_previewScheme == null)- {- MessageBox.Show(this, "Select a scheme in the list first.", "Delete color scheme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- ColorScheme previewScheme = _previewScheme;- string name = previewScheme.Name;- string filePath = previewScheme.FilePath;- if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath))- {- MessageBox.Show(this, "That scheme has no file on disk (nothing to delete).", "Delete color scheme", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- DialogResult answer = MessageBox.Show(this, "Permanently delete the color scheme '" + name + "'?\r\n\r\n" + filePath, "Delete color scheme", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);- if (answer != DialogResult.Yes)- {- return;- }- try- {- File.Delete(filePath);- }- catch (Exception ex)- {- MessageBox.Show(this, "The scheme could not be deleted:\r\n" + ex.Message, "Delete color scheme", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- return;- }- if (_current != null && string.Equals(_current.FilePath, filePath, StringComparison.OrdinalIgnoreCase))- {- _current.FilePath = null;- }- _previewScheme = null;- LoadSchemeList();- ToolStripStatusLabel1.Text = "Color scheme '" + name + "' deleted.";- }-- /// <summary>Selects and scrolls to the first list row whose scheme name matches <paramref name="name"/> (case-insensitive); does nothing if there is none.</summary>- private void SelectSchemeInList(string name)- {- foreach (ListViewItem item in ListView1.Items)- {- ColorScheme scheme = item.Tag as ColorScheme;- if (scheme != null && string.Equals(scheme.Name, name, StringComparison.OrdinalIgnoreCase))- {- item.Selected = true;- item.EnsureVisible();- break;- }- }- }-- /// <summary>- /// Checking the "field" or "intensity" radio button changes the type of the current scheme and marks it- /// dirty. The radio buttons say what the current scheme is meant for; the choice is saved in the scheme- /// file as <c>"scheme_type": "field"</c> or <c>"scheme_type": "intensity"</c>- /// (<see cref="ColorScheme.SchemeTypeField"/> / <see cref="ColorScheme.SchemeTypeIntensity"/>) and is shown- /// again when the file is loaded. Ignored while <see cref="RefreshEditorState"/> is setting the radios- /// programmatically (<c>_updatingRadios</c>), while previewing, and for the radio that just became unchecked.- /// </summary>- private void SchemeType_CheckedChanged(object sender, EventArgs e)- {- if (_updatingRadios)- {- return;- }- if (_current == null || _previewScheme != null)- {- return;- }- RadioButton radio = (RadioButton)sender;- if (!radio.Checked)- {- return;- }- string schemeType = radio == radSchemeTypeField ? ColorScheme.SchemeTypeField : ColorScheme.SchemeTypeIntensity;- if (_current.SchemeType != schemeType)- {- _current.SchemeType = schemeType;- _dirty = true;- RefreshEditorState();- }- }-- /// <summary>The scheme shown in the editor: the previewed list selection if any, otherwise the current one.</summary>- /// <returns>Null when nothing is previewed and no scheme has been loaded.</returns>- private ColorScheme DisplayedScheme()- {- return _previewScheme ?? _current;- }-- /// <summary>- /// Brings every editor control in line with the current/preview state: name box (with an- /// "(unsaved changes)" suffix), the <see cref="ColorScheme.StopCount"/> stop buttons (color, contrasting- /// text, thick border on the selected stop), picker enabling and caption, Load/Save button enabling, the- /// type radios (set with <c>_updatingRadios</c> raised so <see cref="SchemeType_CheckedChanged"/> ignores- /// it) and finally a repaint of the preview bar.- /// </summary>- private void RefreshEditorState()- {- bool previewing = _previewScheme != null;- ColorScheme scheme = DisplayedScheme();- bool hasCurrent = _current != null;- bool editingStop = hasCurrent && !previewing && _selectedStop >= 0;- if (hasCurrent)- {- txtCurrentColorScheme.Text = _current.Name + (_dirty ? " (unsaved changes)" : "");- }- else- {- txtCurrentColorScheme.Text = "(none loaded)";- }- for (int k = 0; k < ColorScheme.StopCount; k++)- {- Button button = _stopButtons[k];- button.Enabled = scheme != null;- if (scheme != null)- {- Color color = Form1.StopColorOf(scheme, k);- button.BackColor = color;- button.ForeColor = Form1.ContrastColor(color);- }- else- {- button.BackColor = SystemColors.Control;- button.ForeColor = SystemColors.ControlText;- }- button.FlatAppearance.BorderSize = (editingStop && k == _selectedStop) ? 4 : 1;- }- _picker.Enabled = editingStop;- if (editingStop)- {- lblColorPicker.Text = "Color Picker - editing Color " + (_selectedStop + 1).ToString() + Form1.StopRole(_selectedStop);- }- else- {- lblColorPicker.Text = "Color Picker (click a Color button to edit it)";- }- btnLoadScheme.Enabled = previewing;- btnSaveCurrentScheme.Enabled = hasCurrent && _dirty;- btnSaveAsColorScheme.Enabled = hasCurrent;- // radio buttons show the type of the displayed scheme; they can only be changed for the current scheme- _updatingRadios = true;- try- {- string schemeType = scheme == null ? "" : scheme.SchemeType;- radSchemeTypeField.Checked = schemeType == ColorScheme.SchemeTypeField;- radSchemeTypeIntensity.Checked = schemeType == ColorScheme.SchemeTypeIntensity;- radSchemeTypeField.Enabled = hasCurrent && !previewing;- radSchemeTypeIntensity.Enabled = hasCurrent && !previewing;- }- finally- {- _updatingRadios = false;- }- pnlScheme.Invalidate();- }-- /// <summary>- /// Paints the vertical preview bar: entry 0 (Color 1) at the top, the last entry (last Color) at the- /// bottom and the middle entry (centre Color) half-way, stretched from a 1 x <see cref="ColorScheme.EntryCount"/>- /// strip without smoothing; white-on-black tick marks at the <see cref="ColorScheme.StopCount"/> stop- /// positions (a full-width thick line for the stop being edited) and the scale labels for the scheme type- /// ("-1 / 0 / +1" for field, "0 / max" for intensity). A plain light fill when there is nothing to show.- /// </summary>- private void pnlScheme_Paint(object sender, PaintEventArgs e)- {- ColorScheme scheme = DisplayedScheme();- Graphics g = e.Graphics;- Rectangle bar = pnlScheme.ClientRectangle;- if (scheme == null)- {- g.Clear(SystemColors.ControlLight);- return;- }- // vertical gradient: top = entry 0 (Color 1), bottom = entry EntryCount - 1 (last Color), middle = entry EntryCount / 2 (centre Color)- using (Bitmap strip = new Bitmap(1, ColorScheme.EntryCount, PixelFormat.Format32bppArgb))- {- for (int i = 0; i < ColorScheme.EntryCount; i++)- {- strip.SetPixel(0, i, scheme.GetEntry(i));- }- g.InterpolationMode = InterpolationMode.NearestNeighbor;- g.PixelOffsetMode = PixelOffsetMode.Half;- g.DrawImage(strip, bar);- }- // tick marks at the stop positions (dark and light so they show on any color)- bool editingStop = _previewScheme == null && _selectedStop >= 0;- for (int k = 0; k < ColorScheme.StopCount; k++)- {- // Stop k sits at fraction k/(StopCount - 1) of the bar height (StopCount stops = StopCount - 1 segments).- int y = (int)Math.Round((k * (bar.Height - 1)) / (double)(ColorScheme.StopCount - 1));- bool highlighted = editingStop && k == _selectedStop;- int tickLength = highlighted ? bar.Width : 9;- int tickWidth = highlighted ? 3 : 1;- using (Pen outline = new Pen(Color.Black, tickWidth + 2))- {- g.DrawLine(outline, 0, y, tickLength, y);- g.DrawLine(outline, bar.Width - tickLength, y, bar.Width, y);- }- using (Pen tick = new Pen(Color.White, tickWidth))- {- g.DrawLine(tick, 0, y, tickLength, y);- g.DrawLine(tick, bar.Width - tickLength, y, bar.Width, y);- }- }- // scale labels that depend on the scheme type- if (scheme.SchemeType == ColorScheme.SchemeTypeField)- {- DrawScaleLabel(g, bar, "-1", 0, scheme);- DrawScaleLabel(g, bar, "0", ColorScheme.EntryCount / 2, scheme);- DrawScaleLabel(g, bar, "+1", ColorScheme.EntryCount - 1, scheme);- }- else if (scheme.SchemeType == ColorScheme.SchemeTypeIntensity)- {- DrawScaleLabel(g, bar, "0", 0, scheme);- DrawScaleLabel(g, bar, "max", ColorScheme.EntryCount - 1, scheme);- }- }-- /// <summary>- /// Draws <paramref name="text"/> horizontally centred on the preview bar at the height of table entry- /// <paramref name="entryIndex"/> (0..<see cref="ColorScheme.EntryCount"/> - 1 mapped onto the bar height),- /// kept at least 12 px away from the top and bottom edges (clear of the end ticks), in black or white- /// depending on the entry color underneath, so it is readable on any color.- /// </summary>- /// <param name="g">Target graphics of the preview panel.</param>- /// <param name="bar">Client rectangle of the preview panel.</param>- /// <param name="text">Label text.</param>- /// <param name="entryIndex">Table entry (0..<see cref="ColorScheme.EntryCount"/> - 1) whose vertical position the label is centred on.</param>- /// <param name="scheme">Scheme being painted; used only to pick a contrasting text color.</param>- private void DrawScaleLabel(Graphics g, Rectangle bar, string text, int entryIndex, ColorScheme scheme)- {- Size textSize = TextRenderer.MeasureText(g, text, pnlScheme.Font);- int centerY = (int)Math.Round((entryIndex * (bar.Height - 1)) / (double)(ColorScheme.EntryCount - 1));- int top = centerY - textSize.Height / 2;- if (top < 12)- {- top = 12; // keep clear of the end ticks- }- if (top + textSize.Height > bar.Height - 12)- {- top = bar.Height - 12 - textSize.Height;- }- Rectangle labelBounds = new Rectangle(0, top, bar.Width, textSize.Height);- TextRenderer.DrawText(g, text, pnlScheme.Font, labelBounds, Form1.ContrastColor(scheme.GetEntry(entryIndex)), TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);- }-- /// <summary>- /// Color shown on stop button <paramref name="k"/>: the real stop for a stop scheme, otherwise the table- /// sampled at the position the stop would have (k/(<see cref="ColorScheme.StopCount"/> - 1) of the- /// 0..<see cref="ColorScheme.EntryCount"/> - 1 range).- /// </summary>- private static Color StopColorOf(ColorScheme scheme, int k)- {- return scheme.HasStops ? scheme.Stops[k] : scheme.SampleAt((k * (ColorScheme.EntryCount - 1)) / (double)(ColorScheme.StopCount - 1));- }-- /// <summary>- /// Suffix for the picker caption describing what stop <paramref name="k"/> represents (first, centre, last);- /// empty for the others. There is a centre stop only while <see cref="ColorScheme.StopCount"/> is odd.- /// </summary>- private static string StopRole(int k)- {- if (k == 0)- {- return " (start of the scale)";- }- if (k == ColorScheme.StopCount - 1)- {- return " (end of the scale)";- }- if (ColorScheme.StopCount % 2 == 1 && k == ColorScheme.StopCount / 2)- {- return " (centre = zero field)";- }- return "";- }-- /// <summary>Black or white, whichever reads better on top of <paramref name="c"/> (Rec. 601 luma, threshold 140 of 255).</summary>- private static Color ContrastColor(Color c)- {- double luma = 0.299 * c.R + 0.587 * c.G + 0.114 * c.B;- return luma > 140.0 ? Color.Black : Color.White;- }-- /// <summary>- /// Renders a <see cref="ThumbWidth"/> x <see cref="ThumbHeight"/> horizontal strip of the scheme (entry 0- /// left, the last entry right) with a gray border, for the list view image list. The caller owns the- /// returned bitmap; <see cref="LoadSchemeList"/> keeps them in <c>_thumbBitmaps</c> and disposes them on- /// the next reload.- /// </summary>- private static Bitmap MakeThumbnail(ColorScheme scheme)- {- Bitmap thumb = new Bitmap(ThumbWidth, ThumbHeight, PixelFormat.Format32bppArgb);- using (Graphics g = Graphics.FromImage(thumb))- {- for (int x = 0; x < ThumbWidth; x++)- {- int entryIndex = (int)Math.Round((x * (ColorScheme.EntryCount - 1)) / (double)(ThumbWidth - 1));- using (SolidBrush brush = new SolidBrush(scheme.GetEntry(entryIndex)))- {- g.FillRectangle(brush, x, 0, 1, ThumbHeight);- }- }- g.DrawRectangle(Pens.Gray, 0, 0, ThumbWidth - 1, ThumbHeight - 1);- }- return thumb;- }- }-}diff --git a/Wave_Dude_2D/Form1.Designer.cs b/Wave_Dude_2D/Form1.Designer.csdeleted file mode 100644index 69f4d34..0000000--- a/Wave_Dude_2D/Form1.Designer.cs+++ /dev/null@@ -1,3563 +0,0 @@-using System;-using System.ComponentModel;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- public partial class Form1 : global::System.Windows.Forms.Form- {- /// <summary>Releases the designer-managed components when <paramref name="disposing"/> is true, then the form itself.</summary>- /// <param name="disposing">True when called from <see cref="System.ComponentModel.Component.Dispose()"/>; false from the finalizer.</param>- [global::System.Diagnostics.DebuggerNonUserCode]- protected override void Dispose(bool disposing)- {- try- {- bool flag = disposing && this.components != null;- if (flag)- {- this.components.Dispose();- }- }- finally- {- base.Dispose(disposing);- }- }-- [global::System.Diagnostics.DebuggerStepThrough]- private void InitializeComponent()- {- global::System.ComponentModel.ComponentResourceManager componentResourceManager = new global::System.ComponentModel.ComponentResourceManager(typeof(global::_2D_wave_sim_V01.Form1));- this.tabMainFunctions = new global::System.Windows.Forms.TabControl();- this.tabConfiguration = new global::System.Windows.Forms.TabPage();- this.grpProjects = new global::System.Windows.Forms.GroupBox();- this.btnPickRoot = new global::System.Windows.Forms.Button();- this.btnSaveConfiguration2 = new global::System.Windows.Forms.Button();- this.lstAllProjects = new global::System.Windows.Forms.ListView();- this.colProjectName = new global::System.Windows.Forms.ColumnHeader();- this.colLastEdit = new global::System.Windows.Forms.ColumnHeader();- this.btnNewProject = new global::System.Windows.Forms.Button();- this.btnRenameProject = new global::System.Windows.Forms.Button();- this.btnLoadProject = new global::System.Windows.Forms.Button();- this.btnDeleteProject = new global::System.Windows.Forms.Button();- this.btnSaveAs = new global::System.Windows.Forms.Button();- this.grpSimulationSettings = new global::System.Windows.Forms.GroupBox();- this.Label61 = new global::System.Windows.Forms.Label();- this.numTimeDecayFactor = new global::System.Windows.Forms.NumericUpDown();- this.numSimulationSteps = new global::System.Windows.Forms.NumericUpDown();- this.lblInfo = new global::System.Windows.Forms.Label();- this.chkUse4thOrderLaplacian = new global::System.Windows.Forms.CheckBox();- this.chkUseGPU = new global::System.Windows.Forms.CheckBox();- this.numQuality = new global::System.Windows.Forms.NumericUpDown();- this.lblVideoQuality = new global::System.Windows.Forms.Label();- this.numIntensityScaling = new global::System.Windows.Forms.NumericUpDown();- this.numOffsetIntensity = new global::System.Windows.Forms.NumericUpDown();- this.numOffsetField = new global::System.Windows.Forms.NumericUpDown();- this.numFieldScaling = new global::System.Windows.Forms.NumericUpDown();- this.Label3 = new global::System.Windows.Forms.Label();- this.numScaleIntensityValues = new global::System.Windows.Forms.Label();- this.Label6 = new global::System.Windows.Forms.Label();- this.lblOffsetField = new global::System.Windows.Forms.Label();- this.Label5 = new global::System.Windows.Forms.Label();- this.Label2 = new global::System.Windows.Forms.Label();- this.cmbIntensityColorScheme = new global::System.Windows.Forms.ComboBox();- this.cmbFieldColorScheme = new global::System.Windows.Forms.ComboBox();- this.chkPreviewVideoIntensity = new global::System.Windows.Forms.CheckBox();- this.chkExportVideoIntensity = new global::System.Windows.Forms.CheckBox();- this.chkPreviewVideoField = new global::System.Windows.Forms.CheckBox();- this.chkExportVideoField = new global::System.Windows.Forms.CheckBox();- this.lblPreviewVideo = new global::System.Windows.Forms.Label();- this.lblExportVideo = new global::System.Windows.Forms.Label();- this.numVisualizeEvery = new global::System.Windows.Forms.NumericUpDown();- this.Label4 = new global::System.Windows.Forms.Label();- this.lblVisualizeEvery = new global::System.Windows.Forms.Label();- this.Label7 = new global::System.Windows.Forms.Label();- this.lblSimulationSteps = new global::System.Windows.Forms.Label();- this.grpSceneProperties = new global::System.Windows.Forms.GroupBox();- this.Label20 = new global::System.Windows.Forms.Label();- this.numRefractiveIndex = new global::System.Windows.Forms.NumericUpDown();- this.picImagePreview = new global::System.Windows.Forms.PictureBox();- this.lblScaleImgSourceIntensity = new global::System.Windows.Forms.Label();- this.numScaleImageSource = new global::System.Windows.Forms.NumericUpDown();- this.btnEditObjectSourceList = new global::System.Windows.Forms.Button();- this.txtDampingEdgeSize = new global::System.Windows.Forms.TextBox();- this.chkUseObjectSources = new global::System.Windows.Forms.CheckBox();- this.chkUseImageSources = new global::System.Windows.Forms.CheckBox();- this.chkDampingEdge = new global::System.Windows.Forms.CheckBox();- this.btnLoadSceneImage = new global::System.Windows.Forms.Button();- this.Label1 = new global::System.Windows.Forms.Label();- this.lblPix = new global::System.Windows.Forms.Label();- this.lblX = new global::System.Windows.Forms.Label();- this.txtYsize = new global::System.Windows.Forms.TextBox();- this.txtXSize = new global::System.Windows.Forms.TextBox();- this.radUserDefinedScene = new global::System.Windows.Forms.RadioButton();- this.radUseSceneImage = new global::System.Windows.Forms.RadioButton();- this.lblImageNameAndSize = new global::System.Windows.Forms.Label();- this.tabSourceList = new global::System.Windows.Forms.TabPage();- this.Label62 = new global::System.Windows.Forms.Label();- this.Label60 = new global::System.Windows.Forms.Label();- this.chkAutoRescaleSourceOn = new global::System.Windows.Forms.CheckBox();- this.picPreviewSource = new global::System.Windows.Forms.PictureBox();- this.grpPlaceSource = new global::System.Windows.Forms.GroupBox();- this.pnlPosition = new global::System.Windows.Forms.Panel();- this.numSourcePositionX = new global::System.Windows.Forms.NumericUpDown();- this.Label36 = new global::System.Windows.Forms.Label();- this.lblPosition = new global::System.Windows.Forms.Label();- this.btnPickSourcePosition = new global::System.Windows.Forms.Button();- this.numSourcePositionY = new global::System.Windows.Forms.NumericUpDown();- this.Label35 = new global::System.Windows.Forms.Label();- this.btnDelete = new global::System.Windows.Forms.Button();- this.btnNew = new global::System.Windows.Forms.Button();- this.btnCopy = new global::System.Windows.Forms.Button();- this.lstSources = new global::System.Windows.Forms.ListBox();- this.pnlSourceImage = new global::System.Windows.Forms.Panel();- this.grpSourceDetails = new global::System.Windows.Forms.GroupBox();- this.txtDetachAfterSteps = new global::System.Windows.Forms.TextBox();- this.btnSaveSource = new global::System.Windows.Forms.Button();- this.Label47 = new global::System.Windows.Forms.Label();- this.chkDetachSource = new global::System.Windows.Forms.CheckBox();- this.lblLambdaIs = new global::System.Windows.Forms.Label();- this.chkSourceOn = new global::System.Windows.Forms.CheckBox();- this.grpComposite = new global::System.Windows.Forms.GroupBox();- this.Label59 = new global::System.Windows.Forms.Label();- this.Label58 = new global::System.Windows.Forms.Label();- this.numRandomizeOffWidth = new global::System.Windows.Forms.NumericUpDown();- this.numRandomizePosition = new global::System.Windows.Forms.NumericUpDown();- this.NumRandomizePhase = new global::System.Windows.Forms.NumericUpDown();- this.numRandomizeFrequency = new global::System.Windows.Forms.NumericUpDown();- this.chkRandomizePhase = new global::System.Windows.Forms.CheckBox();- this.chkRandomizePosition = new global::System.Windows.Forms.CheckBox();- this.chkOffWidth = new global::System.Windows.Forms.CheckBox();- this.chkRandomizeFrequency = new global::System.Windows.Forms.CheckBox();- this.numSpacingSizeY = new global::System.Windows.Forms.NumericUpDown();- this.numSpacingSizeX = new global::System.Windows.Forms.NumericUpDown();- this.numArraySizeY = new global::System.Windows.Forms.NumericUpDown();- this.numArraySizeX = new global::System.Windows.Forms.NumericUpDown();- this.Label50 = new global::System.Windows.Forms.Label();- this.Label51 = new global::System.Windows.Forms.Label();- this.Label52 = new global::System.Windows.Forms.Label();- this.Label53 = new global::System.Windows.Forms.Label();- this.cmbCompositeProperties = new global::System.Windows.Forms.ComboBox();- this.grpSingleSource = new global::System.Windows.Forms.GroupBox();- this.numOffStateCycles = new global::System.Windows.Forms.NumericUpDown();- this.numPhase = new global::System.Windows.Forms.NumericUpDown();- this.numAmplitude = new global::System.Windows.Forms.NumericUpDown();- this.numFrequency = new global::System.Windows.Forms.NumericUpDown();- this.numPulseWidthCycles = new global::System.Windows.Forms.NumericUpDown();- this.Label44 = new global::System.Windows.Forms.Label();- this.Label46 = new global::System.Windows.Forms.Label();- this.Label45 = new global::System.Windows.Forms.Label();- this.Label43 = new global::System.Windows.Forms.Label();- this.Label42 = new global::System.Windows.Forms.Label();- this.Label54 = new global::System.Windows.Forms.Label();- this.Label41 = new global::System.Windows.Forms.Label();- this.Label40 = new global::System.Windows.Forms.Label();- this.cmbPulseShape = new global::System.Windows.Forms.ComboBox();- this.radModePulsed = new global::System.Windows.Forms.RadioButton();- this.radModeContinuous = new global::System.Windows.Forms.RadioButton();- this.txtName = new global::System.Windows.Forms.TextBox();- this.cmbMainType = new global::System.Windows.Forms.ComboBox();- this.Label39 = new global::System.Windows.Forms.Label();- this.lblName = new global::System.Windows.Forms.Label();- this.Label38 = new global::System.Windows.Forms.Label();- this.tabProbeList = new global::System.Windows.Forms.TabPage();- this.GroupBox2 = new global::System.Windows.Forms.GroupBox();- this.Label49 = new global::System.Windows.Forms.Label();- this.Label48 = new global::System.Windows.Forms.Label();- this.Label37 = new global::System.Windows.Forms.Label();- this.grpProbe2 = new global::System.Windows.Forms.GroupBox();- this.Label22 = new global::System.Windows.Forms.Label();- this.numRunningWindow2 = new global::System.Windows.Forms.NumericUpDown();- this.chkProbeOn2 = new global::System.Windows.Forms.CheckBox();- this.txtStartAfterStep2 = new global::System.Windows.Forms.TextBox();- this.chkStartAfterStep2 = new global::System.Windows.Forms.CheckBox();- this.Label23 = new global::System.Windows.Forms.Label();- this.Label24 = new global::System.Windows.Forms.Label();- this.txtMaxScaleY2 = new global::System.Windows.Forms.TextBox();- this.txtMinScaleY2 = new global::System.Windows.Forms.TextBox();- this.radFullScale2 = new global::System.Windows.Forms.RadioButton();- this.radRunningScale2 = new global::System.Windows.Forms.RadioButton();- this.chkAutoScaleY2 = new global::System.Windows.Forms.CheckBox();- this.chkAutoScaleX2 = new global::System.Windows.Forms.CheckBox();- this.numBPosY2 = new global::System.Windows.Forms.NumericUpDown();- this.numAPosY2 = new global::System.Windows.Forms.NumericUpDown();- this.numBPosX2 = new global::System.Windows.Forms.NumericUpDown();- this.numAPosX2 = new global::System.Windows.Forms.NumericUpDown();- this.butPicPositions2 = new global::System.Windows.Forms.Button();- this.Label25 = new global::System.Windows.Forms.Label();- this.cmbPlaceOn2 = new global::System.Windows.Forms.ComboBox();- this.cmbMeasurement2 = new global::System.Windows.Forms.ComboBox();- this.Label26 = new global::System.Windows.Forms.Label();- this.Label27 = new global::System.Windows.Forms.Label();- this.cmbBoxSize2 = new global::System.Windows.Forms.ComboBox();- this.cmbProbeType2 = new global::System.Windows.Forms.ComboBox();- this.Label28 = new global::System.Windows.Forms.Label();- this.Label29 = new global::System.Windows.Forms.Label();- this.Label30 = new global::System.Windows.Forms.Label();- this.Label31 = new global::System.Windows.Forms.Label();- this.Label32 = new global::System.Windows.Forms.Label();- this.Label33 = new global::System.Windows.Forms.Label();- this.Label34 = new global::System.Windows.Forms.Label();- this.grpProbe1 = new global::System.Windows.Forms.GroupBox();- this.Label21 = new global::System.Windows.Forms.Label();- this.numRunningWindow = new global::System.Windows.Forms.NumericUpDown();- this.chkProbeOn1 = new global::System.Windows.Forms.CheckBox();- this.txtStartAfterStep = new global::System.Windows.Forms.TextBox();- this.chkStartAfterStep = new global::System.Windows.Forms.CheckBox();- this.Label19 = new global::System.Windows.Forms.Label();- this.Label18 = new global::System.Windows.Forms.Label();- this.txtMaxScaleY = new global::System.Windows.Forms.TextBox();- this.txtMinScaleY = new global::System.Windows.Forms.TextBox();- this.radFullScale = new global::System.Windows.Forms.RadioButton();- this.radRunningScale = new global::System.Windows.Forms.RadioButton();- this.chkAutoScaleY = new global::System.Windows.Forms.CheckBox();- this.chkAutoScaleX = new global::System.Windows.Forms.CheckBox();- this.numBPosY = new global::System.Windows.Forms.NumericUpDown();- this.numAPosY = new global::System.Windows.Forms.NumericUpDown();- this.numBPosX = new global::System.Windows.Forms.NumericUpDown();- this.numAPosX = new global::System.Windows.Forms.NumericUpDown();- this.butPicPositions = new global::System.Windows.Forms.Button();- this.Label16 = new global::System.Windows.Forms.Label();- this.cmbPlaceOn = new global::System.Windows.Forms.ComboBox();- this.cmbMeasurement = new global::System.Windows.Forms.ComboBox();- this.Label13 = new global::System.Windows.Forms.Label();- this.Label15 = new global::System.Windows.Forms.Label();- this.cmbBoxSize = new global::System.Windows.Forms.ComboBox();- this.cmbProbeType = new global::System.Windows.Forms.ComboBox();- this.Label14 = new global::System.Windows.Forms.Label();- this.Label12 = new global::System.Windows.Forms.Label();- this.Label11 = new global::System.Windows.Forms.Label();- this.Label17 = new global::System.Windows.Forms.Label();- this.Label10 = new global::System.Windows.Forms.Label();- this.Label9 = new global::System.Windows.Forms.Label();- this.Label8 = new global::System.Windows.Forms.Label();- this.pnlProbeImage = new global::System.Windows.Forms.Panel();- this.tabViewer = new global::System.Windows.Forms.TabPage();- this.pnlPreviewIntensityProps = new global::System.Windows.Forms.Panel();- this.chkExportVideoIntensity2 = new global::System.Windows.Forms.CheckBox();- this.Label64 = new global::System.Windows.Forms.Label();- this.numBrightnessIntensityOverlay = new global::System.Windows.Forms.NumericUpDown();- this.numIntensityScaling2 = new global::System.Windows.Forms.NumericUpDown();- this.chkDiplayOverlayInIntensity = new global::System.Windows.Forms.CheckBox();- this.Label66 = new global::System.Windows.Forms.Label();- this.Panel3 = new global::System.Windows.Forms.Panel();- this.Label63 = new global::System.Windows.Forms.Label();- this.chkExportVideoField2 = new global::System.Windows.Forms.CheckBox();- this.numFieldScaling2 = new global::System.Windows.Forms.NumericUpDown();- this.Label65 = new global::System.Windows.Forms.Label();- this.numBrightnessFieldOverlay = new global::System.Windows.Forms.NumericUpDown();- this.chkDiplayOverlayInField = new global::System.Windows.Forms.CheckBox();- this.Label56 = new global::System.Windows.Forms.Label();- this.Label55 = new global::System.Windows.Forms.Label();- this.lblWarningIntensity = new global::System.Windows.Forms.Label();- this.lblWarningField = new global::System.Windows.Forms.Label();- this.btnExportIntensityFrame = new global::System.Windows.Forms.Button();- this.btnExportFieldFrame = new global::System.Windows.Forms.Button();- this.btnOpenImageFolder = new global::System.Windows.Forms.Button();- this.btnOpenVideoFolder = new global::System.Windows.Forms.Button();- this.btnViewIntensityVideo = new global::System.Windows.Forms.Button();- this.btnViewFieldVideo = new global::System.Windows.Forms.Button();- this.pnlPreviewIntensity = new global::System.Windows.Forms.Panel();- this.pnlPreviewField = new global::System.Windows.Forms.Panel();- this.tabOutput = new global::System.Windows.Forms.TabPage();- this.btnRenameVideo = new global::System.Windows.Forms.Button();- this.btnShareWithEditors = new global::System.Windows.Forms.Button();- this.btnCopyToClipboard = new global::System.Windows.Forms.Button();- this.btnOpenImageFolder2 = new global::System.Windows.Forms.Button();- this.btnViewVIdeoInPlayer2 = new global::System.Windows.Forms.Button();- this.btnOpenVIdeoFolder2 = new global::System.Windows.Forms.Button();- this.lblPreview = new global::System.Windows.Forms.Label();- this.btnDeleteVideos = new global::System.Windows.Forms.Button();- this.btnDeleteImages = new global::System.Windows.Forms.Button();- this.btnDeleteScene = new global::System.Windows.Forms.Button();- this.btnLoadExternal = new global::System.Windows.Forms.Button();- this.pnlPreview = new global::System.Windows.Forms.Panel();- this.Label57 = new global::System.Windows.Forms.Label();- this.lstScenes = new global::System.Windows.Forms.ListView();- this.colSceneName = new global::System.Windows.Forms.ColumnHeader();- this.colSceneCreated = new global::System.Windows.Forms.ColumnHeader();- this.lstImages = new global::System.Windows.Forms.ListView();- this.colImageName = new global::System.Windows.Forms.ColumnHeader();- this.colCreatedOn = new global::System.Windows.Forms.ColumnHeader();- this.lstVideo = new global::System.Windows.Forms.ListView();- this.colVideoName = new global::System.Windows.Forms.ColumnHeader();- this.colCreatedOn2 = new global::System.Windows.Forms.ColumnHeader();- this.lstAllProjects3 = new global::System.Windows.Forms.ListView();- this.colProjectName2 = new global::System.Windows.Forms.ColumnHeader();- this.colLastEdited2 = new global::System.Windows.Forms.ColumnHeader();- this.tabColorScheme = new global::System.Windows.Forms.TabPage();- this.lblType = new global::System.Windows.Forms.Label();- this.radSchemeTypeIntensity = new global::System.Windows.Forms.RadioButton();- this.radSchemeTypeField = new global::System.Windows.Forms.RadioButton();- this.btnLoadScheme = new global::System.Windows.Forms.Button();- this.btbChooseFFolder = new global::System.Windows.Forms.Button();- this.lblSchemeFolder = new global::System.Windows.Forms.Label();- this.ListView1 = new global::System.Windows.Forms.ListView();- this.txtSchemeFolder = new global::System.Windows.Forms.TextBox();- this.txtCurrentColorScheme = new global::System.Windows.Forms.TextBox();- this.lblCurrentCOlorScheme = new global::System.Windows.Forms.Label();- this.lblColorSchemeEditor = new global::System.Windows.Forms.Label();- this.btnColor9 = new global::System.Windows.Forms.Button();- this.btnColor8 = new global::System.Windows.Forms.Button();- this.btnColor7 = new global::System.Windows.Forms.Button();- this.btnColor6 = new global::System.Windows.Forms.Button();- this.btnColor5 = new global::System.Windows.Forms.Button();- this.btnColor4 = new global::System.Windows.Forms.Button();- this.btnColor3 = new global::System.Windows.Forms.Button();- this.btnCOlor2 = new global::System.Windows.Forms.Button();- this.btnColor1 = new global::System.Windows.Forms.Button();- this.lblColorPicker = new global::System.Windows.Forms.Label();- this.Panel2 = new global::System.Windows.Forms.Panel();- this.pnlScheme = new global::System.Windows.Forms.Panel();- this.btnDeleteColorScheme = new global::System.Windows.Forms.Button();- this.btnRenameColorScheme = new global::System.Windows.Forms.Button();- this.btnSaveAsColorScheme = new global::System.Windows.Forms.Button();- this.btnSaveCurrentScheme = new global::System.Windows.Forms.Button();- this.btnSaveConfiguration = new global::System.Windows.Forms.Button();- this.btnStartSimulation = new global::System.Windows.Forms.Button();- this.btnPauzeResume = new global::System.Windows.Forms.Button();- this.MenuStrip1 = new global::System.Windows.Forms.MenuStrip();- this.itemFile = new global::System.Windows.Forms.ToolStripMenuItem();- this.NewToolStripMenuItem = new global::System.Windows.Forms.ToolStripMenuItem();- this.OpenToolStripMenuItem = new global::System.Windows.Forms.ToolStripMenuItem();- this.ChooseProjectRootToolStripMenuItem = new global::System.Windows.Forms.ToolStripMenuItem();- this.SetCValueToolStripMenuItem = new global::System.Windows.Forms.ToolStripMenuItem();- this.SaveToolStripMenuItem = new global::System.Windows.Forms.ToolStripMenuItem();- this.ExitToolStripMenuItem = new global::System.Windows.Forms.ToolStripMenuItem();- this.InfoToolStripMenuItem = new global::System.Windows.Forms.ToolStripMenuItem();- this.HelpToolStripMenuItem = new global::System.Windows.Forms.ToolStripMenuItem();- this.AboutToolStripMenuItem = new global::System.Windows.Forms.ToolStripMenuItem();- this.lblProjectName = new global::System.Windows.Forms.Label();- this.txtProjectName = new global::System.Windows.Forms.TextBox();- this.txtRootFolder = new global::System.Windows.Forms.TextBox();- this.lblRootFolder = new global::System.Windows.Forms.Label();- this.btnBrowseRoot = new global::System.Windows.Forms.Button();- this.StatusStrip1 = new global::System.Windows.Forms.StatusStrip();- this.ToolStripStatusLabel1 = new global::System.Windows.Forms.ToolStripStatusLabel();- this.grpNavigateTabs = new global::System.Windows.Forms.GroupBox();- this.btnGotoPreview = new global::System.Windows.Forms.Button();- this.btnGotoProbes = new global::System.Windows.Forms.Button();- this.btnGotoSources = new global::System.Windows.Forms.Button();- this.btnGotoConfiguration = new global::System.Windows.Forms.Button();- this.grpSimulationControlButtons = new global::System.Windows.Forms.GroupBox();- this.Panel1 = new global::System.Windows.Forms.Panel();- this.btnDescription = new global::System.Windows.Forms.Button();- this.grpShareImage = new global::System.Windows.Forms.GroupBox();- this.btnShareIntensityImage = new global::System.Windows.Forms.Button();- this.btnShareFieldImage = new global::System.Windows.Forms.Button();- this.btnShareSceneImage = new global::System.Windows.Forms.Button();- this.tabMainFunctions.SuspendLayout();- this.tabConfiguration.SuspendLayout();- this.grpProjects.SuspendLayout();- this.grpSimulationSettings.SuspendLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numTimeDecayFactor).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numSimulationSteps).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numQuality).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numIntensityScaling).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numOffsetIntensity).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numOffsetField).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numFieldScaling).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numVisualizeEvery).BeginInit();- this.grpSceneProperties.SuspendLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numRefractiveIndex).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.picImagePreview).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numScaleImageSource).BeginInit();- this.tabSourceList.SuspendLayout();- ((global::System.ComponentModel.ISupportInitialize)this.picPreviewSource).BeginInit();- this.grpPlaceSource.SuspendLayout();- this.pnlPosition.SuspendLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numSourcePositionX).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numSourcePositionY).BeginInit();- this.grpSourceDetails.SuspendLayout();- this.grpComposite.SuspendLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numRandomizeOffWidth).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numRandomizePosition).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.NumRandomizePhase).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numRandomizeFrequency).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numSpacingSizeY).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numSpacingSizeX).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numArraySizeY).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numArraySizeX).BeginInit();- this.grpSingleSource.SuspendLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numOffStateCycles).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numPhase).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numAmplitude).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numFrequency).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numPulseWidthCycles).BeginInit();- this.tabProbeList.SuspendLayout();- this.GroupBox2.SuspendLayout();- this.grpProbe2.SuspendLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numRunningWindow2).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numBPosY2).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numAPosY2).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numBPosX2).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numAPosX2).BeginInit();- this.grpProbe1.SuspendLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numRunningWindow).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numBPosY).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numAPosY).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numBPosX).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numAPosX).BeginInit();- this.tabViewer.SuspendLayout();- this.pnlPreviewIntensityProps.SuspendLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numBrightnessIntensityOverlay).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numIntensityScaling2).BeginInit();- this.Panel3.SuspendLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numFieldScaling2).BeginInit();- ((global::System.ComponentModel.ISupportInitialize)this.numBrightnessFieldOverlay).BeginInit();- this.tabOutput.SuspendLayout();- this.tabColorScheme.SuspendLayout();- this.MenuStrip1.SuspendLayout();- this.StatusStrip1.SuspendLayout();- this.grpNavigateTabs.SuspendLayout();- this.grpSimulationControlButtons.SuspendLayout();- this.Panel1.SuspendLayout();- this.grpShareImage.SuspendLayout();- base.SuspendLayout();- this.tabMainFunctions.Controls.Add(this.tabConfiguration);- this.tabMainFunctions.Controls.Add(this.tabSourceList);- this.tabMainFunctions.Controls.Add(this.tabProbeList);- this.tabMainFunctions.Controls.Add(this.tabViewer);- this.tabMainFunctions.Controls.Add(this.tabOutput);- this.tabMainFunctions.Controls.Add(this.tabColorScheme);- this.tabMainFunctions.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 15.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.tabMainFunctions.Location = new global::System.Drawing.Point(16, 89);- this.tabMainFunctions.Name = "tabMainFunctions";- this.tabMainFunctions.Padding = new global::System.Drawing.Point(10, 3);- this.tabMainFunctions.SelectedIndex = 0;- this.tabMainFunctions.Size = new global::System.Drawing.Size(1750, 731);- this.tabMainFunctions.TabIndex = 0;- this.tabConfiguration.Controls.Add(this.grpProjects);- this.tabConfiguration.Controls.Add(this.grpSimulationSettings);- this.tabConfiguration.Controls.Add(this.grpSceneProperties);- this.tabConfiguration.Location = new global::System.Drawing.Point(4, 34);- this.tabConfiguration.Name = "tabConfiguration";- this.tabConfiguration.Padding = new global::System.Windows.Forms.Padding(3);- this.tabConfiguration.Size = new global::System.Drawing.Size(1742, 693);- this.tabConfiguration.TabIndex = 1;- this.tabConfiguration.Text = " Settings ";- this.tabConfiguration.UseVisualStyleBackColor = true;- this.grpProjects.Controls.Add(this.btnPickRoot);- this.grpProjects.Controls.Add(this.btnSaveConfiguration2);- this.grpProjects.Controls.Add(this.lstAllProjects);- this.grpProjects.Controls.Add(this.btnNewProject);- this.grpProjects.Controls.Add(this.btnRenameProject);- this.grpProjects.Controls.Add(this.btnLoadProject);- this.grpProjects.Controls.Add(this.btnDeleteProject);- this.grpProjects.Controls.Add(this.btnSaveAs);- this.grpProjects.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.grpProjects.Location = new global::System.Drawing.Point(23, 25);- this.grpProjects.Name = "grpProjects";- this.grpProjects.Size = new global::System.Drawing.Size(473, 641);- this.grpProjects.TabIndex = 8;- this.grpProjects.TabStop = false;- this.grpProjects.Text = "Projects in current root";- this.btnPickRoot.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnPickRoot.Location = new global::System.Drawing.Point(363, 506);- this.btnPickRoot.Name = "btnPickRoot";- this.btnPickRoot.Size = new global::System.Drawing.Size(88, 27);- this.btnPickRoot.TabIndex = 10;- this.btnPickRoot.Text = "Pick root";- this.btnPickRoot.UseVisualStyleBackColor = true;- this.btnSaveConfiguration2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 15.75f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnSaveConfiguration2.Location = new global::System.Drawing.Point(252, 562);- this.btnSaveConfiguration2.Name = "btnSaveConfiguration2";- this.btnSaveConfiguration2.Size = new global::System.Drawing.Size(191, 49);- this.btnSaveConfiguration2.TabIndex = 9;- this.btnSaveConfiguration2.Text = "Save";- this.btnSaveConfiguration2.UseVisualStyleBackColor = true;- this.lstAllProjects.BackColor = global::System.Drawing.SystemColors.MenuBar;- this.lstAllProjects.Columns.AddRange(new global::System.Windows.Forms.ColumnHeader[] { this.colProjectName, this.colLastEdit });- this.lstAllProjects.FullRowSelect = true;- this.lstAllProjects.HideSelection = false;- this.lstAllProjects.Location = new global::System.Drawing.Point(16, 28);- this.lstAllProjects.MultiSelect = false;- this.lstAllProjects.Name = "lstAllProjects";- this.lstAllProjects.Size = new global::System.Drawing.Size(435, 472);- this.lstAllProjects.TabIndex = 8;- this.lstAllProjects.UseCompatibleStateImageBehavior = false;- this.lstAllProjects.View = global::System.Windows.Forms.View.Details;- this.colProjectName.Text = "ProjectName";- this.colProjectName.Width = 280;- this.colLastEdit.Text = "Last edited";- this.colLastEdit.Width = 150;- this.btnNewProject.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 15.75f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnNewProject.Location = new global::System.Drawing.Point(16, 560);- this.btnNewProject.Name = "btnNewProject";- this.btnNewProject.Size = new global::System.Drawing.Size(191, 51);- this.btnNewProject.TabIndex = 7;- this.btnNewProject.Text = "New project";- this.btnNewProject.UseVisualStyleBackColor = true;- this.btnRenameProject.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnRenameProject.Location = new global::System.Drawing.Point(188, 505);- this.btnRenameProject.Name = "btnRenameProject";- this.btnRenameProject.Size = new global::System.Drawing.Size(78, 28);- this.btnRenameProject.TabIndex = 6;- this.btnRenameProject.Text = "Rename";- this.btnRenameProject.UseVisualStyleBackColor = true;- this.btnLoadProject.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnLoadProject.Location = new global::System.Drawing.Point(16, 507);- this.btnLoadProject.Name = "btnLoadProject";- this.btnLoadProject.Size = new global::System.Drawing.Size(77, 29);- this.btnLoadProject.TabIndex = 6;- this.btnLoadProject.Text = "Load";- this.btnLoadProject.UseVisualStyleBackColor = true;- this.btnDeleteProject.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnDeleteProject.Location = new global::System.Drawing.Point(272, 506);- this.btnDeleteProject.Name = "btnDeleteProject";- this.btnDeleteProject.Size = new global::System.Drawing.Size(73, 27);- this.btnDeleteProject.TabIndex = 6;- this.btnDeleteProject.Text = "Delete";- this.btnDeleteProject.UseVisualStyleBackColor = true;- this.btnSaveAs.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnSaveAs.Location = new global::System.Drawing.Point(99, 507);- this.btnSaveAs.Name = "btnSaveAs";- this.btnSaveAs.Size = new global::System.Drawing.Size(83, 27);- this.btnSaveAs.TabIndex = 4;- this.btnSaveAs.Text = "Save as";- this.btnSaveAs.UseVisualStyleBackColor = true;- this.grpSimulationSettings.Controls.Add(this.Label61);- this.grpSimulationSettings.Controls.Add(this.numTimeDecayFactor);- this.grpSimulationSettings.Controls.Add(this.numSimulationSteps);- this.grpSimulationSettings.Controls.Add(this.lblInfo);- this.grpSimulationSettings.Controls.Add(this.chkUse4thOrderLaplacian);- this.grpSimulationSettings.Controls.Add(this.chkUseGPU);- this.grpSimulationSettings.Controls.Add(this.numQuality);- this.grpSimulationSettings.Controls.Add(this.lblVideoQuality);- this.grpSimulationSettings.Controls.Add(this.numIntensityScaling);- this.grpSimulationSettings.Controls.Add(this.numOffsetIntensity);- this.grpSimulationSettings.Controls.Add(this.numOffsetField);- this.grpSimulationSettings.Controls.Add(this.numFieldScaling);- this.grpSimulationSettings.Controls.Add(this.Label3);- this.grpSimulationSettings.Controls.Add(this.numScaleIntensityValues);- this.grpSimulationSettings.Controls.Add(this.Label6);- this.grpSimulationSettings.Controls.Add(this.lblOffsetField);- this.grpSimulationSettings.Controls.Add(this.Label5);- this.grpSimulationSettings.Controls.Add(this.Label2);- this.grpSimulationSettings.Controls.Add(this.cmbIntensityColorScheme);- this.grpSimulationSettings.Controls.Add(this.cmbFieldColorScheme);- this.grpSimulationSettings.Controls.Add(this.chkPreviewVideoIntensity);- this.grpSimulationSettings.Controls.Add(this.chkExportVideoIntensity);- this.grpSimulationSettings.Controls.Add(this.chkPreviewVideoField);- this.grpSimulationSettings.Controls.Add(this.chkExportVideoField);- this.grpSimulationSettings.Controls.Add(this.lblPreviewVideo);- this.grpSimulationSettings.Controls.Add(this.lblExportVideo);- this.grpSimulationSettings.Controls.Add(this.numVisualizeEvery);- this.grpSimulationSettings.Controls.Add(this.Label4);- this.grpSimulationSettings.Controls.Add(this.lblVisualizeEvery);- this.grpSimulationSettings.Controls.Add(this.Label7);- this.grpSimulationSettings.Controls.Add(this.lblSimulationSteps);- this.grpSimulationSettings.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.grpSimulationSettings.Location = new global::System.Drawing.Point(516, 432);- this.grpSimulationSettings.Name = "grpSimulationSettings";- this.grpSimulationSettings.Size = new global::System.Drawing.Size(1200, 234);- this.grpSimulationSettings.TabIndex = 3;- this.grpSimulationSettings.TabStop = false;- this.grpSimulationSettings.Text = "Simulation Settings";- this.Label61.AutoSize = true;- this.Label61.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label61.Location = new global::System.Drawing.Point(27, 152);- this.Label61.Name = "Label61";- this.Label61.Size = new global::System.Drawing.Size(133, 16);- this.Label61.TabIndex = 16;- this.Label61.Text = "Intensity decay factor";- this.numTimeDecayFactor.Location = new global::System.Drawing.Point(179, 150);- global::System.Windows.Forms.NumericUpDown numTimeDecayFactor = this.numTimeDecayFactor;- int[] array = new int[4];- array[0] = 20;- numTimeDecayFactor.Maximum = new decimal(array);- global::System.Windows.Forms.NumericUpDown numTimeDecayFactor2 = this.numTimeDecayFactor;- int[] array2 = new int[4];- array2[0] = 1;- numTimeDecayFactor2.Minimum = new decimal(array2);- this.numTimeDecayFactor.Name = "numTimeDecayFactor";- this.numTimeDecayFactor.Size = new global::System.Drawing.Size(80, 24);- this.numTimeDecayFactor.TabIndex = 15;- this.numTimeDecayFactor.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numTimeDecayFactor3 = this.numTimeDecayFactor;- int[] array3 = new int[4];- array3[0] = 5;- numTimeDecayFactor3.Value = new decimal(array3);- global::System.Windows.Forms.NumericUpDown numSimulationSteps = this.numSimulationSteps;- int[] array4 = new int[4];- array4[0] = 500;- numSimulationSteps.Increment = new decimal(array4);- this.numSimulationSteps.Location = new global::System.Drawing.Point(179, 188);- global::System.Windows.Forms.NumericUpDown numSimulationSteps2 = this.numSimulationSteps;- int[] array5 = new int[4];- array5[0] = 100000;- numSimulationSteps2.Maximum = new decimal(array5);- global::System.Windows.Forms.NumericUpDown numSimulationSteps3 = this.numSimulationSteps;- int[] array6 = new int[4];- array6[0] = 100;- numSimulationSteps3.Minimum = new decimal(array6);- this.numSimulationSteps.Name = "numSimulationSteps";- this.numSimulationSteps.Size = new global::System.Drawing.Size(80, 24);- this.numSimulationSteps.TabIndex = 14;- this.numSimulationSteps.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numSimulationSteps4 = this.numSimulationSteps;- int[] array7 = new int[4];- array7[0] = 3000;- numSimulationSteps4.Value = new decimal(array7);- this.lblInfo.AutoSize = true;- this.lblInfo.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Underline, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblInfo.Location = new global::System.Drawing.Point(1051, 193);- this.lblInfo.Name = "lblInfo";- this.lblInfo.Size = new global::System.Drawing.Size(37, 16);- this.lblInfo.TabIndex = 13;- this.lblInfo.Text = "(Info)";- this.chkUse4thOrderLaplacian.AutoSize = true;- this.chkUse4thOrderLaplacian.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkUse4thOrderLaplacian.Location = new global::System.Drawing.Point(786, 191);- this.chkUse4thOrderLaplacian.Name = "chkUse4thOrderLaplacian";- this.chkUse4thOrderLaplacian.Size = new global::System.Drawing.Size(266, 20);- this.chkUse4thOrderLaplacian.TabIndex = 12;- this.chkUse4thOrderLaplacian.Text = "Use 4th order Laplacian + sub-sampling ";- this.chkUse4thOrderLaplacian.UseVisualStyleBackColor = true;- this.chkUseGPU.AutoSize = true;- this.chkUseGPU.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkUseGPU.Location = new global::System.Drawing.Point(787, 153);- this.chkUseGPU.Name = "chkUseGPU";- this.chkUseGPU.Size = new global::System.Drawing.Size(187, 20);- this.chkUseGPU.TabIndex = 11;- this.chkUseGPU.Text = "Use GPU (generally faster)";- this.chkUseGPU.UseVisualStyleBackColor = true;- this.numQuality.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numQuality.Location = new global::System.Drawing.Point(491, 191);- this.numQuality.Name = "numQuality";- this.numQuality.Size = new global::System.Drawing.Size(61, 22);- this.numQuality.TabIndex = 10;- this.numQuality.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numQuality = this.numQuality;- int[] array8 = new int[4];- array8[0] = 70;- numQuality.Value = new decimal(array8);- this.lblVideoQuality.AutoSize = true;- this.lblVideoQuality.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblVideoQuality.Location = new global::System.Drawing.Point(377, 193);- this.lblVideoQuality.Name = "lblVideoQuality";- this.lblVideoQuality.Size = new global::System.Drawing.Size(109, 16);- this.lblVideoQuality.TabIndex = 9;- this.lblVideoQuality.Text = "Video quality (%)";- this.numIntensityScaling.DecimalPlaces = 1;- this.numIntensityScaling.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numIntensityScaling.Increment = new decimal(new int[] { 1, 0, 0, 65536 });- this.numIntensityScaling.Location = new global::System.Drawing.Point(904, 79);- this.numIntensityScaling.Name = "numIntensityScaling";- this.numIntensityScaling.Size = new global::System.Drawing.Size(74, 22);- this.numIntensityScaling.TabIndex = 8;- this.numIntensityScaling.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numIntensityScaling = this.numIntensityScaling;- int[] array9 = new int[4];- array9[0] = 30;- numIntensityScaling.Value = new decimal(array9);- this.numOffsetIntensity.DecimalPlaces = 1;- this.numOffsetIntensity.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numOffsetIntensity.Increment = new decimal(new int[] { 1, 0, 0, 131072 });- this.numOffsetIntensity.Location = new global::System.Drawing.Point(1044, 80);- global::System.Windows.Forms.NumericUpDown numOffsetIntensity = this.numOffsetIntensity;- int[] array10 = new int[4];- array10[0] = 1;- numOffsetIntensity.Maximum = new decimal(array10);- this.numOffsetIntensity.Minimum = new decimal(new int[] { 1, 0, 0, int.MinValue });- this.numOffsetIntensity.Name = "numOffsetIntensity";- this.numOffsetIntensity.Size = new global::System.Drawing.Size(82, 22);- this.numOffsetIntensity.TabIndex = 8;- this.numOffsetIntensity.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numOffsetField.DecimalPlaces = 1;- this.numOffsetField.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numOffsetField.Increment = new decimal(new int[] { 1, 0, 0, 131072 });- this.numOffsetField.Location = new global::System.Drawing.Point(1044, 40);- global::System.Windows.Forms.NumericUpDown numOffsetField = this.numOffsetField;- int[] array11 = new int[4];- array11[0] = 1;- numOffsetField.Maximum = new decimal(array11);- this.numOffsetField.Minimum = new decimal(new int[] { 1, 0, 0, int.MinValue });- this.numOffsetField.Name = "numOffsetField";- this.numOffsetField.Size = new global::System.Drawing.Size(82, 22);- this.numOffsetField.TabIndex = 8;- this.numOffsetField.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numFieldScaling.DecimalPlaces = 1;- this.numFieldScaling.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numFieldScaling.Increment = new decimal(new int[] { 1, 0, 0, 65536 });- this.numFieldScaling.Location = new global::System.Drawing.Point(904, 40);- this.numFieldScaling.Name = "numFieldScaling";- this.numFieldScaling.Size = new global::System.Drawing.Size(74, 22);- this.numFieldScaling.TabIndex = 8;- this.numFieldScaling.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numFieldScaling = this.numFieldScaling;- int[] array12 = new int[4];- array12[0] = 30;- numFieldScaling.Value = new decimal(array12);- this.Label3.AutoSize = true;- this.Label3.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label3.Location = new global::System.Drawing.Point(363, 83);- this.Label3.Name = "Label3";- this.Label3.Size = new global::System.Drawing.Size(140, 16);- this.Label3.TabIndex = 6;- this.Label3.Text = "Intensity color scheme";- this.numScaleIntensityValues.AutoSize = true;- this.numScaleIntensityValues.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numScaleIntensityValues.Location = new global::System.Drawing.Point(785, 81);- this.numScaleIntensityValues.Name = "numScaleIntensityValues";- this.numScaleIntensityValues.Size = new global::System.Drawing.Size(105, 16);- this.numScaleIntensityValues.TabIndex = 6;- this.numScaleIntensityValues.Text = "Scale Int. values";- this.Label6.AutoSize = true;- this.Label6.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label6.Location = new global::System.Drawing.Point(997, 82);- this.Label6.Name = "Label6";- this.Label6.Size = new global::System.Drawing.Size(42, 16);- this.Label6.TabIndex = 6;- this.Label6.Text = "Offset";- this.lblOffsetField.AutoSize = true;- this.lblOffsetField.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblOffsetField.Location = new global::System.Drawing.Point(996, 42);- this.lblOffsetField.Name = "lblOffsetField";- this.lblOffsetField.Size = new global::System.Drawing.Size(42, 16);- this.lblOffsetField.TabIndex = 6;- this.lblOffsetField.Text = "Offset";- this.Label5.AutoSize = true;- this.Label5.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label5.Location = new global::System.Drawing.Point(783, 42);- this.Label5.Name = "Label5";- this.Label5.Size = new global::System.Drawing.Size(114, 16);- this.Label5.TabIndex = 6;- this.Label5.Text = "Scale field values";- this.Label2.AutoSize = true;- this.Label2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label2.Location = new global::System.Drawing.Point(363, 44);- this.Label2.Name = "Label2";- this.Label2.Size = new global::System.Drawing.Size(122, 16);- this.Label2.TabIndex = 6;- this.Label2.Text = "Field color scheme";- this.cmbIntensityColorScheme.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.cmbIntensityColorScheme.FormattingEnabled = true;- this.cmbIntensityColorScheme.Location = new global::System.Drawing.Point(509, 79);- this.cmbIntensityColorScheme.Name = "cmbIntensityColorScheme";- this.cmbIntensityColorScheme.Size = new global::System.Drawing.Size(165, 24);- this.cmbIntensityColorScheme.TabIndex = 5;- this.cmbFieldColorScheme.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.cmbFieldColorScheme.FormattingEnabled = true;- this.cmbFieldColorScheme.Location = new global::System.Drawing.Point(509, 40);- this.cmbFieldColorScheme.Name = "cmbFieldColorScheme";- this.cmbFieldColorScheme.Size = new global::System.Drawing.Size(165, 24);- this.cmbFieldColorScheme.TabIndex = 5;- this.chkPreviewVideoIntensity.AutoSize = true;- this.chkPreviewVideoIntensity.Checked = true;- this.chkPreviewVideoIntensity.CheckState = global::System.Windows.Forms.CheckState.Checked;- this.chkPreviewVideoIntensity.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkPreviewVideoIntensity.Location = new global::System.Drawing.Point(193, 80);- this.chkPreviewVideoIntensity.Name = "chkPreviewVideoIntensity";- this.chkPreviewVideoIntensity.Size = new global::System.Drawing.Size(75, 20);- this.chkPreviewVideoIntensity.TabIndex = 4;- this.chkPreviewVideoIntensity.Text = "Intensity";- this.chkPreviewVideoIntensity.UseVisualStyleBackColor = true;- this.chkExportVideoIntensity.AutoSize = true;- this.chkExportVideoIntensity.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkExportVideoIntensity.Location = new global::System.Drawing.Point(193, 41);- this.chkExportVideoIntensity.Name = "chkExportVideoIntensity";- this.chkExportVideoIntensity.Size = new global::System.Drawing.Size(75, 20);- this.chkExportVideoIntensity.TabIndex = 4;- this.chkExportVideoIntensity.Text = "Intensity";- this.chkExportVideoIntensity.UseVisualStyleBackColor = true;- this.chkPreviewVideoField.AutoSize = true;- this.chkPreviewVideoField.Checked = true;- this.chkPreviewVideoField.CheckState = global::System.Windows.Forms.CheckState.Checked;- this.chkPreviewVideoField.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkPreviewVideoField.Location = new global::System.Drawing.Point(130, 81);- this.chkPreviewVideoField.Name = "chkPreviewVideoField";- this.chkPreviewVideoField.Size = new global::System.Drawing.Size(57, 20);- this.chkPreviewVideoField.TabIndex = 4;- this.chkPreviewVideoField.Text = "Field";- this.chkPreviewVideoField.UseVisualStyleBackColor = true;- this.chkExportVideoField.AutoSize = true;- this.chkExportVideoField.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkExportVideoField.Location = new global::System.Drawing.Point(130, 42);- this.chkExportVideoField.Name = "chkExportVideoField";- this.chkExportVideoField.Size = new global::System.Drawing.Size(57, 20);- this.chkExportVideoField.TabIndex = 4;- this.chkExportVideoField.Text = "Field";- this.chkExportVideoField.UseVisualStyleBackColor = true;- this.lblPreviewVideo.AutoSize = true;- this.lblPreviewVideo.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblPreviewVideo.Location = new global::System.Drawing.Point(24, 82);- this.lblPreviewVideo.Name = "lblPreviewVideo";- this.lblPreviewVideo.Size = new global::System.Drawing.Size(93, 16);- this.lblPreviewVideo.TabIndex = 3;- this.lblPreviewVideo.Text = "Preview video";- this.lblExportVideo.AutoSize = true;- this.lblExportVideo.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblExportVideo.Location = new global::System.Drawing.Point(24, 43);- this.lblExportVideo.Name = "lblExportVideo";- this.lblExportVideo.Size = new global::System.Drawing.Size(100, 16);- this.lblExportVideo.TabIndex = 3;- this.lblExportVideo.Text = "Export video of:";- this.numVisualizeEvery.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numVisualizeEvery.Location = new global::System.Drawing.Point(491, 152);- global::System.Windows.Forms.NumericUpDown numVisualizeEvery = this.numVisualizeEvery;- int[] array13 = new int[4];- array13[0] = 6;- numVisualizeEvery.Maximum = new decimal(array13);- this.numVisualizeEvery.Name = "numVisualizeEvery";- this.numVisualizeEvery.Size = new global::System.Drawing.Size(61, 22);- this.numVisualizeEvery.TabIndex = 1;- this.numVisualizeEvery.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numVisualizeEvery2 = this.numVisualizeEvery;- int[] array14 = new int[4];- array14[0] = 2;- numVisualizeEvery2.Value = new decimal(array14);- this.Label4.AutoSize = true;- this.Label4.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label4.Location = new global::System.Drawing.Point(558, 155);- this.Label4.Name = "Label4";- this.Label4.Size = new global::System.Drawing.Size(49, 16);- this.Label4.TabIndex = 0;- this.Label4.Text = "frames";- this.lblVisualizeEvery.AutoSize = true;- this.lblVisualizeEvery.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblVisualizeEvery.Location = new global::System.Drawing.Point(377, 154);- this.lblVisualizeEvery.Name = "lblVisualizeEvery";- this.lblVisualizeEvery.Size = new global::System.Drawing.Size(99, 16);- this.lblVisualizeEvery.TabIndex = 0;- this.lblVisualizeEvery.Text = "Visualize every";- this.Label7.AutoSize = true;- this.Label7.Location = new global::System.Drawing.Point(386, 195);- this.Label7.Name = "Label7";- this.Label7.Size = new global::System.Drawing.Size(0, 18);- this.Label7.TabIndex = 0;- this.lblSimulationSteps.AutoSize = true;- this.lblSimulationSteps.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblSimulationSteps.Location = new global::System.Drawing.Point(32, 193);- this.lblSimulationSteps.Name = "lblSimulationSteps";- this.lblSimulationSteps.Size = new global::System.Drawing.Size(106, 16);- this.lblSimulationSteps.TabIndex = 0;- this.lblSimulationSteps.Text = "Simulation steps";- this.grpSceneProperties.Controls.Add(this.Label20);- this.grpSceneProperties.Controls.Add(this.numRefractiveIndex);- this.grpSceneProperties.Controls.Add(this.picImagePreview);- this.grpSceneProperties.Controls.Add(this.lblScaleImgSourceIntensity);- this.grpSceneProperties.Controls.Add(this.numScaleImageSource);- this.grpSceneProperties.Controls.Add(this.btnEditObjectSourceList);- this.grpSceneProperties.Controls.Add(this.txtDampingEdgeSize);- this.grpSceneProperties.Controls.Add(this.chkUseObjectSources);- this.grpSceneProperties.Controls.Add(this.chkUseImageSources);- this.grpSceneProperties.Controls.Add(this.chkDampingEdge);- this.grpSceneProperties.Controls.Add(this.btnLoadSceneImage);- this.grpSceneProperties.Controls.Add(this.Label1);- this.grpSceneProperties.Controls.Add(this.lblPix);- this.grpSceneProperties.Controls.Add(this.lblX);- this.grpSceneProperties.Controls.Add(this.txtYsize);- this.grpSceneProperties.Controls.Add(this.txtXSize);- this.grpSceneProperties.Controls.Add(this.radUserDefinedScene);- this.grpSceneProperties.Controls.Add(this.radUseSceneImage);- this.grpSceneProperties.Controls.Add(this.lblImageNameAndSize);- this.grpSceneProperties.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.grpSceneProperties.Location = new global::System.Drawing.Point(516, 25);- this.grpSceneProperties.Name = "grpSceneProperties";- this.grpSceneProperties.Size = new global::System.Drawing.Size(1200, 390);- this.grpSceneProperties.TabIndex = 1;- this.grpSceneProperties.TabStop = false;- this.grpSceneProperties.Text = "Scene properties";- this.Label20.AutoSize = true;- this.Label20.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label20.Location = new global::System.Drawing.Point(366, 80);- this.Label20.Name = "Label20";- this.Label20.Size = new global::System.Drawing.Size(104, 16);- this.Label20.TabIndex = 12;- this.Label20.Text = "Refractive index";- this.numRefractiveIndex.DecimalPlaces = 2;- this.numRefractiveIndex.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numRefractiveIndex.Increment = new decimal(new int[] { 1, 0, 0, 131072 });- this.numRefractiveIndex.Location = new global::System.Drawing.Point(476, 78);- this.numRefractiveIndex.Maximum = new decimal(new int[] { 25, 0, 0, 65536 });- this.numRefractiveIndex.Minimum = new decimal(new int[] { 10, 0, 0, 65536 });- this.numRefractiveIndex.Name = "numRefractiveIndex";- this.numRefractiveIndex.Size = new global::System.Drawing.Size(60, 22);- this.numRefractiveIndex.TabIndex = 11;- this.numRefractiveIndex.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numRefractiveIndex.Value = new decimal(new int[] { 10, 0, 0, 65536 });- this.picImagePreview.BackColor = global::System.Drawing.SystemColors.Control;- this.picImagePreview.Location = new global::System.Drawing.Point(587, 22);- this.picImagePreview.Name = "picImagePreview";- this.picImagePreview.Size = new global::System.Drawing.Size(600, 338);- this.picImagePreview.TabIndex = 1;- this.picImagePreview.TabStop = false;- this.lblScaleImgSourceIntensity.AutoSize = true;- this.lblScaleImgSourceIntensity.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblScaleImgSourceIntensity.Location = new global::System.Drawing.Point(179, 183);- this.lblScaleImgSourceIntensity.Name = "lblScaleImgSourceIntensity";- this.lblScaleImgSourceIntensity.Size = new global::System.Drawing.Size(155, 16);- this.lblScaleImgSourceIntensity.TabIndex = 10;- this.lblScaleImgSourceIntensity.Text = "Scale intensity values by";- this.numScaleImageSource.DecimalPlaces = 1;- this.numScaleImageSource.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numScaleImageSource.Increment = new decimal(new int[] { 1, 0, 0, 65536 });- this.numScaleImageSource.Location = new global::System.Drawing.Point(337, 181);- this.numScaleImageSource.Name = "numScaleImageSource";- this.numScaleImageSource.Size = new global::System.Drawing.Size(65, 22);- this.numScaleImageSource.TabIndex = 9;- this.numScaleImageSource.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numScaleImageSource = this.numScaleImageSource;- int[] array15 = new int[4];- array15[0] = 1;- numScaleImageSource.Value = new decimal(array15);- this.btnEditObjectSourceList.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnEditObjectSourceList.Location = new global::System.Drawing.Point(201, 214);- this.btnEditObjectSourceList.Name = "btnEditObjectSourceList";- this.btnEditObjectSourceList.Size = new global::System.Drawing.Size(117, 23);- this.btnEditObjectSourceList.TabIndex = 8;- this.btnEditObjectSourceList.Text = "Edit source list";- this.btnEditObjectSourceList.UseVisualStyleBackColor = true;- this.txtDampingEdgeSize.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.txtDampingEdgeSize.Location = new global::System.Drawing.Point(152, 143);- this.txtDampingEdgeSize.Name = "txtDampingEdgeSize";- this.txtDampingEdgeSize.Size = new global::System.Drawing.Size(100, 22);- this.txtDampingEdgeSize.TabIndex = 7;- this.chkUseObjectSources.AutoSize = true;- this.chkUseObjectSources.Checked = true;- this.chkUseObjectSources.CheckState = global::System.Windows.Forms.CheckState.Checked;- this.chkUseObjectSources.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkUseObjectSources.Location = new global::System.Drawing.Point(26, 218);- this.chkUseObjectSources.Name = "chkUseObjectSources";- this.chkUseObjectSources.Size = new global::System.Drawing.Size(143, 20);- this.chkUseObjectSources.TabIndex = 6;- this.chkUseObjectSources.Text = "Use object sources";- this.chkUseObjectSources.UseVisualStyleBackColor = true;- this.chkUseImageSources.AutoSize = true;- this.chkUseImageSources.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkUseImageSources.Location = new global::System.Drawing.Point(26, 182);- this.chkUseImageSources.Name = "chkUseImageSources";- this.chkUseImageSources.Size = new global::System.Drawing.Size(157, 20);- this.chkUseImageSources.TabIndex = 6;- this.chkUseImageSources.Text = "Use image sources -";- this.chkUseImageSources.UseVisualStyleBackColor = true;- this.chkDampingEdge.AutoSize = true;- this.chkDampingEdge.Checked = true;- this.chkDampingEdge.CheckState = global::System.Windows.Forms.CheckState.Checked;- this.chkDampingEdge.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkDampingEdge.Location = new global::System.Drawing.Point(26, 145);- this.chkDampingEdge.Name = "chkDampingEdge";- this.chkDampingEdge.Size = new global::System.Drawing.Size(120, 20);- this.chkDampingEdge.TabIndex = 6;- this.chkDampingEdge.Text = "Damping edge ";- this.chkDampingEdge.UseVisualStyleBackColor = true;- this.btnLoadSceneImage.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnLoadSceneImage.Location = new global::System.Drawing.Point(138, 39);- this.btnLoadSceneImage.Name = "btnLoadSceneImage";- this.btnLoadSceneImage.Size = new global::System.Drawing.Size(75, 23);- this.btnLoadSceneImage.TabIndex = 5;- this.btnLoadSceneImage.Text = "load";- this.btnLoadSceneImage.UseVisualStyleBackColor = true;- this.Label1.AutoSize = true;- this.Label1.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label1.Location = new global::System.Drawing.Point(258, 146);- this.Label1.Name = "Label1";- this.Label1.Size = new global::System.Drawing.Size(22, 16);- this.Label1.TabIndex = 4;- this.Label1.Text = "px";- this.lblPix.AutoSize = true;- this.lblPix.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblPix.Location = new global::System.Drawing.Point(327, 80);- this.lblPix.Name = "lblPix";- this.lblPix.Size = new global::System.Drawing.Size(22, 16);- this.lblPix.TabIndex = 4;- this.lblPix.Text = "px";- this.lblX.AutoSize = true;- this.lblX.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblX.Location = new global::System.Drawing.Point(243, 80);- this.lblX.Name = "lblX";- this.lblX.Size = new global::System.Drawing.Size(12, 16);- this.lblX.TabIndex = 4;- this.lblX.Text = "/";- this.txtYsize.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.txtYsize.Location = new global::System.Drawing.Point(258, 77);- this.txtYsize.Name = "txtYsize";- this.txtYsize.Size = new global::System.Drawing.Size(64, 22);- this.txtYsize.TabIndex = 3;- this.txtXSize.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.txtXSize.Location = new global::System.Drawing.Point(169, 76);- this.txtXSize.Name = "txtXSize";- this.txtXSize.Size = new global::System.Drawing.Size(72, 22);- this.txtXSize.TabIndex = 3;- this.radUserDefinedScene.AutoSize = true;- this.radUserDefinedScene.Checked = true;- this.radUserDefinedScene.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.radUserDefinedScene.Location = new global::System.Drawing.Point(26, 77);- this.radUserDefinedScene.Name = "radUserDefinedScene";- this.radUserDefinedScene.Size = new global::System.Drawing.Size(141, 20);- this.radUserDefinedScene.TabIndex = 2;- this.radUserDefinedScene.TabStop = true;- this.radUserDefinedScene.Text = "User defined (X /Y)";- this.radUserDefinedScene.UseVisualStyleBackColor = true;- this.radUseSceneImage.AutoSize = true;- this.radUseSceneImage.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.radUseSceneImage.Location = new global::System.Drawing.Point(26, 40);- this.radUseSceneImage.Name = "radUseSceneImage";- this.radUseSceneImage.Size = new global::System.Drawing.Size(106, 20);- this.radUseSceneImage.TabIndex = 0;- this.radUseSceneImage.Text = "Scene image";- this.radUseSceneImage.UseVisualStyleBackColor = true;- this.lblImageNameAndSize.AutoSize = true;- this.lblImageNameAndSize.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblImageNameAndSize.Location = new global::System.Drawing.Point(228, 41);- this.lblImageNameAndSize.Name = "lblImageNameAndSize";- this.lblImageNameAndSize.Size = new global::System.Drawing.Size(103, 16);- this.lblImageNameAndSize.TabIndex = 4;- this.lblImageNameAndSize.Text = "(name and size)";- this.tabSourceList.Controls.Add(this.Label62);- this.tabSourceList.Controls.Add(this.Label60);- this.tabSourceList.Controls.Add(this.chkAutoRescaleSourceOn);- this.tabSourceList.Controls.Add(this.picPreviewSource);- this.tabSourceList.Controls.Add(this.grpPlaceSource);- this.tabSourceList.Controls.Add(this.btnDelete);- this.tabSourceList.Controls.Add(this.btnNew);- this.tabSourceList.Controls.Add(this.btnCopy);- this.tabSourceList.Controls.Add(this.lstSources);- this.tabSourceList.Controls.Add(this.pnlSourceImage);- this.tabSourceList.Controls.Add(this.grpSourceDetails);- this.tabSourceList.Location = new global::System.Drawing.Point(4, 34);- this.tabSourceList.Name = "tabSourceList";- this.tabSourceList.Size = new global::System.Drawing.Size(1742, 693);- this.tabSourceList.TabIndex = 6;- this.tabSourceList.Text = " Sources ";- this.tabSourceList.UseVisualStyleBackColor = true;- this.Label62.AutoSize = true;- this.Label62.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label62.Location = new global::System.Drawing.Point(1187, 18);- this.Label62.Name = "Label62";- this.Label62.Size = new global::System.Drawing.Size(121, 18);- this.Label62.TabIndex = 8;- this.Label62.Text = "List of sources";- this.Label60.AutoSize = true;- this.Label60.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label60.Location = new global::System.Drawing.Point(1185, 408);- this.Label60.Name = "Label60";- this.Label60.Size = new global::System.Drawing.Size(124, 18);- this.Label60.TabIndex = 7;- this.Label60.Text = "Source preview";- this.chkAutoRescaleSourceOn.AutoSize = true;- this.chkAutoRescaleSourceOn.Checked = true;- this.chkAutoRescaleSourceOn.CheckState = global::System.Windows.Forms.CheckState.Checked;- this.chkAutoRescaleSourceOn.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkAutoRescaleSourceOn.Location = new global::System.Drawing.Point(1192, 651);- this.chkAutoRescaleSourceOn.Name = "chkAutoRescaleSourceOn";- this.chkAutoRescaleSourceOn.Size = new global::System.Drawing.Size(186, 20);- this.chkAutoRescaleSourceOn.TabIndex = 6;- this.chkAutoRescaleSourceOn.Text = "Auto-rescale source layout";- this.chkAutoRescaleSourceOn.UseVisualStyleBackColor = true;- this.picPreviewSource.Location = new global::System.Drawing.Point(1185, 430);- this.picPreviewSource.Name = "picPreviewSource";- this.picPreviewSource.Size = new global::System.Drawing.Size(273, 215);- this.picPreviewSource.TabIndex = 5;- this.picPreviewSource.TabStop = false;- this.grpPlaceSource.Controls.Add(this.pnlPosition);- this.grpPlaceSource.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.grpPlaceSource.Location = new global::System.Drawing.Point(1185, 285);- this.grpPlaceSource.Name = "grpPlaceSource";- this.grpPlaceSource.Size = new global::System.Drawing.Size(273, 117);- this.grpPlaceSource.TabIndex = 4;- this.grpPlaceSource.TabStop = false;- this.grpPlaceSource.Text = "Place current source";- this.pnlPosition.BackColor = global::System.Drawing.Color.Azure;- this.pnlPosition.Controls.Add(this.numSourcePositionX);- this.pnlPosition.Controls.Add(this.Label36);- this.pnlPosition.Controls.Add(this.lblPosition);- this.pnlPosition.Controls.Add(this.btnPickSourcePosition);- this.pnlPosition.Controls.Add(this.numSourcePositionY);- this.pnlPosition.Controls.Add(this.Label35);- this.pnlPosition.Location = new global::System.Drawing.Point(22, 25);- this.pnlPosition.Name = "pnlPosition";- this.pnlPosition.Size = new global::System.Drawing.Size(228, 77);- this.pnlPosition.TabIndex = 20;- this.numSourcePositionX.Location = new global::System.Drawing.Point(146, 9);- this.numSourcePositionX.Name = "numSourcePositionX";- this.numSourcePositionX.Size = new global::System.Drawing.Size(65, 22);- this.numSourcePositionX.TabIndex = 11;- this.numSourcePositionX.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.Label36.AutoSize = true;- this.Label36.Location = new global::System.Drawing.Point(123, 11);- this.Label36.Name = "Label36";- this.Label36.Size = new global::System.Drawing.Size(16, 16);- this.Label36.TabIndex = 7;- this.Label36.Text = "X";- this.lblPosition.AutoSize = true;- this.lblPosition.Location = new global::System.Drawing.Point(16, 6);- this.lblPosition.Name = "lblPosition";- this.lblPosition.Size = new global::System.Drawing.Size(97, 16);- this.lblPosition.TabIndex = 12;- this.lblPosition.Text = "Center position";- this.btnPickSourcePosition.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 14.25f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnPickSourcePosition.Location = new global::System.Drawing.Point(15, 31);- this.btnPickSourcePosition.Name = "btnPickSourcePosition";- this.btnPickSourcePosition.Size = new global::System.Drawing.Size(102, 35);- this.btnPickSourcePosition.TabIndex = 9;- this.btnPickSourcePosition.Text = "Pick ";- this.btnPickSourcePosition.UseVisualStyleBackColor = true;- this.numSourcePositionY.Location = new global::System.Drawing.Point(146, 41);- this.numSourcePositionY.Name = "numSourcePositionY";- this.numSourcePositionY.Size = new global::System.Drawing.Size(65, 22);- this.numSourcePositionY.TabIndex = 10;- this.numSourcePositionY.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.Label35.AutoSize = true;- this.Label35.Location = new global::System.Drawing.Point(123, 43);- this.Label35.Name = "Label35";- this.Label35.Size = new global::System.Drawing.Size(17, 16);- this.Label35.TabIndex = 6;- this.Label35.Text = "Y";- this.btnDelete.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnDelete.Location = new global::System.Drawing.Point(1389, 245);- this.btnDelete.Name = "btnDelete";- this.btnDelete.Size = new global::System.Drawing.Size(70, 29);- this.btnDelete.TabIndex = 2;- this.btnDelete.Text = "Delete";- this.btnDelete.UseVisualStyleBackColor = true;- this.btnNew.BackColor = global::System.Drawing.Color.Azure;- this.btnNew.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnNew.Location = new global::System.Drawing.Point(1189, 245);- this.btnNew.Name = "btnNew";- this.btnNew.Size = new global::System.Drawing.Size(70, 28);- this.btnNew.TabIndex = 2;- this.btnNew.Text = "New";- this.btnNew.UseVisualStyleBackColor = false;- this.btnCopy.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnCopy.Location = new global::System.Drawing.Point(1314, 244);- this.btnCopy.Name = "btnCopy";- this.btnCopy.Size = new global::System.Drawing.Size(70, 29);- this.btnCopy.TabIndex = 2;- this.btnCopy.Text = "Copy";- this.btnCopy.UseVisualStyleBackColor = true;- this.lstSources.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lstSources.FormattingEnabled = true;- this.lstSources.ItemHeight = 16;- this.lstSources.Location = new global::System.Drawing.Point(1187, 43);- this.lstSources.Name = "lstSources";- this.lstSources.Size = new global::System.Drawing.Size(273, 196);- this.lstSources.TabIndex = 1;- this.pnlSourceImage.Location = new global::System.Drawing.Point(16, 14);- this.pnlSourceImage.Name = "pnlSourceImage";- this.pnlSourceImage.Size = new global::System.Drawing.Size(1160, 653);- this.pnlSourceImage.TabIndex = 0;- this.grpSourceDetails.Controls.Add(this.txtDetachAfterSteps);- this.grpSourceDetails.Controls.Add(this.btnSaveSource);- this.grpSourceDetails.Controls.Add(this.Label47);- this.grpSourceDetails.Controls.Add(this.chkDetachSource);- this.grpSourceDetails.Controls.Add(this.lblLambdaIs);- this.grpSourceDetails.Controls.Add(this.chkSourceOn);- this.grpSourceDetails.Controls.Add(this.grpComposite);- this.grpSourceDetails.Controls.Add(this.grpSingleSource);- this.grpSourceDetails.Controls.Add(this.radModePulsed);- this.grpSourceDetails.Controls.Add(this.radModeContinuous);- this.grpSourceDetails.Controls.Add(this.txtName);- this.grpSourceDetails.Controls.Add(this.cmbMainType);- this.grpSourceDetails.Controls.Add(this.Label39);- this.grpSourceDetails.Controls.Add(this.lblName);- this.grpSourceDetails.Controls.Add(this.Label38);- this.grpSourceDetails.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.grpSourceDetails.Location = new global::System.Drawing.Point(1471, 15);- this.grpSourceDetails.Name = "grpSourceDetails";- this.grpSourceDetails.Size = new global::System.Drawing.Size(254, 666);- this.grpSourceDetails.TabIndex = 3;- this.grpSourceDetails.TabStop = false;- this.grpSourceDetails.Text = "Source ";- this.txtDetachAfterSteps.BorderStyle = global::System.Windows.Forms.BorderStyle.FixedSingle;- this.txtDetachAfterSteps.Location = new global::System.Drawing.Point(128, 591);- this.txtDetachAfterSteps.Name = "txtDetachAfterSteps";- this.txtDetachAfterSteps.Size = new global::System.Drawing.Size(65, 22);- this.txtDetachAfterSteps.TabIndex = 23;- this.btnSaveSource.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnSaveSource.Location = new global::System.Drawing.Point(12, 623);- this.btnSaveSource.Name = "btnSaveSource";- this.btnSaveSource.Size = new global::System.Drawing.Size(228, 30);- this.btnSaveSource.TabIndex = 17;- this.btnSaveSource.Text = "Save source data";- this.btnSaveSource.UseVisualStyleBackColor = true;- this.Label47.AutoSize = true;- this.Label47.Location = new global::System.Drawing.Point(199, 594);- this.Label47.Name = "Label47";- this.Label47.Size = new global::System.Drawing.Size(41, 16);- this.Label47.TabIndex = 22;- this.Label47.Text = "steps";- this.chkDetachSource.AutoSize = true;- this.chkDetachSource.Location = new global::System.Drawing.Point(23, 592);- this.chkDetachSource.Name = "chkDetachSource";- this.chkDetachSource.Size = new global::System.Drawing.Size(99, 20);- this.chkDetachSource.TabIndex = 21;- this.chkDetachSource.Text = "Detach after";- this.chkDetachSource.UseVisualStyleBackColor = true;- this.lblLambdaIs.AutoSize = true;- this.lblLambdaIs.BackColor = global::System.Drawing.Color.White;- this.lblLambdaIs.Location = new global::System.Drawing.Point(162, 1);- this.lblLambdaIs.Name = "lblLambdaIs";- this.lblLambdaIs.Size = new global::System.Drawing.Size(52, 16);- this.lblLambdaIs.TabIndex = 19;- this.lblLambdaIs.Text = "λ= px";- this.chkSourceOn.AutoSize = true;- this.chkSourceOn.Location = new global::System.Drawing.Point(60, 0);- this.chkSourceOn.Name = "chkSourceOn";- this.chkSourceOn.Size = new global::System.Drawing.Size(42, 20);- this.chkSourceOn.TabIndex = 18;- this.chkSourceOn.Text = "on";- this.chkSourceOn.UseVisualStyleBackColor = true;- this.grpComposite.Controls.Add(this.Label59);- this.grpComposite.Controls.Add(this.Label58);- this.grpComposite.Controls.Add(this.numRandomizeOffWidth);- this.grpComposite.Controls.Add(this.numRandomizePosition);- this.grpComposite.Controls.Add(this.NumRandomizePhase);- this.grpComposite.Controls.Add(this.numRandomizeFrequency);- this.grpComposite.Controls.Add(this.chkRandomizePhase);- this.grpComposite.Controls.Add(this.chkRandomizePosition);- this.grpComposite.Controls.Add(this.chkOffWidth);- this.grpComposite.Controls.Add(this.chkRandomizeFrequency);- this.grpComposite.Controls.Add(this.numSpacingSizeY);- this.grpComposite.Controls.Add(this.numSpacingSizeX);- this.grpComposite.Controls.Add(this.numArraySizeY);- this.grpComposite.Controls.Add(this.numArraySizeX);- this.grpComposite.Controls.Add(this.Label50);- this.grpComposite.Controls.Add(this.Label51);- this.grpComposite.Controls.Add(this.Label52);- this.grpComposite.Controls.Add(this.Label53);- this.grpComposite.Controls.Add(this.cmbCompositeProperties);- this.grpComposite.Location = new global::System.Drawing.Point(12, 344);- this.grpComposite.Name = "grpComposite";- this.grpComposite.Size = new global::System.Drawing.Size(230, 241);- this.grpComposite.TabIndex = 16;- this.grpComposite.TabStop = false;- this.grpComposite.Text = "Composite source";- this.Label59.AutoSize = true;- this.Label59.Location = new global::System.Drawing.Point(181, 17);- this.Label59.Name = "Label59";- this.Label59.Size = new global::System.Drawing.Size(15, 16);- this.Label59.TabIndex = 16;- this.Label59.Text = "y";- this.Label58.AutoSize = true;- this.Label58.Location = new global::System.Drawing.Point(110, 17);- this.Label58.Name = "Label58";- this.Label58.Size = new global::System.Drawing.Size(14, 16);- this.Label58.TabIndex = 16;- this.Label58.Text = "x";- this.numRandomizeOffWidth.Location = new global::System.Drawing.Point(17, 208);- global::System.Windows.Forms.NumericUpDown numRandomizeOffWidth = this.numRandomizeOffWidth;- int[] array16 = new int[4];- array16[0] = 10000;- numRandomizeOffWidth.Maximum = new decimal(array16);- this.numRandomizeOffWidth.Name = "numRandomizeOffWidth";- this.numRandomizeOffWidth.Size = new global::System.Drawing.Size(81, 22);- this.numRandomizeOffWidth.TabIndex = 14;- this.numRandomizeOffWidth.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numRandomizePosition.Location = new global::System.Drawing.Point(129, 208);- global::System.Windows.Forms.NumericUpDown numRandomizePosition = this.numRandomizePosition;- int[] array17 = new int[4];- array17[0] = 5;- numRandomizePosition.Maximum = new decimal(array17);- this.numRandomizePosition.Name = "numRandomizePosition";- this.numRandomizePosition.Size = new global::System.Drawing.Size(80, 22);- this.numRandomizePosition.TabIndex = 14;- this.numRandomizePosition.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.NumRandomizePhase.Location = new global::System.Drawing.Point(129, 162);- global::System.Windows.Forms.NumericUpDown numRandomizePhase = this.NumRandomizePhase;- int[] array18 = new int[4];- array18[0] = 180;- numRandomizePhase.Maximum = new decimal(array18);- this.NumRandomizePhase.Name = "NumRandomizePhase";- this.NumRandomizePhase.Size = new global::System.Drawing.Size(80, 22);- this.NumRandomizePhase.TabIndex = 14;- this.NumRandomizePhase.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numRandomizeFrequency.Location = new global::System.Drawing.Point(18, 163);- global::System.Windows.Forms.NumericUpDown numRandomizeFrequency = this.numRandomizeFrequency;- int[] array19 = new int[4];- array19[0] = 50;- numRandomizeFrequency.Maximum = new decimal(array19);- this.numRandomizeFrequency.Name = "numRandomizeFrequency";- this.numRandomizeFrequency.Size = new global::System.Drawing.Size(80, 22);- this.numRandomizeFrequency.TabIndex = 14;- this.numRandomizeFrequency.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.chkRandomizePhase.AutoSize = true;- this.chkRandomizePhase.Location = new global::System.Drawing.Point(129, 144);- this.chkRandomizePhase.Name = "chkRandomizePhase";- this.chkRandomizePhase.Size = new global::System.Drawing.Size(66, 20);- this.chkRandomizePhase.TabIndex = 15;- this.chkRandomizePhase.Text = "Phase";- this.chkRandomizePhase.UseVisualStyleBackColor = true;- this.chkRandomizePosition.AutoSize = true;- this.chkRandomizePosition.Location = new global::System.Drawing.Point(129, 190);- this.chkRandomizePosition.Name = "chkRandomizePosition";- this.chkRandomizePosition.Size = new global::System.Drawing.Size(75, 20);- this.chkRandomizePosition.TabIndex = 15;- this.chkRandomizePosition.Text = "Position";- this.chkRandomizePosition.UseVisualStyleBackColor = true;- this.chkOffWidth.AutoSize = true;- this.chkOffWidth.Location = new global::System.Drawing.Point(17, 190);- this.chkOffWidth.Name = "chkOffWidth";- this.chkOffWidth.Size = new global::System.Drawing.Size(75, 20);- this.chkOffWidth.TabIndex = 15;- this.chkOffWidth.Text = "Off state";- this.chkOffWidth.UseVisualStyleBackColor = true;- this.chkRandomizeFrequency.AutoSize = true;- this.chkRandomizeFrequency.Location = new global::System.Drawing.Point(19, 145);- this.chkRandomizeFrequency.Name = "chkRandomizeFrequency";- this.chkRandomizeFrequency.Size = new global::System.Drawing.Size(91, 20);- this.chkRandomizeFrequency.TabIndex = 15;- this.chkRandomizeFrequency.Text = "Frequency";- this.chkRandomizeFrequency.UseVisualStyleBackColor = true;- this.numSpacingSizeY.Location = new global::System.Drawing.Point(161, 64);- this.numSpacingSizeY.Name = "numSpacingSizeY";- this.numSpacingSizeY.Size = new global::System.Drawing.Size(55, 22);- this.numSpacingSizeY.TabIndex = 14;- this.numSpacingSizeY.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numSpacingSizeX.Location = new global::System.Drawing.Point(94, 64);- this.numSpacingSizeX.Name = "numSpacingSizeX";- this.numSpacingSizeX.Size = new global::System.Drawing.Size(55, 22);- this.numSpacingSizeX.TabIndex = 14;- this.numSpacingSizeX.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numArraySizeY = this.numArraySizeY;- int[] array20 = new int[4];- array20[0] = 2;- numArraySizeY.Increment = new decimal(array20);- this.numArraySizeY.Location = new global::System.Drawing.Point(161, 36);- global::System.Windows.Forms.NumericUpDown numArraySizeY2 = this.numArraySizeY;- int[] array21 = new int[4];- array21[0] = 101;- numArraySizeY2.Maximum = new decimal(array21);- global::System.Windows.Forms.NumericUpDown numArraySizeY3 = this.numArraySizeY;- int[] array22 = new int[4];- array22[0] = 1;- numArraySizeY3.Minimum = new decimal(array22);- this.numArraySizeY.Name = "numArraySizeY";- this.numArraySizeY.Size = new global::System.Drawing.Size(55, 22);- this.numArraySizeY.TabIndex = 14;- this.numArraySizeY.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numArraySizeY4 = this.numArraySizeY;- int[] array23 = new int[4];- array23[0] = 1;- numArraySizeY4.Value = new decimal(array23);- global::System.Windows.Forms.NumericUpDown numArraySizeX = this.numArraySizeX;- int[] array24 = new int[4];- array24[0] = 2;- numArraySizeX.Increment = new decimal(array24);- this.numArraySizeX.Location = new global::System.Drawing.Point(93, 36);- global::System.Windows.Forms.NumericUpDown numArraySizeX2 = this.numArraySizeX;- int[] array25 = new int[4];- array25[0] = 101;- numArraySizeX2.Maximum = new decimal(array25);- global::System.Windows.Forms.NumericUpDown numArraySizeX3 = this.numArraySizeX;- int[] array26 = new int[4];- array26[0] = 1;- numArraySizeX3.Minimum = new decimal(array26);- this.numArraySizeX.Name = "numArraySizeX";- this.numArraySizeX.Size = new global::System.Drawing.Size(55, 22);- this.numArraySizeX.TabIndex = 14;- this.numArraySizeX.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numArraySizeX4 = this.numArraySizeX;- int[] array27 = new int[4];- array27[0] = 1;- numArraySizeX4.Value = new decimal(array27);- this.Label50.AutoSize = true;- this.Label50.Location = new global::System.Drawing.Point(15, 124);- this.Label50.Name = "Label50";- this.Label50.Size = new global::System.Drawing.Size(77, 16);- this.Label50.TabIndex = 0;- this.Label50.Text = "Randomize";- this.Label51.AutoSize = true;- this.Label51.Location = new global::System.Drawing.Point(15, 96);- this.Label51.Name = "Label51";- this.Label51.Size = new global::System.Drawing.Size(70, 16);- this.Label51.TabIndex = 0;- this.Label51.Text = "Properties";- this.Label52.AutoSize = true;- this.Label52.Location = new global::System.Drawing.Point(15, 66);- this.Label52.Name = "Label52";- this.Label52.Size = new global::System.Drawing.Size(61, 16);- this.Label52.TabIndex = 0;- this.Label52.Text = "Spacing ";- this.Label53.AutoSize = true;- this.Label53.Location = new global::System.Drawing.Point(15, 36);- this.Label53.Name = "Label53";- this.Label53.Size = new global::System.Drawing.Size(67, 16);- this.Label53.TabIndex = 0;- this.Label53.Text = "Array size";- this.cmbCompositeProperties.Enabled = false;- this.cmbCompositeProperties.FormattingEnabled = true;- this.cmbCompositeProperties.Items.AddRange(new object[] { "Inherit from single", "Inherit + randomize" });- this.cmbCompositeProperties.Location = new global::System.Drawing.Point(88, 93);- this.cmbCompositeProperties.Name = "cmbCompositeProperties";- this.cmbCompositeProperties.Size = new global::System.Drawing.Size(134, 24);- this.cmbCompositeProperties.TabIndex = 13;- this.grpSingleSource.Controls.Add(this.numOffStateCycles);- this.grpSingleSource.Controls.Add(this.numPhase);- this.grpSingleSource.Controls.Add(this.numAmplitude);- this.grpSingleSource.Controls.Add(this.numFrequency);- this.grpSingleSource.Controls.Add(this.numPulseWidthCycles);- this.grpSingleSource.Controls.Add(this.Label44);- this.grpSingleSource.Controls.Add(this.Label46);- this.grpSingleSource.Controls.Add(this.Label45);- this.grpSingleSource.Controls.Add(this.Label43);- this.grpSingleSource.Controls.Add(this.Label42);- this.grpSingleSource.Controls.Add(this.Label54);- this.grpSingleSource.Controls.Add(this.Label41);- this.grpSingleSource.Controls.Add(this.Label40);- this.grpSingleSource.Controls.Add(this.cmbPulseShape);- this.grpSingleSource.Location = new global::System.Drawing.Point(12, 126);- this.grpSingleSource.Name = "grpSingleSource";- this.grpSingleSource.Size = new global::System.Drawing.Size(230, 213);- this.grpSingleSource.TabIndex = 16;- this.grpSingleSource.TabStop = false;- this.grpSingleSource.Text = "Single source properties";- this.numOffStateCycles.Location = new global::System.Drawing.Point(106, 179);- global::System.Windows.Forms.NumericUpDown numOffStateCycles = this.numOffStateCycles;- int[] array28 = new int[4];- array28[0] = 100000;- numOffStateCycles.Maximum = new decimal(array28);- global::System.Windows.Forms.NumericUpDown numOffStateCycles2 = this.numOffStateCycles;- int[] array29 = new int[4];- array29[0] = 1;- numOffStateCycles2.Minimum = new decimal(array29);- this.numOffStateCycles.Name = "numOffStateCycles";- this.numOffStateCycles.Size = new global::System.Drawing.Size(64, 22);- this.numOffStateCycles.TabIndex = 14;- this.numOffStateCycles.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numOffStateCycles3 = this.numOffStateCycles;- int[] array30 = new int[4];- array30[0] = 10;- numOffStateCycles3.Value = new decimal(array30);- this.numPhase.Location = new global::System.Drawing.Point(106, 87);- global::System.Windows.Forms.NumericUpDown numPhase = this.numPhase;- int[] array31 = new int[4];- array31[0] = 180;- numPhase.Maximum = new decimal(array31);- this.numPhase.Minimum = new decimal(new int[] { 180, 0, 0, int.MinValue });- this.numPhase.Name = "numPhase";- this.numPhase.Size = new global::System.Drawing.Size(64, 22);- this.numPhase.TabIndex = 14;- this.numPhase.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numAmplitude.Location = new global::System.Drawing.Point(106, 59);- this.numAmplitude.Name = "numAmplitude";- this.numAmplitude.Size = new global::System.Drawing.Size(64, 22);- this.numAmplitude.TabIndex = 14;- this.numAmplitude.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numAmplitude = this.numAmplitude;- int[] array32 = new int[4];- array32[0] = 100;- numAmplitude.Value = new decimal(array32);- this.numFrequency.Location = new global::System.Drawing.Point(106, 31);- global::System.Windows.Forms.NumericUpDown numFrequency = this.numFrequency;- int[] array33 = new int[4];- array33[0] = 255;- numFrequency.Maximum = new decimal(array33);- global::System.Windows.Forms.NumericUpDown numFrequency2 = this.numFrequency;- int[] array34 = new int[4];- array34[0] = 1;- numFrequency2.Minimum = new decimal(array34);- this.numFrequency.Name = "numFrequency";- this.numFrequency.Size = new global::System.Drawing.Size(64, 22);- this.numFrequency.TabIndex = 14;- this.numFrequency.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numFrequency3 = this.numFrequency;- int[] array35 = new int[4];- array35[0] = 100;- numFrequency3.Value = new decimal(array35);- this.numPulseWidthCycles.Location = new global::System.Drawing.Point(106, 151);- this.numPulseWidthCycles.Name = "numPulseWidthCycles";- this.numPulseWidthCycles.Size = new global::System.Drawing.Size(64, 22);- this.numPulseWidthCycles.TabIndex = 14;- this.numPulseWidthCycles.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numPulseWidthCycles = this.numPulseWidthCycles;- int[] array36 = new int[4];- array36[0] = 10;- numPulseWidthCycles.Value = new decimal(array36);- this.Label44.AutoSize = true;- this.Label44.Location = new global::System.Drawing.Point(15, 182);- this.Label44.Name = "Label44";- this.Label44.Size = new global::System.Drawing.Size(56, 16);- this.Label44.TabIndex = 0;- this.Label44.Text = "Off state";- this.Label46.AutoSize = true;- this.Label46.Location = new global::System.Drawing.Point(176, 181);- this.Label46.Name = "Label46";- this.Label46.Size = new global::System.Drawing.Size(47, 16);- this.Label46.TabIndex = 0;- this.Label46.Text = "cycles";- this.Label45.AutoSize = true;- this.Label45.Location = new global::System.Drawing.Point(176, 153);- this.Label45.Name = "Label45";- this.Label45.Size = new global::System.Drawing.Size(47, 16);- this.Label45.TabIndex = 0;- this.Label45.Text = "cycles";- this.Label43.AutoSize = true;- this.Label43.Location = new global::System.Drawing.Point(15, 153);- this.Label43.Name = "Label43";- this.Label43.Size = new global::System.Drawing.Size(75, 16);- this.Label43.TabIndex = 0;- this.Label43.Text = "Pulse width";- this.Label42.AutoSize = true;- this.Label42.Location = new global::System.Drawing.Point(15, 121);- this.Label42.Name = "Label42";- this.Label42.Size = new global::System.Drawing.Size(83, 16);- this.Label42.TabIndex = 0;- this.Label42.Text = "Pulse shape";- this.Label54.AutoSize = true;- this.Label54.Location = new global::System.Drawing.Point(14, 89);- this.Label54.Name = "Label54";- this.Label54.Size = new global::System.Drawing.Size(47, 16);- this.Label54.TabIndex = 0;- this.Label54.Text = "Phase";- this.Label41.AutoSize = true;- this.Label41.Location = new global::System.Drawing.Point(14, 61);- this.Label41.Name = "Label41";- this.Label41.Size = new global::System.Drawing.Size(68, 16);- this.Label41.TabIndex = 0;- this.Label41.Text = "Amplitude";- this.Label40.AutoSize = true;- this.Label40.Location = new global::System.Drawing.Point(14, 33);- this.Label40.Name = "Label40";- this.Label40.Size = new global::System.Drawing.Size(72, 16);- this.Label40.TabIndex = 0;- this.Label40.Text = "Frequency";- this.cmbPulseShape.Enabled = false;- this.cmbPulseShape.FormattingEnabled = true;- this.cmbPulseShape.Items.AddRange(new object[] { "Gaussian", "Smoothed square" });- this.cmbPulseShape.Location = new global::System.Drawing.Point(106, 118);- this.cmbPulseShape.Name = "cmbPulseShape";- this.cmbPulseShape.Size = new global::System.Drawing.Size(110, 24);- this.cmbPulseShape.TabIndex = 13;- this.radModePulsed.AutoSize = true;- this.radModePulsed.Location = new global::System.Drawing.Point(156, 97);- this.radModePulsed.Name = "radModePulsed";- this.radModePulsed.Size = new global::System.Drawing.Size(68, 20);- this.radModePulsed.TabIndex = 15;- this.radModePulsed.TabStop = true;- this.radModePulsed.Text = "Pulsed";- this.radModePulsed.UseVisualStyleBackColor = true;- this.radModeContinuous.AutoSize = true;- this.radModeContinuous.Location = new global::System.Drawing.Point(65, 97);- this.radModeContinuous.Name = "radModeContinuous";- this.radModeContinuous.Size = new global::System.Drawing.Size(92, 20);- this.radModeContinuous.TabIndex = 15;- this.radModeContinuous.TabStop = true;- this.radModeContinuous.Text = "Continuous";- this.radModeContinuous.UseVisualStyleBackColor = true;- this.txtName.BorderStyle = global::System.Windows.Forms.BorderStyle.FixedSingle;- this.txtName.Location = new global::System.Drawing.Point(92, 30);- this.txtName.Name = "txtName";- this.txtName.Size = new global::System.Drawing.Size(142, 22);- this.txtName.TabIndex = 14;- this.cmbMainType.FormattingEnabled = true;- this.cmbMainType.Items.AddRange(new object[] { "Single point", "Composite" });- this.cmbMainType.Location = new global::System.Drawing.Point(92, 61);- this.cmbMainType.Name = "cmbMainType";- this.cmbMainType.Size = new global::System.Drawing.Size(142, 24);- this.cmbMainType.TabIndex = 13;- this.Label39.AutoSize = true;- this.Label39.Location = new global::System.Drawing.Point(20, 99);- this.Label39.Name = "Label39";- this.Label39.Size = new global::System.Drawing.Size(43, 16);- this.Label39.TabIndex = 12;- this.Label39.Text = "Mode";- this.lblName.AutoSize = true;- this.lblName.Location = new global::System.Drawing.Point(20, 33);- this.lblName.Name = "lblName";- this.lblName.Size = new global::System.Drawing.Size(45, 16);- this.lblName.TabIndex = 12;- this.lblName.Text = "Name";- this.Label38.AutoSize = true;- this.Label38.Location = new global::System.Drawing.Point(20, 64);- this.Label38.Name = "Label38";- this.Label38.Size = new global::System.Drawing.Size(66, 16);- this.Label38.TabIndex = 12;- this.Label38.Text = "Main type";- this.tabProbeList.Controls.Add(this.GroupBox2);- this.tabProbeList.Controls.Add(this.grpProbe2);- this.tabProbeList.Controls.Add(this.grpProbe1);- this.tabProbeList.Controls.Add(this.pnlProbeImage);- this.tabProbeList.Location = new global::System.Drawing.Point(4, 34);- this.tabProbeList.Name = "tabProbeList";- this.tabProbeList.Size = new global::System.Drawing.Size(1742, 693);- this.tabProbeList.TabIndex = 2;- this.tabProbeList.Text = " Probes ";- this.tabProbeList.UseVisualStyleBackColor = true;- this.GroupBox2.Controls.Add(this.Label49);- this.GroupBox2.Controls.Add(this.Label48);- this.GroupBox2.Controls.Add(this.Label37);- this.GroupBox2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.GroupBox2.Location = new global::System.Drawing.Point(1201, 584);- this.GroupBox2.Name = "GroupBox2";- this.GroupBox2.Size = new global::System.Drawing.Size(504, 83);- this.GroupBox2.TabIndex = 2;- this.GroupBox2.TabStop = false;- this.GroupBox2.Text = "How to use probes";- this.Label49.AutoSize = true;- this.Label49.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label49.Location = new global::System.Drawing.Point(15, 60);- this.Label49.Name = "Label49";- this.Label49.Size = new global::System.Drawing.Size(430, 16);- this.Label49.TabIndex = 0;- this.Label49.Text = "- Probe type \"Line\": Use 2 clicks to set line, then third click to place plot .";- this.Label48.AutoSize = true;- this.Label48.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label48.Location = new global::System.Drawing.Point(14, 42);- this.Label48.Name = "Label48";- this.Label48.Size = new global::System.Drawing.Size(461, 16);- this.Label48.TabIndex = 0;- this.Label48.Text = "- Probe type \"Point\": First click sets probe location, second sets data window";- this.Label37.AutoSize = true;- this.Label37.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label37.Location = new global::System.Drawing.Point(15, 22);- this.Label37.Name = "Label37";- this.Label37.Size = new global::System.Drawing.Size(442, 16);- this.Label37.TabIndex = 0;- this.Label37.Text = "Set all properties first and then use the \"Pick\" button to choose a location. ";- this.grpProbe2.BackColor = global::System.Drawing.Color.Gainsboro;- this.grpProbe2.Controls.Add(this.Label22);- this.grpProbe2.Controls.Add(this.numRunningWindow2);- this.grpProbe2.Controls.Add(this.chkProbeOn2);- this.grpProbe2.Controls.Add(this.txtStartAfterStep2);- this.grpProbe2.Controls.Add(this.chkStartAfterStep2);- this.grpProbe2.Controls.Add(this.Label23);- this.grpProbe2.Controls.Add(this.Label24);- this.grpProbe2.Controls.Add(this.txtMaxScaleY2);- this.grpProbe2.Controls.Add(this.txtMinScaleY2);- this.grpProbe2.Controls.Add(this.radFullScale2);- this.grpProbe2.Controls.Add(this.radRunningScale2);- this.grpProbe2.Controls.Add(this.chkAutoScaleY2);- this.grpProbe2.Controls.Add(this.chkAutoScaleX2);- this.grpProbe2.Controls.Add(this.numBPosY2);- this.grpProbe2.Controls.Add(this.numAPosY2);- this.grpProbe2.Controls.Add(this.numBPosX2);- this.grpProbe2.Controls.Add(this.numAPosX2);- this.grpProbe2.Controls.Add(this.butPicPositions2);- this.grpProbe2.Controls.Add(this.Label25);- this.grpProbe2.Controls.Add(this.cmbPlaceOn2);- this.grpProbe2.Controls.Add(this.cmbMeasurement2);- this.grpProbe2.Controls.Add(this.Label26);- this.grpProbe2.Controls.Add(this.Label27);- this.grpProbe2.Controls.Add(this.cmbBoxSize2);- this.grpProbe2.Controls.Add(this.cmbProbeType2);- this.grpProbe2.Controls.Add(this.Label28);- this.grpProbe2.Controls.Add(this.Label29);- this.grpProbe2.Controls.Add(this.Label30);- this.grpProbe2.Controls.Add(this.Label31);- this.grpProbe2.Controls.Add(this.Label32);- this.grpProbe2.Controls.Add(this.Label33);- this.grpProbe2.Controls.Add(this.Label34);- this.grpProbe2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.grpProbe2.Location = new global::System.Drawing.Point(1202, 303);- this.grpProbe2.Name = "grpProbe2";- this.grpProbe2.Size = new global::System.Drawing.Size(506, 276);- this.grpProbe2.TabIndex = 1;- this.grpProbe2.TabStop = false;- this.grpProbe2.Text = "Probe 2 ";- this.Label22.AutoSize = true;- this.Label22.Location = new global::System.Drawing.Point(259, 59);- this.Label22.Name = "Label22";- this.Label22.Size = new global::System.Drawing.Size(104, 16);- this.Label22.TabIndex = 14;- this.Label22.Text = "Running window";- this.numRunningWindow2.Location = new global::System.Drawing.Point(371, 58);- global::System.Windows.Forms.NumericUpDown numRunningWindow = this.numRunningWindow2;- int[] array37 = new int[4];- array37[0] = 1000000;- numRunningWindow.Maximum = new decimal(array37);- global::System.Windows.Forms.NumericUpDown numRunningWindow2 = this.numRunningWindow2;- int[] array38 = new int[4];- array38[0] = 10;- numRunningWindow2.Minimum = new decimal(array38);- this.numRunningWindow2.Name = "numRunningWindow2";- this.numRunningWindow2.Size = new global::System.Drawing.Size(83, 22);- this.numRunningWindow2.TabIndex = 13;- this.numRunningWindow2.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numRunningWindow3 = this.numRunningWindow2;- int[] array39 = new int[4];- array39[0] = 500;- numRunningWindow3.Value = new decimal(array39);- this.chkProbeOn2.AutoSize = true;- this.chkProbeOn2.Location = new global::System.Drawing.Point(66, -1);- this.chkProbeOn2.Name = "chkProbeOn2";- this.chkProbeOn2.Size = new global::System.Drawing.Size(44, 20);- this.chkProbeOn2.TabIndex = 12;- this.chkProbeOn2.Text = "On";- this.chkProbeOn2.UseVisualStyleBackColor = true;- this.txtStartAfterStep2.Location = new global::System.Drawing.Point(179, 163);- this.txtStartAfterStep2.Name = "txtStartAfterStep2";- this.txtStartAfterStep2.Size = new global::System.Drawing.Size(57, 22);- this.txtStartAfterStep2.TabIndex = 11;- this.txtStartAfterStep2.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Right;- this.chkStartAfterStep2.AutoSize = true;- this.chkStartAfterStep2.Location = new global::System.Drawing.Point(17, 165);- this.chkStartAfterStep2.Name = "chkStartAfterStep2";- this.chkStartAfterStep2.Size = new global::System.Drawing.Size(167, 20);- this.chkStartAfterStep2.TabIndex = 10;- this.chkStartAfterStep2.Text = "Start recording at step #";- this.chkStartAfterStep2.UseVisualStyleBackColor = true;- this.Label23.AutoSize = true;- this.Label23.Location = new global::System.Drawing.Point(438, 111);- this.Label23.Name = "Label23";- this.Label23.Size = new global::System.Drawing.Size(33, 16);- this.Label23.TabIndex = 2;- this.Label23.Text = "Max";- this.Label24.AutoSize = true;- this.Label24.Location = new global::System.Drawing.Point(378, 111);- this.Label24.Name = "Label24";- this.Label24.Size = new global::System.Drawing.Size(29, 16);- this.Label24.TabIndex = 2;- this.Label24.Text = "Min";- this.txtMaxScaleY2.Location = new global::System.Drawing.Point(431, 127);- this.txtMaxScaleY2.Name = "txtMaxScaleY2";- this.txtMaxScaleY2.Size = new global::System.Drawing.Size(52, 22);- this.txtMaxScaleY2.TabIndex = 8;- this.txtMaxScaleY2.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Right;- this.txtMinScaleY2.Location = new global::System.Drawing.Point(371, 127);- this.txtMinScaleY2.Name = "txtMinScaleY2";- this.txtMinScaleY2.Size = new global::System.Drawing.Size(52, 22);- this.txtMinScaleY2.TabIndex = 8;- this.txtMinScaleY2.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Right;- this.radFullScale2.AutoSize = true;- this.radFullScale2.Location = new global::System.Drawing.Point(379, 24);- this.radFullScale2.Name = "radFullScale2";- this.radFullScale2.Size = new global::System.Drawing.Size(83, 20);- this.radFullScale2.TabIndex = 7;- this.radFullScale2.TabStop = true;- this.radFullScale2.Text = "Full scale";- this.radFullScale2.UseVisualStyleBackColor = true;- this.radRunningScale2.AutoSize = true;- this.radRunningScale2.Location = new global::System.Drawing.Point(262, 24);- this.radRunningScale2.Name = "radRunningScale2";- this.radRunningScale2.Size = new global::System.Drawing.Size(111, 20);- this.radRunningScale2.TabIndex = 7;- this.radRunningScale2.TabStop = true;- this.radRunningScale2.Text = "Running scale";- this.radRunningScale2.UseVisualStyleBackColor = true;- this.chkAutoScaleY2.AutoSize = true;- this.chkAutoScaleY2.Location = new global::System.Drawing.Point(262, 127);- this.chkAutoScaleY2.Name = "chkAutoScaleY2";- this.chkAutoScaleY2.Size = new global::System.Drawing.Size(110, 20);- this.chkAutoScaleY2.TabIndex = 6;- this.chkAutoScaleY2.Text = "Auto Scale Y";- this.chkAutoScaleY2.UseVisualStyleBackColor = true;- this.chkAutoScaleX2.AutoSize = true;- this.chkAutoScaleX2.Location = new global::System.Drawing.Point(262, 91);- this.chkAutoScaleX2.Name = "chkAutoScaleX2";- this.chkAutoScaleX2.Size = new global::System.Drawing.Size(101, 20);- this.chkAutoScaleX2.TabIndex = 6;- this.chkAutoScaleX2.Text = "Auto scale X";- this.chkAutoScaleX2.UseVisualStyleBackColor = true;- this.numBPosY2.Location = new global::System.Drawing.Point(326, 234);- this.numBPosY2.Name = "numBPosY2";- this.numBPosY2.Size = new global::System.Drawing.Size(65, 22);- this.numBPosY2.TabIndex = 5;- this.numBPosY2.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numAPosY2.Location = new global::System.Drawing.Point(126, 234);- this.numAPosY2.Name = "numAPosY2";- this.numAPosY2.Size = new global::System.Drawing.Size(65, 22);- this.numAPosY2.TabIndex = 5;- this.numAPosY2.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numBPosX2.Location = new global::System.Drawing.Point(238, 234);- this.numBPosX2.Name = "numBPosX2";- this.numBPosX2.Size = new global::System.Drawing.Size(65, 22);- this.numBPosX2.TabIndex = 5;- this.numBPosX2.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numAPosX2.Location = new global::System.Drawing.Point(38, 234);- this.numAPosX2.Name = "numAPosX2";- this.numAPosX2.Size = new global::System.Drawing.Size(65, 22);- this.numAPosX2.TabIndex = 5;- this.numAPosX2.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.butPicPositions2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.butPicPositions2.Location = new global::System.Drawing.Point(402, 226);- this.butPicPositions2.Name = "butPicPositions2";- this.butPicPositions2.Size = new global::System.Drawing.Size(90, 34);- this.butPicPositions2.TabIndex = 4;- this.butPicPositions2.Text = "Pick ";- this.butPicPositions2.UseVisualStyleBackColor = true;- this.Label25.AutoSize = true;- this.Label25.Location = new global::System.Drawing.Point(311, 236);- this.Label25.Name = "Label25";- this.Label25.Size = new global::System.Drawing.Size(17, 16);- this.Label25.TabIndex = 2;- this.Label25.Text = "Y";- this.cmbPlaceOn2.FormattingEnabled = true;- this.cmbPlaceOn2.Items.AddRange(new object[] { "Field", "Intensity" });- this.cmbPlaceOn2.Location = new global::System.Drawing.Point(106, 24);- this.cmbPlaceOn2.Name = "cmbPlaceOn2";- this.cmbPlaceOn2.Size = new global::System.Drawing.Size(130, 24);- this.cmbPlaceOn2.TabIndex = 3;- this.cmbMeasurement2.FormattingEnabled = true;- this.cmbMeasurement2.Items.AddRange(new object[] { "Amplitude", "Intensity", "Integrate Intensity" });- this.cmbMeasurement2.Location = new global::System.Drawing.Point(106, 56);- this.cmbMeasurement2.Name = "cmbMeasurement2";- this.cmbMeasurement2.Size = new global::System.Drawing.Size(130, 24);- this.cmbMeasurement2.TabIndex = 3;- this.Label26.AutoSize = true;- this.Label26.Location = new global::System.Drawing.Point(111, 236);- this.Label26.Name = "Label26";- this.Label26.Size = new global::System.Drawing.Size(17, 16);- this.Label26.TabIndex = 2;- this.Label26.Text = "Y";- this.Label27.AutoSize = true;- this.Label27.Location = new global::System.Drawing.Point(223, 236);- this.Label27.Name = "Label27";- this.Label27.Size = new global::System.Drawing.Size(16, 16);- this.Label27.TabIndex = 2;- this.Label27.Text = "X";- this.cmbBoxSize2.FormattingEnabled = true;- this.cmbBoxSize2.Items.AddRange(new object[] { "Tiny (200 x100)", "Small (300 x 150)", "Medium (400x200)", "Large (500x250)", "Extra Large (700x350)" });- this.cmbBoxSize2.Location = new global::System.Drawing.Point(106, 124);- this.cmbBoxSize2.Name = "cmbBoxSize2";- this.cmbBoxSize2.Size = new global::System.Drawing.Size(130, 24);- this.cmbBoxSize2.TabIndex = 3;- this.cmbProbeType2.FormattingEnabled = true;- this.cmbProbeType2.Items.AddRange(new object[] { "Point (A)", "Line (A-B)" });- this.cmbProbeType2.Location = new global::System.Drawing.Point(106, 89);- this.cmbProbeType2.Name = "cmbProbeType2";- this.cmbProbeType2.Size = new global::System.Drawing.Size(130, 24);- this.cmbProbeType2.TabIndex = 3;- this.Label28.AutoSize = true;- this.Label28.Location = new global::System.Drawing.Point(277, 209);- this.Label28.Name = "Label28";- this.Label28.Size = new global::System.Drawing.Size(68, 16);- this.Label28.TabIndex = 2;- this.Label28.Text = "Position B";- this.Label29.AutoSize = true;- this.Label29.Location = new global::System.Drawing.Point(23, 236);- this.Label29.Name = "Label29";- this.Label29.Size = new global::System.Drawing.Size(16, 16);- this.Label29.TabIndex = 2;- this.Label29.Text = "X";- this.Label30.AutoSize = true;- this.Label30.Location = new global::System.Drawing.Point(76, 209);- this.Label30.Name = "Label30";- this.Label30.Size = new global::System.Drawing.Size(68, 16);- this.Label30.TabIndex = 2;- this.Label30.Text = "Position A";- this.Label31.AutoSize = true;- this.Label31.Location = new global::System.Drawing.Point(14, 127);- this.Label31.Name = "Label31";- this.Label31.Size = new global::System.Drawing.Size(60, 16);- this.Label31.TabIndex = 2;- this.Label31.Text = "Box Size";- this.Label32.AutoSize = true;- this.Label32.Location = new global::System.Drawing.Point(14, 92);- this.Label32.Name = "Label32";- this.Label32.Size = new global::System.Drawing.Size(74, 16);- this.Label32.TabIndex = 2;- this.Label32.Text = "Probe type";- this.Label33.AutoSize = true;- this.Label33.Location = new global::System.Drawing.Point(12, 59);- this.Label33.Name = "Label33";- this.Label33.Size = new global::System.Drawing.Size(90, 16);- this.Label33.TabIndex = 2;- this.Label33.Text = "Measurement";- this.Label34.AutoSize = true;- this.Label34.Location = new global::System.Drawing.Point(14, 29);- this.Label34.Name = "Label34";- this.Label34.Size = new global::System.Drawing.Size(64, 16);- this.Label34.TabIndex = 1;- this.Label34.Text = "Place on:";- this.grpProbe1.BackColor = global::System.Drawing.Color.Gainsboro;- this.grpProbe1.Controls.Add(this.Label21);- this.grpProbe1.Controls.Add(this.numRunningWindow);- this.grpProbe1.Controls.Add(this.chkProbeOn1);- this.grpProbe1.Controls.Add(this.txtStartAfterStep);- this.grpProbe1.Controls.Add(this.chkStartAfterStep);- this.grpProbe1.Controls.Add(this.Label19);- this.grpProbe1.Controls.Add(this.Label18);- this.grpProbe1.Controls.Add(this.txtMaxScaleY);- this.grpProbe1.Controls.Add(this.txtMinScaleY);- this.grpProbe1.Controls.Add(this.radFullScale);- this.grpProbe1.Controls.Add(this.radRunningScale);- this.grpProbe1.Controls.Add(this.chkAutoScaleY);- this.grpProbe1.Controls.Add(this.chkAutoScaleX);- this.grpProbe1.Controls.Add(this.numBPosY);- this.grpProbe1.Controls.Add(this.numAPosY);- this.grpProbe1.Controls.Add(this.numBPosX);- this.grpProbe1.Controls.Add(this.numAPosX);- this.grpProbe1.Controls.Add(this.butPicPositions);- this.grpProbe1.Controls.Add(this.Label16);- this.grpProbe1.Controls.Add(this.cmbPlaceOn);- this.grpProbe1.Controls.Add(this.cmbMeasurement);- this.grpProbe1.Controls.Add(this.Label13);- this.grpProbe1.Controls.Add(this.Label15);- this.grpProbe1.Controls.Add(this.cmbBoxSize);- this.grpProbe1.Controls.Add(this.cmbProbeType);- this.grpProbe1.Controls.Add(this.Label14);- this.grpProbe1.Controls.Add(this.Label12);- this.grpProbe1.Controls.Add(this.Label11);- this.grpProbe1.Controls.Add(this.Label17);- this.grpProbe1.Controls.Add(this.Label10);- this.grpProbe1.Controls.Add(this.Label9);- this.grpProbe1.Controls.Add(this.Label8);- this.grpProbe1.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.grpProbe1.Location = new global::System.Drawing.Point(1202, 14);- this.grpProbe1.Name = "grpProbe1";- this.grpProbe1.Size = new global::System.Drawing.Size(506, 276);- this.grpProbe1.TabIndex = 1;- this.grpProbe1.TabStop = false;- this.grpProbe1.Text = "Probe 1 ";- this.Label21.AutoSize = true;- this.Label21.Location = new global::System.Drawing.Point(259, 59);- this.Label21.Name = "Label21";- this.Label21.Size = new global::System.Drawing.Size(104, 16);- this.Label21.TabIndex = 14;- this.Label21.Text = "Running window";- this.numRunningWindow.Location = new global::System.Drawing.Point(371, 58);- global::System.Windows.Forms.NumericUpDown numRunningWindow4 = this.numRunningWindow;- int[] array40 = new int[4];- array40[0] = 1000000;- numRunningWindow4.Maximum = new decimal(array40);- global::System.Windows.Forms.NumericUpDown numRunningWindow5 = this.numRunningWindow;- int[] array41 = new int[4];- array41[0] = 10;- numRunningWindow5.Minimum = new decimal(array41);- this.numRunningWindow.Name = "numRunningWindow";- this.numRunningWindow.Size = new global::System.Drawing.Size(83, 22);- this.numRunningWindow.TabIndex = 13;- this.numRunningWindow.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numRunningWindow6 = this.numRunningWindow;- int[] array42 = new int[4];- array42[0] = 500;- numRunningWindow6.Value = new decimal(array42);- this.chkProbeOn1.AutoSize = true;- this.chkProbeOn1.Location = new global::System.Drawing.Point(66, -1);- this.chkProbeOn1.Name = "chkProbeOn1";- this.chkProbeOn1.Size = new global::System.Drawing.Size(44, 20);- this.chkProbeOn1.TabIndex = 12;- this.chkProbeOn1.Text = "On";- this.chkProbeOn1.UseVisualStyleBackColor = true;- this.txtStartAfterStep.Location = new global::System.Drawing.Point(179, 163);- this.txtStartAfterStep.Name = "txtStartAfterStep";- this.txtStartAfterStep.Size = new global::System.Drawing.Size(57, 22);- this.txtStartAfterStep.TabIndex = 11;- this.txtStartAfterStep.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Right;- this.chkStartAfterStep.AutoSize = true;- this.chkStartAfterStep.Location = new global::System.Drawing.Point(17, 165);- this.chkStartAfterStep.Name = "chkStartAfterStep";- this.chkStartAfterStep.Size = new global::System.Drawing.Size(167, 20);- this.chkStartAfterStep.TabIndex = 10;- this.chkStartAfterStep.Text = "Start recording at step #";- this.chkStartAfterStep.UseVisualStyleBackColor = true;- this.Label19.AutoSize = true;- this.Label19.Location = new global::System.Drawing.Point(438, 111);- this.Label19.Name = "Label19";- this.Label19.Size = new global::System.Drawing.Size(33, 16);- this.Label19.TabIndex = 2;- this.Label19.Text = "Max";- this.Label18.AutoSize = true;- this.Label18.Location = new global::System.Drawing.Point(378, 111);- this.Label18.Name = "Label18";- this.Label18.Size = new global::System.Drawing.Size(29, 16);- this.Label18.TabIndex = 2;- this.Label18.Text = "Min";- this.txtMaxScaleY.Location = new global::System.Drawing.Point(431, 127);- this.txtMaxScaleY.Name = "txtMaxScaleY";- this.txtMaxScaleY.Size = new global::System.Drawing.Size(52, 22);- this.txtMaxScaleY.TabIndex = 8;- this.txtMaxScaleY.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Right;- this.txtMinScaleY.Location = new global::System.Drawing.Point(371, 127);- this.txtMinScaleY.Name = "txtMinScaleY";- this.txtMinScaleY.Size = new global::System.Drawing.Size(52, 22);- this.txtMinScaleY.TabIndex = 8;- this.txtMinScaleY.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Right;- this.radFullScale.AutoSize = true;- this.radFullScale.Location = new global::System.Drawing.Point(379, 24);- this.radFullScale.Name = "radFullScale";- this.radFullScale.Size = new global::System.Drawing.Size(83, 20);- this.radFullScale.TabIndex = 7;- this.radFullScale.TabStop = true;- this.radFullScale.Text = "Full scale";- this.radFullScale.UseVisualStyleBackColor = true;- this.radRunningScale.AutoSize = true;- this.radRunningScale.Location = new global::System.Drawing.Point(262, 24);- this.radRunningScale.Name = "radRunningScale";- this.radRunningScale.Size = new global::System.Drawing.Size(111, 20);- this.radRunningScale.TabIndex = 7;- this.radRunningScale.TabStop = true;- this.radRunningScale.Text = "Running scale";- this.radRunningScale.UseVisualStyleBackColor = true;- this.chkAutoScaleY.AutoSize = true;- this.chkAutoScaleY.Location = new global::System.Drawing.Point(262, 127);- this.chkAutoScaleY.Name = "chkAutoScaleY";- this.chkAutoScaleY.Size = new global::System.Drawing.Size(110, 20);- this.chkAutoScaleY.TabIndex = 6;- this.chkAutoScaleY.Text = "Auto Scale Y";- this.chkAutoScaleY.UseVisualStyleBackColor = true;- this.chkAutoScaleX.AutoSize = true;- this.chkAutoScaleX.Location = new global::System.Drawing.Point(262, 91);- this.chkAutoScaleX.Name = "chkAutoScaleX";- this.chkAutoScaleX.Size = new global::System.Drawing.Size(101, 20);- this.chkAutoScaleX.TabIndex = 6;- this.chkAutoScaleX.Text = "Auto scale X";- this.chkAutoScaleX.UseVisualStyleBackColor = true;- this.numBPosY.Location = new global::System.Drawing.Point(326, 234);- this.numBPosY.Name = "numBPosY";- this.numBPosY.Size = new global::System.Drawing.Size(65, 22);- this.numBPosY.TabIndex = 5;- this.numBPosY.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numAPosY.Location = new global::System.Drawing.Point(126, 234);- this.numAPosY.Name = "numAPosY";- this.numAPosY.Size = new global::System.Drawing.Size(65, 22);- this.numAPosY.TabIndex = 5;- this.numAPosY.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numBPosX.Location = new global::System.Drawing.Point(238, 234);- this.numBPosX.Name = "numBPosX";- this.numBPosX.Size = new global::System.Drawing.Size(65, 22);- this.numBPosX.TabIndex = 5;- this.numBPosX.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.numAPosX.Location = new global::System.Drawing.Point(38, 234);- this.numAPosX.Name = "numAPosX";- this.numAPosX.Size = new global::System.Drawing.Size(65, 22);- this.numAPosX.TabIndex = 5;- this.numAPosX.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.butPicPositions.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.butPicPositions.Location = new global::System.Drawing.Point(402, 226);- this.butPicPositions.Name = "butPicPositions";- this.butPicPositions.Size = new global::System.Drawing.Size(90, 34);- this.butPicPositions.TabIndex = 4;- this.butPicPositions.Text = "Pick ";- this.butPicPositions.UseVisualStyleBackColor = true;- this.Label16.AutoSize = true;- this.Label16.Location = new global::System.Drawing.Point(311, 236);- this.Label16.Name = "Label16";- this.Label16.Size = new global::System.Drawing.Size(17, 16);- this.Label16.TabIndex = 2;- this.Label16.Text = "Y";- this.cmbPlaceOn.FormattingEnabled = true;- this.cmbPlaceOn.Items.AddRange(new object[] { "Field", "Intensity" });- this.cmbPlaceOn.Location = new global::System.Drawing.Point(106, 24);- this.cmbPlaceOn.Name = "cmbPlaceOn";- this.cmbPlaceOn.Size = new global::System.Drawing.Size(130, 24);- this.cmbPlaceOn.TabIndex = 3;- this.cmbMeasurement.FormattingEnabled = true;- this.cmbMeasurement.Items.AddRange(new object[] { "Amplitude", "Intensity", "Integrate Intensity" });- this.cmbMeasurement.Location = new global::System.Drawing.Point(106, 56);- this.cmbMeasurement.Name = "cmbMeasurement";- this.cmbMeasurement.Size = new global::System.Drawing.Size(130, 24);- this.cmbMeasurement.TabIndex = 3;- this.Label13.AutoSize = true;- this.Label13.Location = new global::System.Drawing.Point(111, 236);- this.Label13.Name = "Label13";- this.Label13.Size = new global::System.Drawing.Size(17, 16);- this.Label13.TabIndex = 2;- this.Label13.Text = "Y";- this.Label15.AutoSize = true;- this.Label15.Location = new global::System.Drawing.Point(223, 236);- this.Label15.Name = "Label15";- this.Label15.Size = new global::System.Drawing.Size(16, 16);- this.Label15.TabIndex = 2;- this.Label15.Text = "X";- this.cmbBoxSize.FormattingEnabled = true;- this.cmbBoxSize.Items.AddRange(new object[] { "Tiny (200 x100)", "Small (300 x 150)", "Medium (400x200)", "Large (500x250)", "Extra Large (700x350)" });- this.cmbBoxSize.Location = new global::System.Drawing.Point(106, 124);- this.cmbBoxSize.Name = "cmbBoxSize";- this.cmbBoxSize.Size = new global::System.Drawing.Size(130, 24);- this.cmbBoxSize.TabIndex = 3;- this.cmbProbeType.FormattingEnabled = true;- this.cmbProbeType.Items.AddRange(new object[] { "Point (A)", "Line (A-B)" });- this.cmbProbeType.Location = new global::System.Drawing.Point(106, 89);- this.cmbProbeType.Name = "cmbProbeType";- this.cmbProbeType.Size = new global::System.Drawing.Size(130, 24);- this.cmbProbeType.TabIndex = 3;- this.Label14.AutoSize = true;- this.Label14.Location = new global::System.Drawing.Point(277, 209);- this.Label14.Name = "Label14";- this.Label14.Size = new global::System.Drawing.Size(68, 16);- this.Label14.TabIndex = 2;- this.Label14.Text = "Position B";- this.Label12.AutoSize = true;- this.Label12.Location = new global::System.Drawing.Point(23, 236);- this.Label12.Name = "Label12";- this.Label12.Size = new global::System.Drawing.Size(16, 16);- this.Label12.TabIndex = 2;- this.Label12.Text = "X";- this.Label11.AutoSize = true;- this.Label11.Location = new global::System.Drawing.Point(76, 209);- this.Label11.Name = "Label11";- this.Label11.Size = new global::System.Drawing.Size(68, 16);- this.Label11.TabIndex = 2;- this.Label11.Text = "Position A";- this.Label17.AutoSize = true;- this.Label17.Location = new global::System.Drawing.Point(14, 127);- this.Label17.Name = "Label17";- this.Label17.Size = new global::System.Drawing.Size(60, 16);- this.Label17.TabIndex = 2;- this.Label17.Text = "Box Size";- this.Label10.AutoSize = true;- this.Label10.Location = new global::System.Drawing.Point(14, 92);- this.Label10.Name = "Label10";- this.Label10.Size = new global::System.Drawing.Size(74, 16);- this.Label10.TabIndex = 2;- this.Label10.Text = "Probe type";- this.Label9.AutoSize = true;- this.Label9.Location = new global::System.Drawing.Point(12, 59);- this.Label9.Name = "Label9";- this.Label9.Size = new global::System.Drawing.Size(90, 16);- this.Label9.TabIndex = 2;- this.Label9.Text = "Measurement";- this.Label8.AutoSize = true;- this.Label8.Location = new global::System.Drawing.Point(14, 29);- this.Label8.Name = "Label8";- this.Label8.Size = new global::System.Drawing.Size(64, 16);- this.Label8.TabIndex = 1;- this.Label8.Text = "Place on:";- this.pnlProbeImage.Location = new global::System.Drawing.Point(16, 14);- this.pnlProbeImage.Name = "pnlProbeImage";- this.pnlProbeImage.Size = new global::System.Drawing.Size(1160, 653);- this.pnlProbeImage.TabIndex = 0;- this.tabViewer.Controls.Add(this.pnlPreviewIntensityProps);- this.tabViewer.Controls.Add(this.Panel3);- this.tabViewer.Controls.Add(this.Label56);- this.tabViewer.Controls.Add(this.Label55);- this.tabViewer.Controls.Add(this.lblWarningIntensity);- this.tabViewer.Controls.Add(this.lblWarningField);- this.tabViewer.Controls.Add(this.btnExportIntensityFrame);- this.tabViewer.Controls.Add(this.btnExportFieldFrame);- this.tabViewer.Controls.Add(this.btnOpenImageFolder);- this.tabViewer.Controls.Add(this.btnOpenVideoFolder);- this.tabViewer.Controls.Add(this.btnViewIntensityVideo);- this.tabViewer.Controls.Add(this.btnViewFieldVideo);- this.tabViewer.Controls.Add(this.pnlPreviewIntensity);- this.tabViewer.Controls.Add(this.pnlPreviewField);- this.tabViewer.Location = new global::System.Drawing.Point(4, 34);- this.tabViewer.Name = "tabViewer";- this.tabViewer.Size = new global::System.Drawing.Size(1742, 693);- this.tabViewer.TabIndex = 4;- this.tabViewer.Text = " Preview ";- this.tabViewer.UseVisualStyleBackColor = true;- this.pnlPreviewIntensityProps.BackColor = global::System.Drawing.SystemColors.ButtonFace;- this.pnlPreviewIntensityProps.Controls.Add(this.chkExportVideoIntensity2);- this.pnlPreviewIntensityProps.Controls.Add(this.Label64);- this.pnlPreviewIntensityProps.Controls.Add(this.numBrightnessIntensityOverlay);- this.pnlPreviewIntensityProps.Controls.Add(this.numIntensityScaling2);- this.pnlPreviewIntensityProps.Controls.Add(this.chkDiplayOverlayInIntensity);- this.pnlPreviewIntensityProps.Controls.Add(this.Label66);- this.pnlPreviewIntensityProps.Location = new global::System.Drawing.Point(1023, 12);- this.pnlPreviewIntensityProps.Name = "pnlPreviewIntensityProps";- this.pnlPreviewIntensityProps.Size = new global::System.Drawing.Size(700, 40);- this.pnlPreviewIntensityProps.TabIndex = 14;- this.chkExportVideoIntensity2.AutoSize = true;- this.chkExportVideoIntensity2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkExportVideoIntensity2.Location = new global::System.Drawing.Point(577, 8);- this.chkExportVideoIntensity2.Name = "chkExportVideoIntensity2";- this.chkExportVideoIntensity2.Size = new global::System.Drawing.Size(115, 24);- this.chkExportVideoIntensity2.TabIndex = 12;- this.chkExportVideoIntensity2.Text = "Export video";- this.chkExportVideoIntensity2.UseVisualStyleBackColor = true;- this.Label64.AutoSize = true;- this.Label64.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label64.Location = new global::System.Drawing.Point(13, 9);- this.Label64.Name = "Label64";- this.Label64.Size = new global::System.Drawing.Size(129, 20);- this.Label64.TabIndex = 9;- this.Label64.Text = "Field scale factor";- this.numBrightnessIntensityOverlay.DecimalPlaces = 2;- this.numBrightnessIntensityOverlay.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numBrightnessIntensityOverlay.Increment = new decimal(new int[] { 5, 0, 0, 131072 });- this.numBrightnessIntensityOverlay.Location = new global::System.Drawing.Point(473, 7);- global::System.Windows.Forms.NumericUpDown numBrightnessIntensityOverlay = this.numBrightnessIntensityOverlay;- int[] array43 = new int[4];- array43[0] = 5;- numBrightnessIntensityOverlay.Maximum = new decimal(array43);- this.numBrightnessIntensityOverlay.Name = "numBrightnessIntensityOverlay";- this.numBrightnessIntensityOverlay.Size = new global::System.Drawing.Size(67, 26);- this.numBrightnessIntensityOverlay.TabIndex = 11;- this.numBrightnessIntensityOverlay.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numBrightnessIntensityOverlay2 = this.numBrightnessIntensityOverlay;- int[] array44 = new int[4];- array44[0] = 1;- numBrightnessIntensityOverlay2.Value = new decimal(array44);- this.numIntensityScaling2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numIntensityScaling2.Location = new global::System.Drawing.Point(151, 7);- global::System.Windows.Forms.NumericUpDown numIntensityScaling2 = this.numIntensityScaling2;- int[] array45 = new int[4];- array45[0] = 1000;- numIntensityScaling2.Maximum = new decimal(array45);- this.numIntensityScaling2.Name = "numIntensityScaling2";- this.numIntensityScaling2.Size = new global::System.Drawing.Size(74, 26);- this.numIntensityScaling2.TabIndex = 8;- this.numIntensityScaling2.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.chkDiplayOverlayInIntensity.AutoSize = true;- this.chkDiplayOverlayInIntensity.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkDiplayOverlayInIntensity.Location = new global::System.Drawing.Point(253, 9);- this.chkDiplayOverlayInIntensity.Name = "chkDiplayOverlayInIntensity";- this.chkDiplayOverlayInIntensity.Size = new global::System.Drawing.Size(132, 24);- this.chkDiplayOverlayInIntensity.TabIndex = 10;- this.chkDiplayOverlayInIntensity.Text = "Display overlay";- this.chkDiplayOverlayInIntensity.UseVisualStyleBackColor = true;- this.Label66.AutoSize = true;- this.Label66.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label66.Location = new global::System.Drawing.Point(382, 10);- this.Label66.Name = "Label66";- this.Label66.Size = new global::System.Drawing.Size(91, 20);- this.Label66.TabIndex = 9;- this.Label66.Text = "/ brightness";- this.Panel3.BackColor = global::System.Drawing.SystemColors.ButtonFace;- this.Panel3.Controls.Add(this.Label63);- this.Panel3.Controls.Add(this.chkExportVideoField2);- this.Panel3.Controls.Add(this.numFieldScaling2);- this.Panel3.Controls.Add(this.Label65);- this.Panel3.Controls.Add(this.numBrightnessFieldOverlay);- this.Panel3.Controls.Add(this.chkDiplayOverlayInField);- this.Panel3.Location = new global::System.Drawing.Point(170, 11);- this.Panel3.Name = "Panel3";- this.Panel3.Size = new global::System.Drawing.Size(697, 40);- this.Panel3.TabIndex = 13;- this.Label63.AutoSize = true;- this.Label63.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label63.Location = new global::System.Drawing.Point(9, 10);- this.Label63.Name = "Label63";- this.Label63.Size = new global::System.Drawing.Size(129, 20);- this.Label63.TabIndex = 9;- this.Label63.Text = "Field scale factor";- this.chkExportVideoField2.AutoSize = true;- this.chkExportVideoField2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkExportVideoField2.Location = new global::System.Drawing.Point(571, 9);- this.chkExportVideoField2.Name = "chkExportVideoField2";- this.chkExportVideoField2.Size = new global::System.Drawing.Size(115, 24);- this.chkExportVideoField2.TabIndex = 12;- this.chkExportVideoField2.Text = "Export video";- this.chkExportVideoField2.UseVisualStyleBackColor = true;- this.numFieldScaling2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numFieldScaling2.Location = new global::System.Drawing.Point(144, 8);- global::System.Windows.Forms.NumericUpDown numFieldScaling2 = this.numFieldScaling2;- int[] array46 = new int[4];- array46[0] = 1000;- numFieldScaling2.Maximum = new decimal(array46);- this.numFieldScaling2.Name = "numFieldScaling2";- this.numFieldScaling2.Size = new global::System.Drawing.Size(75, 26);- this.numFieldScaling2.TabIndex = 8;- this.numFieldScaling2.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- this.Label65.AutoSize = true;- this.Label65.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label65.Location = new global::System.Drawing.Point(380, 10);- this.Label65.Name = "Label65";- this.Label65.Size = new global::System.Drawing.Size(91, 20);- this.Label65.TabIndex = 9;- this.Label65.Text = "/ brightness";- this.numBrightnessFieldOverlay.DecimalPlaces = 2;- this.numBrightnessFieldOverlay.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.numBrightnessFieldOverlay.Increment = new decimal(new int[] { 5, 0, 0, 131072 });- this.numBrightnessFieldOverlay.Location = new global::System.Drawing.Point(474, 8);- global::System.Windows.Forms.NumericUpDown numBrightnessFieldOverlay = this.numBrightnessFieldOverlay;- int[] array47 = new int[4];- array47[0] = 5;- numBrightnessFieldOverlay.Maximum = new decimal(array47);- this.numBrightnessFieldOverlay.Name = "numBrightnessFieldOverlay";- this.numBrightnessFieldOverlay.Size = new global::System.Drawing.Size(67, 26);- this.numBrightnessFieldOverlay.TabIndex = 11;- this.numBrightnessFieldOverlay.TextAlign = global::System.Windows.Forms.HorizontalAlignment.Center;- global::System.Windows.Forms.NumericUpDown numBrightnessFieldOverlay2 = this.numBrightnessFieldOverlay;- int[] array48 = new int[4];- array48[0] = 1;- numBrightnessFieldOverlay2.Value = new decimal(array48);- this.chkDiplayOverlayInField.AutoSize = true;- this.chkDiplayOverlayInField.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.chkDiplayOverlayInField.Location = new global::System.Drawing.Point(254, 9);- this.chkDiplayOverlayInField.Name = "chkDiplayOverlayInField";- this.chkDiplayOverlayInField.Size = new global::System.Drawing.Size(132, 24);- this.chkDiplayOverlayInField.TabIndex = 10;- this.chkDiplayOverlayInField.Text = "Display overlay";- this.chkDiplayOverlayInField.UseVisualStyleBackColor = true;- this.Label56.AutoSize = true;- this.Label56.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 20.25f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label56.Location = new global::System.Drawing.Point(881, 16);- this.Label56.Name = "Label56";- this.Label56.Size = new global::System.Drawing.Size(126, 31);- this.Label56.TabIndex = 7;- this.Label56.Text = "Intensity";- this.Label55.AutoSize = true;- this.Label55.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 20.25f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.Label55.Location = new global::System.Drawing.Point(53, 16);- this.Label55.Name = "Label55";- this.Label55.Size = new global::System.Drawing.Size(78, 31);- this.Label55.TabIndex = 7;- this.Label55.Text = "Field";- this.lblWarningIntensity.AutoSize = true;- this.lblWarningIntensity.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblWarningIntensity.Location = new global::System.Drawing.Point(1201, 550);- this.lblWarningIntensity.Name = "lblWarningIntensity";- this.lblWarningIntensity.Size = new global::System.Drawing.Size(183, 20);- this.lblWarningIntensity.TabIndex = 6;- this.lblWarningIntensity.Text = "Intensity video is created";- this.lblWarningField.AutoSize = true;- this.lblWarningField.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblWarningField.Location = new global::System.Drawing.Point(335, 551);- this.lblWarningField.Name = "lblWarningField";- this.lblWarningField.Size = new global::System.Drawing.Size(157, 20);- this.lblWarningField.TabIndex = 6;- this.lblWarningField.Text = "Field video is created";- this.btnExportIntensityFrame.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnExportIntensityFrame.Location = new global::System.Drawing.Point(1410, 545);- this.btnExportIntensityFrame.Name = "btnExportIntensityFrame";- this.btnExportIntensityFrame.Size = new global::System.Drawing.Size(247, 31);- this.btnExportIntensityFrame.TabIndex = 5;- this.btnExportIntensityFrame.Text = "Export frame as image";- this.btnExportIntensityFrame.UseVisualStyleBackColor = true;- this.btnExportFieldFrame.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnExportFieldFrame.Location = new global::System.Drawing.Point(536, 547);- this.btnExportFieldFrame.Name = "btnExportFieldFrame";- this.btnExportFieldFrame.Size = new global::System.Drawing.Size(243, 29);- this.btnExportFieldFrame.TabIndex = 4;- this.btnExportFieldFrame.Text = "Export frame as Image";- this.btnExportFieldFrame.UseVisualStyleBackColor = true;- this.btnOpenImageFolder.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnOpenImageFolder.Location = new global::System.Drawing.Point(1524, 650);- this.btnOpenImageFolder.Name = "btnOpenImageFolder";- this.btnOpenImageFolder.Size = new global::System.Drawing.Size(207, 33);- this.btnOpenImageFolder.TabIndex = 2;- this.btnOpenImageFolder.Text = "Open Image folder";- this.btnOpenImageFolder.UseVisualStyleBackColor = true;- this.btnOpenVideoFolder.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnOpenVideoFolder.Location = new global::System.Drawing.Point(1311, 650);- this.btnOpenVideoFolder.Name = "btnOpenVideoFolder";- this.btnOpenVideoFolder.Size = new global::System.Drawing.Size(207, 33);- this.btnOpenVideoFolder.TabIndex = 2;- this.btnOpenVideoFolder.Text = "Open video folder";- this.btnOpenVideoFolder.UseVisualStyleBackColor = true;- this.btnViewIntensityVideo.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnViewIntensityVideo.Location = new global::System.Drawing.Point(929, 546);- this.btnViewIntensityVideo.Name = "btnViewIntensityVideo";- this.btnViewIntensityVideo.Size = new global::System.Drawing.Size(247, 29);- this.btnViewIntensityVideo.TabIndex = 1;- this.btnViewIntensityVideo.Text = "View video in media player";- this.btnViewIntensityVideo.UseVisualStyleBackColor = true;- this.btnViewFieldVideo.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnViewFieldVideo.Location = new global::System.Drawing.Point(79, 547);- this.btnViewFieldVideo.Name = "btnViewFieldVideo";- this.btnViewFieldVideo.Size = new global::System.Drawing.Size(216, 29);- this.btnViewFieldVideo.TabIndex = 1;- this.btnViewFieldVideo.Text = "View video in media player";- this.btnViewFieldVideo.UseVisualStyleBackColor = true;- this.pnlPreviewIntensity.Location = new global::System.Drawing.Point(873, 57);- this.pnlPreviewIntensity.Name = "pnlPreviewIntensity";- this.pnlPreviewIntensity.Size = new global::System.Drawing.Size(850, 478);- this.pnlPreviewIntensity.TabIndex = 0;- this.pnlPreviewField.Location = new global::System.Drawing.Point(17, 56);- this.pnlPreviewField.Name = "pnlPreviewField";- this.pnlPreviewField.Size = new global::System.Drawing.Size(850, 478);- this.pnlPreviewField.TabIndex = 0;- this.tabOutput.Controls.Add(this.btnRenameVideo);- this.tabOutput.Controls.Add(this.btnShareWithEditors);- this.tabOutput.Controls.Add(this.btnCopyToClipboard);- this.tabOutput.Controls.Add(this.btnOpenImageFolder2);- this.tabOutput.Controls.Add(this.btnViewVIdeoInPlayer2);- this.tabOutput.Controls.Add(this.btnOpenVIdeoFolder2);- this.tabOutput.Controls.Add(this.lblPreview);- this.tabOutput.Controls.Add(this.btnDeleteVideos);- this.tabOutput.Controls.Add(this.btnDeleteImages);- this.tabOutput.Controls.Add(this.btnDeleteScene);- this.tabOutput.Controls.Add(this.btnLoadExternal);- this.tabOutput.Controls.Add(this.pnlPreview);- this.tabOutput.Controls.Add(this.Label57);- this.tabOutput.Controls.Add(this.lstScenes);- this.tabOutput.Controls.Add(this.lstImages);- this.tabOutput.Controls.Add(this.lstVideo);- this.tabOutput.Controls.Add(this.lstAllProjects3);- this.tabOutput.Location = new global::System.Drawing.Point(4, 34);- this.tabOutput.Name = "tabOutput";- this.tabOutput.Size = new global::System.Drawing.Size(1742, 693);- this.tabOutput.TabIndex = 3;- this.tabOutput.Text = " Manage output ";- this.tabOutput.UseVisualStyleBackColor = true;- this.btnRenameVideo.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnRenameVideo.Location = new global::System.Drawing.Point(566, 631);- this.btnRenameVideo.Name = "btnRenameVideo";- this.btnRenameVideo.Size = new global::System.Drawing.Size(75, 31);- this.btnRenameVideo.TabIndex = 20;- this.btnRenameVideo.Text = "Rename";- this.btnRenameVideo.UseVisualStyleBackColor = true;- this.btnShareWithEditors.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnShareWithEditors.Location = new global::System.Drawing.Point(1517, 635);- this.btnShareWithEditors.Name = "btnShareWithEditors";- this.btnShareWithEditors.Size = new global::System.Drawing.Size(193, 27);- this.btnShareWithEditors.TabIndex = 19;- this.btnShareWithEditors.Text = "Share this image with tabs";- this.btnShareWithEditors.UseVisualStyleBackColor = true;- this.btnCopyToClipboard.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnCopyToClipboard.Location = new global::System.Drawing.Point(594, 407);- this.btnCopyToClipboard.Name = "btnCopyToClipboard";- this.btnCopyToClipboard.Size = new global::System.Drawing.Size(129, 30);- this.btnCopyToClipboard.TabIndex = 18;- this.btnCopyToClipboard.Text = "Copy to clipboard";- this.btnCopyToClipboard.UseVisualStyleBackColor = true;- this.btnOpenImageFolder2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnOpenImageFolder2.Location = new global::System.Drawing.Point(759, 407);- this.btnOpenImageFolder2.Name = "btnOpenImageFolder2";- this.btnOpenImageFolder2.Size = new global::System.Drawing.Size(132, 30);- this.btnOpenImageFolder2.TabIndex = 17;- this.btnOpenImageFolder2.Text = "Open image folder";- this.btnOpenImageFolder2.UseVisualStyleBackColor = true;- this.btnViewVIdeoInPlayer2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnViewVIdeoInPlayer2.Location = new global::System.Drawing.Point(677, 630);- this.btnViewVIdeoInPlayer2.Name = "btnViewVIdeoInPlayer2";- this.btnViewVIdeoInPlayer2.Size = new global::System.Drawing.Size(114, 33);- this.btnViewVIdeoInPlayer2.TabIndex = 16;- this.btnViewVIdeoInPlayer2.Text = "View in player";- this.btnViewVIdeoInPlayer2.UseVisualStyleBackColor = true;- this.btnOpenVIdeoFolder2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnOpenVIdeoFolder2.Location = new global::System.Drawing.Point(799, 630);- this.btnOpenVIdeoFolder2.Name = "btnOpenVIdeoFolder2";- this.btnOpenVIdeoFolder2.Size = new global::System.Drawing.Size(93, 34);- this.btnOpenVIdeoFolder2.TabIndex = 15;- this.btnOpenVIdeoFolder2.Text = "Open folder";- this.btnOpenVIdeoFolder2.UseVisualStyleBackColor = true;- this.lblPreview.AutoSize = true;- this.lblPreview.Location = new global::System.Drawing.Point(911, 25);- this.lblPreview.Name = "lblPreview";- this.lblPreview.Size = new global::System.Drawing.Size(88, 25);- this.lblPreview.TabIndex = 14;- this.lblPreview.Text = "Preview";- this.btnDeleteVideos.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnDeleteVideos.Location = new global::System.Drawing.Point(456, 631);- this.btnDeleteVideos.Name = "btnDeleteVideos";- this.btnDeleteVideos.Size = new global::System.Drawing.Size(101, 31);- this.btnDeleteVideos.TabIndex = 13;- this.btnDeleteVideos.Text = "Delete video";- this.btnDeleteVideos.UseVisualStyleBackColor = true;- this.btnDeleteImages.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnDeleteImages.Location = new global::System.Drawing.Point(458, 405);- this.btnDeleteImages.Name = "btnDeleteImages";- this.btnDeleteImages.Size = new global::System.Drawing.Size(99, 32);- this.btnDeleteImages.TabIndex = 13;- this.btnDeleteImages.Text = "Delete image";- this.btnDeleteImages.UseVisualStyleBackColor = true;- this.btnDeleteScene.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnDeleteScene.Location = new global::System.Drawing.Point(459, 177);- this.btnDeleteScene.Name = "btnDeleteScene";- this.btnDeleteScene.Size = new global::System.Drawing.Size(111, 32);- this.btnDeleteScene.TabIndex = 13;- this.btnDeleteScene.Text = "Delete scene";- this.btnDeleteScene.UseVisualStyleBackColor = true;- this.btnLoadExternal.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnLoadExternal.Location = new global::System.Drawing.Point(785, 177);- this.btnLoadExternal.Name = "btnLoadExternal";- this.btnLoadExternal.Size = new global::System.Drawing.Size(104, 32);- this.btnLoadExternal.TabIndex = 13;- this.btnLoadExternal.Text = "Load external";- this.btnLoadExternal.UseVisualStyleBackColor = true;- this.pnlPreview.BackColor = global::System.Drawing.Color.Gainsboro;- this.pnlPreview.Location = new global::System.Drawing.Point(908, 52);- this.pnlPreview.Name = "pnlPreview";- this.pnlPreview.Size = new global::System.Drawing.Size(806, 573);- this.pnlPreview.TabIndex = 12;- this.Label57.AutoSize = true;- this.Label57.Location = new global::System.Drawing.Point(20, 16);- this.Label57.Name = "Label57";- this.Label57.Size = new global::System.Drawing.Size(227, 25);- this.Label57.TabIndex = 11;- this.Label57.Text = "Manage project output";- this.lstScenes.BackColor = global::System.Drawing.SystemColors.MenuBar;- this.lstScenes.Columns.AddRange(new global::System.Windows.Forms.ColumnHeader[] { this.colSceneName, this.colSceneCreated });- this.lstScenes.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lstScenes.FullRowSelect = true;- this.lstScenes.HideSelection = false;- this.lstScenes.Location = new global::System.Drawing.Point(460, 51);- this.lstScenes.Name = "lstScenes";- this.lstScenes.Size = new global::System.Drawing.Size(432, 126);- this.lstScenes.TabIndex = 10;- this.lstScenes.UseCompatibleStateImageBehavior = false;- this.lstScenes.View = global::System.Windows.Forms.View.Details;- this.colSceneName.Text = "Scene file name";- this.colSceneName.Width = 262;- this.colSceneCreated.Text = "Created on";- this.colSceneCreated.Width = 138;- this.lstImages.BackColor = global::System.Drawing.SystemColors.Menu;- this.lstImages.Columns.AddRange(new global::System.Windows.Forms.ColumnHeader[] { this.colImageName, this.colCreatedOn });- this.lstImages.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lstImages.FullRowSelect = true;- this.lstImages.HideSelection = false;- this.lstImages.Location = new global::System.Drawing.Point(460, 221);- this.lstImages.Name = "lstImages";- this.lstImages.Size = new global::System.Drawing.Size(432, 183);- this.lstImages.TabIndex = 9;- this.lstImages.UseCompatibleStateImageBehavior = false;- this.lstImages.View = global::System.Windows.Forms.View.Details;- this.colImageName.Text = "Image file name";- this.colImageName.Width = 258;- this.colCreatedOn.Text = "Created on";- this.colCreatedOn.Width = 141;- this.lstVideo.BackColor = global::System.Drawing.SystemColors.Menu;- this.lstVideo.Columns.AddRange(new global::System.Windows.Forms.ColumnHeader[] { this.colVideoName, this.colCreatedOn2 });- this.lstVideo.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lstVideo.FullRowSelect = true;- this.lstVideo.HideSelection = false;- this.lstVideo.Location = new global::System.Drawing.Point(457, 452);- this.lstVideo.Name = "lstVideo";- this.lstVideo.Size = new global::System.Drawing.Size(435, 173);- this.lstVideo.TabIndex = 9;- this.lstVideo.UseCompatibleStateImageBehavior = false;- this.lstVideo.View = global::System.Windows.Forms.View.Details;- this.colVideoName.Text = "Video file name";- this.colVideoName.Width = 255;- this.colCreatedOn2.Text = "Created on";- this.colCreatedOn2.Width = 145;- this.lstAllProjects3.BackColor = global::System.Drawing.SystemColors.Menu;- this.lstAllProjects3.Columns.AddRange(new global::System.Windows.Forms.ColumnHeader[] { this.colProjectName2, this.colLastEdited2 });- this.lstAllProjects3.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lstAllProjects3.FullRowSelect = true;- this.lstAllProjects3.HideSelection = false;- this.lstAllProjects3.Location = new global::System.Drawing.Point(18, 51);- this.lstAllProjects3.MultiSelect = false;- this.lstAllProjects3.Name = "lstAllProjects3";- this.lstAllProjects3.Size = new global::System.Drawing.Size(427, 611);- this.lstAllProjects3.TabIndex = 9;- this.lstAllProjects3.UseCompatibleStateImageBehavior = false;- this.lstAllProjects3.View = global::System.Windows.Forms.View.Details;- this.colProjectName2.Text = "Project name";- this.colProjectName2.Width = 280;- this.colLastEdited2.Text = "Last edited";- this.colLastEdited2.Width = 160;- this.tabColorScheme.Controls.Add(this.lblType);- this.tabColorScheme.Controls.Add(this.radSchemeTypeIntensity);- this.tabColorScheme.Controls.Add(this.radSchemeTypeField);- this.tabColorScheme.Controls.Add(this.btnLoadScheme);- this.tabColorScheme.Controls.Add(this.btbChooseFFolder);- this.tabColorScheme.Controls.Add(this.lblSchemeFolder);- this.tabColorScheme.Controls.Add(this.ListView1);- this.tabColorScheme.Controls.Add(this.txtSchemeFolder);- this.tabColorScheme.Controls.Add(this.txtCurrentColorScheme);- this.tabColorScheme.Controls.Add(this.lblCurrentCOlorScheme);- this.tabColorScheme.Controls.Add(this.lblColorSchemeEditor);- this.tabColorScheme.Controls.Add(this.btnColor9);- this.tabColorScheme.Controls.Add(this.btnColor8);- this.tabColorScheme.Controls.Add(this.btnColor7);- this.tabColorScheme.Controls.Add(this.btnColor6);- this.tabColorScheme.Controls.Add(this.btnColor5);- this.tabColorScheme.Controls.Add(this.btnColor4);- this.tabColorScheme.Controls.Add(this.btnColor3);- this.tabColorScheme.Controls.Add(this.btnCOlor2);- this.tabColorScheme.Controls.Add(this.btnColor1);- this.tabColorScheme.Controls.Add(this.lblColorPicker);- this.tabColorScheme.Controls.Add(this.Panel2);- this.tabColorScheme.Controls.Add(this.pnlScheme);- this.tabColorScheme.Controls.Add(this.btnDeleteColorScheme);- this.tabColorScheme.Controls.Add(this.btnRenameColorScheme);- this.tabColorScheme.Controls.Add(this.btnSaveAsColorScheme);- this.tabColorScheme.Controls.Add(this.btnSaveCurrentScheme);- this.tabColorScheme.Location = new global::System.Drawing.Point(4, 34);- this.tabColorScheme.Name = "tabColorScheme";- this.tabColorScheme.Padding = new global::System.Windows.Forms.Padding(3);- this.tabColorScheme.Size = new global::System.Drawing.Size(1742, 693);- this.tabColorScheme.TabIndex = 0;- this.tabColorScheme.Text = " Colors ";- this.tabColorScheme.UseVisualStyleBackColor = true;- this.lblType.AutoSize = true;- this.lblType.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblType.Location = new global::System.Drawing.Point(23, 93);- this.lblType.Name = "lblType";- this.lblType.Size = new global::System.Drawing.Size(98, 18);- this.lblType.TabIndex = 19;- this.lblType.Text = "Scheme type:";- this.radSchemeTypeIntensity.AutoSize = true;- this.radSchemeTypeIntensity.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.radSchemeTypeIntensity.Location = new global::System.Drawing.Point(197, 91);- this.radSchemeTypeIntensity.Name = "radSchemeTypeIntensity";- this.radSchemeTypeIntensity.Size = new global::System.Drawing.Size(79, 22);- this.radSchemeTypeIntensity.TabIndex = 18;- this.radSchemeTypeIntensity.Text = "Intensity";- this.radSchemeTypeIntensity.UseVisualStyleBackColor = true;- this.radSchemeTypeField.AutoSize = true;- this.radSchemeTypeField.Checked = true;- this.radSchemeTypeField.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.radSchemeTypeField.Location = new global::System.Drawing.Point(134, 91);- this.radSchemeTypeField.Name = "radSchemeTypeField";- this.radSchemeTypeField.Size = new global::System.Drawing.Size(57, 22);- this.radSchemeTypeField.TabIndex = 18;- this.radSchemeTypeField.TabStop = true;- this.radSchemeTypeField.Text = "Field";- this.radSchemeTypeField.UseVisualStyleBackColor = true;- this.btnLoadScheme.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnLoadScheme.Location = new global::System.Drawing.Point(27, 528);- this.btnLoadScheme.Name = "btnLoadScheme";- this.btnLoadScheme.Size = new global::System.Drawing.Size(88, 28);- this.btnLoadScheme.TabIndex = 11;- this.btnLoadScheme.Text = "Load ";- this.btnLoadScheme.UseVisualStyleBackColor = true;- this.btbChooseFFolder.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btbChooseFFolder.Location = new global::System.Drawing.Point(470, 125);- this.btbChooseFFolder.Name = "btbChooseFFolder";- this.btbChooseFFolder.Size = new global::System.Drawing.Size(89, 25);- this.btbChooseFFolder.TabIndex = 10;- this.btbChooseFFolder.Text = "Choose...";- this.btbChooseFFolder.UseVisualStyleBackColor = true;- this.lblSchemeFolder.AutoSize = true;- this.lblSchemeFolder.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblSchemeFolder.Location = new global::System.Drawing.Point(24, 128);- this.lblSchemeFolder.Name = "lblSchemeFolder";- this.lblSchemeFolder.Size = new global::System.Drawing.Size(104, 18);- this.lblSchemeFolder.TabIndex = 9;- this.lblSchemeFolder.Text = "Scheme folder";- this.ListView1.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.ListView1.HideSelection = false;- this.ListView1.Location = new global::System.Drawing.Point(27, 157);- this.ListView1.Name = "ListView1";- this.ListView1.Size = new global::System.Drawing.Size(531, 365);- this.ListView1.TabIndex = 8;- this.ListView1.UseCompatibleStateImageBehavior = false;- this.txtSchemeFolder.BorderStyle = global::System.Windows.Forms.BorderStyle.FixedSingle;- this.txtSchemeFolder.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.txtSchemeFolder.Location = new global::System.Drawing.Point(134, 125);- this.txtSchemeFolder.Name = "txtSchemeFolder";- this.txtSchemeFolder.Size = new global::System.Drawing.Size(330, 22);- this.txtSchemeFolder.TabIndex = 7;- this.txtCurrentColorScheme.BorderStyle = global::System.Windows.Forms.BorderStyle.FixedSingle;- this.txtCurrentColorScheme.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.txtCurrentColorScheme.Location = new global::System.Drawing.Point(135, 56);- this.txtCurrentColorScheme.Name = "txtCurrentColorScheme";- this.txtCurrentColorScheme.Size = new global::System.Drawing.Size(299, 24);- this.txtCurrentColorScheme.TabIndex = 7;- this.lblCurrentCOlorScheme.AutoSize = true;- this.lblCurrentCOlorScheme.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblCurrentCOlorScheme.Location = new global::System.Drawing.Point(23, 58);- this.lblCurrentCOlorScheme.Name = "lblCurrentCOlorScheme";- this.lblCurrentCOlorScheme.Size = new global::System.Drawing.Size(108, 18);- this.lblCurrentCOlorScheme.TabIndex = 6;- this.lblCurrentCOlorScheme.Text = "Color Scheme:";- this.lblColorSchemeEditor.AutoSize = true;- this.lblColorSchemeEditor.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 14.25f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblColorSchemeEditor.Location = new global::System.Drawing.Point(22, 12);- this.lblColorSchemeEditor.Name = "lblColorSchemeEditor";- this.lblColorSchemeEditor.Size = new global::System.Drawing.Size(204, 24);- this.lblColorSchemeEditor.TabIndex = 5;- this.lblColorSchemeEditor.Text = "Color Scheme Editor";- this.btnColor9.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnColor9.Location = new global::System.Drawing.Point(1054, 514);- this.btnColor9.Name = "btnColor9";- this.btnColor9.Size = new global::System.Drawing.Size(78, 34);- this.btnColor9.TabIndex = 4;- this.btnColor9.Text = "Color 9 ->";- this.btnColor9.UseVisualStyleBackColor = true;- this.btnColor8.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnColor8.Location = new global::System.Drawing.Point(1055, 465);- this.btnColor8.Name = "btnColor8";- this.btnColor8.Size = new global::System.Drawing.Size(78, 34);- this.btnColor8.TabIndex = 4;- this.btnColor8.Text = "Color 8 ->";- this.btnColor8.UseVisualStyleBackColor = true;- this.btnColor7.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnColor7.Location = new global::System.Drawing.Point(1055, 416);- this.btnColor7.Name = "btnColor7";- this.btnColor7.Size = new global::System.Drawing.Size(78, 34);- this.btnColor7.TabIndex = 4;- this.btnColor7.Text = "Color 7 ->";- this.btnColor7.UseVisualStyleBackColor = true;- this.btnColor6.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnColor6.Location = new global::System.Drawing.Point(1055, 368);- this.btnColor6.Name = "btnColor6";- this.btnColor6.Size = new global::System.Drawing.Size(78, 34);- this.btnColor6.TabIndex = 4;- this.btnColor6.Text = "Color 6 ->";- this.btnColor6.UseVisualStyleBackColor = true;- this.btnColor5.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnColor5.Location = new global::System.Drawing.Point(1055, 322);- this.btnColor5.Name = "btnColor5";- this.btnColor5.Size = new global::System.Drawing.Size(78, 34);- this.btnColor5.TabIndex = 4;- this.btnColor5.Text = "Color 5 ->";- this.btnColor5.UseVisualStyleBackColor = true;- this.btnColor4.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnColor4.Location = new global::System.Drawing.Point(1054, 273);- this.btnColor4.Name = "btnColor4";- this.btnColor4.Size = new global::System.Drawing.Size(78, 34);- this.btnColor4.TabIndex = 4;- this.btnColor4.Text = "Color 4 ->";- this.btnColor4.UseVisualStyleBackColor = true;- this.btnColor3.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnColor3.Location = new global::System.Drawing.Point(1054, 225);- this.btnColor3.Name = "btnColor3";- this.btnColor3.Size = new global::System.Drawing.Size(78, 34);- this.btnColor3.TabIndex = 4;- this.btnColor3.Text = "Color 3 ->";- this.btnColor3.UseVisualStyleBackColor = true;- this.btnCOlor2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnCOlor2.Location = new global::System.Drawing.Point(1055, 176);- this.btnCOlor2.Name = "btnCOlor2";- this.btnCOlor2.Size = new global::System.Drawing.Size(78, 34);- this.btnCOlor2.TabIndex = 4;- this.btnCOlor2.Text = "Color 2 ->";- this.btnCOlor2.UseVisualStyleBackColor = true;- this.btnColor1.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnColor1.Location = new global::System.Drawing.Point(1055, 128);- this.btnColor1.Name = "btnColor1";- this.btnColor1.Size = new global::System.Drawing.Size(78, 34);- this.btnColor1.TabIndex = 4;- this.btnColor1.Text = "Color 1 ->";- this.btnColor1.UseVisualStyleBackColor = true;- this.lblColorPicker.AutoSize = true;- this.lblColorPicker.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblColorPicker.Location = new global::System.Drawing.Point(596, 101);- this.lblColorPicker.Name = "lblColorPicker";- this.lblColorPicker.Size = new global::System.Drawing.Size(93, 20);- this.lblColorPicker.TabIndex = 2;- this.lblColorPicker.Text = "Color Picker";- this.Panel2.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.Panel2.Location = new global::System.Drawing.Point(598, 125);- this.Panel2.Name = "Panel2";- this.Panel2.Size = new global::System.Drawing.Size(445, 425);- this.Panel2.TabIndex = 1;- this.pnlScheme.Location = new global::System.Drawing.Point(1139, 139);- this.pnlScheme.Name = "pnlScheme";- this.pnlScheme.Size = new global::System.Drawing.Size(55, 399);- this.pnlScheme.TabIndex = 1;- this.btnDeleteColorScheme.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnDeleteColorScheme.Location = new global::System.Drawing.Point(470, 528);- this.btnDeleteColorScheme.Name = "btnDeleteColorScheme";- this.btnDeleteColorScheme.Size = new global::System.Drawing.Size(89, 28);- this.btnDeleteColorScheme.TabIndex = 0;- this.btnDeleteColorScheme.Text = "Delete";- this.btnDeleteColorScheme.UseVisualStyleBackColor = true;- this.btnRenameColorScheme.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnRenameColorScheme.Location = new global::System.Drawing.Point(376, 528);- this.btnRenameColorScheme.Name = "btnRenameColorScheme";- this.btnRenameColorScheme.Size = new global::System.Drawing.Size(88, 28);- this.btnRenameColorScheme.TabIndex = 0;- this.btnRenameColorScheme.Text = "Rename";- this.btnRenameColorScheme.UseVisualStyleBackColor = true;- this.btnSaveAsColorScheme.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnSaveAsColorScheme.Location = new global::System.Drawing.Point(215, 528);- this.btnSaveAsColorScheme.Name = "btnSaveAsColorScheme";- this.btnSaveAsColorScheme.Size = new global::System.Drawing.Size(88, 28);- this.btnSaveAsColorScheme.TabIndex = 0;- this.btnSaveAsColorScheme.Text = "Save As";- this.btnSaveAsColorScheme.UseVisualStyleBackColor = true;- this.btnSaveCurrentScheme.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnSaveCurrentScheme.Location = new global::System.Drawing.Point(121, 528);- this.btnSaveCurrentScheme.Name = "btnSaveCurrentScheme";- this.btnSaveCurrentScheme.Size = new global::System.Drawing.Size(88, 28);- this.btnSaveCurrentScheme.TabIndex = 0;- this.btnSaveCurrentScheme.Text = "Save ";- this.btnSaveCurrentScheme.UseVisualStyleBackColor = true;- this.btnSaveConfiguration.BackColor = global::System.Drawing.Color.Azure;- this.btnSaveConfiguration.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Bold, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnSaveConfiguration.Location = new global::System.Drawing.Point(1503, 840);- this.btnSaveConfiguration.Name = "btnSaveConfiguration";- this.btnSaveConfiguration.Size = new global::System.Drawing.Size(259, 53);- this.btnSaveConfiguration.TabIndex = 2;- this.btnSaveConfiguration.Text = "Save changes to project";- this.btnSaveConfiguration.UseVisualStyleBackColor = false;- this.btnStartSimulation.BackColor = global::System.Drawing.Color.Azure;- this.btnStartSimulation.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 15.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnStartSimulation.Location = new global::System.Drawing.Point(18, 23);- this.btnStartSimulation.Name = "btnStartSimulation";- this.btnStartSimulation.Size = new global::System.Drawing.Size(216, 42);- this.btnStartSimulation.TabIndex = 7;- this.btnStartSimulation.Text = "Start Simulation";- this.btnStartSimulation.UseVisualStyleBackColor = false;- this.btnPauzeResume.BackColor = global::System.Drawing.Color.Azure;- this.btnPauzeResume.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 15.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnPauzeResume.Location = new global::System.Drawing.Point(18, 71);- this.btnPauzeResume.Name = "btnPauzeResume";- this.btnPauzeResume.Size = new global::System.Drawing.Size(215, 46);- this.btnPauzeResume.TabIndex = 2;- this.btnPauzeResume.Text = "Pauze simulation";- this.btnPauzeResume.UseVisualStyleBackColor = false;- this.MenuStrip1.Items.AddRange(new global::System.Windows.Forms.ToolStripItem[] { this.itemFile, this.InfoToolStripMenuItem });- this.MenuStrip1.Location = new global::System.Drawing.Point(0, 0);- this.MenuStrip1.Name = "MenuStrip1";- this.MenuStrip1.Size = new global::System.Drawing.Size(1781, 28);- this.MenuStrip1.TabIndex = 1;- this.MenuStrip1.Text = "MenuStrip1";- this.itemFile.DropDownItems.AddRange(new global::System.Windows.Forms.ToolStripItem[] { this.NewToolStripMenuItem, this.OpenToolStripMenuItem, this.ChooseProjectRootToolStripMenuItem, this.SetCValueToolStripMenuItem, this.SaveToolStripMenuItem, this.ExitToolStripMenuItem });- this.itemFile.Font = new global::System.Drawing.Font("Segoe UI", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.itemFile.Name = "itemFile";- this.itemFile.Size = new global::System.Drawing.Size(44, 24);- this.itemFile.Text = "File";- this.NewToolStripMenuItem.Name = "NewToolStripMenuItem";- this.NewToolStripMenuItem.Size = new global::System.Drawing.Size(210, 24);- this.NewToolStripMenuItem.Text = "New";- this.OpenToolStripMenuItem.Name = "OpenToolStripMenuItem";- this.OpenToolStripMenuItem.Size = new global::System.Drawing.Size(210, 24);- this.OpenToolStripMenuItem.Text = "Open";- this.ChooseProjectRootToolStripMenuItem.Name = "ChooseProjectRootToolStripMenuItem";- this.ChooseProjectRootToolStripMenuItem.Size = new global::System.Drawing.Size(210, 24);- this.ChooseProjectRootToolStripMenuItem.Text = "Choose project root";- this.SetCValueToolStripMenuItem.Name = "SetCValueToolStripMenuItem";- this.SetCValueToolStripMenuItem.Size = new global::System.Drawing.Size(210, 24);- this.SetCValueToolStripMenuItem.Text = "Set c-value";- this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";- this.SaveToolStripMenuItem.Size = new global::System.Drawing.Size(210, 24);- this.SaveToolStripMenuItem.Text = "Save";- this.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem";- this.ExitToolStripMenuItem.Size = new global::System.Drawing.Size(210, 24);- this.ExitToolStripMenuItem.Text = "Exit";- this.InfoToolStripMenuItem.DropDownItems.AddRange(new global::System.Windows.Forms.ToolStripItem[] { this.HelpToolStripMenuItem, this.AboutToolStripMenuItem });- this.InfoToolStripMenuItem.Font = new global::System.Drawing.Font("Segoe UI", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.InfoToolStripMenuItem.Name = "InfoToolStripMenuItem";- this.InfoToolStripMenuItem.Size = new global::System.Drawing.Size(47, 24);- this.InfoToolStripMenuItem.Text = "Info";- this.HelpToolStripMenuItem.Name = "HelpToolStripMenuItem";- this.HelpToolStripMenuItem.Size = new global::System.Drawing.Size(119, 24);- this.HelpToolStripMenuItem.Text = "Help";- this.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem";- this.AboutToolStripMenuItem.Size = new global::System.Drawing.Size(119, 24);- this.AboutToolStripMenuItem.Text = "About";- this.lblProjectName.AutoSize = true;- this.lblProjectName.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblProjectName.Location = new global::System.Drawing.Point(1101, 13);- this.lblProjectName.Name = "lblProjectName";- this.lblProjectName.Size = new global::System.Drawing.Size(96, 18);- this.lblProjectName.TabIndex = 2;- this.lblProjectName.Text = "Project name";- this.txtProjectName.BorderStyle = global::System.Windows.Forms.BorderStyle.FixedSingle;- this.txtProjectName.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.txtProjectName.Location = new global::System.Drawing.Point(1203, 11);- this.txtProjectName.Name = "txtProjectName";- this.txtProjectName.ReadOnly = true;- this.txtProjectName.Size = new global::System.Drawing.Size(292, 24);- this.txtProjectName.TabIndex = 3;- this.txtRootFolder.BorderStyle = global::System.Windows.Forms.BorderStyle.FixedSingle;- this.txtRootFolder.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.txtRootFolder.Location = new global::System.Drawing.Point(145, 11);- this.txtRootFolder.Name = "txtRootFolder";- this.txtRootFolder.ReadOnly = true;- this.txtRootFolder.Size = new global::System.Drawing.Size(810, 24);- this.txtRootFolder.TabIndex = 3;- this.lblRootFolder.AutoSize = true;- this.lblRootFolder.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.lblRootFolder.Location = new global::System.Drawing.Point(12, 13);- this.lblRootFolder.Name = "lblRootFolder";- this.lblRootFolder.Size = new global::System.Drawing.Size(127, 18);- this.lblRootFolder.TabIndex = 2;- this.lblRootFolder.Text = "Project root folder";- this.btnBrowseRoot.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnBrowseRoot.Location = new global::System.Drawing.Point(966, 8);- this.btnBrowseRoot.Name = "btnBrowseRoot";- this.btnBrowseRoot.Size = new global::System.Drawing.Size(124, 29);- this.btnBrowseRoot.TabIndex = 4;- this.btnBrowseRoot.TabStop = false;- this.btnBrowseRoot.Text = "Browse root";- this.btnBrowseRoot.UseVisualStyleBackColor = true;- this.StatusStrip1.Items.AddRange(new global::System.Windows.Forms.ToolStripItem[] { this.ToolStripStatusLabel1 });- this.StatusStrip1.Location = new global::System.Drawing.Point(0, 967);- this.StatusStrip1.Name = "StatusStrip1";- this.StatusStrip1.Size = new global::System.Drawing.Size(1781, 22);- this.StatusStrip1.TabIndex = 5;- this.StatusStrip1.Text = "StatusStrip1";- this.ToolStripStatusLabel1.Name = "ToolStripStatusLabel1";- this.ToolStripStatusLabel1.Size = new global::System.Drawing.Size(120, 17);- this.ToolStripStatusLabel1.Text = "ToolStripStatusLabel1";- this.grpNavigateTabs.Controls.Add(this.btnGotoPreview);- this.grpNavigateTabs.Controls.Add(this.btnGotoProbes);- this.grpNavigateTabs.Controls.Add(this.btnGotoSources);- this.grpNavigateTabs.Controls.Add(this.btnGotoConfiguration);- this.grpNavigateTabs.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.grpNavigateTabs.Location = new global::System.Drawing.Point(511, 827);- this.grpNavigateTabs.Name = "grpNavigateTabs";- this.grpNavigateTabs.Size = new global::System.Drawing.Size(858, 76);- this.grpNavigateTabs.TabIndex = 8;- this.grpNavigateTabs.TabStop = false;- this.grpNavigateTabs.Text = "Quick navigate to";- this.btnGotoPreview.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnGotoPreview.Location = new global::System.Drawing.Point(635, 27);- this.btnGotoPreview.Name = "btnGotoPreview";- this.btnGotoPreview.Size = new global::System.Drawing.Size(194, 31);- this.btnGotoPreview.TabIndex = 0;- this.btnGotoPreview.Text = "Preview";- this.btnGotoPreview.UseVisualStyleBackColor = true;- this.btnGotoProbes.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnGotoProbes.Location = new global::System.Drawing.Point(431, 27);- this.btnGotoProbes.Name = "btnGotoProbes";- this.btnGotoProbes.Size = new global::System.Drawing.Size(198, 31);- this.btnGotoProbes.TabIndex = 0;- this.btnGotoProbes.Text = "Probes";- this.btnGotoProbes.UseVisualStyleBackColor = true;- this.btnGotoSources.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnGotoSources.Location = new global::System.Drawing.Point(228, 27);- this.btnGotoSources.Name = "btnGotoSources";- this.btnGotoSources.Size = new global::System.Drawing.Size(197, 31);- this.btnGotoSources.TabIndex = 0;- this.btnGotoSources.Text = "Sources";- this.btnGotoSources.UseVisualStyleBackColor = true;- this.btnGotoConfiguration.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnGotoConfiguration.Location = new global::System.Drawing.Point(25, 27);- this.btnGotoConfiguration.Name = "btnGotoConfiguration";- this.btnGotoConfiguration.Size = new global::System.Drawing.Size(197, 31);- this.btnGotoConfiguration.TabIndex = 0;- this.btnGotoConfiguration.Text = "Settings";- this.btnGotoConfiguration.UseVisualStyleBackColor = true;- this.grpSimulationControlButtons.BackColor = global::System.Drawing.SystemColors.Control;- this.grpSimulationControlButtons.Controls.Add(this.btnPauzeResume);- this.grpSimulationControlButtons.Controls.Add(this.btnStartSimulation);- this.grpSimulationControlButtons.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.grpSimulationControlButtons.Location = new global::System.Drawing.Point(16, 827);- this.grpSimulationControlButtons.Name = "grpSimulationControlButtons";- this.grpSimulationControlButtons.Size = new global::System.Drawing.Size(262, 127);- this.grpSimulationControlButtons.TabIndex = 9;- this.grpSimulationControlButtons.TabStop = false;- this.grpSimulationControlButtons.Text = "Simulation Control";- this.Panel1.BackColor = global::System.Drawing.Color.Azure;- this.Panel1.Controls.Add(this.btnDescription);- this.Panel1.Controls.Add(this.txtRootFolder);- this.Panel1.Controls.Add(this.txtProjectName);- this.Panel1.Controls.Add(this.lblRootFolder);- this.Panel1.Controls.Add(this.lblProjectName);- this.Panel1.Controls.Add(this.btnBrowseRoot);- this.Panel1.Location = new global::System.Drawing.Point(19, 33);- this.Panel1.Name = "Panel1";- this.Panel1.Size = new global::System.Drawing.Size(1734, 43);- this.Panel1.TabIndex = 10;- this.btnDescription.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnDescription.Location = new global::System.Drawing.Point(1536, 8);- this.btnDescription.Name = "btnDescription";- this.btnDescription.Size = new global::System.Drawing.Size(168, 29);- this.btnDescription.TabIndex = 5;- this.btnDescription.Text = "Edit description";- this.btnDescription.UseVisualStyleBackColor = true;- this.grpShareImage.Controls.Add(this.btnShareIntensityImage);- this.grpShareImage.Controls.Add(this.btnShareFieldImage);- this.grpShareImage.Controls.Add(this.btnShareSceneImage);- this.grpShareImage.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 9.75f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.grpShareImage.Location = new global::System.Drawing.Point(295, 827);- this.grpShareImage.Name = "grpShareImage";- this.grpShareImage.Size = new global::System.Drawing.Size(199, 125);- this.grpShareImage.TabIndex = 11;- this.grpShareImage.TabStop = false;- this.grpShareImage.Text = "Share with source / probe";- this.btnShareIntensityImage.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnShareIntensityImage.Location = new global::System.Drawing.Point(14, 86);- this.btnShareIntensityImage.Name = "btnShareIntensityImage";- this.btnShareIntensityImage.Size = new global::System.Drawing.Size(154, 27);- this.btnShareIntensityImage.TabIndex = 0;- this.btnShareIntensityImage.Text = "Intensity image";- this.btnShareIntensityImage.UseVisualStyleBackColor = true;- this.btnShareFieldImage.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnShareFieldImage.Location = new global::System.Drawing.Point(16, 53);- this.btnShareFieldImage.Name = "btnShareFieldImage";- this.btnShareFieldImage.Size = new global::System.Drawing.Size(154, 27);- this.btnShareFieldImage.TabIndex = 0;- this.btnShareFieldImage.Text = "Field image";- this.btnShareFieldImage.UseVisualStyleBackColor = true;- this.btnShareSceneImage.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnShareSceneImage.Location = new global::System.Drawing.Point(15, 21);- this.btnShareSceneImage.Name = "btnShareSceneImage";- this.btnShareSceneImage.Size = new global::System.Drawing.Size(155, 27);- this.btnShareSceneImage.TabIndex = 0;- this.btnShareSceneImage.Text = "Scene image";- this.btnShareSceneImage.UseVisualStyleBackColor = true;- // event wiring (was VB WithEvents/Handles)- this.tabMainFunctions.Selecting += new TabControlCancelEventHandler(this.tabMainFunctions_Selecting);- this.tabMainFunctions.DrawItem += new DrawItemEventHandler(this.tabMainFunctions_DrawItem);- this.tabMainFunctions.SelectedIndexChanged += new EventHandler(this.tabMainFunctions_SelectedIndexChanged);- this.tabMainFunctions.SelectedIndexChanged += new EventHandler(this.ProbeTabChanged);- this.tabMainFunctions.SelectedIndexChanged += new EventHandler(this.SourceTabChanged);- this.btnColor5.Click += new EventHandler(this.StopButton_Click);- this.btnColor4.Click += new EventHandler(this.StopButton_Click);- this.btnColor3.Click += new EventHandler(this.StopButton_Click);- this.btnCOlor2.Click += new EventHandler(this.StopButton_Click);- this.btnColor1.Click += new EventHandler(this.StopButton_Click);- this.pnlScheme.Paint += new PaintEventHandler(this.pnlScheme_Paint);- this.btnSaveAsColorScheme.Click += new EventHandler(this.btnSaveAsColorScheme_Click);- this.btnSaveCurrentScheme.Click += new EventHandler(this.btnSaveCurrentScheme_Click);- this.ListView1.ColumnClick += new ColumnClickEventHandler(this.ListView1_ColumnClick);- this.ListView1.SelectedIndexChanged += new EventHandler(this.ListView1_SelectedIndexChanged);- this.ListView1.DoubleClick += new EventHandler(this.ListView1_DoubleClick);- this.ListView1.KeyDown += new KeyEventHandler(this.ListView1_KeyDown);- this.NewToolStripMenuItem.Click += new EventHandler(this.btnNewProject2_Click);- this.OpenToolStripMenuItem.Click += new EventHandler(this.OpenProject_Click);- this.SaveToolStripMenuItem.Click += new EventHandler(this.SaveProject_Click);- this.ExitToolStripMenuItem.Click += new EventHandler(this.ExitProgram_Click);- this.btnLoadScheme.Click += new EventHandler(this.btnLoadScheme_Click);- this.radSchemeTypeIntensity.CheckedChanged += new EventHandler(this.SchemeType_CheckedChanged);- this.radSchemeTypeField.CheckedChanged += new EventHandler(this.SchemeType_CheckedChanged);- this.btbChooseFFolder.Click += new EventHandler(this.btbChooseFFolder_Click);- this.txtSchemeFolder.KeyDown += new KeyEventHandler(this.txtSchemeFolder_KeyDown);- this.btnColor7.Click += new EventHandler(this.StopButton_Click);- this.btnColor6.Click += new EventHandler(this.StopButton_Click);- this.txtRootFolder.DoubleClick += new EventHandler(this.ChooseProjectRootToolStripMenuItem_Click);- this.btnBrowseRoot.Click += new EventHandler(this.ChooseProjectRootToolStripMenuItem_Click);- this.btnSaveAs.Click += new EventHandler(this.SaveAs_Click);- this.txtDampingEdgeSize.TextChanged += new EventHandler(this.DampingSize_TextChanged);- this.txtDampingEdgeSize.Leave += new EventHandler(this.SceneText_Leave);- this.chkUseImageSources.CheckedChanged += new EventHandler(this.chkUseSources_CheckedChanged);- this.chkDampingEdge.CheckedChanged += new EventHandler(this.chkDampingEdge_CheckedChanged);- this.btnLoadSceneImage.Click += new EventHandler(this.btnLOadSceneImage_Click);- this.txtYsize.TextChanged += new EventHandler(this.CanvasSize_TextChanged);- this.txtYsize.Leave += new EventHandler(this.SceneText_Leave);- this.txtXSize.TextChanged += new EventHandler(this.CanvasSize_TextChanged);- this.txtXSize.Leave += new EventHandler(this.SceneText_Leave);- this.radUserDefinedScene.CheckedChanged += new EventHandler(this.SceneMode_CheckedChanged);- this.radUseSceneImage.CheckedChanged += new EventHandler(this.SceneMode_CheckedChanged);- this.btnSaveConfiguration.Click += new EventHandler(this.SaveProject_Click);- this.numVisualizeEvery.ValueChanged += new EventHandler(this.numVisualizeEvery_ValueChanged);- this.chkPreviewVideoIntensity.CheckedChanged += new EventHandler(this.SimulationOption_CheckedChanged);- this.chkExportVideoIntensity.CheckedChanged += new EventHandler(this.SimulationOption_CheckedChanged);- this.chkPreviewVideoField.CheckedChanged += new EventHandler(this.SimulationOption_CheckedChanged);- this.chkExportVideoField.CheckedChanged += new EventHandler(this.SimulationOption_CheckedChanged);- this.cmbFieldColorScheme.SelectedIndexChanged += new EventHandler(this.SchemeCombo_SelectedIndexChanged);- this.cmbIntensityColorScheme.SelectedIndexChanged += new EventHandler(this.SchemeCombo_SelectedIndexChanged);- this.btnStartSimulation.Click += new EventHandler(this.btnStartSimulation_Click);- this.numFieldScaling.ValueChanged += new EventHandler(this.numScaleFieldValues_ValueChanged);- this.numIntensityScaling.ValueChanged += new EventHandler(this.numScaleIntensity_ValueChanged);- this.btnEditObjectSourceList.Click += new EventHandler(this.btnEditSourceList_Click);- this.chkUseObjectSources.CheckedChanged += new EventHandler(this.chkUseObjectSources_CheckedChanged);- this.numScaleImageSource.ValueChanged += new EventHandler(this.ImageSourceScale_ValueChanged);- this.numOffsetIntensity.ValueChanged += new EventHandler(this.numOffsetIntensity_ValueChanged);- this.numOffsetField.ValueChanged += new EventHandler(this.numOffsetField_ValueChanged);- this.btnViewIntensityVideo.Click += new EventHandler(this.btnViewIntensityVideo_Click);- this.btnViewFieldVideo.Click += new EventHandler(this.btnViewFieldVideo_Click);- this.lblVideoQuality.Click += new EventHandler(this.lblVideoQuality_Click);- this.numQuality.ValueChanged += new EventHandler(this.numQuality_ValueChanged);- this.chkUseGPU.CheckedChanged += new EventHandler(this.chkUseGPU_CheckedChanged);- this.btnPauzeResume.Click += new EventHandler(this.btnPauzeResume_Click);- this.grpProbe1.Enter += new EventHandler(this.grpProbe1_Enter);- this.radFullScale.CheckedChanged += new EventHandler(this.ProbeScaleMode_CheckedChanged);- this.radRunningScale.CheckedChanged += new EventHandler(this.ProbeScaleMode_CheckedChanged);- this.chkAutoScaleY.CheckedChanged += new EventHandler(this.ProbeAutoScale_CheckedChanged);- this.chkAutoScaleX.CheckedChanged += new EventHandler(this.ProbeAutoScale_CheckedChanged);- this.numBPosY.ValueChanged += new EventHandler(this.ProbePosition_ValueChanged);- this.numAPosY.ValueChanged += new EventHandler(this.ProbePosition_ValueChanged);- this.numBPosX.ValueChanged += new EventHandler(this.ProbePosition_ValueChanged);- this.numAPosX.ValueChanged += new EventHandler(this.ProbePosition_ValueChanged);- this.butPicPositions.Click += new EventHandler(this.butPicPositions_Click);- this.cmbPlaceOn.SelectedIndexChanged += new EventHandler(this.ProbeCombo_SelectedIndexChanged);- this.cmbMeasurement.SelectedIndexChanged += new EventHandler(this.ProbeCombo_SelectedIndexChanged);- this.cmbBoxSize.SelectedIndexChanged += new EventHandler(this.ProbeCombo_SelectedIndexChanged);- this.cmbProbeType.SelectedIndexChanged += new EventHandler(this.ProbeCombo_SelectedIndexChanged);- this.txtStartAfterStep.KeyDown += new KeyEventHandler(this.ProbeTextBox_KeyDown);- this.txtStartAfterStep.Validated += new EventHandler(this.ProbeStartAfterStep_Validated);- this.chkStartAfterStep.CheckedChanged += new EventHandler(this.ProbeStartAfterStep_CheckedChanged);- this.txtMaxScaleY.KeyDown += new KeyEventHandler(this.ProbeTextBox_KeyDown);- this.txtMaxScaleY.Validated += new EventHandler(this.ProbeYRange_Validated);- this.txtMinScaleY.KeyDown += new KeyEventHandler(this.ProbeTextBox_KeyDown);- this.txtMinScaleY.Validated += new EventHandler(this.ProbeYRange_Validated);- this.numRefractiveIndex.ValueChanged += new EventHandler(this.RefractiveIndex_ValueChanged);- this.chkProbeOn1.CheckedChanged += new EventHandler(this.ProbeOn_CheckedChanged);- this.Label21.Click += new EventHandler(this.Label21_Click);- this.numRunningWindow.ValueChanged += new EventHandler(this.ProbeRunningWindow_ValueChanged);- this.grpProbe2.Enter += new EventHandler(this.grpProbe1_Enter);- this.Label22.Click += new EventHandler(this.Label21_Click);- this.numRunningWindow2.ValueChanged += new EventHandler(this.ProbeRunningWindow2_ValueChanged);- this.chkProbeOn2.CheckedChanged += new EventHandler(this.ProbeOn2_CheckedChanged);- this.txtStartAfterStep2.KeyDown += new KeyEventHandler(this.ProbeTextBox2_KeyDown);- this.txtStartAfterStep2.Validated += new EventHandler(this.ProbeStartAfterStep2_Validated);- this.chkStartAfterStep2.CheckedChanged += new EventHandler(this.ProbeStartAfterStep2_CheckedChanged);- this.txtMaxScaleY2.KeyDown += new KeyEventHandler(this.ProbeTextBox2_KeyDown);- this.txtMaxScaleY2.Validated += new EventHandler(this.ProbeYRange2_Validated);- this.txtMinScaleY2.KeyDown += new KeyEventHandler(this.ProbeTextBox2_KeyDown);- this.txtMinScaleY2.Validated += new EventHandler(this.ProbeYRange2_Validated);- this.radFullScale2.CheckedChanged += new EventHandler(this.ProbeScaleMode2_CheckedChanged);- this.radRunningScale2.CheckedChanged += new EventHandler(this.ProbeScaleMode2_CheckedChanged);- this.chkAutoScaleY2.CheckedChanged += new EventHandler(this.ProbeAutoScale2_CheckedChanged);- this.chkAutoScaleX2.CheckedChanged += new EventHandler(this.ProbeAutoScale2_CheckedChanged);- this.numBPosY2.ValueChanged += new EventHandler(this.ProbePosition2_ValueChanged);- this.numAPosY2.ValueChanged += new EventHandler(this.ProbePosition2_ValueChanged);- this.numBPosX2.ValueChanged += new EventHandler(this.ProbePosition2_ValueChanged);- this.numAPosX2.ValueChanged += new EventHandler(this.ProbePosition2_ValueChanged);- this.butPicPositions2.Click += new EventHandler(this.butPicPositions2_Click);- this.cmbPlaceOn2.SelectedIndexChanged += new EventHandler(this.ProbeCombo2_SelectedIndexChanged);- this.cmbMeasurement2.SelectedIndexChanged += new EventHandler(this.ProbeCombo2_SelectedIndexChanged);- this.cmbBoxSize2.SelectedIndexChanged += new EventHandler(this.ProbeCombo2_SelectedIndexChanged);- this.cmbProbeType2.SelectedIndexChanged += new EventHandler(this.ProbeCombo2_SelectedIndexChanged);- this.btnDelete.Click += new EventHandler(this.btnDelete_Click);- this.lstSources.DrawItem += new DrawItemEventHandler(this.lstSources_DrawItem);- this.lstSources.SelectedIndexChanged += new EventHandler(this.lstSources_SelectedIndexChanged);- this.numSourcePositionY.ValueChanged += new EventHandler(this.SourcePosition_ValueChanged);- this.numSourcePositionX.ValueChanged += new EventHandler(this.SourcePosition_ValueChanged);- this.btnPickSourcePosition.Click += new EventHandler(this.PickSourcePosition_Click);- this.btnCopy.Click += new EventHandler(this.btnCopy_Click);- this.radModePulsed.CheckedChanged += new EventHandler(this.SourceMode_CheckedChanged);- this.radModeContinuous.CheckedChanged += new EventHandler(this.SourceMode_CheckedChanged);- this.cmbMainType.SelectedIndexChanged += new EventHandler(this.SourceMainType_SelectedIndexChanged);- this.numOffStateCycles.ValueChanged += new EventHandler(this.SourceRandomizeLimitInput_ValueChanged);- this.numFrequency.ValueChanged += new EventHandler(this.SourceFrequency_ValueChanged);- this.numFrequency.ValueChanged += new EventHandler(this.SourceRandomizeLimitInput_ValueChanged);- this.numSpacingSizeX.ValueChanged += new EventHandler(this.SourceRandomizeLimitInput_ValueChanged);- this.numArraySizeX.ValueChanged += new EventHandler(this.SourceRandomizeLimitInput_ValueChanged);- this.numArraySizeX.Validating += new CancelEventHandler(this.ArraySize_Validating);- this.cmbCompositeProperties.SelectedIndexChanged += new EventHandler(this.SourceMainType_SelectedIndexChanged);- this.numSpacingSizeY.ValueChanged += new EventHandler(this.SourceRandomizeLimitInput_ValueChanged);- this.numArraySizeY.ValueChanged += new EventHandler(this.SourceRandomizeLimitInput_ValueChanged);- this.numArraySizeY.Validating += new CancelEventHandler(this.ArraySize_Validating);- this.btnSaveSource.Click += new EventHandler(this.btnSaveSource_Click);- this.chkRandomizePhase.CheckedChanged += new EventHandler(this.SourceRandomizeCheck_CheckedChanged);- this.chkRandomizePosition.CheckedChanged += new EventHandler(this.SourceRandomizeCheck_CheckedChanged);- this.chkOffWidth.CheckedChanged += new EventHandler(this.SourceRandomizeCheck_CheckedChanged);- this.chkRandomizeFrequency.CheckedChanged += new EventHandler(this.SourceRandomizeCheck_CheckedChanged);- this.btnOpenVideoFolder.Click += new EventHandler(this.btnOpenVideoFolder_Click);- this.chkDetachSource.CheckedChanged += new EventHandler(this.SourceDetach_CheckedChanged);- this.btnRenameProject.Click += new EventHandler(this.btnRenameProject_Click);- this.btnDeleteProject.Click += new EventHandler(this.btnDeleteProject_Click);- this.btnLoadProject.Click += new EventHandler(this.btnLoadProject_Click);- this.ChooseProjectRootToolStripMenuItem.Click += new EventHandler(this.ChooseProjectRootToolStripMenuItem_Click);- this.SetCValueToolStripMenuItem.Click += new EventHandler(this.SetCValueToolStripMenuItem_Click);- this.btnExportIntensityFrame.Click += new EventHandler(this.btnExportIntensityFrame_Click);- this.btnExportFieldFrame.Click += new EventHandler(this.btnExportFieldFrame_Click);- this.btnOpenImageFolder.Click += new EventHandler(this.btnOpenImageFolder_Click);- this.btnNew.Click += new EventHandler(this.btnNew_Click);- this.btnGotoPreview.Click += new EventHandler(this.btnGotoPreview_Click);- this.btnGotoProbes.Click += new EventHandler(this.btnGotoProbes_Click);- this.btnGotoSources.Click += new EventHandler(this.btnGotoSources_Click);- this.btnGotoConfiguration.Click += new EventHandler(this.btnGotoConfiguration_Click);- this.btnShareIntensityImage.Click += new EventHandler(this.btnShareIntensityImage_Click);- this.btnShareFieldImage.Click += new EventHandler(this.btnShareFieldImage_Click);- this.btnShareSceneImage.Click += new EventHandler(this.btnShareSceneImage_Click);- this.btnNewProject.Click += new EventHandler(this.btnNewProject2_Click);- this.btnColor9.Click += new EventHandler(this.StopButton_Click);- this.btnColor8.Click += new EventHandler(this.StopButton_Click);- this.btnDeleteColorScheme.Click += new EventHandler(this.btnDeleteColorScheme_Click);- this.btnRenameColorScheme.Click += new EventHandler(this.btnRenameColorScheme_Click);- this.lstAllProjects.ColumnClick += new ColumnClickEventHandler(this.lstAllProjects_ColumnClick);- this.lstAllProjects.SelectedIndexChanged += new EventHandler(this.lstAllProjects_SelectedIndexChanged);- this.lstAllProjects.DoubleClick += new EventHandler(this.lstAllProjects_DoubleClick);- this.lstImages.ColumnClick += new ColumnClickEventHandler(this.lstImages_ColumnClick);- this.lstImages.SelectedIndexChanged += new EventHandler(this.lstImages_SelectedIndexChanged);- this.lstImages.KeyDown += new KeyEventHandler(this.lstImages_KeyDown);- this.lstVideo.ColumnClick += new ColumnClickEventHandler(this.lstVideo_ColumnClick);- this.lstVideo.SelectedIndexChanged += new EventHandler(this.lstVideo_SelectedIndexChanged);- this.lstVideo.KeyDown += new KeyEventHandler(this.lstVideo_KeyDown);- this.lstVideo.DoubleClick += new EventHandler(this.lstVideo_DoubleClick);- this.lstAllProjects3.ColumnClick += new ColumnClickEventHandler(this.lstAllProjects3_ColumnClick);- this.lstAllProjects3.SelectedIndexChanged += new EventHandler(this.lstAllProjects3_SelectedIndexChanged);- this.btnDeleteScene.Click += new EventHandler(this.btnDeleteScene_Click);- this.btnLoadExternal.Click += new EventHandler(this.btnLoadExternal_Click);- this.lstScenes.ColumnClick += new ColumnClickEventHandler(this.lstScenes_ColumnClick);- this.lstScenes.SelectedIndexChanged += new EventHandler(this.lstScenes_SelectedIndexChanged);- this.btnOpenImageFolder2.Click += new EventHandler(this.btnOpenImageFolder2_Click);- this.btnViewVIdeoInPlayer2.Click += new EventHandler(this.btnViewVIdeoInPlayer2_Click);- this.btnOpenVIdeoFolder2.Click += new EventHandler(this.btnOpenVIdeoFolder2_Click);- this.btnDeleteVideos.Click += new EventHandler(this.btnDeleteVideos_Click);- this.btnDeleteImages.Click += new EventHandler(this.btnDeleteImages_Click);- this.btnCopyToClipboard.Click += new EventHandler(this.btnCopyToClipboard_Click);- this.btnShareWithEditors.Click += new EventHandler(this.btnShareWithEditors_Click);- this.chkUse4thOrderLaplacian.CheckedChanged += new EventHandler(this.chkUse4thOrderLaplacian_CheckedChanged);- this.lblInfo.Click += new EventHandler(this.lblInfo_Click);- this.btnRenameVideo.Click += new EventHandler(this.btnRenameVideo_Click);- this.picPreviewSource.Paint += new PaintEventHandler(this.picPreviewSource_Paint);- this.picPreviewSource.SizeChanged += new EventHandler(this.picPreviewSource_SizeChanged);- this.chkAutoRescaleSourceOn.CheckedChanged += new EventHandler(this.chkAutoRescaleSourceOn_CheckedChanged);- this.numSimulationSteps.ValueChanged += new EventHandler(this.numSimulationSteps_ValueChanged);- this.numTimeDecayFactor.ValueChanged += new EventHandler(this.numTimeDecayFactor_ValueChanged);- this.numFieldScaling2.ValueChanged += new EventHandler(this.numScaleFieldValues2_ValueChanged);- this.chkDiplayOverlayInField.CheckedChanged += new EventHandler(this.chkDiplayOverlayInField_CheckedChanged);- this.numIntensityScaling2.ValueChanged += new EventHandler(this.numScaleIntensity2_ValueChanged);- this.chkDiplayOverlayInIntensity.CheckedChanged += new EventHandler(this.chkDiplayOverlayInIntensity_CheckedChanged);- this.numBrightnessIntensityOverlay.ValueChanged += new EventHandler(this.numBrightnessIntensityOverlay_ValueChanged);- this.numBrightnessFieldOverlay.ValueChanged += new EventHandler(this.numBrightnessFieldOverlay_ValueChanged);- this.chkExportVideoIntensity2.CheckedChanged += new EventHandler(this.chkExportVideoIntensity2_CheckedChanged);- this.chkExportVideoField2.CheckedChanged += new EventHandler(this.chkExportVideoField2_CheckedChanged);- this.HelpToolStripMenuItem.Click += new EventHandler(this.HelpToolStripMenuItem_Click);- this.AboutToolStripMenuItem.Click += new EventHandler(this.AboutToolStripMenuItem_Click);- this.btnSaveConfiguration2.Click += new EventHandler(this.btnSaveConfiguration2_Click);- this.btnDescription.Click += new EventHandler(this.btnDescription_Click);- this.btnPickRoot.Click += new EventHandler(this.ChooseProjectRootToolStripMenuItem_Click);- base.AutoScaleDimensions = new global::System.Drawing.SizeF(6f, 13f);- base.AutoScaleMode = global::System.Windows.Forms.AutoScaleMode.Font;- base.ClientSize = new global::System.Drawing.Size(1781, 989);- base.Controls.Add(this.grpShareImage);- base.Controls.Add(this.Panel1);- base.Controls.Add(this.grpSimulationControlButtons);- base.Controls.Add(this.grpNavigateTabs);- base.Controls.Add(this.StatusStrip1);- base.Controls.Add(this.tabMainFunctions);- base.Controls.Add(this.MenuStrip1);- base.Controls.Add(this.btnSaveConfiguration);- base.Icon = (global::System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");- base.MainMenuStrip = this.MenuStrip1;- base.Name = "Form1";- this.Text = "Wave Dude 2D V0.29";- this.tabMainFunctions.ResumeLayout(false);- this.tabConfiguration.ResumeLayout(false);- this.grpProjects.ResumeLayout(false);- this.grpSimulationSettings.ResumeLayout(false);- this.grpSimulationSettings.PerformLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numTimeDecayFactor).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numSimulationSteps).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numQuality).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numIntensityScaling).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numOffsetIntensity).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numOffsetField).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numFieldScaling).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numVisualizeEvery).EndInit();- this.grpSceneProperties.ResumeLayout(false);- this.grpSceneProperties.PerformLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numRefractiveIndex).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.picImagePreview).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numScaleImageSource).EndInit();- this.tabSourceList.ResumeLayout(false);- this.tabSourceList.PerformLayout();- ((global::System.ComponentModel.ISupportInitialize)this.picPreviewSource).EndInit();- this.grpPlaceSource.ResumeLayout(false);- this.pnlPosition.ResumeLayout(false);- this.pnlPosition.PerformLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numSourcePositionX).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numSourcePositionY).EndInit();- this.grpSourceDetails.ResumeLayout(false);- this.grpSourceDetails.PerformLayout();- this.grpComposite.ResumeLayout(false);- this.grpComposite.PerformLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numRandomizeOffWidth).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numRandomizePosition).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.NumRandomizePhase).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numRandomizeFrequency).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numSpacingSizeY).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numSpacingSizeX).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numArraySizeY).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numArraySizeX).EndInit();- this.grpSingleSource.ResumeLayout(false);- this.grpSingleSource.PerformLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numOffStateCycles).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numPhase).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numAmplitude).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numFrequency).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numPulseWidthCycles).EndInit();- this.tabProbeList.ResumeLayout(false);- this.GroupBox2.ResumeLayout(false);- this.GroupBox2.PerformLayout();- this.grpProbe2.ResumeLayout(false);- this.grpProbe2.PerformLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numRunningWindow2).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numBPosY2).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numAPosY2).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numBPosX2).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numAPosX2).EndInit();- this.grpProbe1.ResumeLayout(false);- this.grpProbe1.PerformLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numRunningWindow).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numBPosY).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numAPosY).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numBPosX).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numAPosX).EndInit();- this.tabViewer.ResumeLayout(false);- this.tabViewer.PerformLayout();- this.pnlPreviewIntensityProps.ResumeLayout(false);- this.pnlPreviewIntensityProps.PerformLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numBrightnessIntensityOverlay).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numIntensityScaling2).EndInit();- this.Panel3.ResumeLayout(false);- this.Panel3.PerformLayout();- ((global::System.ComponentModel.ISupportInitialize)this.numFieldScaling2).EndInit();- ((global::System.ComponentModel.ISupportInitialize)this.numBrightnessFieldOverlay).EndInit();- this.tabOutput.ResumeLayout(false);- this.tabOutput.PerformLayout();- this.tabColorScheme.ResumeLayout(false);- this.tabColorScheme.PerformLayout();- this.MenuStrip1.ResumeLayout(false);- this.MenuStrip1.PerformLayout();- this.StatusStrip1.ResumeLayout(false);- this.StatusStrip1.PerformLayout();- this.grpNavigateTabs.ResumeLayout(false);- this.grpSimulationControlButtons.ResumeLayout(false);- this.Panel1.ResumeLayout(false);- this.Panel1.PerformLayout();- this.grpShareImage.ResumeLayout(false);- base.ResumeLayout(false);- base.PerformLayout();- }-- private TabControl tabMainFunctions;- private TabPage tabColorScheme;- private TextBox txtCurrentColorScheme;- private Label lblCurrentCOlorScheme;- private Label lblColorSchemeEditor;- private Button btnColor5;- private Button btnColor4;- private Button btnColor3;- private Button btnCOlor2;- private Button btnColor1;- private Label lblColorPicker;- private Panel Panel2;- private Panel pnlScheme;- private Button btnSaveAsColorScheme;- private Button btnSaveCurrentScheme;- private TabPage tabConfiguration;- private TabPage tabProbeList;- private TabPage tabOutput;- private TabPage tabViewer;- private ListView ListView1;- private MenuStrip MenuStrip1;- private ToolStripMenuItem itemFile;- private ToolStripMenuItem NewToolStripMenuItem;- private ToolStripMenuItem OpenToolStripMenuItem;- private ToolStripMenuItem SaveToolStripMenuItem;- private ToolStripMenuItem ExitToolStripMenuItem;- private Label lblSchemeFolder;- private Button btnLoadScheme;- private Label lblType;- private RadioButton radSchemeTypeIntensity;- private RadioButton radSchemeTypeField;- private Button btbChooseFFolder;- private TextBox txtSchemeFolder;- private Button btnColor7;- private Button btnColor6;- private Label lblProjectName;- private TextBox txtProjectName;- private TextBox txtRootFolder;- private Label lblRootFolder;- private Button btnBrowseRoot;- private Button btnSaveAs;- private GroupBox grpSceneProperties;- private TextBox txtDampingEdgeSize;- private CheckBox chkUseImageSources;- private CheckBox chkDampingEdge;- private Button btnLoadSceneImage;- private Label lblImageNameAndSize;- private Label Label1;- private Label lblPix;- private Label lblX;- private TextBox txtYsize;- private TextBox txtXSize;- private RadioButton radUserDefinedScene;- private PictureBox picImagePreview;- private RadioButton radUseSceneImage;- private TabPage tabSourceList;- private Button btnSaveConfiguration;- private GroupBox grpSimulationSettings;- private NumericUpDown numVisualizeEvery;- private Label Label4;- private Label lblVisualizeEvery;- private Label lblSimulationSteps;- private CheckBox chkPreviewVideoIntensity;- private CheckBox chkExportVideoIntensity;- private CheckBox chkPreviewVideoField;- private CheckBox chkExportVideoField;- private Label lblPreviewVideo;- private Label lblExportVideo;- private Panel pnlPreviewIntensity;- private Panel pnlPreviewField;- private ComboBox cmbFieldColorScheme;- private Label Label3;- private Label Label2;- private ComboBox cmbIntensityColorScheme;- private Button btnStartSimulation;- private NumericUpDown numFieldScaling;- private Label Label5;- private NumericUpDown numIntensityScaling;- private Label numScaleIntensityValues;- private Button btnEditObjectSourceList;- private CheckBox chkUseObjectSources;- private Label lblScaleImgSourceIntensity;- private NumericUpDown numScaleImageSource;- private NumericUpDown numOffsetIntensity;- private NumericUpDown numOffsetField;- private Label Label6;- private Label lblOffsetField;- private Button btnViewIntensityVideo;- private Button btnViewFieldVideo;- private Label lblVideoQuality;- private NumericUpDown numQuality;- private CheckBox chkUseGPU;- private Label Label7;- private StatusStrip StatusStrip1;- private ToolStripStatusLabel ToolStripStatusLabel1;- private Button btnPauzeResume;- private Panel pnlSourceImage;- private Panel pnlProbeImage;- private GroupBox grpProbe1;- private RadioButton radFullScale;- private RadioButton radRunningScale;- private CheckBox chkAutoScaleY;- private CheckBox chkAutoScaleX;- private NumericUpDown numBPosY;- private NumericUpDown numAPosY;- private NumericUpDown numBPosX;- private NumericUpDown numAPosX;- private Button butPicPositions;- private Label Label16;- private ComboBox cmbPlaceOn;- private ComboBox cmbMeasurement;- private Label Label13;- private Label Label15;- private ComboBox cmbBoxSize;- private ComboBox cmbProbeType;- private Label Label14;- private Label Label12;- private Label Label11;- private Label Label17;- private Label Label10;- private Label Label9;- private Label Label8;- private TextBox txtStartAfterStep;- private CheckBox chkStartAfterStep;- private Label Label19;- private Label Label18;- private TextBox txtMaxScaleY;- private TextBox txtMinScaleY;- private Label Label20;- private NumericUpDown numRefractiveIndex;- private CheckBox chkProbeOn1;- private Label Label21;- private NumericUpDown numRunningWindow;- private GroupBox grpProbe2;- private Label Label22;- private NumericUpDown numRunningWindow2;- private CheckBox chkProbeOn2;- private TextBox txtStartAfterStep2;- private CheckBox chkStartAfterStep2;- private Label Label23;- private Label Label24;- private TextBox txtMaxScaleY2;- private TextBox txtMinScaleY2;- private RadioButton radFullScale2;- private RadioButton radRunningScale2;- private CheckBox chkAutoScaleY2;- private CheckBox chkAutoScaleX2;- private NumericUpDown numBPosY2;- private NumericUpDown numAPosY2;- private NumericUpDown numBPosX2;- private NumericUpDown numAPosX2;- private Button butPicPositions2;- private Label Label25;- private ComboBox cmbPlaceOn2;- private ComboBox cmbMeasurement2;- private Label Label26;- private Label Label27;- private ComboBox cmbBoxSize2;- private ComboBox cmbProbeType2;- private Label Label28;- private Label Label29;- private Label Label30;- private Label Label31;- private Label Label32;- private Label Label33;- private Label Label34;- private Button btnDelete;- private ListBox lstSources;- private GroupBox grpSourceDetails;- private Label lblPosition;- private NumericUpDown numSourcePositionY;- private NumericUpDown numSourcePositionX;- private Button btnPickSourcePosition;- private Label Label36;- private Label Label35;- private Button btnCopy;- private GroupBox grpSingleSource;- private Label Label43;- private Label Label42;- private Label Label41;- private Label Label40;- private RadioButton radModePulsed;- private RadioButton radModeContinuous;- private TextBox txtName;- private ComboBox cmbMainType;- private Label Label39;- private Label lblName;- private Label Label38;- private NumericUpDown numOffStateCycles;- private NumericUpDown numAmplitude;- private NumericUpDown numFrequency;- private NumericUpDown numPulseWidthCycles;- private Label Label44;- private Label Label46;- private Label Label45;- private ComboBox cmbPulseShape;- private GroupBox grpComposite;- private NumericUpDown numSpacingSizeX;- private NumericUpDown numArraySizeX;- private NumericUpDown numRandomizeFrequency;- private Label Label50;- private Label Label51;- private Label Label52;- private Label Label53;- private ComboBox cmbCompositeProperties;- private NumericUpDown numPhase;- private Label Label54;- private NumericUpDown numSpacingSizeY;- private NumericUpDown numArraySizeY;- private Button btnSaveSource;- private NumericUpDown numRandomizeOffWidth;- private NumericUpDown numRandomizePosition;- private NumericUpDown NumRandomizePhase;- private CheckBox chkRandomizePhase;- private CheckBox chkRandomizePosition;- private CheckBox chkOffWidth;- private CheckBox chkRandomizeFrequency;- private Button btnOpenVideoFolder;- private TextBox txtDetachAfterSteps;- private Label Label47;- private CheckBox chkDetachSource;- private Panel pnlPosition;- private Label lblLambdaIs;- private CheckBox chkSourceOn;- private Button btnRenameProject;- private Button btnDeleteProject;- private Button btnLoadProject;- private ToolStripMenuItem ChooseProjectRootToolStripMenuItem;- private ToolStripMenuItem SetCValueToolStripMenuItem;- private Button btnExportIntensityFrame;- private Button btnExportFieldFrame;- private Button btnOpenImageFolder;- private Button btnNew;- private Label lblWarningIntensity;- private Label lblWarningField;- private GroupBox grpNavigateTabs;- private GroupBox grpSimulationControlButtons;- private Button btnGotoPreview;- private Button btnGotoProbes;- private Button btnGotoSources;- private Button btnGotoConfiguration;- private Panel Panel1;- private GroupBox grpShareImage;- private Button btnShareIntensityImage;- private Button btnShareFieldImage;- private Button btnShareSceneImage;- private Button btnNewProject;- private Button btnColor9;- private Button btnColor8;- private GroupBox grpProjects;- private GroupBox grpPlaceSource;- private GroupBox GroupBox2;- private Label Label49;- private Label Label48;- private Label Label37;- private Button btnDeleteColorScheme;- private Button btnRenameColorScheme;- private Label Label56;- private Label Label55;- private ListView lstAllProjects;- private ColumnHeader colProjectName;- private ColumnHeader colLastEdit;- private ListView lstImages;- private ColumnHeader colImageName;- private ColumnHeader colCreatedOn;- private ListView lstVideo;- private ColumnHeader colVideoName;- private ListView lstAllProjects3;- private ColumnHeader colProjectName2;- private ColumnHeader colLastEdited2;- private Button btnDeleteScene;- private Button btnLoadExternal;- private Panel pnlPreview;- private Label Label57;- private ListView lstScenes;- private ColumnHeader colSceneName;- private ColumnHeader colSceneCreated;- private Button btnOpenImageFolder2;- private Button btnViewVIdeoInPlayer2;- private Button btnOpenVIdeoFolder2;- private Label lblPreview;- private Button btnDeleteVideos;- private Button btnDeleteImages;- private Button btnCopyToClipboard;- private Button btnShareWithEditors;- private CheckBox chkUse4thOrderLaplacian;- private Label lblInfo;- private Button btnRenameVideo;- private PictureBox picPreviewSource;- private CheckBox chkAutoRescaleSourceOn;- private NumericUpDown numSimulationSteps;- private Label Label59;- private Label Label58;- private Label Label60;- private Label Label61;- private NumericUpDown numTimeDecayFactor;- private Label Label62;- private Label Label63;- private NumericUpDown numFieldScaling2;- private CheckBox chkDiplayOverlayInField;- private Label Label64;- private NumericUpDown numIntensityScaling2;- private CheckBox chkDiplayOverlayInIntensity;- private NumericUpDown numBrightnessIntensityOverlay;- private NumericUpDown numBrightnessFieldOverlay;- private Label Label66;- private Label Label65;- private Panel pnlPreviewIntensityProps;- private CheckBox chkExportVideoIntensity2;- private Panel Panel3;- private CheckBox chkExportVideoField2;- private ToolStripMenuItem InfoToolStripMenuItem;- private ToolStripMenuItem HelpToolStripMenuItem;- private ToolStripMenuItem AboutToolStripMenuItem;- private Button btnSaveConfiguration2;- private Button btnDescription;- private Button btnPickRoot;- private global::System.ComponentModel.IContainer components;- }-}diff --git a/Wave_Dude_2D/Form1.Output.cs b/Wave_Dude_2D/Form1.Output.csdeleted file mode 100644index 5530b42..0000000--- a/Wave_Dude_2D/Form1.Output.cs+++ /dev/null@@ -1,799 +0,0 @@-using System;-using System.Collections.Generic;-using System.Drawing;-using System.Globalization;-using System.IO;-using System.Linq;-using System.Runtime.InteropServices;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Outputs tab: a second project list (<c>lstAllProjects3</c>) and, for the project selected- /// there, three file lists (scene images, rendered frames, videos) with a shared preview box- /// and delete/rename/open/copy commands. Only one of the three file lists has a selection at- /// a time; selecting in one clears the other two. The lists show files on disk, not the open- /// project's state, so they are refreshed from disk after every change. Everything here runs- /// on the UI thread.- /// </summary>- public partial class Form1- {- /// <summary>- /// Creates the preview <see cref="PictureBox"/> (zoom-to-fit, docked in <c>pnlPreview</c>),- /// fills the Outputs-tab project list and sets the initial button state. Called once from- /// <c>Form1_Load</c>.- /// </summary>- private void InitializeOutputsTab()- {- _outputPreviewPic = new PictureBox();- _outputPreviewPic.Dock = DockStyle.Fill;- _outputPreviewPic.SizeMode = PictureBoxSizeMode.Zoom;- pnlPreview.Controls.Add(_outputPreviewPic);- RefreshOutputProjectList("");- UpdateShareWithEditorsButton();- }-- /// <summary>- /// Rebuilds the Outputs-tab project list from disk with its own sort state and selects- /// <paramref name="preferredName"/>, or the previously selected project when that is "".- /// Selecting an entry triggers <see cref="lstAllProjects3_SelectedIndexChanged"/>, which- /// reloads the file lists.- /// </summary>- private void RefreshOutputProjectList(string preferredName = "")- {- string selectedName = (preferredName.Length > 0) ? preferredName : SelectedProjectName(lstAllProjects3);- List<Form1.ProjectListEntry> entries = BuildProjectEntries();- SortProjectEntries(entries, _outputProjectSortColumn, _outputProjectSortAscending);- PopulateProjectListView(lstAllProjects3, entries);- UpdateOutputProjectSortHeaders();- SelectProjectInList(lstAllProjects3, selectedName);- }-- /// <summary>Clicking a column header sorts the Outputs-tab project list by it; clicking the current sort column again flips the direction.</summary>- private void lstAllProjects3_ColumnClick(object sender, ColumnClickEventArgs e)- {- if (e.Column == _outputProjectSortColumn)- {- _outputProjectSortAscending = !_outputProjectSortAscending;- }- else- {- _outputProjectSortColumn = e.Column;- _outputProjectSortAscending = true;- }- RefreshOutputProjectList("");- }-- /// <summary>Appends " ^" (ascending) or " v" (descending) to the header of the column the Outputs-tab project list is sorted by.</summary>- private void UpdateOutputProjectSortHeaders()- {- string arrow = _outputProjectSortAscending ? " ^" : " v";- colProjectName2.Text = "Project name" + ((_outputProjectSortColumn == 0) ? arrow : "");- colLastEdited2.Text = "Last edited" + ((_outputProjectSortColumn == 1) ? arrow : "");- }-- /// <summary>Full folder path of the project selected in the Outputs-tab list, or "" when none is selected.</summary>- private string SelectedOutputProjectFolder()- {- string name = SelectedProjectName(lstAllProjects3);- return (name.Length == 0) ? "" : ProjectStore.FolderPathFor(_settings.ProjectRoot, name);- }-- /// <summary>Selecting a project reloads the three file lists for it.</summary>- private void lstAllProjects3_SelectedIndexChanged(object sender, EventArgs e)- {- RefreshOutputFileLists();- }-- /// <summary>- /// Refills the scene, image and video lists from the selected Outputs-tab project (empties- /// them when none is selected), updates their sort headers, clears the preview and the- /// copy-button state. Previous file selections are dropped; the <c>Refill*List</c> methods- /// are the variants that keep them.- /// </summary>- private void RefreshOutputFileLists()- {- string projectFolder = SelectedOutputProjectFolder();- FillFileList(lstScenes, projectFolder, ProjectStore.SceneImageFolderName, Form1.SceneImageExtensions, _sceneSortColumn, _sceneSortAscending);- FillFileList(lstImages, projectFolder, ProjectStore.OutputFramesFolderName, Form1.OutputImageExtensions, _imageSortColumn, _imageSortAscending);- FillFileList(lstVideo, projectFolder, ProjectStore.OutputVideoFolderName, Form1.OutputVideoExtensions, _videoSortColumn, _videoSortAscending);- UpdateFileListSortHeaders(colSceneName, "Scene file name", colSceneCreated, "Created on", _sceneSortColumn, _sceneSortAscending);- UpdateFileListSortHeaders(colImageName, "Image file name", colCreatedOn, "Created on", _imageSortColumn, _imageSortAscending);- UpdateFileListSortHeaders(colVideoName, "Video file name", colCreatedOn2, "Created on", _videoSortColumn, _videoSortAscending);- ClearOutputPreview();- UpdateCopyToClipboardButton();- }-- /// <summary>- /// Replaces the items of <paramref name="list"/> with the files in- /// <c>projectFolder\subfolderName</c> whose lower-cased extension (including the dot) is in- /// <paramref name="extensions"/>. Sorted by file name, or by creation time when the list has- /// a date column and <paramref name="sortColumn"/> is 1. Each item's <c>Tag</c> is the full- /// path; the optional second column shows the local creation time as "yyyy-MM-dd HH:mm".- /// The list is left empty when <paramref name="projectFolder"/> is "" or the sub-folder does- /// not exist.- /// </summary>- private void FillFileList(ListView list, string projectFolder, string subfolderName, string[] extensions, int sortColumn, bool sortAscending)- {- list.BeginUpdate();- try- {- list.Items.Clear();- if (projectFolder.Length == 0)- {- return;- }- string folder = Path.Combine(projectFolder, subfolderName);- if (!Directory.Exists(folder))- {- return;- }- List<string> files = new List<string>(Directory.GetFiles(folder));- files.RemoveAll(f => Array.IndexOf(extensions, Path.GetExtension(f).ToLowerInvariant()) < 0);- bool byCreatedDate = list.Columns.Count > 1 && sortColumn == 1;- files.Sort((a, b) => CompareFileEntries(a, b, byCreatedDate, sortAscending));- foreach (string file in files)- {- ListViewItem item = new ListViewItem(Path.GetFileName(file));- if (list.Columns.Count > 1)- {- item.SubItems.Add(File.GetCreationTime(file).ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture));- }- item.Tag = file;- list.Items.Add(item);- }- }- finally- {- list.EndUpdate();- }- }-- /// <summary>Sort comparison for two full file paths: by creation time (read from disk on every call) or by file name, case-insensitive; negated for descending order.</summary>- private static int CompareFileEntries(string a, string b, bool byCreatedDate, bool ascending)- {- int order = byCreatedDate- ? File.GetCreationTime(a).CompareTo(File.GetCreationTime(b))- : string.Compare(Path.GetFileName(a), Path.GetFileName(b), StringComparison.OrdinalIgnoreCase);- return ascending ? order : -order;- }-- /// <summary>Writes the two header labels of a file list, appending " ^" or " v" to the column (0 = name, 1 = date) the list is sorted by.</summary>- private void UpdateFileListSortHeaders(ColumnHeader nameColumn, string nameLabel, ColumnHeader dateColumn, string dateLabel, int sortColumn, bool ascending)- {- string arrow = ascending ? " ^" : " v";- nameColumn.Text = nameLabel + ((sortColumn == 0) ? arrow : "");- dateColumn.Text = dateLabel + ((sortColumn == 1) ? arrow : "");- }-- /// <summary>Full paths (item tags) of the selected items in a file list; items without a path tag are skipped.</summary>- private List<string> SelectedFilePaths(ListView list)- {- List<string> paths = new List<string>();- foreach (ListViewItem item in list.SelectedItems)- {- string path = item.Tag as string;- if (!string.IsNullOrEmpty(path))- {- paths.Add(path);- }- }- return paths;- }-- /// <summary>Re-selects every item of <paramref name="list"/> whose path is in <paramref name="paths"/> (case-insensitive); used to keep the selection across a refill.</summary>- private void ReselectFiles(ListView list, List<string> paths)- {- if (paths.Count == 0)- {- return;- }- foreach (ListViewItem item in list.Items)- {- string path = item.Tag as string;- if (path != null && paths.Contains(path, StringComparer.OrdinalIgnoreCase))- {- item.Selected = true;- }- }- }-- /// <summary>Reloads and re-sorts the scene-image list, keeping the selected files selected; used after a header click.</summary>- private void RefillSceneList()- {- List<string> selected = SelectedFilePaths(lstScenes);- FillFileList(lstScenes, SelectedOutputProjectFolder(), ProjectStore.SceneImageFolderName, Form1.SceneImageExtensions, _sceneSortColumn, _sceneSortAscending);- UpdateFileListSortHeaders(colSceneName, "Scene file name", colSceneCreated, "Created on", _sceneSortColumn, _sceneSortAscending);- ReselectFiles(lstScenes, selected);- }-- /// <summary>Reloads and re-sorts the output-frame list, keeping the selected files selected; used after a header click.</summary>- private void RefillImageList()- {- List<string> selected = SelectedFilePaths(lstImages);- FillFileList(lstImages, SelectedOutputProjectFolder(), ProjectStore.OutputFramesFolderName, Form1.OutputImageExtensions, _imageSortColumn, _imageSortAscending);- UpdateFileListSortHeaders(colImageName, "Image file name", colCreatedOn, "Created on", _imageSortColumn, _imageSortAscending);- ReselectFiles(lstImages, selected);- }-- /// <summary>Reloads and re-sorts the video list, keeping the selected files selected; used after a header click.</summary>- private void RefillVideoList()- {- List<string> selected = SelectedFilePaths(lstVideo);- FillFileList(lstVideo, SelectedOutputProjectFolder(), ProjectStore.OutputVideoFolderName, Form1.OutputVideoExtensions, _videoSortColumn, _videoSortAscending);- UpdateFileListSortHeaders(colVideoName, "Video file name", colCreatedOn2, "Created on", _videoSortColumn, _videoSortAscending);- ReselectFiles(lstVideo, selected);- }-- /// <summary>Clicking a header sorts the scene-image list by that column (toggling direction on a repeat click).</summary>- private void lstScenes_ColumnClick(object sender, ColumnClickEventArgs e)- {- Form1.ToggleFileSort(ref _sceneSortColumn, ref _sceneSortAscending, e.Column);- RefillSceneList();- }-- /// <summary>Clicking a header sorts the output-frame list by that column (toggling direction on a repeat click).</summary>- private void lstImages_ColumnClick(object sender, ColumnClickEventArgs e)- {- Form1.ToggleFileSort(ref _imageSortColumn, ref _imageSortAscending, e.Column);- RefillImageList();- }-- /// <summary>Clicking a header sorts the video list by that column (toggling direction on a repeat click).</summary>- private void lstVideo_ColumnClick(object sender, ColumnClickEventArgs e)- {- Form1.ToggleFileSort(ref _videoSortColumn, ref _videoSortAscending, e.Column);- RefillVideoList();- }-- /// <summary>Applies a header click to a sort column/direction pair: the same column flips the direction, a different column becomes the sort column in ascending order.</summary>- private static void ToggleFileSort(ref int sortColumn, ref bool sortAscending, int clickedColumn)- {- if (clickedColumn == sortColumn)- {- sortAscending = !sortAscending;- }- else- {- sortColumn = clickedColumn;- sortAscending = true;- }- }-- /// <summary>- /// Clears the selection of the two file lists other than <paramref name="active"/> (the one the user- /// just clicked in), so only one of the three ever shows a selection at a time - otherwise it is unclear- /// which list's item <c>pnlPreview</c> is actually showing. The Projects list (<c>lstAllProjects3</c>) is- /// not one of these three and keeps its own selection regardless. Sets- /// <c>_clearingFileListSelection</c> while doing so, so that their- /// <c>SelectedIndexChanged</c> handlers ignore the change and do not clear the preview.- /// </summary>- private void ClearOtherFileListSelections(ListView active)- {- _clearingFileListSelection = true;- try- {- if (active != lstScenes)- {- lstScenes.SelectedItems.Clear();- }- if (active != lstImages)- {- lstImages.SelectedItems.Clear();- }- if (active != lstVideo)- {- lstVideo.SelectedItems.Clear();- }- }- finally- {- _clearingFileListSelection = false;- }- }-- /// <summary>Selecting a scene image makes it the only selection across the three lists and shows it in the preview; ignored while another list is clearing selections.</summary>- private void lstScenes_SelectedIndexChanged(object sender, EventArgs e)- {- if (_clearingFileListSelection)- {- return;- }- ClearOtherFileListSelections(lstScenes);- ShowOutputPreview(lstScenes);- }-- /// <summary>Selecting output frames makes them the only selection across the three lists, previews the first one and updates the copy button; ignored while another list is clearing selections.</summary>- private void lstImages_SelectedIndexChanged(object sender, EventArgs e)- {- if (_clearingFileListSelection)- {- return;- }- ClearOtherFileListSelections(lstImages);- ShowOutputPreview(lstImages);- UpdateCopyToClipboardButton();- }-- /// <summary>- /// Shows the first selected file of <paramref name="list"/> in the preview as a still image- /// (an in-memory copy, so the file is not locked). Clears the preview when the file is- /// missing or cannot be decoded; leaves it untouched when nothing is selected.- /// </summary>- private void ShowOutputPreview(ListView list)- {- if (list.SelectedItems.Count == 0)- {- return;- }- string path = list.SelectedItems[0].Tag as string;- if (string.IsNullOrEmpty(path) || !File.Exists(path))- {- ClearOutputPreview();- return;- }- try- {- SetOutputPreviewImage(Form1.LoadImageCopy(path), false);- }- catch (Exception)- {- ClearOutputPreview();- }- }-- /// <summary>- /// Selecting exactly one video makes it the only selection across the three lists and shows- /// a thumbnail-sized preview of it, via the operating system's own shell thumbnail cache- /// (<see cref="GetShellThumbnail"/>, further down) - there is no dependency-free way to decode/draw- /// an actual video frame with just System.Drawing/System.Windows.Forms. The thumbnail is requested- /// at the preview box's current size (at least 64x64 pixels). Selecting zero or more than one video- /// (<c>lstVideo</c> allows multi-select) clears the preview instead, since a single thumbnail cannot- /// stand in for several files; a missing file or a shell failure clears it too.- /// Ignored while another list is clearing selections.- /// </summary>- private void lstVideo_SelectedIndexChanged(object sender, EventArgs e)- {- if (_clearingFileListSelection)- {- return;- }- ClearOtherFileListSelections(lstVideo);- if (lstVideo.SelectedItems.Count != 1)- {- ClearOutputPreview();- return;- }- string path = lstVideo.SelectedItems[0].Tag as string;- if (string.IsNullOrEmpty(path) || !File.Exists(path))- {- ClearOutputPreview();- return;- }- try- {- int width = Math.Max(64, _outputPreviewPic.ClientSize.Width);- int height = Math.Max(64, _outputPreviewPic.ClientSize.Height);- SetOutputPreviewImage(Form1.GetShellThumbnail(path, width, height), true);- }- catch (Exception)- {- ClearOutputPreview();- }- }-- /// <summary>- /// Puts <paramref name="image"/> (may be null) into the preview box, disposing the image that- /// was there before (the preview box owns its image), remembers whether it is a video- /// thumbnail and updates the "share with editors" button accordingly.- /// </summary>- private void SetOutputPreviewImage(Image image, bool isVideo = false)- {- Image previous = _outputPreviewPic.Image;- _outputPreviewPic.Image = image;- if (previous != null)- {- previous.Dispose();- }- _outputPreviewIsVideo = isVideo;- UpdateShareWithEditorsButton();- }-- /// <summary>Removes and disposes the preview image; safe to call before <see cref="InitializeOutputsTab"/> has created the preview box.</summary>- private void ClearOutputPreview()- {- if (_outputPreviewPic != null)- {- SetOutputPreviewImage(null, false);- }- }-- /// <summary>- /// Permanently deletes the selected scene image files after confirmation. If the list shows- /// the open project and one of the files is the scene image it currently uses, the question- /// says so and the scene is switched to "User defined" after deleting. Files that could not- /// be deleted are reported together at the end.- /// </summary>- private void btnDeleteScene_Click(object sender, EventArgs e)- {- if (lstScenes.SelectedItems.Count == 0)- {- MessageBox.Show(this, "Select a scene image in the list first.", "Delete scene", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- List<string> paths = SelectedFilePaths(lstScenes);-- bool listShowsOpenProject = _project != null && string.Equals(_project.FolderPath, SelectedOutputProjectFolder(), StringComparison.OrdinalIgnoreCase);- string currentImagePath = (listShowsOpenProject && _scene.UseImage) ? SceneSettings.ToFullPath(_project.FolderPath, _scene.ImageFile) : "";- bool deletesCurrentImage = currentImagePath.Length > 0 && paths.Exists(p => string.Equals(p, currentImagePath, StringComparison.OrdinalIgnoreCase));-- string question = (paths.Count == 1)- ? "Permanently delete '" + Path.GetFileName(paths[0]) + "'?"- : "Permanently delete these " + paths.Count.ToString(CultureInfo.InvariantCulture) + " scene images?";- if (deletesCurrentImage)- {- question += "\r\n\r\nThis is the scene image currently used by the open project. Deleting it will switch the scene to \"User defined\" instead.";- }- if (MessageBox.Show(this, question, "Delete scene", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)- {- return;- }-- List<string> errors = new List<string>();- foreach (string path in paths)- {- try- {- File.Delete(path);- }- catch (Exception ex)- {- errors.Add(Path.GetFileName(path) + ": " + ex.Message);- }- }- if (deletesCurrentImage)- {- radUserDefinedScene.Checked = true;- }- RefreshOutputFileLists();- ShowDeleteErrorsIfAny(errors, "Delete scene");- }-- /// <summary>- /// Runs the Scene tab's "load scene image" dialog (which copies an outside image into the- /// open project's scene_images folder and makes it the scene image), then refreshes the- /// file lists if the Outputs tab currently shows the open project.- /// </summary>- private void btnLoadExternal_Click(object sender, EventArgs e)- {- btnLOadSceneImage_Click(sender, e);- if (_project != null && string.Equals(_project.FolderPath, SelectedOutputProjectFolder(), StringComparison.OrdinalIgnoreCase))- {- RefreshOutputFileLists();- }- }-- /// <summary>Deletes the selected output frames (see <see cref="DeleteSelectedImages"/>).</summary>- private void btnDeleteImages_Click(object sender, EventArgs e)- {- DeleteSelectedImages();- }-- /// <summary>Pressing Delete in the output-frame list deletes the selected frames.</summary>- private void lstImages_KeyDown(object sender, KeyEventArgs e)- {- if (e.KeyCode == Keys.Delete)- {- e.Handled = true;- DeleteSelectedImages();- }- }-- /// <summary>Permanently deletes the selected output frame files after confirmation; files that could not be deleted are reported together at the end.</summary>- private void DeleteSelectedImages()- {- if (lstImages.SelectedItems.Count == 0)- {- MessageBox.Show(this, "Select one or more images in the list first.", "Delete images", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- int count = lstImages.SelectedItems.Count;- string question = (count == 1)- ? "Permanently delete '" + lstImages.SelectedItems[0].Text + "'?"- : "Permanently delete these " + count.ToString(CultureInfo.InvariantCulture) + " images?";- if (MessageBox.Show(this, question, "Delete images", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)- {- return;- }- List<string> errors = new List<string>();- foreach (ListViewItem item in lstImages.SelectedItems)- {- string path = (string)item.Tag;- try- {- File.Delete(path);- }- catch (Exception ex)- {- errors.Add(item.Text + ": " + ex.Message);- }- }- RefreshOutputFileLists();- ShowDeleteErrorsIfAny(errors, "Delete images");- }-- /// <summary>Copies the single selected output frame to the clipboard as a bitmap (the clipboard takes its own copy, so the loaded bitmap is disposed immediately).</summary>- private void btnCopyToClipboard_Click(object sender, EventArgs e)- {- if (lstImages.SelectedItems.Count != 1)- {- return;- }- string path = lstImages.SelectedItems[0].Tag as string;- if (string.IsNullOrEmpty(path) || !File.Exists(path))- {- return;- }- try- {- using (Bitmap bitmap = Form1.LoadImageCopy(path))- {- Clipboard.SetImage(bitmap);- }- ToolStripStatusLabel1.Text = "Copied '" + Path.GetFileName(path) + "' to the clipboard.";- }- catch (Exception ex)- {- MessageBox.Show(this, "The image could not be copied to the clipboard:\r\n\r\n" + ex.Message, "Copy to clipboard", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- /// <summary>Enables "Copy to clipboard" only when exactly one output frame is selected.</summary>- private void UpdateCopyToClipboardButton()- {- btnCopyToClipboard.Enabled = lstImages.SelectedItems.Count == 1;- }-- /// <summary>Opens the selected project's output_frames folder in Explorer (icon view; the folder is created if missing).</summary>- private void btnOpenImageFolder2_Click(object sender, EventArgs e)- {- string folder = SelectedOutputProjectFolder();- if (folder.Length == 0)- {- MessageBox.Show(this, "Select a project in the list first.", "Open image folder", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- try- {- OpenFolderInExplorer(Path.Combine(folder, ProjectStore.OutputFramesFolderName), FVM_ICON);- }- catch (Exception ex)- {- MessageBox.Show(this, "The image folder could not be opened:\r\n\r\n" + ex.Message, "Open image folder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- /// <summary>Deletes the selected videos (see <see cref="DeleteSelectedVideos"/>).</summary>- private void btnDeleteVideos_Click(object sender, EventArgs e)- {- DeleteSelectedVideos();- }-- /// <summary>Pressing Delete in the video list deletes the selected videos.</summary>- private void lstVideo_KeyDown(object sender, KeyEventArgs e)- {- if (e.KeyCode == Keys.Delete)- {- e.Handled = true;- DeleteSelectedVideos();- }- }-- /// <summary>Permanently deletes the selected video files after confirmation; files that could not be deleted are reported together at the end.</summary>- private void DeleteSelectedVideos()- {- if (lstVideo.SelectedItems.Count == 0)- {- MessageBox.Show(this, "Select one or more videos in the list first.", "Delete videos", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- int count = lstVideo.SelectedItems.Count;- string question = (count == 1)- ? "Permanently delete '" + lstVideo.SelectedItems[0].Text + "'?"- : "Permanently delete these " + count.ToString(CultureInfo.InvariantCulture) + " videos?";- if (MessageBox.Show(this, question, "Delete videos", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)- {- return;- }- List<string> errors = new List<string>();- foreach (ListViewItem item in lstVideo.SelectedItems)- {- string path = (string)item.Tag;- try- {- File.Delete(path);- }- catch (Exception ex)- {- errors.Add(item.Text + ": " + ex.Message);- }- }- RefreshOutputFileLists();- ShowDeleteErrorsIfAny(errors, "Delete videos");- }-- /// <summary>Opens the first selected video in the system's default player.</summary>- private void btnViewVIdeoInPlayer2_Click(object sender, EventArgs e)- {- if (lstVideo.SelectedItems.Count == 0)- {- MessageBox.Show(this, "Select a video in the list first.", "View in player", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- OpenVideo((string)lstVideo.SelectedItems[0].Tag);- }-- /// <summary>Double-clicking a video opens it in the system's default player.</summary>- private void lstVideo_DoubleClick(object sender, EventArgs e)- {- if (lstVideo.SelectedItems.Count > 0)- {- OpenVideo((string)lstVideo.SelectedItems[0].Tag);- }- }-- /// <summary>- /// Renames the single selected video file inside its folder after prompting for a new file- /// name; an empty or unchanged name is a no-op, invalid characters and an existing target- /// are refused. The extension is not enforced, so a file renamed to a non-video extension- /// disappears from the list.- /// </summary>- private void btnRenameVideo_Click(object sender, EventArgs e)- {- if (lstVideo.SelectedItems.Count != 1)- {- MessageBox.Show(this, "Select a single video in the list first.", "Rename video", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- string oldPath = (string)lstVideo.SelectedItems[0].Tag;- string fileName = Path.GetFileName(oldPath);- string newName = fileName;- if (!PromptForText("Rename video", "New name for '" + fileName + "':", fileName, ref newName))- {- return;- }- newName = newName.Trim();- if (newName.Length == 0 || newName == fileName)- {- return;- }- if (newName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)- {- MessageBox.Show(this, "That name contains characters that are not allowed in a file name.", "Rename video", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- return;- }- string newPath = Path.Combine(Path.GetDirectoryName(oldPath), newName);- if (File.Exists(newPath))- {- MessageBox.Show(this, "A file named '" + newName + "' already exists.", "Rename video", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- return;- }- try- {- File.Move(oldPath, newPath);- RefreshOutputFileLists();- }- catch (Exception ex)- {- MessageBox.Show(this, "The video could not be renamed:\r\n\r\n" + ex.Message, "Rename video", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- /// <summary>Opens the selected project's output_video folder in Explorer (details view; the folder is created if missing).</summary>- private void btnOpenVIdeoFolder2_Click(object sender, EventArgs e)- {- string folder = SelectedOutputProjectFolder();- if (folder.Length == 0)- {- MessageBox.Show(this, "Select a project in the list first.", "Open video folder", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- try- {- OpenFolderInExplorer(Path.Combine(folder, ProjectStore.OutputVideoFolderName), FVM_DETAILS);- }- catch (Exception ex)- {- MessageBox.Show(this, "The video folder could not be opened:\r\n\r\n" + ex.Message, "Open video folder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- /// <summary>Copies the previewed still image into the Sources and Probes tab preview boxes.</summary>- private void btnShareWithEditors_Click(object sender, EventArgs e)- {- CopyPreviewToTabs(_outputPreviewPic);- }-- /// <summary>Enables "Share with editors" only while the preview shows a still image (not a video thumbnail).</summary>- private void UpdateShareWithEditorsButton()- {- btnShareWithEditors.Enabled = !_outputPreviewIsVideo && _outputPreviewPic != null && _outputPreviewPic.Image != null;- }-- /// <summary>Shows one message box listing <paramref name="errors"/> (one per line) under <paramref name="title"/>; does nothing for an empty list.</summary>- private void ShowDeleteErrorsIfAny(List<string> errors, string title)- {- if (errors.Count > 0)- {- MessageBox.Show(this, "Some files could not be deleted:\r\n\r\n" + string.Join("\r\n", errors), title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- // ---- the video preview thumbnail, via the Windows shell (no video codec of our own)- //- // Windows shell thumbnail interop (IShellItemImageFactory, declared with NativeSize and ThumbnailOptions in- // Form1.cs) - plain P/Invoke/COM interop against shell32.dll and gdi32.dll, no NuGet package or project- // reference needed, but genuine COM interop nonetheless, which could not be exercised on an actual Windows- // machine while writing it. GetShellThumbnail is written so a wrong detail here surfaces as "no thumbnail- // for this file" (via the try/catch in lstVideo_SelectedIndexChanged) rather than a crash - if the preview- // comes out consistently missing for videos, this is the place to revisit.-- /// <summary>- /// shell32: creates the shell item for a file system path and returns the interface- /// identified by <paramref name="riid"/>. <c>PreserveSig = false</c> turns a failing HRESULT- /// into a <see cref="COMException"/>.- /// </summary>- [DllImport("shell32.dll", CharSet = CharSet.Unicode, PreserveSig = false)]- private static extern void SHCreateItemFromParsingName([MarshalAs(UnmanagedType.LPWStr)] string path, IntPtr pbc, [In] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv);-- /// <summary>gdi32: frees a GDI object; used for the HBITMAP the shell hands back in <see cref="GetShellThumbnail"/>.</summary>- [DllImport("gdi32.dll")]- private static extern bool DeleteObject(IntPtr hObject);-- /// <summary>- /// Asks the Windows shell (<c>IShellItemImageFactory</c>) for the thumbnail it would show for- /// a file, requesting <paramref name="width"/> x <paramref name="height"/> pixels but- /// accepting a larger one. Used for video previews. The returned bitmap is an independent- /// managed copy; the shell's HBITMAP and the COM object are released before returning.- /// </summary>- /// <returns>The thumbnail, or null when the shell does not provide one for the file.</returns>- /// <exception cref="COMException">The shell could not create the item or extract the thumbnail.</exception>- private static Bitmap GetShellThumbnail(string filePath, int width, int height)- {- Guid factoryGuid = typeof(Form1.IShellItemImageFactory).GUID;- object shellItem;- Form1.SHCreateItemFromParsingName(filePath, IntPtr.Zero, ref factoryGuid, out shellItem);- Form1.IShellItemImageFactory factory = shellItem as Form1.IShellItemImageFactory;- if (factory == null)- {- return null;- }- IntPtr bitmapHandle = IntPtr.Zero;- try- {- factory.GetImage(new Form1.NativeSize- {- cx = width,- cy = height- }, Form1.ThumbnailOptions.BiggerSizeOk | Form1.ThumbnailOptions.ThumbnailOnly, out bitmapHandle);- if (bitmapHandle == IntPtr.Zero)- {- return null;- }- using (Bitmap wrapper = Image.FromHbitmap(bitmapHandle))- {- return new Bitmap(wrapper);- }- }- finally- {- if (bitmapHandle != IntPtr.Zero)- {- Form1.DeleteObject(bitmapHandle);- }- Marshal.ReleaseComObject(factory);- }- }- }-}diff --git a/Wave_Dude_2D/Form1.Probes.cs b/Wave_Dude_2D/Form1.Probes.csdeleted file mode 100644index b046fe3..0000000--- a/Wave_Dude_2D/Form1.Probes.cs+++ /dev/null@@ -1,1148 +0,0 @@-using System;-using System.Collections.Generic;-using System.Drawing;-using System.Drawing.Drawing2D;-using System.Globalization;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Probes tab: editing the two <see cref="ProbeSettings"/> in <c>_probes</c> through the- /// per-probe control sets in <c>_probeUi</c>, picking positions with the mouse on the probe- /// picture, and overlaying probe markers and live graphs on the preview pictures.- /// Everything here runs on the UI thread; <see cref="ShowProbeSamples"/> is the only entry point- /// fed by the simulation worker, and it arrives already marshalled through <c>PostToUi</c>.- /// </summary>- /// <remarks>- /// <para>- /// A probe measures the field (amplitude) or the intensity while the simulation runs and shows- /// the result in a little graph box in the field or intensity picture: a point probe (A) plots- /// the value at A against the simulation step; a line probe (A-B) plots the values along the- /// line A-B (position on the line on X) at the current step, so it changes every step. The- /// settings are kept in <c>_probes</c> and stored in the "probes" section of the project file.- /// Each probe has its own "On" check box (<see cref="ProbeSettings.Active"/>): when off, the- /// probe is hidden (its marker, graph box and burned-in overlay are all skipped) but it keeps- /// being sampled, so switching it back on shows its recorded history rather than starting from- /// a blank graph.- /// </para>- /// <para>- /// There are two independent probes, Probe 1 and Probe 2, each with its own group of controls- /// (<c>grpProbe1</c>/<c>grpProbe2</c>). <c>_probeUi</c> holds one <see cref="ProbeControlSet"/>- /// per group, so the code that reads/writes a probe's settings and the events of its controls- /// can be shared between the two groups instead of being written out twice.- /// </para>- /// <para>- /// The Probes tab shows a copy of a simulation picture (Preview tab, "Copy Image..." buttons),- /// shared by both probes. Each group has its own Pick button: it lets the user click in that- /// picture for that probe's position A, for a line position B, and for the top left corner of- /// that probe's graph box.- /// </para>- /// <para>- /// Two coordinate systems are used throughout. Canvas pixels are 0-based cells of the- /// simulation grid (size from <c>EffectiveCanvas()</c> while editing, <c>_runCanvas</c> for the- /// current/last run); picture-box pixels are client coordinates of a <see cref="PictureBox"/>- /// in Zoom mode, where the image is scaled uniformly and centred. <see cref="ZoomedImageRectangle"/>- /// gives the image's rectangle in picture-box pixels; <see cref="TryPictureToCanvas"/> and- /// <see cref="ToScreen"/> convert between the two.- /// </para>- /// </remarks>- public partial class Form1- {- /// <summary>- /// The control set for probe <paramref name="index"/>, or null while the form is still being- /// constructed: <c>InitializeComponent</c> (which runs before <see cref="InitializeProbeControls"/>)- /// sets some control values away from their .NET default, such as <c>numRunningWindow</c>'s 500,- /// and that alone fires the control's change event immediately, before <c>_probeUi</c> exists.- /// The event handlers below go through this instead of indexing <c>_probeUi</c> directly, so- /// that early firing is a harmless no-op instead of a <see cref="NullReferenceException"/>.- /// </summary>- private Form1.ProbeControlSet ProbeUi(int index)- {- return _probeUi == null ? null : _probeUi[index];- }-- /// <summary>Creates the default probe list: <see cref="ProbeCount"/> fresh, inactive probes.</summary>- private static List<ProbeSettings> NewProbeList()- {- List<ProbeSettings> probes = new List<ProbeSettings>();- for (int i = 0; i < Form1.ProbeCount; i++)- {- probes.Add(new ProbeSettings());- }- return probes;- }-- /// <summary>Keeps <c>_probes</c> at exactly <see cref="ProbeCount"/> entries after loading a project: pads with new (default) probes when a saved project has fewer (from before Probe 2 existed), trims extras when it somehow has more.</summary>- private void NormalizeProbeCount()- {- while (_probes.Count < Form1.ProbeCount)- {- _probes.Add(new ProbeSettings());- }- while (_probes.Count > Form1.ProbeCount)- {- _probes.RemoveAt(_probes.Count - 1);- }- }-- /// <summary>- /// One-time setup from <c>Form1_Load</c>: binds the designer controls of both probe panels into- /// <c>_probeUi</c>, fills the fixed combo boxes (the choices are made here, not in the designer,- /// in the order of the <see cref="ProbeSettings"/> enumerations because the selected index is- /// cast straight to the enum), sets spinner ranges, hooks the paint and mouse handlers of the- /// probe and preview pictures (which must already exist) and shows the current probes.- /// </summary>- private void InitializeProbeControls()- {- _probeUi = new Form1.ProbeControlSet[]- {- new Form1.ProbeControlSet(0, "Probe 1", chkProbeOn1, cmbPlaceOn, cmbMeasurement, cmbProbeType, cmbBoxSize, numAPosX, numAPosY, numBPosX, numBPosY, butPicPositions, radRunningScale, radFullScale, chkAutoScaleX, chkAutoScaleY, txtMinScaleY, txtMaxScaleY, chkStartAfterStep, txtStartAfterStep, numRunningWindow, new Control[] { numBPosX, numBPosY, Label14, Label15, Label16 }),- new Form1.ProbeControlSet(1, "Probe 2", chkProbeOn2, cmbPlaceOn2, cmbMeasurement2, cmbProbeType2, cmbBoxSize2, numAPosX2, numAPosY2, numBPosX2, numBPosY2, butPicPositions2, radRunningScale2, radFullScale2, chkAutoScaleX2, chkAutoScaleY2, txtMinScaleY2, txtMaxScaleY2, chkStartAfterStep2, txtStartAfterStep2, numRunningWindow2, new Control[] { numBPosX2, numBPosY2, Label28, Label27, Label25 })- };- foreach (Form1.ProbeControlSet ui in _probeUi)- {- foreach (ComboBox combo in new ComboBox[] { ui.CmbPlaceOn, ui.CmbMeasurement, ui.CmbProbeType, ui.CmbBoxSize })- {- combo.DropDownStyle = ComboBoxStyle.DropDownList;- }- ui.CmbPlaceOn.Items.Clear();- ui.CmbPlaceOn.Items.AddRange(new object[] { "Field", "Intensity" });- ui.CmbProbeType.Items.Clear();- ui.CmbProbeType.Items.AddRange(new object[] { "Point (A)", "Line (A-B)" });- ui.CmbBoxSize.Items.Clear();- ui.CmbBoxSize.Items.AddRange(new object[] { "Tiny (200 x 100)", "Small (300 x 150)", "Medium (400 x 200)", "Large (500 x 250)", "Extra Large (700 x 350)" });- foreach (NumericUpDown position in new NumericUpDown[] { ui.NumAPosX, ui.NumAPosY, ui.NumBPosX, ui.NumBPosY })- {- position.DecimalPlaces = 0;- position.Minimum = 0m;- // Placeholder until SetProbeRanges knows the canvas size.- position.Maximum = (decimal)(SceneSettings.MaxCanvasSize - 1);- }- ui.NumRunningWindow.DecimalPlaces = 0;- ui.NumRunningWindow.Minimum = 10m;- ui.NumRunningWindow.Maximum = ProbeSettings.MaxRunningWindow;- }- // the graphs and markers are drawn over the pictures (the pictures themselves stay clean)- _picField.Paint += PreviewPicture_Paint;- _picIntensity.Paint += PreviewPicture_Paint;- _picProbe.Paint += ProbePicture_Paint;- _picProbe.MouseClick += ProbePicture_MouseClick;- _picProbe.MouseMove += ProbePicture_MouseMove;- _picProbe.MouseLeave += ProbePicture_MouseLeave;- ShowProbesInControls();- }-- /// <summary>Cancels any position pick in progress and pushes every probe in <c>_probes</c> into its controls.</summary>- private void ShowProbesInControls()- {- EndPick();- foreach (Form1.ProbeControlSet ui in _probeUi)- {- ShowProbeInControls(ui);- }- }-- /// <summary>- /// Normalizes the probe and writes all of its values into the controls of <paramref name="ui"/>.- /// <c>_loadingProbe</c> is set meanwhile so the change handlers do not write back or mark the- /// project dirty. Positions are clamped to the spinner ranges; the Y range is shown with "G6"- /// in the invariant culture. Ends by refreshing the enabled states and repainting the pictures.- /// </summary>- private void ShowProbeInControls(Form1.ProbeControlSet ui)- {- ProbeSettings probe = _probes[ui.Index];- probe.Normalize();- _loadingProbe = true;- try- {- SetProbeRanges(ui);- ui.ChkOn.Checked = probe.Active;- ui.CmbPlaceOn.SelectedIndex = (int)probe.PlaceOn;- FillMeasurementCombo(ui, probe);- ui.CmbProbeType.SelectedIndex = (int)probe.Kind;- ui.CmbBoxSize.SelectedIndex = (int)probe.BoxSize;- ui.NumAPosX.Value = Form1.ClampToRange(ui.NumAPosX, probe.PosAX);- ui.NumAPosY.Value = Form1.ClampToRange(ui.NumAPosY, probe.PosAY);- ui.NumBPosX.Value = Form1.ClampToRange(ui.NumBPosX, probe.PosBX);- ui.NumBPosY.Value = Form1.ClampToRange(ui.NumBPosY, probe.PosBY);- ui.RadRunning.Checked = probe.ScaleMode == ProbeScaleMode.Running;- ui.RadFull.Checked = probe.ScaleMode == ProbeScaleMode.Full;- ui.ChkAutoX.Checked = probe.AutoScaleX;- ui.ChkAutoY.Checked = probe.AutoScaleY;- ui.TxtMinY.Text = probe.YMin.ToString("G6", CultureInfo.InvariantCulture);- ui.TxtMaxY.Text = probe.YMax.ToString("G6", CultureInfo.InvariantCulture);- ui.ChkStartAfter.Checked = probe.UseStartAfterStep;- ui.TxtStartAfter.Text = probe.StartAfterStep.ToString(CultureInfo.InvariantCulture);- ui.NumRunningWindow.Value = Form1.ClampToRange(ui.NumRunningWindow, probe.RunningWindow);- }- finally- {- _loadingProbe = false;- }- UpdateProbeControlState(ui);- InvalidateProbePictures();- }-- /// <summary>- /// Rebuilds the measurement combo for the probe's <see cref="ProbeSettings.PlaceOn"/>: the field- /// offers only "Amplitude", the intensity output "Intensity" and "Integrated intensity".- /// Selects the entry matching <paramref name="p"/>'s measurement (index 1 = integrated).- /// </summary>- private void FillMeasurementCombo(Form1.ProbeControlSet ui, ProbeSettings p)- {- ui.CmbMeasurement.Items.Clear();- if (p.PlaceOn == ProbePlaceOn.Field)- {- ui.CmbMeasurement.Items.Add("Amplitude");- ui.CmbMeasurement.SelectedIndex = 0;- }- else- {- ui.CmbMeasurement.Items.Add("Intensity");- ui.CmbMeasurement.Items.Add("Integrated intensity");- ui.CmbMeasurement.SelectedIndex = ((p.Measurement == ProbeMeasurement.IntegratedIntensity) ? 1 : 0);- }- }-- /// <summary>Maps a measurement combo index back to the enum for the given surface (inverse of <see cref="FillMeasurementCombo"/>); the field always yields amplitude.</summary>- private static ProbeMeasurement MeasurementFromIndex(ProbePlaceOn placeOn, int index)- {- if (placeOn == ProbePlaceOn.Field)- {- return ProbeMeasurement.Amplitude;- }- return index == 1 ? ProbeMeasurement.IntegratedIntensity : ProbeMeasurement.Intensity;- }-- /// <summary>- /// Enables/disables controls to match the probe: B position only for line probes; scale mode,- /// auto X and running window only for point probes (a profile has a fixed X axis); the Y range- /// boxes only when auto Y is off; the start-after step box only when its check box is on.- /// </summary>- private void UpdateProbeControlState(Form1.ProbeControlSet ui)- {- bool isLine = _probes[ui.Index].Kind == ProbeKind.Line;- foreach (Control control in ui.BOnlyControls)- {- control.Enabled = isLine;- }- foreach (Control control in new Control[] { ui.RadRunning, ui.RadFull, ui.ChkAutoX, ui.NumRunningWindow })- {- control.Enabled = !isLine;- }- ui.TxtMinY.Enabled = !ui.ChkAutoY.Checked;- ui.TxtMaxY.Enabled = !ui.ChkAutoY.Checked;- ui.TxtStartAfter.Enabled = ui.ChkStartAfter.Checked;- }-- /// <summary>Applies <see cref="SetProbeRanges(Form1.ProbeControlSet)"/> to both probes; no-op before the controls are initialized.</summary>- private void SetProbeRanges()- {- if (_probeUi == null)- {- return;- }- foreach (Form1.ProbeControlSet ui in _probeUi)- {- SetProbeRanges(ui);- }- }-- /// <summary>- /// Limits the position spinners to the current canvas size (width-1 / height-1 in canvas pixels,- /// or <see cref="SceneSettings.MaxCanvasSize"/> - 1 when the size is unknown). Lowering a maximum- /// can clamp the value and fire ValueChanged, so <c>_loadingProbe</c> is raised meanwhile (and- /// restored to its previous state, since this is also called from inside <see cref="ShowProbeInControls"/>).- /// </summary>- private void SetProbeRanges(Form1.ProbeControlSet ui)- {- Size canvas = EffectiveCanvas();- decimal maxX = new decimal((canvas.Width > 0) ? (canvas.Width - 1) : (SceneSettings.MaxCanvasSize - 1));- decimal maxY = new decimal((canvas.Height > 0) ? (canvas.Height - 1) : (SceneSettings.MaxCanvasSize - 1));- bool wasLoading = _loadingProbe;- _loadingProbe = true;- try- {- ui.NumAPosX.Maximum = maxX;- ui.NumBPosX.Maximum = maxX;- ui.NumAPosY.Maximum = maxY;- ui.NumBPosY.Maximum = maxY;- }- finally- {- _loadingProbe = wasLoading;- }- }-- /// <summary>- /// Copies every control of <paramref name="ui"/> into its <see cref="ProbeSettings"/>. Spinners are- /// validated first so typed-but-uncommitted text counts. The Y range is parsed (invariant culture)- /// only when auto Y is off, and unparsable text leaves the old value; same for the start-after step.- /// Ends with <see cref="ProbeSettings.Normalize"/>. Does not mark the project dirty or repaint.- /// </summary>- private void ReadProbeControls(Form1.ProbeControlSet ui)- {- ProbeSettings probe = _probes[ui.Index];- probe.Active = ui.ChkOn.Checked;- if (ui.CmbPlaceOn.SelectedIndex >= 0)- {- probe.PlaceOn = (ProbePlaceOn)ui.CmbPlaceOn.SelectedIndex;- }- if (ui.CmbMeasurement.SelectedIndex >= 0)- {- probe.Measurement = Form1.MeasurementFromIndex(probe.PlaceOn, ui.CmbMeasurement.SelectedIndex);- }- if (ui.CmbProbeType.SelectedIndex >= 0)- {- probe.Kind = (ProbeKind)ui.CmbProbeType.SelectedIndex;- }- if (ui.CmbBoxSize.SelectedIndex >= 0)- {- probe.BoxSize = (ProbeBoxSize)ui.CmbBoxSize.SelectedIndex;- }- ui.NumAPosX.Validate();- ui.NumAPosY.Validate();- ui.NumBPosX.Validate();- ui.NumBPosY.Validate();- probe.PosAX = Convert.ToInt32(ui.NumAPosX.Value);- probe.PosAY = Convert.ToInt32(ui.NumAPosY.Value);- probe.PosBX = Convert.ToInt32(ui.NumBPosX.Value);- probe.PosBY = Convert.ToInt32(ui.NumBPosY.Value);- probe.ScaleMode = (ui.RadFull.Checked ? ProbeScaleMode.Full : ProbeScaleMode.Running);- probe.AutoScaleX = ui.ChkAutoX.Checked;- probe.AutoScaleY = ui.ChkAutoY.Checked;- if (!ui.ChkAutoY.Checked)- {- double yMin;- if (double.TryParse(ui.TxtMinY.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out yMin))- {- probe.YMin = yMin;- }- double yMax;- if (double.TryParse(ui.TxtMaxY.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out yMax))- {- probe.YMax = yMax;- }- }- probe.UseStartAfterStep = ui.ChkStartAfter.Checked;- int startAfter;- if (int.TryParse(ui.TxtStartAfter.Text, NumberStyles.Integer, CultureInfo.InvariantCulture, out startAfter))- {- probe.StartAfterStep = startAfter;- }- ui.NumRunningWindow.Validate();- probe.RunningWindow = Convert.ToInt32(ui.NumRunningWindow.Value);- probe.Normalize();- }-- /// <summary>Probe 1: a combo box (place on / measurement / type / box size) changed; see <see cref="HandleProbeComboChanged"/>.</summary>- private void ProbeCombo_SelectedIndexChanged(object sender, EventArgs e)- {- HandleProbeComboChanged(ProbeUi(0), sender);- }-- /// <summary>Probe 1: an A/B position spinner changed; the new canvas position is stored.</summary>- private void ProbePosition_ValueChanged(object sender, EventArgs e)- {- HandleProbePositionChanged(ProbeUi(0));- }-- /// <summary>Probe 1: the "on" check box toggled the probe's active flag.</summary>- private void ProbeOn_CheckedChanged(object sender, EventArgs e)- {- HandleProbeOnChanged(ProbeUi(0));- }-- /// <summary>Probe 1: Enter in a Y-range or start-after text box applies all controls.</summary>- private void ProbeTextBox_KeyDown(object sender, KeyEventArgs e)- {- HandleProbeTextBoxKeyDown(ProbeUi(0), e);- }-- /// <summary>Probe 1: running/full scale radio button changed.</summary>- private void ProbeScaleMode_CheckedChanged(object sender, EventArgs e)- {- HandleProbeScaleModeChanged(ProbeUi(0));- }-- /// <summary>Probe 1: auto X / auto Y check box changed.</summary>- private void ProbeAutoScale_CheckedChanged(object sender, EventArgs e)- {- HandleProbeAutoScaleChanged(ProbeUi(0));- }-- /// <summary>Probe 1: a Y-range text box lost focus; all controls are applied.</summary>- private void ProbeYRange_Validated(object sender, EventArgs e)- {- HandleProbeControlApplied(ProbeUi(0));- }-- /// <summary>Probe 1: the "start after step" check box toggled.</summary>- private void ProbeStartAfterStep_CheckedChanged(object sender, EventArgs e)- {- HandleProbeStartAfterStepChanged(ProbeUi(0));- }-- /// <summary>Probe 1: the start-after step text box lost focus; all controls are applied.</summary>- private void ProbeStartAfterStep_Validated(object sender, EventArgs e)- {- HandleProbeControlApplied(ProbeUi(0));- }-- /// <summary>Probe 1: the running window spinner changed; all controls are applied.</summary>- private void ProbeRunningWindow_ValueChanged(object sender, EventArgs e)- {- HandleProbeControlApplied(ProbeUi(0));- }-- /// <summary>Probe 2: a combo box changed; see <see cref="HandleProbeComboChanged"/>.</summary>- private void ProbeCombo2_SelectedIndexChanged(object sender, EventArgs e)- {- HandleProbeComboChanged(ProbeUi(1), sender);- }-- /// <summary>Probe 2: an A/B position spinner changed; the new canvas position is stored.</summary>- private void ProbePosition2_ValueChanged(object sender, EventArgs e)- {- HandleProbePositionChanged(ProbeUi(1));- }-- /// <summary>Probe 2: the "on" check box toggled the probe's active flag.</summary>- private void ProbeOn2_CheckedChanged(object sender, EventArgs e)- {- HandleProbeOnChanged(ProbeUi(1));- }-- /// <summary>Probe 2: Enter in a Y-range or start-after text box applies all controls.</summary>- private void ProbeTextBox2_KeyDown(object sender, KeyEventArgs e)- {- HandleProbeTextBoxKeyDown(ProbeUi(1), e);- }-- /// <summary>Probe 2: running/full scale radio button changed.</summary>- private void ProbeScaleMode2_CheckedChanged(object sender, EventArgs e)- {- HandleProbeScaleModeChanged(ProbeUi(1));- }-- /// <summary>Probe 2: auto X / auto Y check box changed.</summary>- private void ProbeAutoScale2_CheckedChanged(object sender, EventArgs e)- {- HandleProbeAutoScaleChanged(ProbeUi(1));- }-- /// <summary>Probe 2: a Y-range text box lost focus; all controls are applied.</summary>- private void ProbeYRange2_Validated(object sender, EventArgs e)- {- HandleProbeControlApplied(ProbeUi(1));- }-- /// <summary>Probe 2: the "start after step" check box toggled.</summary>- private void ProbeStartAfterStep2_CheckedChanged(object sender, EventArgs e)- {- HandleProbeStartAfterStepChanged(ProbeUi(1));- }-- /// <summary>Probe 2: the start-after step text box lost focus; all controls are applied.</summary>- private void ProbeStartAfterStep2_Validated(object sender, EventArgs e)- {- HandleProbeControlApplied(ProbeUi(1));- }-- /// <summary>Probe 2: the running window spinner changed; all controls are applied.</summary>- private void ProbeRunningWindow2_ValueChanged(object sender, EventArgs e)- {- HandleProbeControlApplied(ProbeUi(1));- }-- /// <summary>- /// Shared handler for the four combo boxes of a probe. Ignored while loading. Changing the probe- /// type cancels a pick in progress for that probe; changing "place on" first updates the probe and- /// refills the measurement combo (under the loading guard, so the refill does not recurse). Then- /// all controls are read back, enabled states refreshed, and the project marked dirty.- /// </summary>- /// <param name="ui">Control set of the probe whose combo box changed; null before <see cref="InitializeProbeControls"/> has run.</param>- /// <param name="sender">The combo box that raised the event.</param>- private void HandleProbeComboChanged(Form1.ProbeControlSet ui, object sender)- {- if (ui == null || _loadingProbe)- {- return;- }- if (sender == ui.CmbProbeType && _pickStep != 0 && _pickIndex == ui.Index)- {- // the number of clicks depends on the type; only cancel a pick that belongs to this probe- EndPick();- }- if (sender == ui.CmbPlaceOn && ui.CmbPlaceOn.SelectedIndex >= 0)- {- // the measurements that are possible depend on the picture- ProbeSettings probe = _probes[ui.Index];- probe.PlaceOn = (ProbePlaceOn)ui.CmbPlaceOn.SelectedIndex;- probe.Normalize();- _loadingProbe = true;- try- {- FillMeasurementCombo(ui, probe);- }- finally- {- _loadingProbe = false;- }- }- ReadProbeControls(ui);- UpdateProbeControlState(ui);- ProbeSettingsChanged();- }-- /// <summary>Stores the four position spinners (canvas pixels) into the probe and marks the project dirty; ignored while loading.</summary>- private void HandleProbePositionChanged(Form1.ProbeControlSet ui)- {- if (ui == null || _loadingProbe)- {- return;- }- ProbeSettings probe = _probes[ui.Index];- probe.PosAX = Convert.ToInt32(ui.NumAPosX.Value);- probe.PosAY = Convert.ToInt32(ui.NumAPosY.Value);- probe.PosBX = Convert.ToInt32(ui.NumBPosX.Value);- probe.PosBY = Convert.ToInt32(ui.NumBPosY.Value);- ProbeSettingsChanged();- }-- /// <summary>Stores the "on" check box into <see cref="ProbeSettings.Active"/> and marks the project dirty; ignored while loading.</summary>- private void HandleProbeOnChanged(Form1.ProbeControlSet ui)- {- if (ui == null || _loadingProbe)- {- return;- }- _probes[ui.Index].Active = ui.ChkOn.Checked;- ProbeSettingsChanged();- }-- /// <summary>- /// Enter in a probe text box applies the value right away (like losing focus does) instead of- /// just beeping: the key is swallowed and all controls of the probe are applied. These are- /// single line boxes, so Enter never inserts an actual line break. Ignored while loading.- /// </summary>- private void HandleProbeTextBoxKeyDown(Form1.ProbeControlSet ui, KeyEventArgs e)- {- if (e.KeyCode != Keys.Return)- {- return;- }- e.SuppressKeyPress = true;- e.Handled = true;- if (ui == null || _loadingProbe)- {- return;- }- ReadProbeControls(ui);- ProbeSettingsChanged();- }-- /// <summary>Stores the scale mode radio buttons into the probe and marks the project dirty; ignored while loading.</summary>- private void HandleProbeScaleModeChanged(Form1.ProbeControlSet ui)- {- if (ui == null || _loadingProbe)- {- return;- }- _probes[ui.Index].ScaleMode = (ui.RadFull.Checked ? ProbeScaleMode.Full : ProbeScaleMode.Running);- ProbeSettingsChanged();- }-- /// <summary>- /// Stores the auto X / auto Y check boxes. When auto Y has just been switched off, the Y range the- /// running graph currently shows is frozen into the probe (<see cref="FreezeValueRange"/>) and- /// written into the min/max text boxes, so the user starts from the displayed range rather than- /// the stale stored one. Ignored while loading.- /// </summary>- private void HandleProbeAutoScaleChanged(Form1.ProbeControlSet ui)- {- if (ui == null || _loadingProbe)- {- return;- }- ProbeSettings probe = _probes[ui.Index];- bool wasAutoY = probe.AutoScaleY;- probe.AutoScaleX = ui.ChkAutoX.Checked;- probe.AutoScaleY = ui.ChkAutoY.Checked;- // switching the automatic value axis off keeps the range that is shown now, ready to fine-tune by hand- if (wasAutoY && !probe.AutoScaleY)- {- FreezeValueRange(ui, probe);- _loadingProbe = true;- try- {- ui.TxtMinY.Text = probe.YMin.ToString("G6", CultureInfo.InvariantCulture);- ui.TxtMaxY.Text = probe.YMax.ToString("G6", CultureInfo.InvariantCulture);- }- finally- {- _loadingProbe = false;- }- }- UpdateProbeControlState(ui);- ProbeSettingsChanged();- }-- /// <summary>Generic "commit" used by Validated and ValueChanged events: reads all controls back and marks the project dirty; ignored while loading.</summary>- private void HandleProbeControlApplied(Form1.ProbeControlSet ui)- {- if (ui == null || _loadingProbe)- {- return;- }- ReadProbeControls(ui);- ProbeSettingsChanged();- }-- /// <summary>Stores the "start after step" check box, enables/disables its text box and marks the project dirty; ignored while loading.</summary>- private void HandleProbeStartAfterStepChanged(Form1.ProbeControlSet ui)- {- if (ui == null || _loadingProbe)- {- return;- }- _probes[ui.Index].UseStartAfterStep = ui.ChkStartAfter.Checked;- UpdateProbeControlState(ui);- ProbeSettingsChanged();- }-- /// <summary>- /// When auto Y scaling is switched off, keeps the Y range the running graph currently shows:- /// recomputes the auto-scaled range from the trace of the current/last run (via- /// <see cref="ProbeGraphPainter.ComputeRanges"/> on an auto-Y clone) and stores it in- /// <paramref name="p"/>. Does nothing when there is no run trace for this probe, when the run- /// used a different probe kind, when a line probe has no profile yet (or is still gated by- /// its start-after step), when a point probe has no samples, or when the computed range is empty.- /// </summary>- private void FreezeValueRange(Form1.ProbeControlSet ui, ProbeSettings p)- {- int index = ui.Index;- if (_probeTraces.Count <= index || _runProbes == null || _runProbes.Count <= index)- {- return;- }- if (_runProbes[index].Kind != p.Kind)- {- return;- }- ProbeTrace trace = _probeTraces[index];- if (p.Kind == ProbeKind.Line)- {- // a line probe shows nothing at all before the start step: nothing to freeze- if (p.UseStartAfterStep && trace.StepsSampled < p.StartAfterStep)- {- return;- }- if (trace.Profile == null)- {- return;- }- }- else if (trace.Series.Count == 0)- {- return;- }- ProbeSettings autoScaled = p.Clone();- autoScaled.AutoScaleY = true;- double xMin = 0.0;- double xMax = 0.0;- double yMin = 0.0;- double yMax = 0.0;- ProbeGraphPainter.ComputeRanges(autoScaled, trace, _runSteps, ref xMin, ref xMax, ref yMin, ref yMax);- if (yMax > yMin)- {- p.YMin = yMin;- p.YMax = yMax;- }- }-- /// <summary>Marks the project dirty (unless a loading flag is set) and repaints all three probe-related pictures.</summary>- private void ProbeSettingsChanged()- {- MarkProjectChanged();- InvalidateProbePictures();- }-- /// <summary>Invalidates the probe picture and the field/intensity previews so markers and graph boxes are redrawn; safe before the pictures exist.</summary>- private void InvalidateProbePictures()- {- if (_picProbe != null)- {- _picProbe.Invalidate();- }- if (_picField != null)- {- _picField.Invalidate();- }- if (_picIntensity != null)- {- _picIntensity.Invalidate();- }- }-- /// <summary>- /// Any main tab switch cancels a pick in progress and refreshes the spinner ranges (the canvas- /// size may have changed on the Configuration tab); switching to the Probes tab additionally- /// loads the scene image (or a black canvas) into the probe picture if it is still empty.- /// </summary>- private void ProbeTabChanged(object sender, EventArgs e)- {- EndPick();- SetProbeRanges();- if (tabMainFunctions.SelectedTab == tabProbeList)- {- AutoLoadSceneImageIfEmpty(_picProbe);- }- }-- /// <summary>Probe 1 "pick positions" button: starts picking in the probe picture, or cancels it when already picking.</summary>- private void butPicPositions_Click(object sender, EventArgs e)- {- StartOrCancelPick(ProbeUi(0));- }-- /// <summary>Probe 2 "pick positions" button: starts picking in the probe picture, or cancels it when already picking.</summary>- private void butPicPositions2_Click(object sender, EventArgs e)- {- StartOrCancelPick(ProbeUi(1));- }-- /// <summary>Toggles pick mode for one probe: cancels a pick in progress (for any probe) and, unless that pick was this probe's, starts a new one.</summary>- private void StartOrCancelPick(Form1.ProbeControlSet ui)- {- if (ui == null)- {- return;- }- bool wasPicking = _pickStep != 0 && _pickIndex == ui.Index;- EndPick();- if (!wasPicking)- {- StartPick(ui);- }- }-- /// <summary>- /// When there is no picture yet to pick from (no simulation has run), makes a plain black one at- /// the canvas size that the Configuration tab currently specifies (the scene image's size, or the- /// user defined width/height), so a probe position can still be picked before ever running a- /// simulation. Replaced by the real picture as soon as one is copied over from the Preview tab.- /// Does nothing when the canvas size is unknown. The bitmap is owned by the picture box.- /// </summary>- private void EnsureProbePicture()- {- Size canvas = EffectiveCanvas();- if (canvas.Width <= 0 || canvas.Height <= 0)- {- return;- }- Bitmap placeholder = new Bitmap(canvas.Width, canvas.Height);- using (Graphics g = Graphics.FromImage(placeholder))- {- g.Clear(Color.Black);- }- _picProbe.Image = placeholder;- }-- /// <summary>- /// Enters pick mode for <paramref name="ui"/>'s probe: makes sure the probe picture has an image- /// (otherwise shows a message and gives up), sets <c>_pickIndex</c>/<c>_pickStep</c> to step 1,- /// switches to a cross cursor, relabels the pick button "Cancel" and shows the first instruction- /// in the status bar. Clicks are then handled by <see cref="ProbePicture_MouseClick"/>.- /// </summary>- private void StartPick(Form1.ProbeControlSet ui)- {- if (_picProbe.Image == null)- {- EnsureProbePicture();- }- if (_picProbe.Image == null)- {- MessageBox.Show(this, "There is no picture to pick from yet, and the canvas size is not known either\r\n(choose a scene image, or a user defined width and height, on the Configuration tab first).", "Probe positions", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- _pickIndex = ui.Index;- _pickStep = 1;- _pickHover = null;- _picProbe.Cursor = Cursors.Cross;- ui.ButPick.Text = "Cancel";- ShowPickInstruction();- }-- /// <summary>Writes the status-bar instruction for the current pick step (1: position A / the point, 2: position B, 3: top-left corner of the graph box).</summary>- private void ShowPickInstruction()- {- Form1.ProbeControlSet ui = _probeUi[_pickIndex];- switch (_pickStep)- {- case 1:- ToolStripStatusLabel1.Text = ((_probes[_pickIndex].Kind == ProbeKind.Line) ? (ui.Title + ": click in the picture for position A, the start of the line (press Cancel to stop picking).") : (ui.Title + ": click in the picture for the position of the probe (press Cancel to stop picking)."));- break;- case 2:- ToolStripStatusLabel1.Text = ui.Title + ": click in the picture for position B, the end of the line.";- break;- case 3:- ToolStripStatusLabel1.Text = ui.Title + ": click in the picture for the top left corner of the graph box.";- break;- default:- ToolStripStatusLabel1.Text = "";- break;- }- }-- /// <summary>Leaves pick mode: restores the pick button text, clears step and hover, resets the cursor, repaints, and clears the status bar if a pick was active. Safe to call when nothing is being picked or before the probe picture exists.</summary>- private void EndPick()- {- bool wasPicking = _pickStep != 0;- if (wasPicking)- {- _probeUi[_pickIndex].ButPick.Text = _probeUi[_pickIndex].PickButtonText;- }- _pickStep = 0;- _pickHover = null;- if (_picProbe != null)- {- _picProbe.Cursor = Cursors.Default;- _picProbe.Invalidate();- }- if (wasPicking)- {- ToolStripStatusLabel1.Text = "";- }- }-- /// <summary>- /// Left click on the probe picture while picking: the click (picture-box pixels) is converted to a- /// canvas pixel and, depending on the step, written into the A spinners (their ValueChanged stores- /// it in the probe), the B spinners, or directly into <see cref="ProbeSettings.BoxX"/>/<c>BoxY</c>.- /// Point probes skip step 2. Clicks outside the image area are ignored.- /// </summary>- private void ProbePicture_MouseClick(object sender, MouseEventArgs e)- {- if (_pickStep == 0 || e.Button != MouseButtons.Left)- {- return;- }- Form1.ProbeControlSet ui = _probeUi[_pickIndex];- int x = 0;- int y = 0;- if (!TryPictureToCanvas(_picProbe, e.Location, ref x, ref y))- {- return;- }- switch (_pickStep)- {- case 1:- ui.NumAPosX.Value = Form1.ClampToRange(ui.NumAPosX, x);- ui.NumAPosY.Value = Form1.ClampToRange(ui.NumAPosY, y);- _pickStep = ((_probes[_pickIndex].Kind == ProbeKind.Line) ? 2 : 3);- ShowPickInstruction();- break;- case 2:- ui.NumBPosX.Value = Form1.ClampToRange(ui.NumBPosX, x);- ui.NumBPosY.Value = Form1.ClampToRange(ui.NumBPosY, y);- _pickStep = 3;- ShowPickInstruction();- break;- default:- _probes[_pickIndex].BoxX = x;- _probes[_pickIndex].BoxY = y;- ProbeSettingsChanged();- EndPick();- break;- }- _picProbe.Invalidate();- }-- /// <summary>During step 3 (graph box placement) remembers the mouse position in picture-box pixels so <see cref="ProbePicture_Paint"/> can preview the box there.</summary>- private void ProbePicture_MouseMove(object sender, MouseEventArgs e)- {- if (_pickStep == 3)- {- _pickHover = new Point?(e.Location);- _picProbe.Invalidate();- }- }-- /// <summary>Drops the box preview position when the mouse leaves the probe picture.</summary>- private void ProbePicture_MouseLeave(object sender, EventArgs e)- {- if (_pickHover != null)- {- _pickHover = null;- _picProbe.Invalidate();- }- }-- /// <summary>- /// Maps a point in picture-box pixels to canvas pixel coordinates; false when the box has no- /// image or the point lies outside the zoomed image area. The canvas size is- /// <c>EffectiveCanvas()</c>, falling back to the image size when unknown. The result is floored- /// and clamped to 0..width-1 / 0..height-1.- /// </summary>- private bool TryPictureToCanvas(PictureBox box, Point point, ref int x, ref int y)- {- if (box.Image == null)- {- return false;- }- RectangleF area = Form1.ZoomedImageRectangle(box);- if (area.Width <= 0f || area.Height <= 0f || !area.Contains(point.X, point.Y))- {- return false;- }- Size canvas = EffectiveCanvas();- if (canvas.Width <= 0)- {- canvas = box.Image.Size;- }- x = (int)Math.Floor((point.X - area.X) / area.Width * canvas.Width);- y = (int)Math.Floor((point.Y - area.Y) / area.Height * canvas.Height);- x = Math.Max(0, Math.Min(canvas.Width - 1, x));- y = Math.Max(0, Math.Min(canvas.Height - 1, y));- return true;- }-- /// <summary>- /// The rectangle (picture-box pixels) the image occupies inside a picture box in Zoom size mode:- /// uniformly scaled to fit and centred. Empty when there is no image. All preview boxes are- /// created with <c>SizeMode = Zoom</c>, so this matches what WinForms draws.- /// </summary>- private static RectangleF ZoomedImageRectangle(PictureBox box)- {- Image image = box.Image;- if (image == null || image.Width <= 0 || image.Height <= 0)- {- return RectangleF.Empty;- }- float boxWidth = box.ClientSize.Width;- float boxHeight = box.ClientSize.Height;- float scale = Math.Min(boxWidth / image.Width, boxHeight / image.Height);- float width = image.Width * scale;- float height = image.Height * scale;- return new RectangleF((boxWidth - width) / 2f, (boxHeight - height) / 2f, width, height);- }-- /// <summary>- /// Converts a rectangle in canvas pixels to picture-box pixels (despite the name, not screen- /// coordinates): offsets by the image area's origin and scales by <paramref name="sx"/>/<paramref name="sy"/>- /// (picture-box pixels per canvas pixel), rounding each edge.- /// </summary>- private static Rectangle ToScreen(Rectangle r, RectangleF area, float sx, float sy)- {- return new Rectangle((int)Math.Round(area.X + r.X * sx), (int)Math.Round(area.Y + r.Y * sy), (int)Math.Round(r.Width * sx), (int)Math.Round(r.Height * sy));- }-- /// <summary>- /// Paint overlay for the field and intensity preview pictures: draws markers and live graphs for- /// the probes of the current/last run (<c>_runProbes</c>, scaled by <c>_runCanvas</c> because the- /// picture shows run output) whose <see cref="ProbeSettings.PlaceOn"/> matches the picture.- /// Position, kind and measurement come from the run copy, but display settings are taken from- /// the probe being edited (<see cref="ProbeSettings.CopyDisplayFrom"/>) so box moves, scaling and- /// the active flag apply immediately. Nothing is drawn before the first run.- /// </summary>- private void PreviewPicture_Paint(object sender, PaintEventArgs e)- {- PictureBox picture = (PictureBox)sender;- if (picture.Image == null || _runProbes == null || _runCanvas.Width <= 0)- {- return;- }- ProbePlaceOn placeOn = ((picture == _picField) ? ProbePlaceOn.Field : ProbePlaceOn.Intensity);- RectangleF area = Form1.ZoomedImageRectangle(picture);- if (area.Width <= 0f)- {- return;- }- float sx = area.Width / _runCanvas.Width;- float sy = area.Height / _runCanvas.Height;- for (int i = 0; i < _runProbes.Count; i++)- {- // what is measured comes from the run; how the graph looks can be changed while it runs- ProbeSettings probe = _runProbes[i].Clone();- if (i < _probes.Count)- {- probe.CopyDisplayFrom(_probes[i]);- }- if (probe.PlaceOn != placeOn || !probe.Active)- {- continue;- }- ProbeGraphPainter.DrawMarkers(e.Graphics, probe, i, area.X, area.Y, sx, sy);- ProbeTrace trace = null;- if (i < _probeTraces.Count)- {- trace = _probeTraces[i];- }- Rectangle rect = Form1.ToScreen(ProbeGraphPainter.BoxInCanvas(probe, _runCanvas.Width, _runCanvas.Height), area, sx, sy);- ProbeGraphPainter.DrawGraph(e.Graphics, rect, probe.Title(i), probe, trace, _runSteps);- }- }-- /// <summary>- /// Paint overlay for the probe picture on the Probes tab (scaled by <c>EffectiveCanvas()</c>,- /// falling back to the image size): the markers of both probes, and the graph box outline of- /// whichever one is being edited or positioned, as a translucent dashed yellow placeholder- /// labelled with the probe title. A switched off probe ("On" unchecked) is hidden here too; the- /// only exception is while the user is actively picking its position or graph box, so they can- /// still see what they are placing. During pick step 3 the placeholder follows the hovered mouse- /// position instead of the stored box position.- /// </summary>- private void ProbePicture_Paint(object sender, PaintEventArgs e)- {- if (_picProbe.Image == null)- {- return;- }- Size canvas = EffectiveCanvas();- if (canvas.Width <= 0)- {- canvas = _picProbe.Image.Size;- }- RectangleF area = Form1.ZoomedImageRectangle(_picProbe);- if (area.Width <= 0f)- {- return;- }- float sx = area.Width / canvas.Width;- float sy = area.Height / canvas.Height;- for (int i = 0; i < _probes.Count; i++)- {- ProbeSettings probe = _probes[i];- bool picking = _pickStep != 0 && _pickIndex == i;- if (!probe.Active && !picking)- {- continue;- }- ProbeGraphPainter.DrawMarkers(e.Graphics, probe, i, area.X, area.Y, sx, sy);- // while the corner of this probe's box is being picked, the box follows the mouse- ProbeSettings shown = probe;- if (_pickStep == 3 && _pickIndex == i && _pickHover != null)- {- int hoverX = 0;- int hoverY = 0;- if (TryPictureToCanvas(_picProbe, _pickHover.Value, ref hoverX, ref hoverY))- {- shown = probe.Clone();- shown.BoxX = hoverX;- shown.BoxY = hoverY;- }- }- Rectangle rect = Form1.ToScreen(ProbeGraphPainter.BoxInCanvas(shown, canvas.Width, canvas.Height), area, sx, sy);- using (SolidBrush fill = new SolidBrush(Color.FromArgb(40, 255, 208, 64)))- {- e.Graphics.FillRectangle(fill, rect);- }- using (Pen outline = new Pen(Color.FromArgb(230, 255, 208, 64), 1.5f))- {- outline.DashStyle = DashStyle.Dash;- e.Graphics.DrawRectangle(outline, rect);- }- using (Font font = new Font("Segoe UI", 12f, FontStyle.Bold, GraphicsUnit.Pixel))- {- using (SolidBrush textBrush = new SolidBrush(Color.FromArgb(240, 255, 208, 64)))- {- e.Graphics.DrawString(probe.Title(i), font, textBrush, rect.X + 4, rect.Y + 3);- }- }- }- }-- /// <summary>Replaces <c>_probes</c> with the list from the current project's config (padded/truncated to <see cref="ProbeCount"/>) and shows it; no-op without a project.</summary>- private void LoadProbesFromProject()- {- if (_project == null)- {- return;- }- _probes = ProbeSettings.ListFromConfig(_project.Config);- NormalizeProbeCount();- ShowProbesInControls();- }-- /// <summary>Replaces <c>_probes</c> with defaults (new project) and shows them.</summary>- private void ResetProbes()- {- _probes = Form1.NewProbeList();- ShowProbesInControls();- }-- /// <summary>Commits every control to <c>_probes</c> and returns independent copies for the <c>SimulationJob</c>, so the worker thread never reads the instances the user keeps editing.</summary>- private List<ProbeSettings> ProbesForRun()- {- foreach (Form1.ProbeControlSet ui in _probeUi)- {- ReadProbeControls(ui);- }- List<ProbeSettings> copies = new List<ProbeSettings>();- foreach (ProbeSettings probe in _probes)- {- copies.Add(probe.Clone());- }- return copies;- }-- /// <summary>- /// Called when a simulation starts: records the run's probe copies, canvas size (canvas pixels)- /// and total step count for the paint handlers, replaces the traces with one empty- /// <see cref="ProbeTrace"/> per probe, and repaints.- /// </summary>- /// <param name="probes">The copies from <see cref="ProbesForRun"/>; may be null.</param>- /// <param name="canvas">Canvas size of the run in canvas pixels; the previews scale probe positions by it.</param>- /// <param name="steps">Total steps of the run, used for the full-scale X axis.</param>- private void BeginProbeRun(List<ProbeSettings> probes, Size canvas, int steps)- {- _runProbes = probes;- _runCanvas = canvas;- _runSteps = steps;- _probeTraces.Clear();- if (probes != null)- {- for (int i = 0; i < probes.Count; i++)- {- _probeTraces.Add(new ProbeTrace());- }- }- InvalidateProbePictures();- }-- /// <summary>- /// Receives a batch of probe results from <see cref="SimulationRunner.ProbesUpdated"/>; runs on the- /// UI thread because the subscription wraps it in <c>PostToUi</c>. Batches from a runner that is no- /// longer <c>_runner</c> (or arriving after dispose) are dropped. Appends the new samples to each- /// trace's series, replaces the profile when the batch carries one, updates the sampled step count- /// and repaints the field/intensity previews (the probe picture shows no live data).- /// </summary>- private void ShowProbeSamples(SimulationRunner runner, ProbeUpdate update)- {- if (runner != _runner || base.IsDisposed)- {- return;- }- int count = Math.Min(update.Samples.Length, _probeTraces.Count);- for (int i = 0; i < count; i++)- {- _probeTraces[i].Series.Add(update.Samples[i]);- if (update.Profiles[i] != null)- {- _probeTraces[i].SetProfile(update.Profiles[i], update.Lengths[i]);- }- _probeTraces[i].StepsSampled = update.StepsDone;- }- if (_picField != null)- {- _picField.Invalidate();- }- if (_picIntensity != null)- {- _picIntensity.Invalidate();- }- }- }-}diff --git a/Wave_Dude_2D/Form1.Projects.cs b/Wave_Dude_2D/Form1.Projects.csdeleted file mode 100644index 460ccbc..0000000--- a/Wave_Dude_2D/Form1.Projects.cs+++ /dev/null@@ -1,403 +0,0 @@-using System;-using System.Collections.Generic;-using System.Globalization;-using System.IO;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Projects tab: <c>lstAllProjects</c>, the sortable list of every project folder found directly inside- /// the configured project root (File > Choose project root, <see cref="AppSettings.ProjectRoot"/>) -- /// a quick way to switch projects without browsing to their folder every time - and the- /// new/load/delete/rename commands that act on the selected entry. Two columns, <c>colProjectName</c>- /// and <c>colLastEdit</c> ("last edited" = the last write time of that project's configuration.json).- /// Clicking either header sorts by it (<see cref="lstAllProjects_ColumnClick"/>), toggling direction on- /// a repeat click of the same header - the usual Explorer/Excel convention. Each row's <c>Tag</c> holds- /// a <see cref="ProjectListEntry"/> so the raw name and date stay available without re-parsing the- /// displayed text. The list-building helpers here (<see cref="BuildProjectEntries"/>,- /// <see cref="SortProjectEntries"/>, <see cref="PopulateProjectListView"/>,- /// <see cref="SelectedProjectName"/>, <see cref="SelectProjectInList"/>) are shared with the- /// second project list on the Outputs tab (<c>Form1.Output.cs</c>). Everything here runs on- /// the UI thread.- /// </summary>- public partial class Form1- {- /// <summary>- /// Scans the project root for project folders and returns one unsorted entry per project.- /// The "last modified" time is the write time of the project's configuration.json, or of- /// the folder itself when that file is missing (legacy folders).- /// </summary>- /// <returns>An empty list when no project root is configured or it cannot be read.</returns>- private List<Form1.ProjectListEntry> BuildProjectEntries()- {- List<Form1.ProjectListEntry> entries = new List<Form1.ProjectListEntry>();- foreach (string name in ProjectStore.ListProjects(_settings.ProjectRoot))- {- string folder = ProjectStore.FolderPathFor(_settings.ProjectRoot, name);- string configPath = Path.Combine(folder, ProjectConfig.FileName);- DateTime lastModified = File.Exists(configPath) ? File.GetLastWriteTime(configPath) : Directory.GetLastWriteTime(folder);- entries.Add(new Form1.ProjectListEntry(name, lastModified));- }- return entries;- }-- /// <summary>- /// Sorts <paramref name="entries"/> in place: column 0 by name (case-insensitive), any other- /// column by last-modified time; the list is reversed afterwards for descending order.- /// </summary>- private void SortProjectEntries(List<Form1.ProjectListEntry> entries, int sortColumn, bool ascending)- {- if (sortColumn == 0)- {- entries.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));- }- else- {- entries.Sort((a, b) => DateTime.Compare(a.LastModified, b.LastModified));- }- if (!ascending)- {- entries.Reverse();- }- }-- /// <summary>- /// Replaces the items of <paramref name="list"/> with one row per entry: the name and the- /// last-modified time as local "yyyy-MM-dd HH:mm". Each item's <c>Tag</c> holds its- /// <see cref="ProjectListEntry"/>.- /// </summary>- private void PopulateProjectListView(ListView list, List<Form1.ProjectListEntry> entries)- {- list.BeginUpdate();- try- {- list.Items.Clear();- foreach (Form1.ProjectListEntry entry in entries)- {- ListViewItem item = new ListViewItem(entry.Name);- item.SubItems.Add(entry.LastModified.ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture));- item.Tag = entry;- list.Items.Add(item);- }- }- finally- {- list.EndUpdate();- }- }-- /// <summary>Name of the first selected project in <paramref name="list"/>, or "" when nothing is selected.</summary>- private string SelectedProjectName(ListView list)- {- if (list.SelectedItems.Count == 0)- {- return "";- }- Form1.ProjectListEntry entry = list.SelectedItems[0].Tag as Form1.ProjectListEntry;- return (entry != null) ? entry.Name : "";- }-- /// <summary>- /// Adds the entry named <paramref name="name"/> (case-insensitive) to the selection of- /// <paramref name="list"/> and scrolls it into view; does nothing for "" or an unknown name.- /// </summary>- private void SelectProjectInList(ListView list, string name)- {- if (name.Length == 0)- {- return;- }- foreach (ListViewItem item in list.Items)- {- Form1.ProjectListEntry entry = (Form1.ProjectListEntry)item.Tag;- if (string.Equals(entry.Name, name, StringComparison.OrdinalIgnoreCase))- {- item.Selected = true;- item.EnsureVisible();- break;- }- }- }-- /// <summary>- /// Rebuilds the Projects-tab list from disk with the current sort, keeps the previously- /// selected project selected when it still exists, and refreshes the sort arrows and buttons.- /// Called after every project command and whenever the root folder changes.- /// </summary>- private void RefreshProjectList()- {- string selectedName = SelectedProjectName(lstAllProjects);- List<Form1.ProjectListEntry> entries = BuildProjectEntries();- SortProjectEntries(entries, _projectSortColumn, _projectSortAscending);- PopulateProjectListView(lstAllProjects, entries);- UpdateProjectListSortHeaders();- SelectProjectInList(lstAllProjects, selectedName);- UpdateProjectListButtons();- }-- /// <summary>Clicking a column header sorts the project list by it; clicking the current sort column again flips the direction.</summary>- private void lstAllProjects_ColumnClick(object sender, ColumnClickEventArgs e)- {- if (e.Column == _projectSortColumn)- {- _projectSortAscending = !_projectSortAscending;- }- else- {- _projectSortColumn = e.Column;- _projectSortAscending = true;- }- RefreshProjectList();- }-- /// <summary>Appends " ^" (ascending) or " v" (descending) to the header text of the column the project list is sorted by.</summary>- private void UpdateProjectListSortHeaders()- {- string arrow = _projectSortAscending ? " ^" : " v";- colProjectName.Text = "Project name" + ((_projectSortColumn == 0) ? arrow : "");- colLastEdit.Text = "Last edited" + ((_projectSortColumn == 1) ? arrow : "");- }-- /// <summary>Enables "New" only when a project root is configured, and Load/Delete/Rename only when a project is selected.</summary>- private void UpdateProjectListButtons()- {- bool hasSelection = lstAllProjects.SelectedItems.Count > 0;- btnNewProject.Enabled = _settings != null && _settings.ProjectRoot.Length > 0;- btnLoadProject.Enabled = hasSelection;- btnDeleteProject.Enabled = hasSelection;- btnRenameProject.Enabled = hasSelection;- }-- /// <summary>- /// Creates a new project (wired to both the "New project" button and File > New): offers- /// to save the open project, then asks for a name until it is valid and unused or the prompt- /// is cancelled (never overwrites an existing project: a name already used there is refused and- /// the dialog reopens). On success the editor is reset to defaults, those defaults are written into- /// the new project's configuration.json, and the project becomes the current one. There is no such- /// thing as a "new project" until it has actually been named and created here, so File > New no- /// longer leaves an unnamed, un-saved project open for editing.- /// </summary>- private void btnNewProject2_Click(object sender, EventArgs e)- {- if (_settings.ProjectRoot.Length == 0)- {- MessageBox.Show(this, "Choose a project root folder first (File > Choose project root).", "New project", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- if (!ConfirmSaveProject())- {- return;- }- string name = "";- while (PromptForText("New project", "Name for the new project:", name, ref name))- {- name = name.Trim();- string error = ProjectStore.ValidateName(name);- if (error.Length > 0)- {- MessageBox.Show(this, error, "New project", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- continue;- }- if (ProjectStore.IsProjectFolder(ProjectStore.FolderPathFor(_settings.ProjectRoot, name)))- {- MessageBox.Show(this, "A project named '" + name + "' already exists in this root folder. Choose a different name.", "New project", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- continue;- }- try- {- Project project = ProjectStore.Create(_settings.ProjectRoot, name);- StartNewProject();- // Write the just-computed defaults (StartNewProject read numSimulationSteps/numTimeDecayFactor- // etc. from their Designer values) into the new project's configuration.json before- // SetCurrentProject reads it back - otherwise, since a freshly created project has no "steps" or- // "time_decay_factor" key yet, FromConfig would fall back to its own hardcoded legacy-compatibility- // defaults (for an older project saved before these settings existed) instead, silently discarding- // the Designer values StartNewProject just set.- _scene.ToConfig(project.Config);- _simulation.ToConfig(project.Config);- ProbeSettings.ListToConfig(_probes, project.Config);- SourceSettings.ListToConfig(_sources, project.Config);- project.Save();- SetCurrentProject(project);- ToolStripStatusLabel1.Text = "Project '" + name + "' created.";- break;- }- catch (Exception ex)- {- MessageBox.Show(this, "The project could not be created:\r\n\r\n" + ex.Message, "New project", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }- }-- /// <summary>Changing the selection updates which project buttons are enabled.</summary>- private void lstAllProjects_SelectedIndexChanged(object sender, EventArgs e)- {- UpdateProjectListButtons();- }-- /// <summary>Double-clicking a project loads it, exactly like the Load button.</summary>- private void lstAllProjects_DoubleClick(object sender, EventArgs e)- {- btnLoadProject_Click(sender, e);- }-- /// <summary>Full folder path of the project selected in the Projects-tab list, or "" when none is selected.</summary>- private string SelectedProjectFolder()- {- string name = SelectedProjectName(lstAllProjects);- return (name.Length == 0) ? "" : ProjectStore.FolderPathFor(_settings.ProjectRoot, name);- }-- /// <summary>- /// True when <paramref name="folder"/> is the open project's folder and a- /// <see cref="SimulationRunner"/> still exists for it (a run is in progress), in which case- /// the folder must not be deleted or renamed.- /// </summary>- private bool IsOpenProjectRunning(string folder)- {- return _project != null && _runner != null && string.Equals(_project.FolderPath, folder, StringComparison.OrdinalIgnoreCase);- }-- /// <summary>Loads the selected project into the editor after offering to save unsaved changes; read errors are shown in a message box.</summary>- private void btnLoadProject_Click(object sender, EventArgs e)- {- string folder = SelectedProjectFolder();- if (folder.Length == 0)- {- return;- }- try- {- if (ConfirmSaveProject())- {- SetCurrentProject(ProjectStore.Open(folder));- }- }- catch (Exception ex)- {- MessageBox.Show(this, "The project could not be opened:\r\n\r\n" + ex.Message, "Load project", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- /// <summary>- /// Permanently deletes the selected project folder after a confirmation that also mentions- /// how many files its assets folder holds. Refused while a simulation is running for that- /// project. If the deleted project was the open one, the editor is reset to a new, unsaved- /// project.- /// </summary>- private void btnDeleteProject_Click(object sender, EventArgs e)- {- string name = SelectedProjectName(lstAllProjects);- string folder = SelectedProjectFolder();- if (folder.Length == 0)- {- return;- }- if (IsOpenProjectRunning(folder))- {- MessageBox.Show(this, "A simulation is running for this project. Stop it first.", "Delete project", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- string question = "Permanently delete the project '" + name + "' and everything in its folder?\r\n\r\n" + folder;- // the assets folder is where the user keeps their own third-party files (e.g. a Photoshop source file) -- // point this out explicitly, since deleting the project deletes those too, and they have no other copy here- int assetCount = Form1.CountFilesIn(Path.Combine(folder, ProjectStore.AssetsFolderName));- if (assetCount > 0)- {- question += "\r\n\r\nThis includes " + assetCount.ToString(CultureInfo.InvariantCulture) + " file(s) in its assets folder - copy them elsewhere first if you want to keep them.";- }- if (MessageBox.Show(this, question, "Delete project", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)- {- return;- }- bool deletesOpenProject = _project != null && string.Equals(_project.FolderPath, folder, StringComparison.OrdinalIgnoreCase);- try- {- ProjectStore.Delete(folder);- }- catch (Exception ex)- {- MessageBox.Show(this, "The project could not be deleted:\r\n\r\n" + ex.Message, "Delete project", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- RefreshProjectList();- return;- }- if (deletesOpenProject)- {- StartNewProject();- UpdateProjectAccess();- }- RefreshProjectList();- ToolStripStatusLabel1.Text = "Project '" + name + "' deleted.";- }-- /// <summary>Number of files anywhere below <paramref name="folderPath"/>; 0 when the folder is missing or unreadable.</summary>- private static int CountFilesIn(string folderPath)- {- if (!Directory.Exists(folderPath))- {- return 0;- }- try- {- return Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories).Length;- }- catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException)- {- return 0;- }- }-- /// <summary>- /// Renames the selected project folder after prompting for a new name (validated by- /// <see cref="ProjectStore.Rename"/>). Refused while a simulation is running for it; an- /// unchanged name is a no-op.- /// </summary>- /// <remarks>- /// When the renamed project is the open one it is re-opened from the new folder so the editor and the- /// title bar stay in sync and all project-relative paths stay valid (a project's name is always just- /// its folder name - see <see cref="Project.Name"/>). That re-reads configuration.json, so unsaved- /// edits to the open project are discarded without asking.- /// </remarks>- private void btnRenameProject_Click(object sender, EventArgs e)- {- string oldName = SelectedProjectName(lstAllProjects);- string folder = SelectedProjectFolder();- if (folder.Length == 0)- {- return;- }- if (IsOpenProjectRunning(folder))- {- MessageBox.Show(this, "A simulation is running for this project. Stop it first.", "Rename project", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- string newName = oldName;- if (!PromptForText("Rename project", "New name for '" + oldName + "':", oldName, ref newName))- {- return;- }- newName = newName.Trim();- if (newName == oldName)- {- return;- }- bool renamesOpenProject = _project != null && string.Equals(_project.FolderPath, folder, StringComparison.OrdinalIgnoreCase);- try- {- string newFolder = ProjectStore.Rename(folder, newName);- if (renamesOpenProject)- {- SetCurrentProject(ProjectStore.Open(newFolder));- }- RefreshProjectList();- SelectProjectInList(lstAllProjects, newName);- ToolStripStatusLabel1.Text = "Project '" + oldName + "' renamed to '" + newName + "'.";- }- catch (Exception ex)- {- MessageBox.Show(this, "The project could not be renamed:\r\n\r\n" + ex.Message, "Rename project", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }- }-}diff --git a/Wave_Dude_2D/Form1.Scene.cs b/Wave_Dude_2D/Form1.Scene.csdeleted file mode 100644index e88ac05..0000000--- a/Wave_Dude_2D/Form1.Scene.cs+++ /dev/null@@ -1,959 +0,0 @@-using System;-using System.Drawing;-using System.Drawing.Drawing2D;-using System.Drawing.Imaging;-using System.Globalization;-using System.IO;-using System.Runtime.InteropServices;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Scene tab: scene image / user-defined canvas, damping edge, image sources,- /// and the glowing-edges overlay drawn on top of the field / intensity previews.- /// The model is <c>_scene</c> (a <see cref="SceneSettings"/>), the loaded bitmap is- /// <c>_sceneImage</c> (owned by the form, replaced through <see cref="ReplaceSceneImage"/>),- /// and <c>_loadingScene</c> is the re-entrancy guard that makes the change handlers ignore- /// programmatic control updates. Everything here runs on the UI thread.- /// </summary>- public partial class Form1- {- /// <summary>- /// Applies the Scene tab control settings that are not in the designer (preview zoom mode,- /// label ellipsis, text lengths, image-source scale range). Called once from <c>Form1_Load</c>.- /// </summary>- private void InitializeSceneControls()- {- picImagePreview.BorderStyle = BorderStyle.FixedSingle;- picImagePreview.BackColor = SystemColors.ControlLight;- picImagePreview.SizeMode = PictureBoxSizeMode.Zoom;- lblImageNameAndSize.AutoSize = false;- lblImageNameAndSize.AutoEllipsis = true;- lblImageNameAndSize.Size = new Size(470, 20);- txtXSize.MaxLength = 5;- txtYsize.MaxLength = 5;- txtDampingEdgeSize.MaxLength = 4;- // amplitude factor of the sources in the scene image- numScaleImageSource.Minimum = 0m;- numScaleImageSource.Maximum = (decimal)SceneSettings.MaxImageSourceScale;-- // No ShowSceneInControls() here: grpSceneProperties is disabled until a real project exists- // (UpdateProjectAccess). Populating it now from a blank _scene would overwrite whatever defaults the- // Designer gave these controls before StartNewProject/SetCurrentProject ever get a chance to read them- // back out (see the matching comment in InitializeSimulationControls, where this actually matters -- // numSimulationSteps' Designer default of 3000).- }-- /// <summary>- /// Replaces <c>_scene</c> with the scene section of the open project's config, loads the- /// referenced image as the scene image (silently leaving it unloaded when the file is missing- /// or unreadable) and shows everything in the controls. Does nothing when no project is open.- /// </summary>- private void LoadSceneFromProject()- {- if (_project == null)- {- return;- }- _scene = SceneSettings.FromConfig(_project.Config);- ReplaceSceneImage(null);- if (_scene.ImageFile.Length > 0)- {- string imagePath = SceneSettings.ToFullPath(_project.FolderPath, _scene.ImageFile);- if (File.Exists(imagePath))- {- try- {- ReplaceSceneImage(Form1.LoadImageCopy(imagePath));- }- catch (Exception)- {- // the image label tells that the image could not be loaded (UpdateImageLabel)- }- }- }- ShowSceneInControls();- }-- /// <summary>- /// Copies <c>_scene</c> into the Scene tab controls with <c>_loadingScene</c> set so the change- /// handlers neither write back nor mark the project dirty, then refreshes control enabling,- /// the preview and the damping-edge validation colour.- /// </summary>- private void ShowSceneInControls()- {- _loadingScene = true;- try- {- radUseSceneImage.Checked = _scene.UseImage;- radUserDefinedScene.Checked = !_scene.UseImage;- txtXSize.Text = _scene.UserWidth.ToString(CultureInfo.InvariantCulture);- txtYsize.Text = _scene.UserHeight.ToString(CultureInfo.InvariantCulture);- chkDampingEdge.Checked = _scene.DampingEdgeEnabled;- txtDampingEdgeSize.Text = _scene.DampingEdgeSize.ToString(CultureInfo.InvariantCulture);- chkUseImageSources.Checked = _scene.UseSources;- numScaleImageSource.Value = Form1.ClampToRange(numScaleImageSource, _scene.ImageSourceScale);- chkUseObjectSources.Checked = _scene.UseObjectSources;- numRefractiveIndex.Value = Form1.ClampToRange(numRefractiveIndex, _scene.BackgroundRefractiveIndex);- txtXSize.ForeColor = SystemColors.WindowText;- txtYsize.ForeColor = SystemColors.WindowText;- }- finally- {- _loadingScene = false;- }- UpdateSceneControlState();- UpdateScenePreview();- ShowDampingValidity();- }-- /// <summary>Enables or disables the Scene tab controls according to the scene mode (image vs. user-defined size), the damping-edge checkbox and the image-sources checkbox.</summary>- private void UpdateSceneControlState()- {- bool useImage = _scene.UseImage;- btnLoadSceneImage.Enabled = useImage;- lblImageNameAndSize.Enabled = useImage;- txtXSize.Enabled = !useImage;- txtYsize.Enabled = !useImage;- lblX.Enabled = !useImage;- lblPix.Enabled = !useImage;- numRefractiveIndex.Enabled = !useImage; // a scene image has its own refractive index per pixel- Label20.Enabled = !useImage;- txtDampingEdgeSize.Enabled = _scene.DampingEdgeEnabled;- Label1.Enabled = _scene.DampingEdgeEnabled;- numScaleImageSource.Enabled = _scene.UseSources;- lblScaleImgSourceIntensity.Enabled = _scene.UseSources;- }-- /// <summary>- /// Shows either the scene image (zoomed) or a generated placeholder for the user-defined canvas- /// size in <c>picImagePreview</c>, disposing the previous placeholder. The scene image itself- /// is not disposed here (see <see cref="ReplaceSceneImage"/>).- /// </summary>- private void UpdateScenePreview()- {- UpdateImageLabel();- if (_scene.UseImage)- {- picImagePreview.SizeMode = PictureBoxSizeMode.Zoom;- picImagePreview.Image = _sceneImage;- DisposeEmptyPreview();- }- else- {- // user defined canvas: an empty picture with the proportions of the canvas- picImagePreview.SizeMode = PictureBoxSizeMode.CenterImage;- Bitmap preview = MakeEmptyCanvasPreview(_scene.UserWidth, _scene.UserHeight);- picImagePreview.Image = preview;- DisposeEmptyPreview();- _emptyPreview = preview;- }- }-- /// <summary>Sets the image name/size label: no image, image configured but not loadable, or file name with pixel size.</summary>- private void UpdateImageLabel()- {- if (_scene.ImageFile.Length == 0)- {- lblImageNameAndSize.Text = "(no image loaded)";- }- else if (_sceneImage == null)- {- lblImageNameAndSize.Text = "(image not found or not readable: " + Path.GetFileName(_scene.ImageFile) + ")";- }- else- {- lblImageNameAndSize.Text = Path.GetFileName(_scene.ImageFile) + " (" + _sceneImage.Width.ToString(CultureInfo.InvariantCulture) + " x " + _sceneImage.Height.ToString(CultureInfo.InvariantCulture) + " px)";- }- }-- /// <summary>- /// Draws a white placeholder bitmap with a grey frame and a "W x H px (empty scene)" caption,- /// scaled with preserved aspect ratio to fit the preview box client area minus an 8 px margin- /// (at least 2 x 2 px).- /// </summary>- /// <param name="canvasWidth">Canvas width in simulation pixels.</param>- /// <param name="canvasHeight">Canvas height in simulation pixels.</param>- /// <returns>A new bitmap; the caller stores it in <c>_emptyPreview</c> and disposes it.</returns>- private Bitmap MakeEmptyCanvasPreview(int canvasWidth, int canvasHeight)- {- int maxWidth = Math.Max(16, picImagePreview.ClientSize.Width - 8);- int maxHeight = Math.Max(16, picImagePreview.ClientSize.Height - 8);- double scale = Math.Min((double)maxWidth / canvasWidth, (double)maxHeight / canvasHeight);- int previewWidth = Math.Max(2, (int)Math.Round(canvasWidth * scale));- int previewHeight = Math.Max(2, (int)Math.Round(canvasHeight * scale));- Bitmap preview = new Bitmap(previewWidth, previewHeight, PixelFormat.Format32bppArgb);- using (Graphics g = Graphics.FromImage(preview))- {- g.Clear(Color.White);- using (Pen pen = new Pen(Color.Gray))- {- g.DrawRectangle(pen, 0, 0, previewWidth - 1, previewHeight - 1);- }- using (Font font = new Font("Microsoft Sans Serif", 9f))- using (StringFormat format = new StringFormat())- {- format.Alignment = StringAlignment.Center;- format.LineAlignment = StringAlignment.Center;- g.DrawString(canvasWidth.ToString(CultureInfo.InvariantCulture) + " x " + canvasHeight.ToString(CultureInfo.InvariantCulture) + " px (empty scene)", font, Brushes.Gray, new RectangleF(0f, 0f, previewWidth, previewHeight), format);- }- }- return preview;- }-- /// <summary>Disposes the placeholder preview bitmap, if any. Callers assign a new preview image first.</summary>- private void DisposeEmptyPreview()- {- if (_emptyPreview != null)- {- _emptyPreview.Dispose();- _emptyPreview = null;- }- }-- /// <summary>- /// Makes <paramref name="newImage"/> the current scene image, taking ownership. The previous- /// image is detached from the preview box if it is shown there and disposed, and the glow-edges- /// overlay is recomputed for the new image.- /// </summary>- /// <param name="newImage">The new scene image, or null to unload.</param>- private void ReplaceSceneImage(Bitmap newImage)- {- Bitmap oldImage = _sceneImage;- _sceneImage = newImage;- if (oldImage != null)- {- if (object.ReferenceEquals(picImagePreview.Image, oldImage))- {- picImagePreview.Image = null;- }- oldImage.Dispose();- }- UpdateGlowEdgesImage();- }-- /// <summary>- /// Disposes <c>_glowEdgesImage</c> and its cached resized copy (<see cref="GetGlowOverlayResized"/>) and- /// sets both to null, without touching <c>_sceneImage</c> - used both by <see cref="UpdateGlowEdgesImage"/>- /// (about to rebuild it from the scene image) and by <see cref="SceneMode_CheckedChanged"/> (switching to- /// <c>radUserDefinedScene</c>, where the overlay should disappear even though <c>_sceneImage</c> itself is- /// kept around in case the user switches back).- /// </summary>- private void ClearGlowEdgesImage()- {- if (_glowEdgesImage != null)- {- _glowEdgesImage.Dispose();- _glowEdgesImage = null;- }- if (_glowOverlayCache != null)- {- _glowOverlayCache.Dispose();- _glowOverlayCache = null;- }- }-- /// <summary>- /// Recomputes the Sobel edge image from <c>_sceneImage</c> (none when no image is loaded) and- /// re-composes the field and intensity previews so the overlay follows the new scene.- /// </summary>- private void UpdateGlowEdgesImage()- {- ClearGlowEdgesImage();- if (_sceneImage != null)- {- _glowEdgesImage = Form1.ComputeGlowingEdges(_sceneImage);- }- RefreshPreviewOverlay(_picField, FieldOverlayGain());- RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain());- }-- /// <summary>Overlay gain for the field preview: the brightness box value when the overlay checkbox is on, otherwise 0 (overlay off).</summary>- private double FieldOverlayGain()- {- return chkDiplayOverlayInField.Checked ? Convert.ToDouble(numBrightnessFieldOverlay.Value) : 0.0;- }-- /// <summary>Overlay gain for the intensity preview: the brightness box value when the overlay checkbox is on, otherwise 0 (overlay off).</summary>- private double IntensityOverlayGain()- {- return chkDiplayOverlayInIntensity.Checked ? Convert.ToDouble(numBrightnessIntensityOverlay.Value) : 0.0;- }-- /// <summary>- /// Builds a "glowing edges" picture of <paramref name="source"/>: a same-size picture that is black except- /// along its edges (fast color changes), where each of the three color channels is set to how sharp the- /// change in THAT channel is there (a 3x3 Sobel gradient magnitude, scaled and clamped to a byte). This is- /// deliberately done per channel rather than as a single grayscale edge strength, so e.g. a hard- /// red-to-black edge lights up mostly in red - keeping a hint of the original colors in the edge lines, the- /// way Photoshop's "Glowing Edges" filter does. The local <c>GlowScale</c> constant is the one tunable- /// "how bright" knob - a typical hard (full black-to-white) edge produces a raw Sobel magnitude of up to- /// about 1442, and <c>GlowScale</c> brings that into the 0-255 byte range without every ordinary edge- /// saturating to pure white; ask if this should be stronger/weaker. The source is first drawn into a- /// 24bpp copy so any pixel format works. The outermost ring of pixels is left black (there is no full 3x3- /// neighborhood there), and images smaller than 3 x 3 give an all-black result. Used as the- /// glowing-edges overlay of the field / intensity previews and exports.- /// </summary>- /// <returns>A new 24bpp bitmap of the source size, owned by the caller.</returns>- private static Bitmap ComputeGlowingEdges(Bitmap source)- {- const double GlowScale = 0.25;-- int width = source.Width;- int height = source.Height;- Bitmap edges = new Bitmap(width, height, PixelFormat.Format24bppRgb);- using (Graphics g = Graphics.FromImage(edges))- {- g.Clear(Color.Black);- }- if (width < 3 || height < 3)- {- return edges; // too small for a 3x3 kernel - stays plain black- }- // normalize the source into a plain 24bppRgb picture first (it may be indexed, 32bppArgb, ...)- using (Bitmap sourceCopy = new Bitmap(width, height, PixelFormat.Format24bppRgb))- {- using (Graphics g = Graphics.FromImage(sourceCopy))- {- g.DrawImageUnscaled(source, 0, 0);- }- Rectangle bounds = new Rectangle(0, 0, width, height);- BitmapData sourceData = sourceCopy.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);- BitmapData edgesData = edges.LockBits(bounds, ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);- try- {- int sourceStride = sourceData.Stride;- int edgesStride = edgesData.Stride;- byte[] sourcePixels = new byte[sourceStride * height];- byte[] edgePixels = new byte[edgesStride * height];- Marshal.Copy(sourceData.Scan0, sourcePixels, 0, sourcePixels.Length);- // 24bppRgb stores each pixel as three bytes, in B,G,R order- for (int y = 1; y < height - 1; y++)- {- int rowAbove = (y - 1) * sourceStride;- int row = y * sourceStride;- int rowBelow = (y + 1) * sourceStride;- int edgeRow = y * edgesStride;- for (int x = 1; x < width - 1; x++)- {- // offsets of the left-hand pixel of the 3x3 window in each of its three rows- int above = rowAbove + (x - 1) * 3;- int middle = row + (x - 1) * 3;- int below = rowBelow + (x - 1) * 3;- int target = edgeRow + x * 3;- for (int channel = 0; channel < 3; channel++)- {- int topLeft = sourcePixels[above + channel];- int top = sourcePixels[above + 3 + channel];- int topRight = sourcePixels[above + 6 + channel];- int left = sourcePixels[middle + channel];- int right = sourcePixels[middle + 6 + channel];- int bottomLeft = sourcePixels[below + channel];- int bottom = sourcePixels[below + 3 + channel];- int bottomRight = sourcePixels[below + 6 + channel];- int gx = topRight + 2 * right + bottomRight - (topLeft + 2 * left + bottomLeft);- int gy = bottomLeft + 2 * bottom + bottomRight - (topLeft + 2 * top + topRight);- double magnitude = Math.Sqrt((double)gx * gx + (double)gy * gy) * GlowScale;- edgePixels[target + channel] = (byte)Math.Round(Math.Min(255.0, magnitude));- }- }- }- Marshal.Copy(edgePixels, 0, edgesData.Scan0, edgePixels.Length);- }- finally- {- sourceCopy.UnlockBits(sourceData);- edges.UnlockBits(edgesData);- }- }- return edges;- }-- /// <summary>- /// Returns the edge image scaled (bilinear) to <paramref name="targetSize"/>, the preview- /// frame size in picture-box pixels. The result is cached in <c>_glowOverlayCache</c> until a- /// different size is requested or the scene image changes.- /// </summary>- /// <returns>The cached 24bpp bitmap (owned by the form; do not dispose), or null when there is no scene image.</returns>- private Bitmap GetGlowOverlayResized(Size targetSize)- {- if (_glowEdgesImage == null)- {- return null;- }- if (_glowOverlayCache != null && _glowOverlayCacheSize.Equals(targetSize))- {- return _glowOverlayCache;- }- if (_glowOverlayCache != null)- {- _glowOverlayCache.Dispose();- }- Bitmap resized = new Bitmap(Math.Max(1, targetSize.Width), Math.Max(1, targetSize.Height), PixelFormat.Format24bppRgb);- using (Graphics g = Graphics.FromImage(resized))- {- g.Clear(Color.Black);- g.InterpolationMode = InterpolationMode.HighQualityBilinear;- g.DrawImage(_glowEdgesImage, new Rectangle(Point.Empty, targetSize));- }- _glowOverlayCache = resized;- _glowOverlayCacheSize = targetSize;- return resized;- }-- /// <summary>- /// Returns a copy of <paramref name="frame"/> with the glow-edges overlay (<see cref="ComputeGlowingEdges"/>,- /// <see cref="GetGlowOverlayResized"/>) additively blended on top, each of the overlay's bytes multiplied by- /// <paramref name="gain"/> first (<c>numBrightnessFieldOverlay</c>/<c>numBrightnessIntensityOverlay</c> - 1- /// leaves <see cref="ComputeGlowingEdges"/>' own brightness as is, above 1 brightens the overlay, 0 removes- /// it entirely). Multiplying (rather than e.g. adding a flat offset) is what keeps a still-black background- /// black at any gain - 0 times anything is still 0 - while scaling up faint edges where the color change- /// was small, which is the actual complaint this is for: a plain "brightness" slider that also lifted the- /// black background to gray would defeat its own purpose here. The overlay's black pixels (no edge there)- /// leave the frame untouched, and its bright pixels brighten the frame, clamped at 255 per channel; alpha- /// is left untouched. Frames with fewer than 3 bytes per pixel, or no overlay, give a plain copy.- /// </summary>- /// <param name="frame">The raw preview frame; never modified.</param>- /// <param name="gain">Overlay brightness multiplier; negative values count as 0.</param>- /// <returns>A new bitmap owned by the caller.</returns>- private Bitmap ComposeGlowOverlay(Bitmap frame, double gain)- {- Bitmap overlay = GetGlowOverlayResized(frame.Size);- Bitmap result = new Bitmap(frame);- if (overlay == null)- {- return result;- }- double overlayGain = Math.Max(0.0, gain);- int bytesPerDstPixel = Image.GetPixelFormatSize(result.PixelFormat) / 8;- if (bytesPerDstPixel < 3)- {- return result; // an indexed/unexpected format we can't safely blend into- }- Rectangle bounds = new Rectangle(0, 0, frame.Width, frame.Height);- BitmapData resultData = result.LockBits(bounds, ImageLockMode.ReadWrite, result.PixelFormat);- BitmapData overlayData = overlay.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);- try- {- int resultStride = resultData.Stride;- int overlayStride = overlayData.Stride;- int height = frame.Height;- int width = frame.Width;- byte[] resultPixels = new byte[resultStride * height];- byte[] overlayPixels = new byte[overlayStride * height];- Marshal.Copy(resultData.Scan0, resultPixels, 0, resultPixels.Length);- Marshal.Copy(overlayData.Scan0, overlayPixels, 0, overlayPixels.Length);- for (int y = 0; y < height; y++)- {- int resultRow = y * resultStride;- int overlayRow = y * overlayStride;- for (int x = 0; x < width; x++)- {- int resultOffset = resultRow + x * bytesPerDstPixel;- int overlayOffset = overlayRow + x * 3;- // both layouts are B,G,R... (result may have a 4th, alpha byte - left untouched)- resultPixels[resultOffset] = (byte)Math.Round(Math.Min(255.0, resultPixels[resultOffset] + overlayPixels[overlayOffset] * overlayGain));- resultPixels[resultOffset + 1] = (byte)Math.Round(Math.Min(255.0, resultPixels[resultOffset + 1] + overlayPixels[overlayOffset + 1] * overlayGain));- resultPixels[resultOffset + 2] = (byte)Math.Round(Math.Min(255.0, resultPixels[resultOffset + 2] + overlayPixels[overlayOffset + 2] * overlayGain));- }- }- Marshal.Copy(resultPixels, 0, resultData.Scan0, resultPixels.Length);- }- finally- {- result.UnlockBits(resultData);- overlay.UnlockBits(overlayData);- }- return result;- }-- /// <summary>- /// Shows <paramref name="frame"/> in <paramref name="box"/>, taking ownership of it. The raw- /// frame is kept in <c>box.Tag</c> and <c>box.Image</c> receives either the same object or,- /// when <paramref name="gain"/> > 0 and an overlay exists, a composed copy. The previous raw- /// frame and previous composed image (when distinct) are disposed. Called on the UI thread- /// from <c>ShowPreview</c>, which <c>SimulationRunner</c> reaches through <c>PostToUi</c>.- /// </summary>- private void SetPreviewFrame(PictureBox box, Bitmap frame, double gain)- {- Image oldImage = box.Image;- Bitmap oldFrame = box.Tag as Bitmap;- box.Tag = frame;- box.Image = ((gain > 0.0 && _glowEdgesImage != null) ? ComposeGlowOverlay(frame, gain) : frame);- if (oldImage != null && !object.ReferenceEquals(oldImage, oldFrame))- {- oldImage.Dispose();- }- if (oldFrame != null)- {- oldFrame.Dispose();- }- }-- /// <summary>- /// Re-composes the overlay for a preview box from the raw frame kept in <c>box.Tag</c>- /// (no-op when the box is null or holds no frame), disposing the previously composed image.- /// Used when the overlay checkbox / brightness or the scene image changes.- /// </summary>- private void RefreshPreviewOverlay(PictureBox box, double gain)- {- if (box == null)- {- return;- }- Bitmap frame = box.Tag as Bitmap;- if (frame == null)- {- return;- }- Image oldImage = box.Image;- box.Image = ((gain > 0.0 && _glowEdgesImage != null) ? ComposeGlowOverlay(frame, gain) : frame);- if (oldImage != null && !object.ReferenceEquals(oldImage, frame))- {- oldImage.Dispose();- }- }-- /// <summary>Toggling the field overlay re-composes the field preview.</summary>- private void chkDiplayOverlayInField_CheckedChanged(object sender, EventArgs e)- {- RefreshPreviewOverlay(_picField, FieldOverlayGain());- }-- /// <summary>Toggling the intensity overlay re-composes the intensity preview.</summary>- private void chkDiplayOverlayInIntensity_CheckedChanged(object sender, EventArgs e)- {- RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain());- }-- /// <summary>- /// Changing the field overlay brightness re-composes the field preview. <c>numBrightnessFieldOverlay</c> /- /// <c>numBrightnessIntensityOverlay</c> (Viewer tab, next to the "Display overlay" checkboxes) scale the- /// glow-edges overlay's own brightness - 1 is the Designer default (no change), higher brightens faint- /// edges, 0 is the same as unchecking the overlay entirely. See <see cref="ComposeGlowOverlay"/>'s gain- /// parameter for why a multiplier (not a flat offset) is used.- /// </summary>- private void numBrightnessFieldOverlay_ValueChanged(object sender, EventArgs e)- {- RefreshPreviewOverlay(_picField, FieldOverlayGain());- }-- /// <summary>Changing the intensity overlay brightness re-composes the intensity preview (see <see cref="numBrightnessFieldOverlay_ValueChanged"/> for the gain semantics).</summary>- private void numBrightnessIntensityOverlay_ValueChanged(object sender, EventArgs e)- {- RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain());- }-- /// <summary>- /// Loads an image file into a new memory-backed 32bpp ARGB <see cref="Bitmap"/> so GDI+ does- /// not keep the file locked. Unreadable files throw the usual IO / GDI+ exceptions.- /// </summary>- private static Bitmap LoadImageCopy(string fullPath)- {- using (FileStream stream = new FileStream(fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))- using (Image image = Image.FromStream(stream))- {- return new Bitmap(image);- }- }-- /// <summary>- /// Size of the simulation canvas in canvas pixels: the scene image size in image mode- /// (<see cref="Size.Empty"/> when no image is loaded), otherwise the user-defined width and height.- /// </summary>- private Size EffectiveCanvas()- {- if (_scene.UseImage)- {- return (_sceneImage == null) ? Size.Empty : _sceneImage.Size;- }- return new Size(_scene.UserWidth, _scene.UserHeight);- }-- /// <summary>- /// Replaces the image in <paramref name="pic"/> (the source / probe placement boxes) with a copy- /// of the scene image, or with a black canvas of the effective size in user-defined mode, and- /// disposes the previous image. When the canvas size is not known yet a message is shown and- /// the box is left unchanged.- /// </summary>- private void ImportSceneImageInto(PictureBox pic)- {- Image oldImage = pic.Image;- Bitmap fresh;- if (_scene.UseImage && _sceneImage != null)- {- fresh = new Bitmap(_sceneImage);- }- else- {- Size canvas = EffectiveCanvas();- if (canvas.Width <= 0 || canvas.Height <= 0)- {- MessageBox.Show(this, "The canvas size is not known yet\r\n(choose a scene image, or a user defined width and height, on the Configuration tab first).", "Import scene image", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- fresh = new Bitmap(canvas.Width, canvas.Height);- using (Graphics g = Graphics.FromImage(fresh))- {- g.Clear(Color.Black);- }- }- pic.Image = fresh;- pic.Invalidate();- if (oldImage != null)- {- oldImage.Dispose();- }- }-- /// <summary>- /// Like <see cref="ImportSceneImageInto"/> but only when <paramref name="pic"/> has no image yet,- /// and silently does nothing when the canvas size is unknown. Called when the Sources / Probes- /// tabs are shown.- /// </summary>- private void AutoLoadSceneImageIfEmpty(PictureBox pic)- {- if (pic == null || pic.Image != null)- {- return;- }- if (_scene.UseImage && _sceneImage != null)- {- pic.Image = new Bitmap(_sceneImage);- pic.Invalidate();- }- else- {- Size canvas = EffectiveCanvas();- if (canvas.Width <= 0 || canvas.Height <= 0)- {- return; // canvas size not known yet - nothing to show- }- Bitmap placeholder = new Bitmap(canvas.Width, canvas.Height);- using (Graphics g = Graphics.FromImage(placeholder))- {- g.Clear(Color.Black);- }- pic.Image = placeholder;- pic.Invalidate();- }- }-- /// <summary>- /// Parses <paramref name="text"/> as an unsigned decimal integer (invariant culture, digits only- /// after trimming) and checks it lies in <paramref name="minValue"/>..<paramref name="maxValue"/>.- /// </summary>- /// <param name="text">Text box content; leading / trailing whitespace is trimmed.</param>- /// <param name="minValue">Smallest accepted value, inclusive.</param>- /// <param name="maxValue">Largest accepted value, inclusive.</param>- /// <param name="value">Receives the parsed number (0 when parsing fails), even when the range check fails.</param>- /// <returns>True when the text parsed and is within range.</returns>- private static bool TryParseInt(string text, int minValue, int maxValue, ref int value)- {- return int.TryParse(text.Trim(), NumberStyles.None, CultureInfo.InvariantCulture, out value) && value >= minValue && value <= maxValue;- }-- /// <summary>- /// Validates the damping-edge text: it must be a whole number 1..<see cref="SceneSettings.MaxDampingEdgeSize"/>- /// and, when the canvas size is known, less than half of the smaller canvas side.- /// </summary>- /// <param name="text">Content of the damping-edge text box.</param>- /// <param name="value">Receives the parsed number.</param>- /// <returns>An empty string when acceptable, otherwise the message to show the user.</returns>- private string DampingProblem(string text, ref int value)- {- if (!Form1.TryParseInt(text, 1, SceneSettings.MaxDampingEdgeSize, ref value))- {- return "Enter a whole number of pixels, 1 or more.";- }- Size size = EffectiveCanvas();- int smallerSide = Math.Min(size.Width, size.Height);- if (size.Width > 0 && 2 * value >= smallerSide)- {- return "The damping edge must be less than half of the smaller canvas side (" + smallerSide.ToString(CultureInfo.InvariantCulture) + " px).";- }- return "";- }-- /// <summary>Colours the damping-edge text box red when its text is not acceptable for the current canvas size, without changing the stored value.</summary>- private void ShowDampingValidity()- {- int value = 0;- bool valid = DampingProblem(txtDampingEdgeSize.Text, ref value).Length == 0;- txtDampingEdgeSize.ForeColor = valid ? SystemColors.WindowText : Color.Red;- }-- /// <summary>- /// Switching between "use scene image" and "user defined" stores the mode, rebuilds or clears- /// the glow overlay, updates control enabling, the preview and the damping validation, and- /// marks the project changed. Ignored for the radio being unchecked and while <c>_loadingScene</c> is set.- /// Switching to <c>radUserDefinedScene</c> drops the glow-edges overlay (<see cref="ClearGlowEdgesImage"/>) -- /// without it, a "Display overlay" checkbox left checked on the Preview tab would otherwise keep showing- /// the old scene image's overlay, which no longer corresponds to anything in a user-defined scene, and that- /// stale overlay would then also be baked into any picture shared afterwards into the Sources/Probes tabs- /// (<see cref="CopyPreviewToTabs"/>). <c>_sceneImage</c> itself is kept (not disposed) so switching back to- /// <c>radUseSceneImage</c> restores the overlay too, via <see cref="UpdateGlowEdgesImage"/>, without needing- /// to reload the image file.- /// </summary>- private void SceneMode_CheckedChanged(object sender, EventArgs e)- {- if (_loadingScene)- {- return;- }- RadioButton radio = (RadioButton)sender;- if (!radio.Checked)- {- return;- }- _scene.UseImage = object.ReferenceEquals(radio, radUseSceneImage);- if (_scene.UseImage)- {- UpdateGlowEdgesImage();- }- else- {- ClearGlowEdgesImage();- RefreshPreviewOverlay(_picField, FieldOverlayGain());- RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain());- }- UpdateSceneControlState();- UpdateScenePreview();- ShowDampingValidity();- MarkProjectChanged();- }-- /// <summary>- /// Lets the user pick an image file, loads it as the scene image, copies it into the project's- /// scene-image folder when it lies outside the project folder, stores the project-relative path,- /// switches to image mode and marks the project changed. Unreadable files are reported and nothing- /// changes. Also invoked from the Output tab's "load external" button.- /// </summary>- private void btnLOadSceneImage_Click(object sender, EventArgs e)- {- string projectFolder = ((_project == null) ? "" : _project.FolderPath);- using (OpenFileDialog dialog = new OpenFileDialog())- {- dialog.Title = "Choose the scene image";- dialog.Filter = "Images (*.png;*.jpg;*.jpeg;*.bmp;*.tif;*.tiff;*.gif)|*.png;*.jpg;*.jpeg;*.bmp;*.tif;*.tiff;*.gif|All files (*.*)|*.*";- if (_project != null)- {- if (Directory.Exists(_project.SceneImageFolder))- {- dialog.InitialDirectory = _project.SceneImageFolder;- }- else- {- dialog.InitialDirectory = _project.FolderPath;- }- }- if (dialog.ShowDialog(this) != DialogResult.OK)- {- return;- }- Bitmap image;- try- {- image = Form1.LoadImageCopy(dialog.FileName);- }- catch (Exception ex)- {- MessageBox.Show(this, "The file could not be read as an image:\r\n\r\n" + ex.Message, "Scene image", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- return;- }- ReplaceSceneImage(image);- // an image from outside the project's own folder is copied in, so the project does not depend on a file- // elsewhere on disk; the copy is what gets used and saved from here on- string imagePath = dialog.FileName;- if (_project != null && !Form1.IsInsideFolder(imagePath, _project.FolderPath))- {- imagePath = Form1.CopyIntoSceneImageFolder(_project, imagePath);- }- _scene.ImageFile = SceneSettings.ToStoredPath(projectFolder, imagePath);- _scene.UseImage = true;- }- _loadingScene = true;- try- {- radUseSceneImage.Checked = true;- }- finally- {- _loadingScene = false;- }- UpdateSceneControlState();- UpdateScenePreview();- ShowDampingValidity();- MarkProjectChanged();- }-- /// <summary>- /// Typing a user-defined width or height (<see cref="SceneSettings.MinCanvasSize"/>..<see cref="SceneSettings.MaxCanvasSize"/>)- /// stores it, refreshes the preview and damping validation and marks the project changed; invalid text- /// turns the box red and shows a tooltip without changing the stored value.- /// </summary>- private void CanvasSize_TextChanged(object sender, EventArgs e)- {- if (_loadingScene)- {- return;- }- TextBox box = (TextBox)sender;- int size = 0;- if (Form1.TryParseInt(box.Text, SceneSettings.MinCanvasSize, SceneSettings.MaxCanvasSize, ref size))- {- box.ForeColor = SystemColors.WindowText;- _sceneTip.Hide(box);- if (object.ReferenceEquals(box, txtXSize))- {- _scene.UserWidth = size;- }- else- {- _scene.UserHeight = size;- }- UpdateScenePreview();- ShowDampingValidity();- MarkProjectChanged();- }- else- {- box.ForeColor = Color.Red;- _sceneTip.Show("Enter a whole number of pixels from " + SceneSettings.MinCanvasSize.ToString(CultureInfo.InvariantCulture) + " to " + SceneSettings.MaxCanvasSize.ToString(CultureInfo.InvariantCulture) + ".", box, 0, box.Height + 2, 3000);- }- }-- /// <summary>Stores the damping-edge on/off flag, enables or disables the size box and marks the project changed.</summary>- private void chkDampingEdge_CheckedChanged(object sender, EventArgs e)- {- if (_loadingScene)- {- return;- }- _scene.DampingEdgeEnabled = chkDampingEdge.Checked;- UpdateSceneControlState();- MarkProjectChanged();- }-- /// <summary>- /// Stores the damping-edge size when <see cref="DampingProblem"/> accepts the text and marks the- /// project changed; otherwise turns the box red and shows the problem as a tooltip.- /// </summary>- private void DampingSize_TextChanged(object sender, EventArgs e)- {- if (_loadingScene)- {- return;- }- int value = 0;- string problem = DampingProblem(txtDampingEdgeSize.Text, ref value);- if (problem.Length == 0)- {- _scene.DampingEdgeSize = value;- txtDampingEdgeSize.ForeColor = SystemColors.WindowText;- _sceneTip.Hide(txtDampingEdgeSize);- MarkProjectChanged();- }- else- {- txtDampingEdgeSize.ForeColor = Color.Red;- _sceneTip.Show(problem, txtDampingEdgeSize, 0, txtDampingEdgeSize.Height + 2, 3000);- }- }-- /// <summary>- /// Leaving a canvas-size or damping-size text box restores the last accepted value from- /// <c>_scene</c> (under <c>_loadingScene</c> so no change handler runs), resets the text colour- /// and re-validates the damping edge.- /// </summary>- private void SceneText_Leave(object sender, EventArgs e)- {- TextBox box = (TextBox)sender;- _sceneTip.Hide(box);- _loadingScene = true;- try- {- if (object.ReferenceEquals(box, txtXSize))- {- box.Text = _scene.UserWidth.ToString(CultureInfo.InvariantCulture);- }- else if (object.ReferenceEquals(box, txtYsize))- {- box.Text = _scene.UserHeight.ToString(CultureInfo.InvariantCulture);- }- else- {- box.Text = _scene.DampingEdgeSize.ToString(CultureInfo.InvariantCulture);- }- box.ForeColor = SystemColors.WindowText;- }- finally- {- _loadingScene = false;- }- ShowDampingValidity();- }-- /// <summary>Stores whether green pixels of the scene image act as sources, enables or disables the scale box and marks the project changed.</summary>- private void chkUseSources_CheckedChanged(object sender, EventArgs e)- {- if (_loadingScene)- {- return;- }- _scene.UseSources = chkUseImageSources.Checked;- UpdateSceneControlState();- MarkProjectChanged();- }-- /// <summary>Stores whether the object sources from the source list are used and marks the project changed.</summary>- private void chkUseObjectSources_CheckedChanged(object sender, EventArgs e)- {- if (_loadingScene)- {- return;- }- _scene.UseObjectSources = chkUseObjectSources.Checked;- MarkProjectChanged();- }-- /// <summary>Stores the image-source intensity scale (0..<see cref="SceneSettings.MaxImageSourceScale"/>) and marks the project changed.</summary>- private void ImageSourceScale_ValueChanged(object sender, EventArgs e)- {- if (_loadingScene)- {- return;- }- _scene.ImageSourceScale = Convert.ToDouble(numScaleImageSource.Value);- MarkProjectChanged();- }-- /// <summary>Stores the background refractive index of the user-defined (empty) scene and marks the project changed.</summary>- private void RefractiveIndex_ValueChanged(object sender, EventArgs e)- {- if (_loadingScene)- {- return;- }- _scene.BackgroundRefractiveIndex = Convert.ToDouble(numRefractiveIndex.Value);- MarkProjectChanged();- }-- /// <summary>- /// Converts <paramref name="value"/> to a decimal clamped to the <see cref="NumericUpDown.Minimum"/>..- /// <see cref="NumericUpDown.Maximum"/> range of <paramref name="box"/>, so that assigning it to- /// <see cref="NumericUpDown.Value"/> cannot throw. Used by all tabs when loading settings.- /// </summary>- private static decimal ClampToRange(NumericUpDown box, double value)- {- return (value < Convert.ToDouble(box.Minimum)) ? box.Minimum : ((value > Convert.ToDouble(box.Maximum)) ? box.Maximum : new decimal(value));- }-- /// <summary>Jumps to the source list tab.</summary>- private void btnEditSourceList_Click(object sender, EventArgs e)- {- tabMainFunctions.SelectedTab = tabSourceList;- }- }-}diff --git a/Wave_Dude_2D/Form1.Simulation.cs b/Wave_Dude_2D/Form1.Simulation.csdeleted file mode 100644index 6a2a3fb..0000000--- a/Wave_Dude_2D/Form1.Simulation.cs+++ /dev/null@@ -1,1530 +0,0 @@-using System;-using System.Collections.Generic;-using System.Diagnostics;-using System.Drawing;-using System.Drawing.Imaging;-using System.Globalization;-using System.IO;-using System.Reflection;-using System.Runtime.InteropServices;-using System.Threading;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Simulation: the settings on the Configuration tab (steps, video export, previews, color schemes) are kept- /// in <c>_simulation</c> (a <see cref="SimulationSettings"/>) and saved in configuration.json with the- /// project. "Start simulation" hands a copy of everything to a <see cref="SimulationRunner"/>, which does the- /// work on a background thread. The runner reports back through events; <see cref="PostToUi"/> passes them- /// on to this (the UI) thread. Also home to the Preview tab (run/pause/stop, the field / intensity preview- /// boxes with the glow-edges overlay, sharing pictures with the Sources/Probes tabs, still-frame export,- /// opening the output folders in Explorer). Everything here runs on the UI thread unless stated otherwise.- /// </summary>- public partial class Form1- {- /// <summary>- /// Called once from <c>Form1_Load</c>: sets the ranges of the simulation NumericUpDowns (the viewer-tab scaling boxes copy- /// the configuration-tab ones), creates the four black preview boxes and puts the buttons, labels and status bar in their idle state.- /// </summary>- private void InitializeSimulationControls()- {- numVisualizeEvery.Minimum = 1m;-- // brightness factors of the field and intensity pictures (render_field / render_intensity in the Python code)- numFieldScaling.Minimum = 0.1m;- numFieldScaling.Maximum = 1000m;- numIntensityScaling.Minimum = 0.1m;- numIntensityScaling.Maximum = 1000m;-- // numFieldScaling2/numIntensityScaling2 (Viewer tab) are a second set of controls for the very same- // FieldBrightness/IntensityBrightness values as numFieldScaling/numIntensityScaling (Configuration tab) -- // see numScaleFieldValues_ValueChanged/numScaleIntensity_ValueChanged and their "2" counterparts, which- // keep both pairs in sync. Match the originals' range/precision so a value entered in either pair means- // the same thing and is not rejected/rounded differently by the other.- numFieldScaling2.Minimum = numFieldScaling.Minimum;- numFieldScaling2.Maximum = numFieldScaling.Maximum;- numFieldScaling2.DecimalPlaces = numFieldScaling.DecimalPlaces;- numFieldScaling2.Increment = numFieldScaling.Increment;- numIntensityScaling2.Minimum = numIntensityScaling.Minimum;- numIntensityScaling2.Maximum = numIntensityScaling.Maximum;- numIntensityScaling2.DecimalPlaces = numIntensityScaling.DecimalPlaces;- numIntensityScaling2.Increment = numIntensityScaling.Increment;-- // offsets (black levels of the color tables): 2 decimals, otherwise the default of -0.05 would be rounded- foreach (NumericUpDown offsetBox in new NumericUpDown[] { numOffsetField, numOffsetIntensity })- {- offsetBox.DecimalPlaces = 2;- offsetBox.Minimum = -1m;- offsetBox.Maximum = 1m;- offsetBox.Increment = 0.01m;- }-- numQuality.Minimum = 1m;- numQuality.Maximum = 100m;- numQuality.DecimalPlaces = 0;-- // the summary of a run is shown in the status bar, its details in the tooltip- StatusStrip1.ShowItemToolTips = true;- ToolStripStatusLabel1.Spring = true;- ToolStripStatusLabel1.TextAlign = ContentAlignment.MiddleLeft;- ToolStripStatusLabel1.Text = "";-- UpdateRunButtons();-- btnViewIntensityVideo.Text = "View intensity video in media player";- UpdateVideoButtons();- cmbFieldColorScheme.DropDownStyle = ComboBoxStyle.DropDownList;- cmbIntensityColorScheme.DropDownStyle = ComboBoxStyle.DropDownList;-- _picField = Form1.MakePreviewBox(pnlPreviewField);- _picIntensity = Form1.MakePreviewBox(pnlPreviewIntensity);- _picSource = Form1.MakePreviewBox(pnlSourceImage);- _picProbe = Form1.MakePreviewBox(pnlProbeImage);- UpdateCopyButtons();-- // warn, in lblWarningField/lblWarningIntensity, when the last (or next) run will not export that video -- // shown/hidden per video in UpdateSimulationControlState; these are Designer labels placed in the clear,- // not (like the dynamic label this used to be) a control positioned over other controls at runtime- lblWarningField.Text = "Field video not exported";- lblWarningField.ForeColor = Color.DarkBlue;- lblWarningIntensity.Text = "Intensity video not exported";- lblWarningIntensity.ForeColor = Color.DarkBlue;-- // No ShowSimulationInControls() here: grpSimulationSettings is disabled until a real project exists- // (UpdateProjectAccess). Steps and TimeDecayFactor have no software default of their own any more (see- // their comments in SimulationSettings) - populating the controls now, from the blank _simulation this- // form starts with, would clamp numSimulationSteps/numTimeDecayFactor down from their Designer defaults- // (3000 and 10) to their Minimum before StartNewProject ever gets a chance to read the Designer value back- // out of them. StartNewProject/SetCurrentProject call ShowSimulationInControls() themselves once a real- // project exists.- }-- /// <summary>Creates a black, zoom-to-fit <see cref="PictureBox"/> that fills <paramref name="host"/>.</summary>- private static PictureBox MakePreviewBox(Panel host)- {- host.BackColor = Color.Black;- PictureBox pictureBox = new PictureBox();- pictureBox.Dock = DockStyle.Fill;- pictureBox.SizeMode = PictureBoxSizeMode.Zoom;- pictureBox.BackColor = Color.Black;- host.Controls.Add(pictureBox);- return pictureBox;- }-- /// <summary>- /// Copies <c>_simulation</c> into the controls, clamping every value to its box's range (the clamped- /// <c>VisualizeEvery</c> is written back into the settings). <c>_loadingSim</c> is set meanwhile so the- /// ValueChanged handlers neither write back nor mark the project dirty.- /// </summary>- private void ShowSimulationInControls()- {- _loadingSim = true;- try- {- // the range of the numeric box is set in the designer; keep the settings inside it- int visualizeEvery = Math.Max(Convert.ToInt32(numVisualizeEvery.Minimum), Math.Min(Convert.ToInt32(numVisualizeEvery.Maximum), _simulation.VisualizeEvery));- _simulation.VisualizeEvery = visualizeEvery;- numSimulationSteps.Value = Form1.ClampToRange(numSimulationSteps, _simulation.Steps);- numVisualizeEvery.Value = visualizeEvery;- numFieldScaling.Value = Form1.ClampToRange(numFieldScaling, _simulation.FieldBrightness);- numIntensityScaling.Value = Form1.ClampToRange(numIntensityScaling, _simulation.IntensityBrightness);- numFieldScaling2.Value = Form1.ClampToRange(numFieldScaling2, _simulation.FieldBrightness);- numIntensityScaling2.Value = Form1.ClampToRange(numIntensityScaling2, _simulation.IntensityBrightness);- numQuality.Value = Form1.ClampToRange(numQuality, _simulation.VideoQuality);- numOffsetField.Value = Form1.ClampToRange(numOffsetField, _simulation.FieldBlackLevel);- numOffsetIntensity.Value = Form1.ClampToRange(numOffsetIntensity, _simulation.IntensityBlackLevel);- numTimeDecayFactor.Value = Form1.ClampToRange(numTimeDecayFactor, _simulation.TimeDecayFactor);- chkExportVideoField.Checked = _simulation.ExportField;- chkExportVideoIntensity.Checked = _simulation.ExportIntensity;- chkExportVideoField2.Checked = _simulation.ExportField;- chkExportVideoIntensity2.Checked = _simulation.ExportIntensity;- chkPreviewVideoField.Checked = _simulation.PreviewField;- chkPreviewVideoIntensity.Checked = _simulation.PreviewIntensity;- chkUseGPU.Checked = _simulation.UseGpu;- chkUse4thOrderLaplacian.Checked = _simulation.Use4thOrderLaplacian;- FillSchemeCombo(cmbFieldColorScheme, ColorScheme.SchemeTypeField, _simulation.FieldColorScheme);- FillSchemeCombo(cmbIntensityColorScheme, ColorScheme.SchemeTypeIntensity, _simulation.IntensityColorScheme);- }- finally- {- _loadingSim = false;- }- UpdateSimulationControlState();- }-- /// <summary>Enables the scheme combos, the quality box and the "not exported" warnings according to the export / preview check boxes.</summary>- private void UpdateSimulationControlState()- {- cmbFieldColorScheme.Enabled = chkExportVideoField.Checked || chkPreviewVideoField.Checked;- cmbIntensityColorScheme.Enabled = chkExportVideoIntensity.Checked || chkPreviewVideoIntensity.Checked;- // the quality only matters for exported videos- bool exporting = chkExportVideoField.Checked || chkExportVideoIntensity.Checked;- numQuality.Enabled = exporting;- lblVideoQuality.Enabled = exporting;- lblWarningField.Visible = !chkExportVideoField.Checked;- lblWarningIntensity.Visible = !chkExportVideoIntensity.Checked;- }-- /// <summary>- /// Refills both scheme combos from <c>_schemes</c> (after the scheme list was reloaded) keeping the stored selections,- /// without dirtying the project. Saves and restores <c>_loadingSim</c> so it can be called while a load is in progress.- /// </summary>- private void RefreshSchemeCombos()- {- bool wasLoading = _loadingSim;- _loadingSim = true;- try- {- FillSchemeCombo(cmbFieldColorScheme, ColorScheme.SchemeTypeField, _simulation.FieldColorScheme);- FillSchemeCombo(cmbIntensityColorScheme, ColorScheme.SchemeTypeIntensity, _simulation.IntensityColorScheme);- }- finally- {- _loadingSim = wasLoading;- }- }-- /// <summary>Fills <paramref name="combo"/> with the schemes of one type and selects the one named <paramref name="selectedName"/> (case-insensitive), or nothing. Schemes without a type are left out.</summary>- /// <param name="combo">The field or intensity scheme combo; its items become <see cref="ColorScheme"/> objects.</param>- /// <param name="schemeType"><see cref="ColorScheme.SchemeTypeField"/> or <see cref="ColorScheme.SchemeTypeIntensity"/>.</param>- /// <param name="selectedName">Name of the scheme to select; no selection when it is not in the list.</param>- private void FillSchemeCombo(ComboBox combo, string schemeType, string selectedName)- {- combo.BeginUpdate();- try- {- combo.Items.Clear();- ColorScheme selected = null;- foreach (ColorScheme scheme in _schemes)- {- if (string.Equals(scheme.SchemeType, schemeType, StringComparison.OrdinalIgnoreCase))- {- combo.Items.Add(scheme);- if (string.Equals(scheme.Name, selectedName, StringComparison.OrdinalIgnoreCase))- {- selected = scheme;- }- }- }- if (selected != null)- {- combo.SelectedItem = selected;- }- else- {- combo.SelectedIndex = -1;- }- }- finally- {- combo.EndUpdate();- }- }-- /// <summary>Looks up a loaded scheme by name and type (both case-insensitive).</summary>- /// <returns>The scheme, or null when no such scheme is loaded.</returns>- private ColorScheme FindScheme(string name, string schemeType)- {- foreach (ColorScheme scheme in _schemes)- {- if (string.Equals(scheme.Name, name, StringComparison.OrdinalIgnoreCase) && string.Equals(scheme.SchemeType, schemeType, StringComparison.OrdinalIgnoreCase))- {- return scheme;- }- }- return null;- }-- /// <summary>- /// Switching to the Configuration tab reloads the scheme list from the scheme folder (or just refills the combos when the- /// folder does not exist); switching to the Output tab refreshes its project list, preferring the current project.- /// </summary>- private void tabMainFunctions_SelectedIndexChanged(object sender, EventArgs e)- {- // cmbFieldColorScheme/cmbIntensityColorScheme live on the Configuration tab. Schemes may have been added,- // renamed or deleted on the Color Scheme tab since these were last filled - or even just added to the- // folder from outside the app - so re-read the scheme folder from disk (RefreshSchemeCombos alone only- // refills the combos from the in-memory list, which can be stale) rather than assume it is still current.- if (tabMainFunctions.SelectedTab == tabConfiguration)- {- string schemeFolder = txtSchemeFolder.Text.Trim();- if (Directory.Exists(schemeFolder))- {- LoadSchemeList();- }- else- {- RefreshSchemeCombos();- }- }- // lstAllProjects3 (Outputs tab) has the same staleness problem - a project may have appeared, been- // renamed or been deleted since it was last filled, so re-read it fresh on every arrival too. Default the- // selection to whichever project is currently open in the editor (falls back to the previous selection,- // or none, when no project is open - see RefreshOutputProjectList).- if (tabMainFunctions.SelectedTab == tabOutput)- {- RefreshOutputProjectList((_project != null) ? _project.Name : "");- }- }-- /// <summary>- /// Stores the number of steps and marks the project dirty. <c>numSimulationSteps</c> replaces the old- /// <c>cmbSimulationSteps</c> combo box, so the number of steps is no longer limited to a fixed preset list -- /// the range (currently 1 to 50,000) is set in the Designer, and the control itself never allows an- /// out-of-range or non-integer value, so unlike the old free-text combo this needs no separate- /// parsing/validation/error-coloring here.- /// </summary>- private void numSimulationSteps_ValueChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.Steps = Convert.ToInt32(numSimulationSteps.Value);- MarkProjectChanged();- }- }-- /// <summary>Stores how many steps go by between two rendered frames.</summary>- private void numVisualizeEvery_ValueChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.VisualizeEvery = Convert.ToInt32(numVisualizeEvery.Value);- MarkProjectChanged();- }- }-- /// <summary>- /// Copies a value into a NumericUpDown that mirrors another one (<c>numFieldScaling</c>/<c>numFieldScaling2</c>,- /// <c>numIntensityScaling</c>/<c>numIntensityScaling2</c> - Configuration tab and Viewer tab controls for the- /// very same setting), without re-triggering that control's own ValueChanged - every simulation control's- /// ValueChanged already checks <c>_loadingSim</c> first, so reusing it here as the reentrancy guard stops- /// the two controls from setting each other back and forth.- /// </summary>- private void SetLinkedScalingValue(NumericUpDown box, decimal value)- {- decimal clamped = (value < box.Minimum) ? box.Minimum : ((value > box.Maximum) ? box.Maximum : value);- if (box.Value != clamped)- {- bool wasLoading = _loadingSim;- _loadingSim = true;- try- {- box.Value = clamped;- }- finally- {- _loadingSim = wasLoading;- }- }- }-- /// <summary>- /// Copies a checked state into a CheckBox that mirrors another one (<c>chkExportVideoField</c>/- /// <c>chkExportVideoField2</c>, <c>chkExportVideoIntensity</c>/<c>chkExportVideoIntensity2</c> - Configuration- /// tab and Viewer tab controls for the very same setting) - the same <c>_loadingSim</c> reentrancy-guard idea- /// as <see cref="SetLinkedScalingValue"/>, for a CheckBox's Checked instead of a NumericUpDown's Value.- /// </summary>- private void SetLinkedCheckedValue(CheckBox box, bool value)- {- if (box.Checked != value)- {- bool wasLoading = _loadingSim;- _loadingSim = true;- try- {- box.Checked = value;- }- finally- {- _loadingSim = wasLoading;- }- }- }-- /// <summary>Stores the field brightness and mirrors it into the viewer-tab box.</summary>- private void numScaleFieldValues_ValueChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.FieldBrightness = Convert.ToDouble(numFieldScaling.Value);- SetLinkedScalingValue(numFieldScaling2, numFieldScaling.Value);- MarkProjectChanged();- }- }-- /// <summary>Viewer-tab copy: stores the field brightness and mirrors it back into the configuration-tab box.</summary>- private void numScaleFieldValues2_ValueChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.FieldBrightness = Convert.ToDouble(numFieldScaling2.Value);- SetLinkedScalingValue(numFieldScaling, numFieldScaling2.Value);- MarkProjectChanged();- }- }-- /// <summary>Stores the video quality (1..100).</summary>- private void numQuality_ValueChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.VideoQuality = Convert.ToInt32(numQuality.Value);- MarkProjectChanged();- }- }-- /// <summary>Stores the field black level (-1..1 palette offset).</summary>- private void numOffsetField_ValueChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.FieldBlackLevel = Convert.ToDouble(numOffsetField.Value);- MarkProjectChanged();- }- }-- /// <summary>Stores the intensity black level (-1..1 palette offset).</summary>- private void numOffsetIntensity_ValueChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.IntensityBlackLevel = Convert.ToDouble(numOffsetIntensity.Value);- MarkProjectChanged();- }- }-- /// <summary>Stores the time decay factor.</summary>- private void numTimeDecayFactor_ValueChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.TimeDecayFactor = Convert.ToDouble(numTimeDecayFactor.Value);- MarkProjectChanged();- }- }-- /// <summary>Stores the intensity brightness and mirrors it into the viewer-tab box.</summary>- private void numScaleIntensity_ValueChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.IntensityBrightness = Convert.ToDouble(numIntensityScaling.Value);- SetLinkedScalingValue(numIntensityScaling2, numIntensityScaling.Value);- MarkProjectChanged();- }- }-- /// <summary>Viewer-tab copy: stores the intensity brightness and mirrors it back into the configuration-tab box.</summary>- private void numScaleIntensity2_ValueChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.IntensityBrightness = Convert.ToDouble(numIntensityScaling2.Value);- SetLinkedScalingValue(numIntensityScaling, numIntensityScaling2.Value);- MarkProjectChanged();- }- }-- /// <summary>- /// Shared handler of the four export / preview boxes on the configuration tab: stores all four flags, mirrors the two- /// export flags into the viewer tab and updates the dependent controls.- /// </summary>- private void SimulationOption_CheckedChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.ExportField = chkExportVideoField.Checked;- _simulation.ExportIntensity = chkExportVideoIntensity.Checked;- _simulation.PreviewField = chkPreviewVideoField.Checked;- _simulation.PreviewIntensity = chkPreviewVideoIntensity.Checked;- SetLinkedCheckedValue(chkExportVideoField2, chkExportVideoField.Checked);- SetLinkedCheckedValue(chkExportVideoIntensity2, chkExportVideoIntensity.Checked);- UpdateSimulationControlState();- MarkProjectChanged();- }- }-- /// <summary>Viewer-tab copy of the field export box: stores the flag and mirrors it back.</summary>- private void chkExportVideoField2_CheckedChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.ExportField = chkExportVideoField2.Checked;- SetLinkedCheckedValue(chkExportVideoField, chkExportVideoField2.Checked);- UpdateSimulationControlState();- MarkProjectChanged();- }- }-- /// <summary>Viewer-tab copy of the intensity export box: stores the flag and mirrors it back.</summary>- private void chkExportVideoIntensity2_CheckedChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.ExportIntensity = chkExportVideoIntensity2.Checked;- SetLinkedCheckedValue(chkExportVideoIntensity, chkExportVideoIntensity2.Checked);- UpdateSimulationControlState();- MarkProjectChanged();- }- }-- /// <summary>Stores whether the OpenCL engine is tried first.</summary>- private void chkUseGPU_CheckedChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.UseGpu = chkUseGPU.Checked;- MarkProjectChanged();- }- }-- /// <summary>Stores the Laplacian order choice.</summary>- private void chkUse4thOrderLaplacian_CheckedChanged(object sender, EventArgs e)- {- if (!_loadingSim)- {- _simulation.Use4thOrderLaplacian = chkUse4thOrderLaplacian.Checked;- MarkProjectChanged();- }- }-- /// <summary>Shared handler of both scheme combos: stores the chosen scheme name in the field or intensity setting, depending on which combo raised it.</summary>- private void SchemeCombo_SelectedIndexChanged(object sender, EventArgs e)- {- if (_loadingSim)- {- return;- }- ComboBox combo = (ComboBox)sender;- ColorScheme scheme = combo.SelectedItem as ColorScheme;- if (scheme == null)- {- return;- }- if (combo == cmbFieldColorScheme)- {- _simulation.FieldColorScheme = scheme.Name;- }- else- {- _simulation.IntensityColorScheme = scheme.Name;- }- MarkProjectChanged();- }-- /// <summary>Starts a run, or asks the running one to stop (the button doubles as Stop while a run is active).</summary>- private void btnStartSimulation_Click(object sender, EventArgs e)- {- if (_runner != null)- {- // the button is also a stop button while a simulation runs- RequestStop();- }- else- {- StartSimulation();- }- }-- /// <summary>- /// Puts a copy of the current scene image (or the black placeholder when there is none) in- /// <c>pnlSourceImage</c> and <c>pnlProbeImage</c> - the same picture the "Import scene image" buttons on- /// those tabs load, just from here instead (<see cref="ImportSceneImageInto"/>).- /// </summary>- private void btnShareSceneImage_Click(object sender, EventArgs e)- {- ImportSceneImageInto(_picSource);- ImportSceneImageInto(_picProbe);- }-- /// <summary>Copies the field preview into the Sources and Probes picture boxes.</summary>- private void btnShareFieldImage_Click(object sender, EventArgs e)- {- CopyPreviewToTabs(_picField);- }-- /// <summary>Copies the intensity preview into the Sources and Probes picture boxes.</summary>- private void btnShareIntensityImage_Click(object sender, EventArgs e)- {- CopyPreviewToTabs(_picIntensity);- }-- /// <summary>- /// Gives <c>_picSource</c> and <c>_picProbe</c> (Sources tab and Probes tab) each their own copy of the image- /// in <paramref name="source"/>, disposing what they showed before - <c>source.Image</c> exactly as currently- /// displayed, glow-edges overlay baked in when "Display overlay" happens to be checked for that preview- /// (<see cref="SetPreviewFrame"/>/<see cref="RefreshPreviewOverlay"/>), and not when it is not. Does nothing- /// when there is no image.- /// </summary>- private void CopyPreviewToTabs(PictureBox source)- {- Image image = source.Image;- if (image == null)- {- return;- }- foreach (PictureBox target in new PictureBox[] { _picSource, _picProbe })- {- Bitmap copy = new Bitmap(image);- Image previous = target.Image;- target.Image = copy;- if (previous != null)- {- previous.Dispose();- }- }- }-- /// <summary>- /// The field/intensity share buttons are only on when their preview shows a picture; <c>btnShareSceneImage</c>- /// is not gated the same way, matching "Import scene image" on the Sources/Probes tabs, which always works- /// (it falls back to a black placeholder when there is no scene image). Also refreshes the export buttons.- /// </summary>- private void UpdateCopyButtons()- {- btnShareFieldImage.Enabled = _picField != null && _picField.Image != null;- btnShareIntensityImage.Enabled = _picIntensity != null && _picIntensity.Image != null;- UpdateExportButtons();- }-- /// <summary>- /// The "Export current Field/Intensity frame" buttons are only on while the simulation is not actively- /// running (paused, or fully stopped) and there is something to export: either a live, paused engine- /// (<see cref="SimulationRunner.RenderCurrentFrame"/>), a full-resolution snapshot cached from the last run- /// (<c>_lastFullFieldFrame</c> / <c>_lastFullIntensityFrame</c>), or at least the picture currently shown in- /// the preview.- /// </summary>- private void UpdateExportButtons()- {- bool canExport = _paused || _runner == null;- btnExportFieldFrame.Enabled = canExport && (_lastFullFieldFrame != null || (_picField != null && _picField.Image != null));- btnExportIntensityFrame.Enabled = canExport && (_lastFullIntensityFrame != null || (_picIntensity != null && _picIntensity.Image != null));- }-- /// <summary>- /// Toggles pause: blocks or releases the runner's gate, switches the status texts and shows the viewer tab on resume.- /// Ignored when nothing runs or a stop is already pending.- /// </summary>- private void btnPauzeResume_Click(object sender, EventArgs e)- {- if (_runner == null || _stopRequested)- {- return;- }- if (_paused)- {- _paused = false;- _simStatus = _progressText;- ToolStripStatusLabel1.Text = "Simulation running...";- _runner.ResumeRun();- // back to the Preview tab, so the user follows the simulation again- tabMainFunctions.SelectedTab = tabViewer;- }- else- {- _paused = true;- _simStatus = "paused - " + _progressText;- ToolStripStatusLabel1.Text = "Simulation paused (press Resume to continue, or Stop to finish and save the videos)";- _runner.PauseRun();- }- UpdateRunButtons();- UpdateTitle();- }-- /// <summary>Shows the Configuration tab.</summary>- private void btnGotoConfiguration_Click(object sender, EventArgs e)- {- tabMainFunctions.SelectedTab = tabConfiguration;- }-- /// <summary>Shows the Sources tab.</summary>- private void btnGotoSources_Click(object sender, EventArgs e)- {- tabMainFunctions.SelectedTab = tabSourceList;- }-- /// <summary>Shows the Probes tab.</summary>- private void btnGotoProbes_Click(object sender, EventArgs e)- {- tabMainFunctions.SelectedTab = tabProbeList;- }-- /// <summary>Shows the viewer tab.</summary>- private void btnGotoPreview_Click(object sender, EventArgs e)- {- tabMainFunctions.SelectedTab = tabViewer;- }-- /// <summary>- /// Asks the runner to cancel (it finishes the current step, closes the video files and raises <c>Finished</c>) and puts the- /// UI into the "stopping" state; the Start button is disabled until <see cref="OnSimulationFinished"/> re-enables it.- /// </summary>- private void RequestStop()- {- if (_runner == null || _stopRequested)- {- return;- }- _stopRequested = true;- _paused = false;- _runner.Cancel();- btnStartSimulation.Enabled = false;- btnStartSimulation.Text = "Stopping...";- _simStatus = "stopping...";- ToolStripStatusLabel1.Text = "Stopping the simulation and closing the video files...";- UpdateRunButtons();- UpdateTitle();- }-- /// <summary>- /// Greys the pause button when it cannot be used, sets its Pause / Resume caption and refreshes the export- /// buttons. The pause button on the Preview tab is only usable while a simulation runs.- /// <c>btnStartSimulation</c> is also the stop/restart button (see its own Click handler) and keeps its own- /// Text/Enabled state (<see cref="RequestStop"/>, <see cref="StartSimulation"/>,- /// <see cref="OnSimulationFinished"/>) - there used to be a separate <c>btnStopSimulation</c> for that,- /// removed as redundant once <c>btnStartSimulation</c> started doing double duty.- /// </summary>- private void UpdateRunButtons()- {- bool canPause = _runner != null && !_stopRequested;- // Not actually disabling the button here: with its custom Azure BackColor, Windows' own disabled-button- // rendering draws the text with a strange two-tone (etched) effect instead of plain gray. So the button- // stays enabled and its color is set by hand instead - btnPauzeResume_Click already ignores clicks while- // no simulation is running, so behaviorally it is still "disabled".- btnPauzeResume.ForeColor = (canPause ? SystemColors.ControlText : Color.Gray);- btnPauzeResume.Text = (_paused ? "Resume simulation" : "Pause simulation");- UpdateExportButtons();- }-- /// <summary>Shows <paramref name="message"/> in a "Start simulation" message box.</summary>- private void ShowSimulationProblem(string message)- {- MessageBox.Show(this, message, "Start simulation", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- }-- /// <summary>- /// Validates every simulation control and copies it into <c>_simulation</c> (and the image source scale into- /// <c>_scene</c>) just before a run, regardless of <c>_loadingSim</c>, so the run always uses what is on the- /// screen (also a value that was typed in but not confirmed yet is used - that is what the <c>Validate()</c>- /// calls are for).- /// </summary>- private void ReadSimulationControls()- {- numVisualizeEvery.Validate();- numFieldScaling.Validate();- numIntensityScaling.Validate();- numFieldScaling2.Validate();- numIntensityScaling2.Validate();- numOffsetField.Validate();- numOffsetIntensity.Validate();- numQuality.Validate();- numScaleImageSource.Validate();- numTimeDecayFactor.Validate();- _simulation.VisualizeEvery = Convert.ToInt32(numVisualizeEvery.Value);- _simulation.FieldBrightness = Convert.ToDouble(numFieldScaling.Value);- _simulation.IntensityBrightness = Convert.ToDouble(numIntensityScaling.Value);- _simulation.FieldBlackLevel = Convert.ToDouble(numOffsetField.Value);- _simulation.IntensityBlackLevel = Convert.ToDouble(numOffsetIntensity.Value);- _simulation.VideoQuality = Convert.ToInt32(numQuality.Value);- _simulation.TimeDecayFactor = Convert.ToDouble(numTimeDecayFactor.Value);- _simulation.ExportField = chkExportVideoField.Checked;- _simulation.ExportIntensity = chkExportVideoIntensity.Checked;- _simulation.PreviewField = chkPreviewVideoField.Checked;- _simulation.PreviewIntensity = chkPreviewVideoIntensity.Checked;- _simulation.UseGpu = chkUseGPU.Checked;- _simulation.Use4thOrderLaplacian = chkUse4thOrderLaplacian.Checked;- _scene.ImageSourceScale = Convert.ToDouble(numScaleImageSource.Value);- }-- /// <summary>- /// UI thread. Validates the scene and settings (asks to save the project first when exporting, warns when the scene has no- /// sources), builds a <see cref="SimulationJob"/> with cloned settings, palettes, probes, sources and numbered output file- /// names, wires every <see cref="SimulationRunner"/> event through <see cref="PostToUi"/> and starts the worker thread.- /// </summary>- private void StartSimulation()- {- ReadSimulationControls();- SimulationSettings settings = _simulation;- bool wantField = settings.ExportField || settings.PreviewField;- bool wantIntensity = settings.ExportIntensity || settings.PreviewIntensity;- bool exporting = settings.ExportField || settings.ExportIntensity;- bool previewing = settings.PreviewField || settings.PreviewIntensity;- if (!wantField && !wantIntensity)- {- ShowSimulationProblem("Nothing to do: tick at least one of the export or preview options.");- return;- }- // numSimulationSteps (a NumericUpDown) never holds an out-of-range or non-integer value, so unlike the old- // cmbSimulationSteps combo box this needs no parsing/validation here- settings.Steps = Convert.ToInt32(numSimulationSteps.Value);-- // the videos are written in the output folder of the project, so the project has to exist on disk- if (exporting && _project == null)- {- DialogResult saveAnswer = MessageBox.Show(this, "The videos are saved in the output folder of the project, so the project must be saved first.\r\n\r\nSave the project now?", "Start simulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);- if (saveAnswer != DialogResult.Yes)- {- return;- }- if (!SaveProject())- {- return;- }- // Saving replaces _simulation (SetCurrentProject reloads it from the config), so re-fetch it.- settings = _simulation;- }- Size canvas = EffectiveCanvas();- if (canvas.Width <= 0)- {- ShowSimulationProblem("There is no scene yet: load a scene image in the Scene properties, or define a canvas size.");- return;- }- int dampingEdge = 0;- if (_scene.DampingEdgeEnabled)- {- string dampingProblem = DampingProblem(txtDampingEdgeSize.Text, ref dampingEdge);- if (dampingProblem.Length > 0)- {- ShowSimulationProblem("The damping edge cannot be used: " + dampingProblem);- txtDampingEdgeSize.Focus();- return;- }- }- // without any source (image or object) nothing happens- bool useSources = _scene.UseSources;- bool hasImageSources = _scene.UseImage && useSources && SceneData.CountSources(_sceneImage) > 0;- bool hasObjectSources = _scene.UseObjectSources && _sources.Count > 0;- string noSourcesWarning = "";- if (!hasImageSources && !hasObjectSources)- {- List<string> reasons = new List<string>();- if (_scene.UseImage)- {- if (!useSources)- {- reasons.Add("image sources are switched off in the Scene properties");- }- else if (SceneData.CountSources(_sceneImage) == 0)- {- reasons.Add("the scene image has no sources (no pixels with a green value above 0)");- }- }- if (!_scene.UseObjectSources)- {- reasons.Add("object sources are switched off in the Scene properties");- }- else if (_sources.Count == 0)- {- reasons.Add("there are no object sources yet (add one on the Sources tab)");- }- noSourcesWarning = "This scene has no sources yet: " + string.Join("; ", reasons) + ". The field will stay empty.";- }- if (noSourcesWarning.Length > 0)- {- DialogResult runAnyway = MessageBox.Show(this, noSourcesWarning + "\r\n\r\nRun the simulation anyway?", "Start simulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);- if (runAnyway != DialogResult.Yes)- {- return;- }- }- // color tables- int[] fieldLut = null;- int[] intensityLut = null;- if (wantField)- {- ColorScheme fieldScheme = FindScheme(settings.FieldColorScheme, ColorScheme.SchemeTypeField);- if (fieldScheme == null)- {- ShowSimulationProblem("Choose a color scheme for the field first.");- cmbFieldColorScheme.Focus();- return;- }- fieldLut = ColorLut.Build(fieldScheme, false, settings.FieldBlackLevel, false, false).Argb;- }- if (wantIntensity)- {- ColorScheme intensityScheme = FindScheme(settings.IntensityColorScheme, ColorScheme.SchemeTypeIntensity);- if (intensityScheme == null)- {- ShowSimulationProblem("Choose a color scheme for the intensity first.");- cmbIntensityColorScheme.Focus();- return;- }- intensityLut = ColorLut.Build(intensityScheme, false, settings.IntensityBlackLevel, false, false).Argb;- }- // the job: the runner works on copies, so the settings can be edited while it runs- SimulationJob job = new SimulationJob();- if (_scene.UseImage)- {- job.Image = new Bitmap(_sceneImage);- }- else- {- job.Width = canvas.Width;- job.Height = canvas.Height;- job.BackgroundRefractiveIndex = _scene.BackgroundRefractiveIndex;- }- job.UseSources = useSources;- job.SourceAmplitude = _scene.ImageSourceScale;- job.DampingEdge = dampingEdge;- job.Settings = settings.Clone();- job.FieldLut = fieldLut;- job.IntensityLut = intensityLut;- _lastFieldLut = fieldLut;- _lastIntensityLut = intensityLut;- job.PreviewWidth = Math.Max(16, Math.Min(pnlPreviewField.ClientSize.Width, pnlPreviewIntensity.ClientSize.Width));- job.PreviewHeight = Math.Max(16, Math.Min(pnlPreviewField.ClientSize.Height, pnlPreviewIntensity.ClientSize.Height));- job.Probes = ProbesForRun();- job.ObjectSources = SourcesForRun();-- // the glow-edges overlay (Viewer tab) is only ever needed by the runner to bake into an exported video -- // the live preview blends its own copy in locally (ShowPreview/ComposeGlowOverlay), which can track the- // checkbox/brightness box live while this, like Settings, is frozen at the start of the run- job.FieldOverlayGain = FieldOverlayGain();- job.IntensityOverlayGain = IntensityOverlayGain();- if (exporting && _glowEdgesImage != null && (job.FieldOverlayGain > 0.0 || job.IntensityOverlayGain > 0.0))- {- job.GlowOverlay = new Bitmap(_glowEdgesImage);- }- if (exporting)- {- try- {- Directory.CreateDirectory(_project.OutputVideoFolder);- }- catch (Exception ex)- {- if (job.Image != null)- {- job.Image.Dispose();- }- if (job.GlowOverlay != null)- {- job.GlowOverlay.Dispose();- }- ShowSimulationProblem("The output folder could not be created:\r\n" + _project.OutputVideoFolder + "\r\n\r\n" + ex.Message);- return;- }- string suffix = NextNumericSuffix(_project.OutputVideoFolder).ToString("D4", CultureInfo.InvariantCulture);- if (settings.ExportField)- {- job.FieldVideoPath = Path.Combine(_project.OutputVideoFolder, _project.Name + "_field_" + suffix + ".mp4");- }- if (settings.ExportIntensity)- {- job.IntensityVideoPath = Path.Combine(_project.OutputVideoFolder, _project.Name + "_intensity_" + suffix + ".mp4");- }- }- ClearPreviews();- BeginProbeRun(job.Probes, canvas, settings.Steps);- _fieldVideoFile = "";- _intensityVideoFile = "";- UpdateVideoButtons();- _runInfo = "Field: brightness " + settings.FieldBrightness.ToString("0.0#", CultureInfo.CurrentCulture)- + ", offset " + settings.FieldBlackLevel.ToString("0.0#", CultureInfo.CurrentCulture)- + "\r\nIntensity: brightness " + settings.IntensityBrightness.ToString("0.0#", CultureInfo.CurrentCulture)- + ", offset " + settings.IntensityBlackLevel.ToString("0.0#", CultureInfo.CurrentCulture)- + "\r\nImage source scale: " + _scene.ImageSourceScale.ToString("0.0#", CultureInfo.CurrentCulture);- if (previewing)- {- tabMainFunctions.SelectedTab = tabViewer;- }- SimulationRunner runner = new SimulationRunner(job);- runner.ProgressChanged += (done, total) => PostToUi(() => ShowProgress(runner, done, total));- runner.EngineReady += (description, note) => PostToUi(() => ShowEngine(runner, description, note));- runner.ProbesUpdated += update => PostToUi(() => ShowProbeSamples(runner, update));- runner.PreviewReady += (isField, frame) => PostToUi(() => ShowPreview(runner, isField, frame));- runner.Finished += result => PostToUi(() => OnSimulationFinished(runner, result));- _runner = runner;- btnStartSimulation.Text = "Stop Simulation";- _simStatus = "starting...";- _progressText = "starting...";- _paused = false;- _stopRequested = false;- UpdateRunButtons();- ToolStripStatusLabel1.Text = "Simulation running...";- ToolStripStatusLabel1.ToolTipText = "";- UpdateTitle();- runner.Start();- }-- /// <summary>- /// Queues <paramref name="work"/> on the UI thread with <c>BeginInvoke</c>. Called from the runner's worker thread;- /// the work is dropped silently when the form is disposed or its handle is gone (including the- /// <see cref="InvalidOperationException"/> thrown while the handle is being destroyed).- /// </summary>- private void PostToUi(Action work)- {- if (base.IsDisposed || !base.IsHandleCreated)- {- return;- }- try- {- base.BeginInvoke(work);- }- catch (InvalidOperationException)- {- }- }-- /// <summary>- /// UI thread (via <see cref="PostToUi"/>): updates the progress text and window title. Ignored for a stale runner and while- /// stopping, so "stopping..." is not overwritten by a late progress event.- /// </summary>- private void ShowProgress(SimulationRunner runner, int done, int total)- {- // A late progress event from the worker must not overwrite the "stopping..." status set by RequestStop.- if (runner != _runner || string.CompareOrdinal(_simStatus, "stopping...") == 0)- {- return;- }- _lastStepsDone = done;- int percent = (int)(100L * done / Math.Max(1, total)); // long: 100 * steps can exceed int.MaxValue- _progressText = "step " + done.ToString("N0", CultureInfo.CurrentCulture) + " of " + total.ToString("N0", CultureInfo.CurrentCulture) + " (" + percent.ToString(CultureInfo.InvariantCulture) + "%)";- _simStatus = (_paused ? "paused - " : "") + _progressText;- UpdateTitle();- }-- /// <summary>UI thread (via <see cref="PostToUi"/>): shows which engine the runner picked, plus the fallback note, in the status bar.</summary>- private void ShowEngine(SimulationRunner runner, string description, string note)- {- if (runner != _runner || base.IsDisposed)- {- return;- }- string status = "Simulation running on " + description;- if (note.Length > 0)- {- status = status + " - " + note;- }- ToolStripStatusLabel1.Text = status;- ToolStripStatusLabel1.ToolTipText = status;- }-- /// <summary>- /// UI thread (via <see cref="PostToUi"/>): shows the downscaled preview frame in the field or intensity box (composed with the- /// glow overlay when enabled) and takes ownership of <paramref name="frame"/>; a frame for a stale runner is disposed instead.- /// Always acknowledges with <see cref="SimulationRunner.PreviewShown"/> so the worker may render the next preview.- /// </summary>- private void ShowPreview(SimulationRunner runner, bool isField, Bitmap frame)- {- if (runner != _runner || base.IsDisposed)- {- frame.Dispose();- runner.PreviewShown();- return;- }- PictureBox target = (isField ? _picField : _picIntensity);- double overlayGain = (isField ? FieldOverlayGain() : IntensityOverlayGain());- SetPreviewFrame(target, frame, overlayGain);- UpdateCopyButtons();- runner.PreviewShown();- }-- /// <summary>- /// UI thread (via <see cref="PostToUi"/>): clears the runner, takes ownership of the result's full-size frames, enables the- /// video buttons and builds the status-bar summary (steps, elapsed, steps/s, engine, files) with the details in its tooltip;- /// a failed run is also reported in a message box.- /// </summary>- private void OnSimulationFinished(SimulationRunner runner, SimulationResult result)- {- if (runner != _runner || base.IsDisposed)- {- return;- }- _runner = null;- _hasRun = true;- _paused = false;- _stopRequested = false;- _lastStepsDone = result.StepsDone;- UpdateRunButtons();- _simStatus = "";- btnStartSimulation.Text = "Start Simulation";- btnStartSimulation.Enabled = true;- UpdateTitle();- _fieldVideoFile = result.FieldFile;- _intensityVideoFile = result.IntensityFile;- UpdateVideoButtons();-- // a full-resolution snapshot of the last frame, for a still export once nothing is running any more- Bitmap previousFieldFrame = _lastFullFieldFrame;- _lastFullFieldFrame = result.LastFieldFrame;- if (previousFieldFrame != null)- {- previousFieldFrame.Dispose();- }- Bitmap previousIntensityFrame = _lastFullIntensityFrame;- _lastFullIntensityFrame = result.LastIntensityFrame;- if (previousIntensityFrame != null)- {- previousIntensityFrame.Dispose();- }- UpdateExportButtons();- string elapsed = result.Elapsed.ToString("hh\\:mm\\:ss", CultureInfo.InvariantCulture);- string details = "";- if (result.Files.Count > 0)- {- details = "\r\n\r\nVideos (in " + Path.GetDirectoryName(result.Files[0]) + "):";- foreach (string file in result.Files)- {- details = details + "\r\n" + Path.GetFileName(file);- }- }- if (result.Status != SimulationStatus.Failed && result.Message.Length > 0)- {- details = details + "\r\n\r\n" + result.Message;- }- if (result.Engine.Length > 0)- {- details = details + "\r\n\r\nEngine: " + result.Engine;- if (result.EngineNote.Length > 0)- {- details = details + "\r\n" + result.EngineNote;- }- }- details = details + "\r\n\r\n" + _runInfo;- string stepsText = result.StepsDone.ToString("N0", CultureInfo.CurrentCulture);-- // the summary goes in the status bar (the details in its tooltip); only a failure gets a message box- string summary;- switch (result.Status)- {- case SimulationStatus.Completed:- summary = "Simulation completed: " + stepsText + " steps in " + elapsed;- break;- case SimulationStatus.Cancelled:- summary = "Simulation stopped after " + stepsText + " steps (" + elapsed + ")";- break;- default:- summary = "Simulation failed after " + stepsText + " steps";- break;- }- if (result.Elapsed.TotalSeconds > 0.5 && result.StepsDone > 0)- {- summary = summary + " - " + ((double)result.StepsDone / result.Elapsed.TotalSeconds).ToString("0.0", CultureInfo.CurrentCulture) + " steps/s";- }- if (result.Engine.Length > 0)- {- summary = summary + " - " + result.Engine;- if (result.EngineNote.Length > 0)- {- summary = summary + " (" + result.EngineNote + ")";- }- }- if (result.Files.Count > 0)- {- List<string> fileNames = new List<string>();- foreach (string file in result.Files)- {- fileNames.Add(Path.GetFileName(file));- }- summary = summary + " - video: " + string.Join(", ", fileNames);- }- if (result.Status != SimulationStatus.Failed && result.Message.Length > 0)- {- summary += " - MP4 (H.264) was not available, the videos are .avi files";- }- ToolStripStatusLabel1.Text = summary;- ToolStripStatusLabel1.ToolTipText = summary + details;- if (result.Status == SimulationStatus.Failed)- {- MessageBox.Show(this, "The simulation failed after " + stepsText + " steps:\r\n\r\n" + result.Message + details, "Simulation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- /// <summary>Enables the "view video" buttons when the last run's video files still exist.</summary>- private void UpdateVideoButtons()- {- btnViewFieldVideo.Enabled = _fieldVideoFile.Length > 0 && File.Exists(_fieldVideoFile);- btnViewIntensityVideo.Enabled = _intensityVideoFile.Length > 0 && File.Exists(_intensityVideoFile);- }-- /// <summary>Opens the last field video in the default media player.</summary>- private void btnViewFieldVideo_Click(object sender, EventArgs e)- {- OpenVideo(_fieldVideoFile);- }-- /// <summary>Opens the last intensity video in the default media player.</summary>- private void btnViewIntensityVideo_Click(object sender, EventArgs e)- {- OpenVideo(_intensityVideoFile);- }-- /// <summary>Launches <paramref name="videoFile"/> with the shell's default player; tells the user when the file has gone or cannot be opened.</summary>- private void OpenVideo(string videoFile)- {- if (videoFile.Length == 0 || !File.Exists(videoFile))- {- MessageBox.Show(this, "The video file does not exist (any more):\r\n" + videoFile, "Video", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- UpdateVideoButtons();- return;- }- try- {- Process.Start(new ProcessStartInfo(videoFile)- {- UseShellExecute = true- });- }- catch (Exception ex)- {- MessageBox.Show(this, "The video could not be opened:\r\n\r\n" + ex.Message, "Video", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- /// <summary>Opens the project's video folder in Explorer.</summary>- private void btnOpenVideoFolder_Click(object sender, EventArgs e)- {- OpenVideoFolder();- }-- /// <summary>Opens the project's exported-frames folder in Explorer.</summary>- private void btnOpenImageFolder_Click(object sender, EventArgs e)- {- OpenFramesFolder();- }-- /// <summary>Saves the current or last field frame as a PNG.</summary>- private void btnExportFieldFrame_Click(object sender, EventArgs e)- {- ExportFrame(true);- }-- /// <summary>Saves the current or last intensity frame as a PNG.</summary>- private void btnExportIntensityFrame_Click(object sender, EventArgs e)- {- ExportFrame(false);- }-- /// <summary>- /// Saves a full-size frame as PNG in the project's frames folder. While the run is paused the runner renders the live- /// field / intensity with the palette of the current run (that bitmap is owned and disposed here); otherwise the last frame- /// of the previous run is used. The glow overlay is composed in when enabled. The file name carries the step count and a- /// 4-digit sequence number.- /// </summary>- private void ExportFrame(bool isField)- {- Bitmap frame = null;- bool ownsFrame = false;- if (_runner != null && _paused)- {- int[] lut = (isField ? _lastFieldLut : _lastIntensityLut);- float brightness = (float)(isField ? _simulation.FieldBrightness : _simulation.IntensityBrightness);- frame = _runner.RenderCurrentFrame(isField, lut, brightness);- ownsFrame = true;- }- if (frame == null)- {- frame = (isField ? _lastFullFieldFrame : _lastFullIntensityFrame);- }- if (frame == null)- {- MessageBox.Show(this, "There is no picture to export yet.", "Export frame", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- try- {- Directory.CreateDirectory(_project.OutputFramesFolder);- }- catch (Exception ex)- {- if (ownsFrame)- {- frame.Dispose();- }- MessageBox.Show(this, "The output folder could not be created:\r\n" + _project.OutputFramesFolder + "\r\n\r\n" + ex.Message, "Export frame", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- return;- }- string kind = (isField ? "field" : "intensity");- double overlayGain = (isField ? FieldOverlayGain() : IntensityOverlayGain());- Bitmap output = frame;- bool ownsOutput = false;- if (overlayGain > 0.0 && _glowEdgesImage != null)- {- output = ComposeGlowOverlay(frame, overlayGain);- ownsOutput = true;- }- string suffix = NextNumericSuffix(_project.OutputFramesFolder).ToString("D4", CultureInfo.InvariantCulture);- string fileName = _project.Name + "_" + kind + "_frame" + _lastStepsDone.ToString(CultureInfo.InvariantCulture) + "_" + suffix + ".png";- string path = Path.Combine(_project.OutputFramesFolder, fileName);- try- {- output.Save(path, ImageFormat.Png);- ToolStripStatusLabel1.Text = "Frame exported: " + fileName;- }- catch (Exception ex)- {- MessageBox.Show(this, "The frame could not be saved:\r\n\r\n" + ex.Message, "Export frame", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- finally- {- if (ownsOutput)- {- output.Dispose();- }- if (ownsFrame)- {- frame.Dispose();- }- }- }-- /// <summary>- /// Next available 4-digit numeric filename suffix for a file saved into <paramref name="folder"/>: the highest- /// existing file in the folder whose name (before the extension) ends in exactly 4 digits, plus 1 - starts at- /// 1 when there is no such file yet. Used for exported frames (<see cref="ExportFrame"/>) and videos- /// (<see cref="StartSimulation"/>) instead of the previous date/time stamp, which was found to make file- /// names too long. Formats with "D4" (e.g. "0001"), growing past 4 digits rather than wrapping once the- /// count passes 9999.- /// </summary>- private int NextNumericSuffix(string folder)- {- int highest = 0;- if (Directory.Exists(folder))- {- foreach (string file in Directory.GetFiles(folder))- {- string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);- if (fileNameWithoutExtension.Length >= 4)- {- string tail = fileNameWithoutExtension.Substring(fileNameWithoutExtension.Length - 4);- int value;- if (int.TryParse(tail, NumberStyles.None, CultureInfo.InvariantCulture, out value) && value > highest)- {- highest = value;- }- }- }- }- return highest + 1;- }-- /// <summary>- /// Opens the project's video output folder in Windows Explorer - which already shows video thumbnails and- /// lets the files be renamed or deleted there, so there is no need to build a picker of our own for that.- /// Opened in "Details" view (see <see cref="OpenFolderInExplorer"/>) - more useful than thumbnails for a- /// folder of video files. Reports when there is no project.- /// </summary>- private void OpenVideoFolder()- {- string folder = ((_project == null) ? "" : _project.OutputVideoFolder);- if (folder.Length == 0)- {- MessageBox.Show(this, "There is no project open yet.", "Open video folder", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- try- {- // so the folder can be opened even before any video has been exported- OpenFolderInExplorer(folder, FVM_DETAILS);- }- catch (Exception ex)- {- MessageBox.Show(this, "The video folder could not be opened:\r\n\r\n" + ex.Message, "Open video folder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- /// <summary>- /// Opens the project's output frames folder (<c>btnOpenImageFolder</c> on the Preview tab) in Windows- /// Explorer, the same way <see cref="OpenVideoFolder"/> does for the video folder - but in "Large icons"- /// view (see <see cref="OpenFolderInExplorer"/>), which shows thumbnails of the exported images. Reports- /// when there is no project.- /// </summary>- private void OpenFramesFolder()- {- string folder = ((_project == null) ? "" : _project.OutputFramesFolder);- if (folder.Length == 0)- {- MessageBox.Show(this, "There is no project open yet.", "Open image folder", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- try- {- // so the folder can be opened even before any frame has been exported- OpenFolderInExplorer(folder, FVM_ICON);- }- catch (Exception ex)- {- MessageBox.Show(this, "The image folder could not be opened:\r\n\r\n" + ex.Message, "Open image folder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- /// <summary>- /// Creates <paramref name="folder"/> if needed, opens it in Windows Explorer and tries to make that window use- /// the given view mode (one of the <c>FVM_</c> constants in <c>Form1.cs</c>). Explorer has no command-line- /// switch for this, so the folder is opened as before (explorer.exe on the path) and then, best-effort, the- /// "Shell.Application" COM automation object is used to find the newly opened window for that exact folder- /// and set its <c>Document.CurrentViewMode</c> (<see cref="SetExplorerWindowViewMode"/>). This uses late- /// binding via reflection rather than a direct COM reference, since adding a COM reference to the project- /// for this alone is more trouble than it is worth.- /// <para>- /// This is not fully reliable: if a window for the folder is already open, Explorer reuses it instead of- /// opening a new one (so its view stays whatever it already was), and Explorer separately remembers, per- /// folder, whatever view the user leaves it in afterwards - so this only really matters the first time (or- /// after Explorer has forgotten it). Either way the folder itself always opens; only the requested view can- /// silently fail to apply, which is why every failure in the view-mode step is swallowed rather than shown- /// to the user.- /// </para>- /// </summary>- /// <param name="folder">Folder to open; created when missing (that may throw, unlike the view-mode step).</param>- /// <param name="viewMode">Explorer FOLDERVIEWMODE value: <see cref="FVM_ICON"/> or <see cref="FVM_DETAILS"/>.</param>- private void OpenFolderInExplorer(string folder, int viewMode)- {- Directory.CreateDirectory(folder);- Process.Start(new ProcessStartInfo("explorer.exe", "\"" + folder + "\"")- {- UseShellExecute = true- });- try- {- SetExplorerWindowViewMode(folder, viewMode);- }- catch (Exception)- {- // best effort only - the folder is already open regardless of whether this succeeds- }- }-- /// <summary>- /// Finds the Explorer window that was just opened on <paramref name="folder"/> (polling up to 8 times)- /// through the Shell.Application COM automation object (late bound) and sets its view mode- /// (<see cref="FVM_ICON"/> or <see cref="FVM_DETAILS"/>); see <see cref="OpenFolderInExplorer"/> for why and- /// for the caveats. Runs on the UI thread and sleeps 120 ms between polls, so it can block the UI for about- /// a second when the window never shows up.- /// </summary>- private void SetExplorerWindowViewMode(string folder, int viewMode)- {- string targetPath = Path.GetFullPath(folder).TrimEnd(new char[] { Path.DirectorySeparatorChar });- Type shellType = Type.GetTypeFromProgID("Shell.Application");- if (shellType == null)- {- return;- }- object shell = Activator.CreateInstance(shellType);- try- {- const BindingFlags memberFlags = BindingFlags.InvokeMethod | BindingFlags.GetProperty;-- // give the freshly launched Explorer window a moment to appear- for (int attempt = 1; attempt <= 8; attempt++)- {- object windows = shellType.InvokeMember("Windows", memberFlags, null, shell, null);- Type windowsType = windows.GetType();- int count = Convert.ToInt32(windowsType.InvokeMember("Count", memberFlags, null, windows, null));- for (int i = 0; i < count; i++)- {- object window = windowsType.InvokeMember("Item", memberFlags, null, windows, new object[] { i });- if (window == null)- {- continue;- }- Type windowType = window.GetType();- string locationUrl = windowType.InvokeMember("LocationURL", memberFlags, null, window, null) as string;- if (string.IsNullOrEmpty(locationUrl))- {- continue;- }- string windowPath;- try- {- windowPath = new Uri(locationUrl).LocalPath.TrimEnd(new char[] { Path.DirectorySeparatorChar });- }- catch (Exception)- {- continue;- }- if (string.Equals(windowPath, targetPath, StringComparison.OrdinalIgnoreCase))- {- object document = windowType.InvokeMember("Document", memberFlags, null, window, null);- if (document != null)- {- document.GetType().InvokeMember("CurrentViewMode", BindingFlags.SetProperty, null, document, new object[] { viewMode });- }- return;- }- }- Thread.Sleep(120); // give Explorer time to register the new window- }- }- finally- {- Marshal.ReleaseComObject(shell);- }- }-- /// <summary>- /// Empties both preview boxes, disposing the shown image and the raw frame kept in <c>Tag</c> (they differ when the glow- /// overlay was composed in), and drops the last full-size frames.- /// </summary>- private void ClearPreviews()- {- foreach (PictureBox pictureBox in new PictureBox[] { _picField, _picIntensity })- {- if (pictureBox == null)- {- continue;- }- Image image = pictureBox.Image;- Bitmap tagged = pictureBox.Tag as Bitmap;- pictureBox.Image = null;- pictureBox.Tag = null;- if (image != null && !object.ReferenceEquals(image, tagged))- {- image.Dispose();- }- if (tagged != null)- {- tagged.Dispose();- }- }-- // a new run is starting - the cached last-frame snapshots are from the previous run, so drop them- if (_lastFullFieldFrame != null)- {- _lastFullFieldFrame.Dispose();- }- _lastFullFieldFrame = null;- if (_lastFullIntensityFrame != null)- {- _lastFullIntensityFrame.Dispose();- }- _lastFullIntensityFrame = null;- UpdateCopyButtons();- }-- // grpProbe1_Enter/grpProbe2_Enter and Label21/Label22 Click are unused Designer-generated stubs (harmless, left- // empty). The Pick button, the Sources combo boxes and Button1 (the Probes tab's "Import scene image", still- // under its Designer default name) are wired in Form1.Sources.cs/Form1.Probes.cs instead, where the rest of- // those tabs lives.-- /// <summary>Wired by the designer to both probe group boxes; intentionally does nothing.</summary>- private void grpProbe1_Enter(object sender, EventArgs e)- {- }-- /// <summary>Wired by the designer to two labels; intentionally does nothing.</summary>- private void Label21_Click(object sender, EventArgs e)- {- }-- /// <summary>Wired by the designer; intentionally does nothing.</summary>- private void lblVideoQuality_Click(object sender, EventArgs e)- {- }-- /// <summary>Saves the project (viewer-tab copy of the Save button).</summary>- private void btnSaveConfiguration2_Click(object sender, EventArgs e)- {- SaveProject();- }-- /// <summary>- /// "Created on" column header of the video list on the Output tab. Created and assigned by the designer; declared as a- /// property (VB.NET WithEvents style) and placed in this file by the decompiler.- /// </summary>- protected internal virtual ColumnHeader colCreatedOn2 { get; set; }- }-}diff --git a/Wave_Dude_2D/Form1.Sources.cs b/Wave_Dude_2D/Form1.Sources.csdeleted file mode 100644index 28531e0..0000000--- a/Wave_Dude_2D/Form1.Sources.cs+++ /dev/null@@ -1,1169 +0,0 @@-using System;-using System.Collections.Generic;-using System.ComponentModel;-using System.Drawing;-using System.Globalization;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Source list tab: editing, saving and previewing the wave sources of the project.- /// The list of saved sources lives in <c>_sources</c>; the editor controls always show- /// <c>_editing</c>, which is a clone of the selected entry (or a fresh source when nothing- /// is selected) until the user presses "Save source". <c>_loadingSource</c> guards the- /// control change handlers while the editor is being filled, <c>_syncingSourceList</c>- /// guards the list selection handler while the list is rebuilt. Everything here runs on- /// the UI thread.- /// </summary>- /// <remarks>- /// <para>- /// An object source is a point (or, for a composite source, an X-Y array of points) that drives- /// the field directly, as opposed to the image-derived sources (the green channel of the scene- /// image). Unlike an image source it has its own frequency, amplitude and phase, and it can be- /// continuous or pulsed (on for a number of cycles, then off for a number of cycles). A composite- /// source is a set of point sources built from the same base ("single source") parameters,- /// optionally randomized per element.- /// </para>- /// <para>- /// Editing a source is a two step process. First, <c>txtName</c>/<c>cmbMainType</c>/- /// <c>grpSingleSource</c>/<c>grpComposite</c> describe the source; the position is typed or- /// picked with the Pick button in the picture (a copy of a Preview tab picture, "Copy Image to- /// probe and source tab"). A freshly created source has no position yet- /// (<see cref="SourceSettings.HasPosition"/> is false): the picture shows no marker for it until- /// one is picked or typed, so an unpositioned source is never mistaken for one at (0, 0) or- /// wherever the numeric fields default to. Second, "Save source" resolves those parameters (for a- /// composite source, including a fresh random draw when "Inherit + randomize" is chosen) into a- /// fixed list of point-source elements (<c>_editing.Elements</c>), then adds the result to- /// <c>lstSources</c> (a new source) or updates the selected one. Only saved sources are used in a- /// simulation (when "Use object sources" is ticked in the scene properties): the engine always- /// runs the already-generated element list, never re-randomizing, so a run is reproducible.- /// </para>- /// <para>- /// Selecting a source in <c>lstSources</c> loads it straight into the editor (there is no separate- /// Edit step/button). New and Copy load a (blank, respectively copied) source into the editor and- /// clear the list selection; neither touches <c>lstSources</c> itself until Save is pressed, which- /// adds or updates the entry.- /// </para>- /// </remarks>- public partial class Form1- {- /// <summary>- /// One-time set-up at form load: remembers the "Pick" button text and the save button- /// colour, sets the numeric input limits (positions 0..<see cref="SceneSettings.MaxCanvasSize"/> - 1- /// canvas px, array sizes 1..999 stepping by 2, spacings 0..<see cref="SceneSettings.MaxCanvasSize"/> px),- /// wires dirty tracking and the scene picture events, switches the list to owner drawing and- /// shows the initial source.- /// </summary>- private void InitializeSourceControls()- {- _pickSourceButtonText = btnPickSourcePosition.Text;- _sourceSaveButtonDefaultBackColor = btnSaveSource.BackColor;- WireSourceDirtyTracking(grpSourceDetails);- numSourcePositionX.DecimalPlaces = 0;- numSourcePositionX.Minimum = 0m;- numSourcePositionX.Maximum = (decimal)(SceneSettings.MaxCanvasSize - 1);- numSourcePositionY.DecimalPlaces = 0;- numSourcePositionY.Minimum = 0m;- numSourcePositionY.Maximum = (decimal)(SceneSettings.MaxCanvasSize - 1);- // Minimum (1) and Maximum (999) are both odd, and Increment is 2, so the up/down spinner buttons can only- // ever land on an odd array size - see ArraySize_Validating for what catches an even value typed in- // directly (the spinner can't produce one, but the keyboard can).- numArraySizeX.DecimalPlaces = 0;- numArraySizeX.Minimum = 1m;- numArraySizeX.Maximum = 999m;- numArraySizeX.Increment = 2m;- numArraySizeY.DecimalPlaces = 0;- numArraySizeY.Minimum = 1m;- numArraySizeY.Maximum = 999m;- numArraySizeY.Increment = 2m;- numSpacingSizeX.DecimalPlaces = 0;- numSpacingSizeX.Minimum = 0m;- numSpacingSizeX.Maximum = (decimal)SceneSettings.MaxCanvasSize;- numSpacingSizeY.DecimalPlaces = 0;- numSpacingSizeY.Minimum = 0m;- numSpacingSizeY.Maximum = (decimal)SceneSettings.MaxCanvasSize;- numAmplitude.DecimalPlaces = 0;- numPulseWidthCycles.DecimalPlaces = 0;- if (numPulseWidthCycles.Minimum < 1m)- {- numPulseWidthCycles.Minimum = 1m;- }- // Designer limit is too small for long pulses; widen it without touching the Designer.- if (numPulseWidthCycles.Maximum < 100m)- {- numPulseWidthCycles.Maximum = 1000000m;- }- numOffStateCycles.DecimalPlaces = 0;- numRandomizeFrequency.DecimalPlaces = 0;- numRandomizeOffWidth.DecimalPlaces = 0;- numRandomizePosition.DecimalPlaces = 0;- NumRandomizePhase.DecimalPlaces = 0;- _picSource.Paint += SourcePicture_Paint;- _picSource.MouseClick += SourcePicture_MouseClick;- // owner-drawn so a switched-off source (chkSourceOn unchecked) can be shown greyed out in the list -- // it stays fully selectable, only its text color changes (see lstSources_DrawItem)- lstSources.DrawMode = DrawMode.OwnerDrawFixed;- RefreshSourceList();- ShowSourceInControls(_editing);- ClearSourceDirty();- UpdateListButtonState();- }-- /// <summary>- /// Replaces the source list with the sources stored in the open project and shows the first- /// one (if any) selected and loaded into the editor, rather than always starting the editor on- /// a blank "new source" template: opening a project that already has sources shows one of them,- /// not a to-be-inserted one. "First" is whichever generate/save order the list is in; there is- /// no separate "last edited" tracking kept across a save/reload to prefer instead. An empty- /// project gets an empty editor. No-op without a project.- /// </summary>- private void LoadSourcesFromProject()- {- if (_project == null)- {- return;- }- _sources = SourceSettings.ListFromConfig(_project.Config);- if (_sources.Count > 0)- {- _currentSourceIndex = 0;- _editing = _sources[0].Clone();- }- else- {- _currentSourceIndex = -1;- _editing = new SourceSettings();- }- RefreshSourceList();- _syncingSourceList = true;- try- {- lstSources.SelectedIndex = _currentSourceIndex;- }- finally- {- _syncingSourceList = false;- }- ShowSourceInControls(_editing);- ClearSourceDirty();- UpdateListButtonState();- }-- /// <summary>- /// Empties the source list and the editor for a new project. The editor is only- /// refreshed once the source picture box exists, i.e. after the form has been built.- /// </summary>- private void ResetSources()- {- _sources = new List<SourceSettings>();- _currentSourceIndex = -1;- _editing = new SourceSettings();- RefreshSourceList();- if (_picSource != null)- {- ShowSourceInControls(_editing);- ClearSourceDirty();- }- UpdateListButtonState();- }-- /// <summary>- /// Collects the elements of all enabled sources for a simulation run, or null when- /// object sources are not in use (scene flag off, or no sources at all). Sources whose- /// element list is still empty are generated on the spot. The returned list holds the- /// sources' own <see cref="SourceElement"/> instances, not copies; the engines only- /// read them from the worker thread.- /// </summary>- private List<SourceElement> SourcesForRun()- {- if (_scene == null || !_scene.UseObjectSources || _sources.Count == 0)- {- return null;- }- List<SourceElement> elements = new List<SourceElement>();- foreach (SourceSettings source in _sources)- {- // switched off (chkSourceOn unchecked): keep the source and its parameters, just leave it out of the- // run entirely, so it neither drives the field nor gets in the way of waves passing through it- if (!source.SourceOn)- {- continue;- }- if (source.Elements == null || source.Elements.Count == 0)- {- // a source saved before it was ever generated (should not normally happen) - generate it now, once- source.GenerateElements(_sourceRandom);- }- elements.AddRange(source.Elements);- }- return elements;- }-- /// <summary>Rebuilds the list box items from <c>_sources</c>, keeping the current selection index when it is still valid; the selection handler is suppressed meanwhile.</summary>- private void RefreshSourceList()- {- int selectedIndex = lstSources.SelectedIndex;- _syncingSourceList = true;- try- {- lstSources.Items.Clear();- foreach (SourceSettings source in _sources)- {- lstSources.Items.Add(Form1.SourceListText(source));- }- if (selectedIndex >= 0 && selectedIndex < lstSources.Items.Count)- {- lstSources.SelectedIndex = selectedIndex;- }- }- finally- {- _syncingSourceList = false;- }- }-- /// <summary>List box caption for a source: the name followed by "(single)" or "(composite, X x Y)".</summary>- private static string SourceListText(SourceSettings s)- {- if (s.MainType == SourceMainType.Composite)- {- return s.Name + " (composite, " + s.ArraySizeX.ToString(CultureInfo.InvariantCulture) + " x " + s.ArraySizeY.ToString(CultureInfo.InvariantCulture) + ")";- }- return s.Name + " (single)";- }-- /// <summary>Owner-draws a list entry: a switched-off source (<c>chkSourceOn</c> unchecked) is drawn greyed out; it stays fully selectable, only the text colour changes, so the selection highlight still shows normally.</summary>- private void lstSources_DrawItem(object sender, DrawItemEventArgs e)- {- if (e.Index < 0 || e.Index >= lstSources.Items.Count)- {- return;- }- e.DrawBackground();- Color textColor = ((e.Index < _sources.Count && !_sources[e.Index].SourceOn) ? Color.Gray : e.ForeColor);- using (SolidBrush brush = new SolidBrush(textColor))- {- e.Graphics.DrawString(lstSources.Items[e.Index].ToString(), e.Font, brush, e.Bounds);- }- e.DrawFocusRectangle();- }-- /// <summary>- /// Selecting a list entry cancels any position pick and loads a clone of that source straight- /// into the editor (unsaved edits of the previous source are discarded); clearing the selection- /// (New/Copy, or the list becoming empty) loads a blank/default source instead. Programmatic- /// selection changes (<see cref="RefreshSourceList"/>, <see cref="CommitSourceEdits"/>) set- /// <c>_syncingSourceList</c> first so they do not re-trigger this.- /// </summary>- private void lstSources_SelectedIndexChanged(object sender, EventArgs e)- {- UpdateListButtonState();- if (_syncingSourceList)- {- return;- }- EndSourcePick();- if (lstSources.SelectedIndex < 0)- {- _currentSourceIndex = -1;- _editing = new SourceSettings();- }- else- {- _currentSourceIndex = lstSources.SelectedIndex;- _editing = _sources[_currentSourceIndex].Clone();- }- ShowSourceInControls(_editing);- ClearSourceDirty();- if (_picSource != null)- {- _picSource.Invalidate();- }- picPreviewSource.Invalidate();- ToolStripStatusLabel1.Text = ((_currentSourceIndex >= 0) ? ("Editing '" + _editing.Name + "': press Save source to keep the changes.") : "");- }-- /// <summary>Enables Copy and Delete only while a list entry is selected.</summary>- private void UpdateListButtonState()- {- bool hasSelection = lstSources.SelectedIndex >= 0;- btnCopy.Enabled = hasSelection;- btnDelete.Enabled = hasSelection;- }-- /// <summary>Starts a new, unsaved source named "Source N" in the editor, deselects the list and focuses the name box.</summary>- private void btnNew_Click(object sender, EventArgs e)- {- EndSourcePick();- _syncingSourceList = true;- try- {- lstSources.SelectedIndex = -1;- }- finally- {- _syncingSourceList = false;- }- _currentSourceIndex = -1;- _editing = new SourceSettings();- _editing.Name = "Source " + (_sources.Count + 1).ToString(CultureInfo.InvariantCulture);- ShowSourceInControls(_editing);- MarkSourceDirty(); // not saved yet - pressing Save source is what actually adds it- UpdateListButtonState();- if (_picSource != null)- {- _picSource.Invalidate();- }- picPreviewSource.Invalidate();- ToolStripStatusLabel1.Text = "New source: fill in its properties, then press Save source.";- txtName.Focus();- txtName.SelectAll();- }-- /// <summary>Loads a clone of the selected source, named "... copy", into the editor as a new unsaved source (it is only added to the list on save).</summary>- private void btnCopy_Click(object sender, EventArgs e)- {- if (lstSources.SelectedIndex < 0)- {- return;- }- EndSourcePick();- string originalName = _sources[lstSources.SelectedIndex].Name;- _editing = _sources[lstSources.SelectedIndex].Clone();- _editing.Name = _editing.Name + " copy";- _syncingSourceList = true;- try- {- lstSources.SelectedIndex = -1;- }- finally- {- _syncingSourceList = false;- }- _currentSourceIndex = -1;- ShowSourceInControls(_editing);- MarkSourceDirty(); // not saved yet - pressing Save source is what actually adds it- UpdateListButtonState();- if (_picSource != null)- {- _picSource.Invalidate();- }- picPreviewSource.Invalidate();- ToolStripStatusLabel1.Text = "Copy of '" + originalName + "': change it and press Save source to add it as a new source.";- txtName.Focus();- txtName.SelectAll();- }-- /// <summary>After confirmation, removes the selected source from the list and marks the project dirty; clears the editor if that source was being edited.</summary>- private void btnDelete_Click(object sender, EventArgs e)- {- if (lstSources.SelectedIndex < 0)- {- return;- }- int selectedIndex = lstSources.SelectedIndex;- string name = _sources[selectedIndex].Name;- if (MessageBox.Show(this, "Delete the source '" + name + "'?", "Delete source", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)- {- return;- }- _sources.RemoveAt(selectedIndex);- if (_currentSourceIndex == selectedIndex)- {- _currentSourceIndex = -1;- _editing = new SourceSettings();- ShowSourceInControls(_editing);- ClearSourceDirty();- }- else if (_currentSourceIndex > selectedIndex)- {- _currentSourceIndex--;- }- RefreshSourceList();- UpdateListButtonState();- MarkProjectChanged();- if (_picSource != null)- {- _picSource.Invalidate();- }- picPreviewSource.Invalidate();- ToolStripStatusLabel1.Text = "Source '" + name + "' deleted.";- }-- /// <summary>Saves the editor contents into the list (see <see cref="CommitSourceEdits"/>).</summary>- private void btnSaveSource_Click(object sender, EventArgs e)- {- CommitSourceEdits();- }-- /// <summary>- /// Reads the editor controls into the source being edited, regenerates its elements- /// (re-rolling any randomisation) and stores it in the list, replacing the selected entry- /// or appending a new one, then clears the "unsaved changes" indicator on <c>btnSaveSource</c>.- /// Shared by "Save source" itself and by completing a position pick for an already-selected- /// source (see <see cref="SourcePicture_MouseClick"/>), so picking a new position for an- /// existing source is never left stale until a separate press of Save source. Marks the- /// project dirty and leaves the editor on a fresh clone of the saved source. Returns false,- /// without committing anything, if the source has no name yet, the same as "Save source"- /// always required.- /// </summary>- private bool CommitSourceEdits()- {- ReadSourceControls(_editing);- if (_editing.Name.Trim().Length == 0)- {- MessageBox.Show(this, "Give the source a name first.", "Save source", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- txtName.Focus();- return false;- }- // always (re)generate the elements from the current editor values, so a changed position (or any other- // parameter) is never left stale in a source that already had elements from an earlier generate/save- _editing.GenerateElements(_sourceRandom);- if (_currentSourceIndex >= 0 && _currentSourceIndex < _sources.Count)- {- _sources[_currentSourceIndex] = _editing;- }- else- {- _sources.Add(_editing);- _currentSourceIndex = _sources.Count - 1;- }- RefreshSourceList();- _syncingSourceList = true;- try- {- lstSources.SelectedIndex = _currentSourceIndex;- }- finally- {- _syncingSourceList = false;- }- UpdateListButtonState();- MarkProjectChanged();- if (_picSource != null)- {- _picSource.Invalidate();- }- picPreviewSource.Invalidate();- ToolStripStatusLabel1.Text = "Source '" + _editing.Name + "' saved (" + _editing.Elements.Count.ToString(CultureInfo.InvariantCulture) + " element(s)).";- // the editor keeps editing the source that was just saved, so pressing Save again updates it in place- _editing = _editing.Clone();- ClearSourceDirty();- return true;- }-- /// <summary>- /// Fills the editor controls from a source (after normalising it), with- /// <c>_loadingSource</c> set so the change handlers neither mark the editor dirty nor- /// write back into <c>_editing</c>. Values outside a control's range are clamped for- /// display. The randomise limits are refreshed before the randomise amounts are set so- /// they are not clipped by stale maxima; finally the enabled states and the wavelength- /// label are updated.- /// </summary>- private void ShowSourceInControls(SourceSettings s)- {- s.Normalize();- _loadingSource = true;- try- {- txtName.Text = s.Name;- cmbMainType.SelectedIndex = (int)s.MainType;- chkSourceOn.Checked = s.SourceOn;- chkDetachSource.Checked = s.DetachSource;- txtDetachAfterSteps.Text = s.DetachAfterSteps.ToString(CultureInfo.InvariantCulture);- numSourcePositionX.Value = Form1.ClampToRange(numSourcePositionX, s.PosX);- numSourcePositionY.Value = Form1.ClampToRange(numSourcePositionY, s.PosY);- numFrequency.Value = Form1.ClampToRange(numFrequency, s.Frequency);- numAmplitude.Value = Form1.ClampToRange(numAmplitude, s.Amplitude);- numPhase.Value = Form1.ClampToRange(numPhase, s.PhaseDeg);- radModePulsed.Checked = s.Mode == SourceMode.Pulsed;- radModeContinuous.Checked = s.Mode == SourceMode.Continuous;- cmbPulseShape.SelectedIndex = (int)s.PulseShape;- numPulseWidthCycles.Value = Form1.ClampToRange(numPulseWidthCycles, s.PulseWidthCycles);- numOffStateCycles.Value = Form1.ClampToRange(numOffStateCycles, s.OffStateCycles);- numArraySizeX.Value = Form1.ClampToRange(numArraySizeX, s.ArraySizeX);- numArraySizeY.Value = Form1.ClampToRange(numArraySizeY, s.ArraySizeY);- numSpacingSizeX.Value = Form1.ClampToRange(numSpacingSizeX, s.SpacingX);- numSpacingSizeY.Value = Form1.ClampToRange(numSpacingSizeY, s.SpacingY);- // the three "amount" fields below are clamped against the just-loaded values above (see- // UpdateRandomizeLimits) - called explicitly here rather than relying only on the ValueChanged handler- // further down, since a value that happens to equal what a control already shows does not raise that event- UpdateRandomizeLimits();- cmbCompositeProperties.SelectedIndex = (int)s.CompositeMode;- chkRandomizeFrequency.Checked = s.RandomizeFrequency;- numRandomizeFrequency.Value = Form1.ClampToRange(numRandomizeFrequency, s.RandomizeFrequencyAmount);- chkRandomizePhase.Checked = s.RandomizePhase;- NumRandomizePhase.Value = Form1.ClampToRange(NumRandomizePhase, s.RandomizePhaseAmount);- chkOffWidth.Checked = s.RandomizeOffWidth;- numRandomizeOffWidth.Value = Form1.ClampToRange(numRandomizeOffWidth, s.RandomizeOffWidthAmount);- chkRandomizePosition.Checked = s.RandomizePosition;- numRandomizePosition.Value = Form1.ClampToRange(numRandomizePosition, s.RandomizePositionAmount);- }- finally- {- _loadingSource = false;- }- UpdateSourceControlState();- UpdateLambdaLabel();- }-- /// <summary>- /// Hooks the change events of every input control below <paramref name="container"/> to- /// <see cref="MarkSourceDirty"/>, recursively since <c>grpSourceDetails</c> nests- /// <c>grpSingleSource</c> and <c>grpComposite</c>, so any change the user makes to a source's- /// properties there turns <c>btnSaveSource</c> orange until the change is saved (see- /// <see cref="MarkSourceDirty"/>/<see cref="ClearSourceDirty"/>). Called once, from- /// <see cref="InitializeSourceControls"/>. The source's position (<c>numSourcePositionX</c>/<c>Y</c>,- /// in <c>grpPlaceSource</c>, not <c>grpSourceDetails</c>) is deliberately not included here:- /// picking or typing a position is committed through its own path instead- /// (<see cref="SourcePicture_MouseClick"/>/<see cref="SourcePosition_ValueChanged"/>).- /// </summary>- private void WireSourceDirtyTracking(Control container)- {- foreach (Control control in container.Controls)- {- if (control is TextBox textBox)- {- textBox.TextChanged += SourceDetail_Changed;- }- else if (control is NumericUpDown numericUpDown)- {- numericUpDown.ValueChanged += SourceDetail_Changed;- }- else if (control is CheckBox checkBox)- {- checkBox.CheckedChanged += SourceDetail_Changed;- }- else if (control is RadioButton radioButton)- {- radioButton.CheckedChanged += SourceDetail_Changed;- }- else if (control is ComboBox comboBox)- {- comboBox.SelectedIndexChanged += SourceDetail_Changed;- }- if (control.HasChildren)- {- WireSourceDirtyTracking(control);- }- }- }-- /// <summary>Common handler for every control wired by <see cref="WireSourceDirtyTracking"/>. Ignored while the code itself is filling the controls (<see cref="ShowSourceInControls"/> sets <c>_loadingSource</c> first), so only an actual user edit counts.</summary>- private void SourceDetail_Changed(object sender, EventArgs e)- {- if (!_loadingSource)- {- MarkSourceDirty();- }- }-- /// <summary>Signals unsaved edits by colouring the save button orange.</summary>- private void MarkSourceDirty()- {- btnSaveSource.BackColor = Color.Orange;- }-- /// <summary>Restores <c>btnSaveSource</c> to its own Designer colour (captured in <c>_sourceSaveButtonDefaultBackColor</c>), once its pending changes are saved or discarded by loading a different/blank source into the editor.</summary>- private void ClearSourceDirty()- {- btnSaveSource.BackColor = _sourceSaveButtonDefaultBackColor;- }-- /// <summary>- /// Copies the editor controls into <paramref name="target"/> and normalises it. The- /// detach step count is parsed with the invariant culture and left unchanged when the- /// text is not a non-negative integer. Does not touch <c>HasPosition</c> or the elements.- /// </summary>- private void ReadSourceControls(SourceSettings target)- {- target.Name = txtName.Text.Trim();- target.MainType = ((cmbMainType.SelectedIndex == 1) ? SourceMainType.Composite : SourceMainType.Simple);- target.SourceOn = chkSourceOn.Checked;- target.DetachSource = chkDetachSource.Checked;- int detachAfterSteps;- if (int.TryParse(txtDetachAfterSteps.Text.Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out detachAfterSteps) && detachAfterSteps >= 0)- {- target.DetachAfterSteps = detachAfterSteps;- }- target.PosX = Convert.ToInt32(numSourcePositionX.Value);- target.PosY = Convert.ToInt32(numSourcePositionY.Value);- target.Frequency = Convert.ToInt32(numFrequency.Value);- target.Amplitude = Convert.ToInt32(numAmplitude.Value);- target.PhaseDeg = Convert.ToInt32(numPhase.Value);- target.Mode = (radModePulsed.Checked ? SourceMode.Pulsed : SourceMode.Continuous);- target.PulseShape = ((cmbPulseShape.SelectedIndex == 1) ? SourcePulseShape.SmoothedSquare : SourcePulseShape.Gaussian);- target.PulseWidthCycles = Convert.ToInt32(numPulseWidthCycles.Value);- target.OffStateCycles = Convert.ToInt32(numOffStateCycles.Value);- target.ArraySizeX = Convert.ToInt32(numArraySizeX.Value);- target.ArraySizeY = Convert.ToInt32(numArraySizeY.Value);- target.SpacingX = Convert.ToInt32(numSpacingSizeX.Value);- target.SpacingY = Convert.ToInt32(numSpacingSizeY.Value);- target.CompositeMode = ((cmbCompositeProperties.SelectedIndex == 1) ? SourceCompositeMode.InheritAndRandomize : SourceCompositeMode.InheritFromSingle);- target.RandomizeFrequency = chkRandomizeFrequency.Checked;- target.RandomizeFrequencyAmount = Convert.ToInt32(numRandomizeFrequency.Value);- target.RandomizePhase = chkRandomizePhase.Checked;- target.RandomizePhaseAmount = Convert.ToInt32(NumRandomizePhase.Value);- target.RandomizeOffWidth = chkOffWidth.Checked;- target.RandomizeOffWidthAmount = Convert.ToInt32(numRandomizeOffWidth.Value);- target.RandomizePosition = chkRandomizePosition.Checked;- target.RandomizePositionAmount = Convert.ToInt32(numRandomizePosition.Value);- target.Normalize();- }-- /// <summary>- /// Enables or disables the dependent inputs: pulse controls only in pulsed mode, the- /// detach step box only when detaching, the array and composite controls only for a- /// composite source, and each randomise amount only when the composite mode is- /// "randomize" and its own checkbox is ticked.- /// </summary>- private void UpdateSourceControlState()- {- bool isComposite = cmbMainType.SelectedIndex == 1;- grpComposite.Enabled = isComposite;- bool isPulsed = radModePulsed.Checked;- cmbPulseShape.Enabled = isPulsed;- numPulseWidthCycles.Enabled = isPulsed;- numOffStateCycles.Enabled = isPulsed;- txtDetachAfterSteps.Enabled = chkDetachSource.Checked;- bool canRandomize = isComposite && cmbCompositeProperties.SelectedIndex == 1;- cmbCompositeProperties.Enabled = isComposite;- numArraySizeX.Enabled = isComposite;- numArraySizeY.Enabled = isComposite;- numSpacingSizeX.Enabled = isComposite;- numSpacingSizeY.Enabled = isComposite;- chkRandomizeFrequency.Enabled = canRandomize;- chkRandomizePhase.Enabled = canRandomize;- chkOffWidth.Enabled = canRandomize;- chkRandomizePosition.Enabled = canRandomize;- numRandomizeFrequency.Enabled = canRandomize && chkRandomizeFrequency.Checked;- NumRandomizePhase.Enabled = canRandomize && chkRandomizePhase.Checked;- numRandomizeOffWidth.Enabled = canRandomize && chkOffWidth.Checked;- numRandomizePosition.Enabled = canRandomize && chkRandomizePosition.Checked;- }-- /// <summary>Changing the main type or the composite mode combo box re-evaluates which inputs are enabled.</summary>- private void SourceMainType_SelectedIndexChanged(object sender, EventArgs e)- {- if (!_loadingSource)- {- UpdateSourceControlState();- }- }-- /// <summary>Switching between continuous and pulsed enables or disables the pulse inputs.</summary>- private void SourceMode_CheckedChanged(object sender, EventArgs e)- {- if (!_loadingSource)- {- UpdateSourceControlState();- }- }-- /// <summary>Keeps <c>lblLambdaIs</c> in sync with <c>numFrequency</c>. Not guarded by <c>_loadingSource</c>, since it must also refresh when a source is loaded into the editor (<see cref="ShowSourceInControls"/>), not only on a user edit.</summary>- private void SourceFrequency_ValueChanged(object sender, EventArgs e)- {- UpdateLambdaLabel();- }-- /// <summary>- /// Shows an estimated wavelength for the current <c>numFrequency</c> value in <c>lblLambdaIs</c>,- /// as "λ=xx,x px" (using the current culture's decimal separator). lambda = c / f: f is the- /// cyclic frequency (cycles/step) that a source's level (1-255, the <c>numFrequency</c> control)- /// maps to via <see cref="SimulationSettings.SourceFrequencyScale"/>, the same formula the engines- /// use (level / 255 * 0.5 * SourceFrequencyScale is the <em>angular</em> frequency in radians per- /// step, so dividing by 2π gives cycles/step), and c is the propagation speed set via File >- /// Set c-value (<see cref="SimulationSettings.WaveSpeedC"/>), in canvas pixels per step. Falls- /// back to a scale of 2.0 and c = 0.563 before the simulation settings exist. This is only ever- /// an estimate/display value: the real per-pixel wave speed the simulation actually uses comes- /// from the scene's refractive index instead (see <see cref="SceneData.C2"/>) and is not- /// necessarily uniform.- /// </summary>- private void UpdateLambdaLabel()- {- if (lblLambdaIs == null)- {- return;- }- int frequency = Convert.ToInt32(numFrequency.Value);- double frequencyScale = ((_simulation != null) ? _simulation.SourceFrequencyScale : 2.0);- double angularFrequency = frequency / 255.0 * 0.5 * frequencyScale;- double cyclesPerStep = angularFrequency / (2.0 * Math.PI);- if (cyclesPerStep <= 0.0)- {- lblLambdaIs.Text = "λ= - px";- }- else- {- double waveSpeed = ((_simulation != null) ? _simulation.WaveSpeedC : 0.563);- double wavelength = waveSpeed / cyclesPerStep;- // the current culture's own decimal separator (a comma in nl-NL, for instance), not a fixed "."- lblLambdaIs.Text = "λ=" + wavelength.ToString("0.0", CultureInfo.CurrentCulture) + " px";- }- }-- /// <summary>Ticking "detach" enables the detach step box.</summary>- private void SourceDetach_CheckedChanged(object sender, EventArgs e)- {- if (!_loadingSource)- {- UpdateSourceControlState();- }- }-- /// <summary>Ticking one of the randomise checkboxes enables its amount input.</summary>- private void SourceRandomizeCheck_CheckedChanged(object sender, EventArgs e)- {- if (!_loadingSource)- {- UpdateSourceControlState();- }- }-- /// <summary>- /// Keeps the three randomise "amount" fields' Maximum in step with the single-source values they- /// are added to (see <see cref="UpdateRandomizeLimits"/>) whenever frequency, off-width, array- /// size or spacing changes. Not guarded by <c>_loadingSource</c>, since <see cref="ShowSourceInControls"/>- /// also relies on this to be current before it sets the amount fields' Value (though it- /// additionally calls <see cref="UpdateRandomizeLimits"/> directly itself, since a value that- /// happens to already match a control's current Value does not raise ValueChanged).- /// </summary>- private void SourceRandomizeLimitInput_ValueChanged(object sender, EventArgs e)- {- UpdateRandomizeLimits();- }-- /// <summary>- /// Caps how large a "randomize amount" can be set to, so <see cref="SourceSettings.GenerateElements"/>'- /// inherited ± amount can never be forced to clip against a hard limit and so end up biased- /// instead of a true symmetric spread:- /// <list type="bullet">- /// <item><description>frequency (<c>numRandomizeFrequency</c>): the source's level must stay within- /// 1-255, so the amount cannot exceed the smaller of (Frequency - 1) and (255 - Frequency).</description></item>- /// <item><description>off-width cycles (<c>numRandomizeOffWidth</c>): GenerateElements floors the result- /// at 1 cycle, so the amount cannot exceed (OffStateCycles - 1).</description></item>- /// <item><description>position (<c>numRandomizePosition</c>): position has no natural upper/lower bound- /// the way frequency and off-width do, so instead the amount is capped at half the array's own- /// spacing along whichever axis (or axes) actually separate elements (ArraySizeX/Y > 1); a- /// randomized element's jitter can then never overshoot as far as a neighbouring (unrandomized)- /// grid position. An array that is only one element wide in both directions (no neighbour to- /// protect against) is left unbounded at <see cref="SceneSettings.MaxCanvasSize"/>.</description></item>- /// </list>- /// Phase (<c>NumRandomizePhase</c>) is not limited here: its result is already clamped to -180..180- /// in GenerateElements, and since ±180° is the same angle either way, that clipping does not- /// bias the result the way it would for frequency or off-width. Lowering a Maximum below a- /// field's current Value clamps that Value down to it automatically (standard NumericUpDown- /// behaviour), so the amount fields never need to be set here, only their Maximum.- /// </summary>- private void UpdateRandomizeLimits()- {- int frequency = Convert.ToInt32(numFrequency.Value);- numRandomizeFrequency.Maximum = new decimal(Math.Max(0, Math.Min(frequency - 1, 255 - frequency)));- int offStateCycles = Convert.ToInt32(numOffStateCycles.Value);- numRandomizeOffWidth.Maximum = new decimal(Math.Max(0, offStateCycles - 1));- int arraySizeX = Convert.ToInt32(numArraySizeX.Value);- int arraySizeY = Convert.ToInt32(numArraySizeY.Value);- if (arraySizeX <= 1 && arraySizeY <= 1)- {- numRandomizePosition.Maximum = (decimal)SceneSettings.MaxCanvasSize;- }- else- {- // the smallest spacing among the axes that actually separate elements (Count > 1), without relying on- // System.Linq (not imported by this file) for a two/one-element Min()- List<int> relevantSpacing = new List<int>();- if (arraySizeX > 1)- {- relevantSpacing.Add(Convert.ToInt32(numSpacingSizeX.Value));- }- if (arraySizeY > 1)- {- relevantSpacing.Add(Convert.ToInt32(numSpacingSizeY.Value));- }- int minSpacing = relevantSpacing[0];- for (int i = 1; i < relevantSpacing.Count; i++)- {- if (relevantSpacing[i] < minSpacing)- {- minSpacing = relevantSpacing[i];- }- }- numRandomizePosition.Maximum = new decimal(Math.Max(0, minSpacing / 2));- }- }-- /// <summary>- /// <c>numArraySizeX</c>/<c>numArraySizeY</c> must stay odd: an even-sized array has its centre- /// between two pixels instead of on one, which (especially at small spacings) places the whole- /// array off-grid in an irregular way. The spinner buttons can never produce an even value- /// (Minimum/Maximum are both odd and Increment is 2, see <see cref="InitializeSourceControls"/>),- /// but typing a value directly can, so this catches that on Validating (the point where a typed- /// value is finalized: on Tab/click-away, or on Enter via the global <c>NumericUpDown_KeyDown</c>- /// hook that moves focus off the control) and bumps it up by one (capped at the maximum), with a- /// warning so the change is not a silent surprise. Not guarded by <c>_loadingSource</c>:- /// Validating only fires from an actual focus change, never from a plain Value assignment in- /// code (e.g. <see cref="ShowSourceInControls"/> loading a project), so it can only ever be the- /// user's own keyboard entry.- /// </summary>- private void ArraySize_Validating(object sender, CancelEventArgs e)- {- NumericUpDown input = (NumericUpDown)sender;- int value = Convert.ToInt32(input.Value);- if (value % 2 != 0)- {- return;- }- int adjusted = Math.Min(Convert.ToInt32(input.Maximum), value + 1);- input.Value = new decimal(adjusted);- MessageBox.Show(this, "Use uneven numbers only - the array size has been increased to " + adjusted.ToString(CultureInfo.InvariantCulture) + ".", "Array size", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- }-- /// <summary>Any main tab change cancels a running position pick; arriving on the source tab loads the scene picture if needed and re-syncs the list selection with the editor.</summary>- private void SourceTabChanged(object sender, EventArgs e)- {- EndSourcePick();- if (tabMainFunctions.SelectedTab == tabSourceList)- {- AutoLoadSceneImageIfEmpty(_picSource);- SyncSourceListSelectionToEditor();- }- }-- /// <summary>- /// Makes <c>lstSources</c>' highlighted item and <c>grpSourceDetails</c> agree with the source- /// actually loaded in the editor (<c>_editing</c>/<c>_currentSourceIndex</c>, the last source- /// that was selected or edited) whenever the tab is opened, without triggering the selection- /// handler. Without this, coming back from another tab could show some list item highlighted- /// (left over from before, or the list's own default) while the detail controls still showed a- /// different source, or one that no longer matched the highlighted entry at all.- /// </summary>- private void SyncSourceListSelectionToEditor()- {- _syncingSourceList = true;- try- {- if (_currentSourceIndex >= 0 && _currentSourceIndex < lstSources.Items.Count)- {- lstSources.SelectedIndex = _currentSourceIndex;- }- else- {- lstSources.SelectedIndex = -1;- }- }- finally- {- _syncingSourceList = false;- }- ShowSourceInControls(_editing);- }-- /// <summary>Toggles position picking on the scene picture; the button reads "Cancel" while picking.</summary>- private void PickSourcePosition_Click(object sender, EventArgs e)- {- if (_sourcePicking)- {- EndSourcePick();- }- else- {- StartSourcePick();- }- }-- /// <summary>Enters pick mode (cross cursor, "Cancel" button, status hint) after making sure the picture box has an image; shows a message and stays idle when the canvas size is unknown.</summary>- private void StartSourcePick()- {- if (_picSource.Image == null)- {- EnsureSourcePicture();- }- if (_picSource.Image == null)- {- MessageBox.Show(this, "There is no picture to pick from yet, and the canvas size is not known either\r\n(choose a scene image, or a user defined width and height, on the Configuration tab first).", "Source position", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- _sourcePicking = true;- _picSource.Cursor = Cursors.Cross;- btnPickSourcePosition.Text = "Cancel";- ToolStripStatusLabel1.Text = "Click in the picture for the position of the source (press Cancel to stop picking).";- }-- /// <summary>- /// When there is no picture yet to pick from (no simulation has run), makes a plain black one at- /// the canvas size that the Configuration tab currently specifies (the scene image's size, or the- /// user defined width/height), so a source position can still be picked before ever running a- /// simulation. Replaced by the real picture as soon as one is copied over from the Preview tab.- /// No-op when the canvas size is unknown. The bitmap is owned by the picture box.- /// </summary>- private void EnsureSourcePicture()- {- Size canvas = EffectiveCanvas();- if (canvas.Width <= 0 || canvas.Height <= 0)- {- return;- }- Bitmap placeholder = new Bitmap(canvas.Width, canvas.Height);- using (Graphics g = Graphics.FromImage(placeholder))- {- g.Clear(Color.Black);- }- _picSource.Image = placeholder;- }-- /// <summary>Leaves pick mode and restores cursor, button text and status bar; no-op when not picking.</summary>- private void EndSourcePick()- {- if (!_sourcePicking)- {- return;- }- _sourcePicking = false;- btnPickSourcePosition.Text = _pickSourceButtonText;- if (_picSource != null)- {- _picSource.Cursor = Cursors.Default;- }- ToolStripStatusLabel1.Text = "";- }-- /// <summary>- /// A left click on the scene picture while picking converts the click to canvas pixels,- /// writes them into the position inputs and the edited source, ends the pick and, when- /// an existing list entry is being edited, saves the source immediately. Clicks outside- /// the image are ignored.- /// </summary>- private void SourcePicture_MouseClick(object sender, MouseEventArgs e)- {- if (!_sourcePicking || e.Button != MouseButtons.Left)- {- return;- }- int canvasX = 0;- int canvasY = 0;- if (!TryPictureToCanvas(_picSource, e.Location, ref canvasX, ref canvasY))- {- return;- }- numSourcePositionX.Value = Form1.ClampToRange(numSourcePositionX, canvasX);- numSourcePositionY.Value = Form1.ClampToRange(numSourcePositionY, canvasY);- // SourcePosition_ValueChanged updates _editing and invalidates the picture, but not when the values above- // did not actually change (e.g. clicking back on the same pixel), so do it here too, explicitly- if (!_loadingSource)- {- _editing.PosX = canvasX;- _editing.PosY = canvasY;- _editing.HasPosition = true;- _picSource.Invalidate();- }- EndSourcePick();- // picking a position for a source that is already in the list commits the editor's current data (the- // picked position and anything else changed since the last save) straight to it, the same as pressing Save- // source - so the pick is never left stale waiting for a separate save. A brand new/copied source (not- // selected in the list yet) is left as before: still just a live, unsaved position until Save source is- // pressed, since adding it here could otherwise silently add an incomplete/unnamed source to the list.- if (_currentSourceIndex >= 0)- {- CommitSourceEdits();- }- }-- /// <summary>Keeps the live marker in the picture in sync while typing a new position, same as picking one does: moves the edited source (and flags it as positioned) so its marker follows on the scene picture before saving.</summary>- private void SourcePosition_ValueChanged(object sender, EventArgs e)- {- if (_loadingSource)- {- return;- }- _editing.PosX = Convert.ToInt32(numSourcePositionX.Value);- _editing.PosY = Convert.ToInt32(numSourcePositionY.Value);- _editing.HasPosition = true;- if (_picSource != null)- {- _picSource.Invalidate();- }- }-- /// <summary>- /// Draws a marker for every positioned source over the scene picture: saved sources in- /// blue, the one being edited (taken from <c>_editing</c>, so unsaved moves show) in- /// yellow, plus the unsaved new source when nothing is selected. Canvas pixels are scaled- /// to the zoomed image rectangle of the picture box.- /// </summary>- private void SourcePicture_Paint(object sender, PaintEventArgs e)- {- if (_picSource.Image == null)- {- return;- }- Size canvas = EffectiveCanvas();- if (canvas.Width <= 0)- {- canvas = _picSource.Image.Size;- }- RectangleF imageRect = Form1.ZoomedImageRectangle(_picSource);- if (imageRect.Width <= 0f)- {- return;- }- float scaleX = imageRect.Width / canvas.Width;- float scaleY = imageRect.Height / canvas.Height;- for (int i = 0; i < _sources.Count; i++)- {- bool isCurrent = i == _currentSourceIndex;- // the source being edited is shown at its live (not yet saved) position, so moving it in the picture or- // the X/Y boxes is reflected immediately instead of only after Save source- SourceSettings shown = (isCurrent ? _editing : _sources[i]);- if (shown.HasPosition)- {- Form1.DrawSourceMarker(e.Graphics, shown, imageRect, scaleX, scaleY, isCurrent);- }- }- // the source being created or copied (not in _sources yet) is shown too, so its position can be seen while- // picking - but only once it actually has one (Pick or a typed X/Y), never at the unset default- if (_currentSourceIndex < 0 && _editing.HasPosition)- {- Form1.DrawSourceMarker(e.Graphics, _editing, imageRect, scaleX, scaleY, true);- }- }-- /// <summary>Draws a circle-and-crosshair marker with the source name at the source position; the current source is drawn larger and in yellow, others in blue.</summary>- /// <param name="g">Target surface of the picture box's paint event.</param>- /// <param name="s">Source whose canvas-pixel position and name are drawn.</param>- /// <param name="area">Rectangle the canvas occupies inside the picture box, in picture-box pixels.</param>- /// <param name="sx">Picture-box pixels per canvas pixel horizontally.</param>- /// <param name="sy">Picture-box pixels per canvas pixel vertically.</param>- /// <param name="isCurrent">True for the source being edited (larger yellow marker).</param>- private static void DrawSourceMarker(Graphics g, SourceSettings s, RectangleF area, float sx, float sy, bool isCurrent)- {- Color color = (isCurrent ? Color.FromArgb(230, 255, 208, 64) : Color.FromArgb(200, 64, 180, 255));- float radius = (isCurrent ? 5f : 4f);- float cx = area.X + s.PosX * sx;- float cy = area.Y + s.PosY * sy;- using (Pen pen = new Pen(color, isCurrent ? 2f : 1.5f))- {- g.DrawEllipse(pen, cx - radius, cy - radius, radius * 2f, radius * 2f);- g.DrawLine(pen, cx - radius - 3f, cy, cx + radius + 3f, cy);- g.DrawLine(pen, cx, cy - radius - 3f, cx, cy + radius + 3f);- }- using (Font font = new Font("Segoe UI", 11f, FontStyle.Bold, GraphicsUnit.Pixel))- {- using (SolidBrush brush = new SolidBrush(color))- {- g.DrawString(s.Name, font, brush, cx + radius + 4f, cy - radius - 2f);- }- }- }-- /// <summary>- /// Shows the layout of the source currently loaded in the editor (<c>_editing</c>) as white dots- /// on a black background, centred in the preview box. The source picture above is at canvas- /// scale, so a source (especially a composite source's individual elements) can be too small or- /// too close together to make out there. <c>chkAutoRescaleSourceOn</c> (checked by default) picks- /// which of two views this shows instead: checked, it zooms in on just the elements themselves- /// (centred, the element bounding box scaled to fill the box minus a <c>marginFraction</c> margin- /// on each side, each element shown as a dot of radius <c>dotRadius</c> so it stays visible), so- /// their relative arrangement is always visible regardless of where the source sits on the canvas- /// or how tightly its array is spaced; unchecked, the true, unscaled size (one simulation pixel is- /// one screen pixel, and each element is drawn as exactly that: a single pixel, the same size it- /// actually is in the simulation), so a composite source's real physical footprint (how many- /// actual simulation pixels its array spans) can be judged directly. Either way it shows- /// <c>_editing.Elements</c>, the last generated list, so it is blank for a brand new/copied source- /// until it is generated by Save source, and otherwise reflects whatever was last saved (or, for- /// the source just saved, just regenerated). Kept in sync by a <c>picPreviewSource.Invalidate()</c>- /// call everywhere <c>_editing</c>/the currently edited source changes (loading a different one,- /// New/Copy/Delete, and Save source), the same places <c>_picSource.Invalidate()</c> is called for- /// the position marker above, and by <see cref="chkAutoRescaleSourceOn_CheckedChanged"/> when the- /// view itself is switched.- /// </summary>- private void picPreviewSource_Paint(object sender, PaintEventArgs e)- {- e.Graphics.Clear(Color.Black);- List<SourceElement> elements = ((_editing != null) ? _editing.Elements : null);- if (elements == null || elements.Count == 0)- {- return;- }- int minX = elements[0].PosX;- int maxX = elements[0].PosX;- int minY = elements[0].PosY;- int maxY = elements[0].PosY;- foreach (SourceElement element in elements)- {- if (element.PosX < minX)- {- minX = element.PosX;- }- if (element.PosX > maxX)- {- maxX = element.PosX;- }- if (element.PosY < minY)- {- minY = element.PosY;- }- if (element.PosY > maxY)- {- maxY = element.PosY;- }- }- float boxW = picPreviewSource.ClientSize.Width;- float boxH = picPreviewSource.ClientSize.Height;- if (boxW <= 0f || boxH <= 0f)- {- return;- }- float centerX = (minX + maxX) / 2f;- float centerY = (minY + maxY) / 2f;- bool autoRescale = chkAutoRescaleSourceOn == null || chkAutoRescaleSourceOn.Checked;- float scale;- if (autoRescale)- {- // a single element (or several coinciding at the same spot) has no span to scale to - fall back to a- // fixed half-extent instead of dividing by zero, so it still just shows one dot in the middle of the box- float halfExtent = Math.Max(maxX - minX, maxY - minY) / 2f;- if (halfExtent <= 0f)- {- halfExtent = 1f;- }- const float marginFraction = 0.15f; // keeps outer dots from touching/clipping at the edge of the box- float usable = Math.Min(boxW, boxH) * (1f - 2f * marginFraction);- scale = usable / (halfExtent * 2f);- }- else- {- scale = 1f; // true size: one simulation pixel is one screen pixel- }- const float dotRadius = 3f;- using (SolidBrush brush = new SolidBrush(Color.White))- {- foreach (SourceElement element in elements)- {- float px = boxW / 2f + (element.PosX - centerX) * scale;- float py = boxH / 2f + (element.PosY - centerY) * scale;- if (autoRescale)- {- e.Graphics.FillEllipse(brush, px - dotRadius, py - dotRadius, 2f * dotRadius, 2f * dotRadius);- }- else- {- e.Graphics.FillRectangle(brush, px, py, 1f, 1f);- }- }- }- }-- /// <summary>Redraws at the (centred, rescaled) size whenever the box itself is resized, the same as any other owner-drawn control that scales to its client area.</summary>- private void picPreviewSource_SizeChanged(object sender, EventArgs e)- {- picPreviewSource.Invalidate();- }-- /// <summary>Toggling auto-rescale repaints the preview in the other scale mode.</summary>- private void chkAutoRescaleSourceOn_CheckedChanged(object sender, EventArgs e)- {- picPreviewSource.Invalidate();- }- }-}diff --git a/Wave_Dude_2D/Form1.cs b/Wave_Dude_2D/Form1.csdeleted file mode 100644index df81362..0000000--- a/Wave_Dude_2D/Form1.cs+++ /dev/null@@ -1,1439 +0,0 @@-using System;-using System.Collections.Generic;-using System.Diagnostics;-using System.Drawing;-using System.Globalization;-using System.IO;-using System.Runtime.InteropServices;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Main window of the wave simulator. This part holds start-up and shutdown, the File/Info- /// menus, project open/save, the hand-built modal prompts, and every private field and- /// nested type shared by the other <c>Form1.*.cs</c> parts (Colors, Projects, Output, Scene,- /// Simulation, Probes, Sources). All of it runs on the UI thread; the only other thread is- /// the <see cref="SimulationRunner"/> worker, whose events are marshalled back through- /// <see cref="PostToUi"/> in the Simulation part.- /// </summary>- public partial class Form1 : Form- {- /// <summary>- /// Wires the form lifetime events, gives every shared field its start value (empty- /// settings objects, default sort orders, the root-blink timer, an unnamed source being- /// edited) and then runs the designer code. The real set-up continues in- /// <see cref="Form1_Load"/>.- /// </summary>- public Form1()- {- base.Load += Form1_Load;- base.FormClosed += Form1_FormClosed;- base.FormClosing += Form1_FormClosing;- _schemes = new List<ColorScheme>();- _selectedStop = -1;- _thumbs = new ImageList();- _projectSortColumn = 1;- _projectSortAscending = false;- _outputProjectSortColumn = 1;- _outputProjectSortAscending = false;- _schemeSortColumn = 2;- _schemeSortAscending = true;- _sceneSortColumn = 1;- _sceneSortAscending = false;- _imageSortColumn = 1;- _imageSortAscending = false;- _videoSortColumn = 1;- _videoSortAscending = false;- _thumbBitmaps = new List<Bitmap>();- _settings = new AppSettings();- _rootBlinkTimer = new global::System.Windows.Forms.Timer- {- Interval = 700- };- _rootBlinkTimer.Tick += RootBlinkTimer_Tick;- _scene = new SceneSettings();- _sceneTip = new ToolTip();- _simulation = new SimulationSettings();- _simStatus = "";- _fieldVideoFile = "";- _intensityVideoFile = "";- _runInfo = "";- _progressText = "";- _probes = Form1.NewProbeList();- _probeTraces = new List<ProbeTrace>();- _sources = new List<SourceSettings>();- _currentSourceIndex = -1;- _editing = new SourceSettings();- _pickSourceButtonText = "Pick";- _sourceRandom = new Random();- InitializeComponent();- }-- /// <summary>- /// Finishes what the designer cannot express: collects the nine colour-stop buttons,- /// configures the scheme list view and its thumbnail list, embeds the- /// <see cref="ColorPickerControl"/>, switches the main tab control to owner drawing,- /// loads the default scheme folder, runs the per-tab initialisers, re-parents- /// <c>btnPickRoot</c> so it stays clickable while <c>grpProjects</c> is disabled, loads the- /// user settings and project list, and makes Enter in any <see cref="NumericUpDown"/>- /// move the focus on.- /// </summary>- private void Form1_Load(object sender, EventArgs e)- {- // one button per stop, in scale order (Color 1 = first entry ... last button = last entry)- _stopButtons = new Button[] { btnColor1, btnCOlor2, btnColor3, btnColor4, btnColor5, btnColor6, btnColor7, btnColor8, btnColor9 };- Debug.Assert(_stopButtons.Length == ColorScheme.StopCount, "The number of Color buttons must equal ColorScheme.StopCount.");- foreach (Button button in _stopButtons)- {- button.UseVisualStyleBackColor = false;- button.FlatStyle = FlatStyle.Flat;- button.FlatAppearance.BorderSize = 1;- button.FlatAppearance.BorderColor = Color.Black;- }- // scheme list: thumbnail + name, grouped by category- _thumbs.ImageSize = new Size(ThumbWidth, ThumbHeight);- _thumbs.ColorDepth = ColorDepth.Depth32Bit;- ListView1.View = View.Details;- ListView1.FullRowSelect = true;- ListView1.MultiSelect = false;- ListView1.HideSelection = false;- ListView1.HeaderStyle = ColumnHeaderStyle.Clickable;- ListView1.SmallImageList = _thumbs;- ListView1.Columns.Clear();- ListView1.Columns.Add("Scheme", 250);- ListView1.Columns.Add("Kind", 55);- ListView1.Columns.Add("Type", 62);- UpdateSchemeListSortHeaders();- pnlScheme.BorderStyle = BorderStyle.FixedSingle;- Panel2.BorderStyle = BorderStyle.FixedSingle;- _picker = new ColorPickerControl();- _picker.Dock = DockStyle.Fill;- Panel2.Controls.Add(_picker);- _picker.ColorChanged += Picker_ColorChanged;- txtCurrentColorScheme.ReadOnly = true;- // tabMainFunctions: owner-drawn only so a disabled tab's own label can be shown in a lighter gray- // (WinForms does not do this by itself - a disabled TabPage still draws its label at full strength) -- // see tabMainFunctions_DrawItem.- tabMainFunctions.DrawMode = TabDrawMode.OwnerDrawFixed;- // lstAllProjects (Configuration tab project list): sortable by clicking colProjectName/colLastEdit, see- // lstAllProjects_ColumnClick. Show the initial sort direction in the header the same way a click would.- UpdateProjectListSortHeaders();- // the program's own scheme folder (ColorSchemeList in the project, or next to the exe when deployed)- txtSchemeFolder.Text = ColorSchemeStore.FindDefaultFolder();- if (Directory.Exists(txtSchemeFolder.Text))- {- LoadSchemeList();- }- RefreshEditorState();- // lblInfo (Settings tab): a clickable "hyperlink" style label - see lblInfo_Click for what it shows- lblInfo.ForeColor = Color.Blue;- lblInfo.Cursor = Cursors.Hand;- InitializeSceneControls();- InitializeSimulationControls();- InitializeProbeControls();- InitializeSourceControls();- // btnPickRoot must stay clickable even when no project root is known yet (that is the one situation it- // exists for), but the Designer put it inside grpProjects, and WinForms disables an enabled child along- // with a disabled parent - grpProjects.Enabled = false (UpdateProjectAccess, no root) would silently- // swallow its clicks right when they matter most. Move it onto tabConfiguration itself, in the same- // screen position, so it is never caught by that.- Point rootButtonSpot = grpProjects.Location;- rootButtonSpot.Offset(btnPickRoot.Location);- grpProjects.Controls.Remove(btnPickRoot);- tabConfiguration.Controls.Add(btnPickRoot);- btnPickRoot.Location = rootButtonSpot;- btnPickRoot.BringToFront();- InitializeProject();- InitializeOutputsTab();- // Enter in a NumericUpDown's edit box otherwise just beeps (Windows beeps on an unhandled Enter- // keystroke) and leaves the typed value sitting there uncommitted - HookNumericUpDownEnterKey wires- // every NumericUpDown on the form, wherever it lives, to NumericUpDown_KeyDown instead.- HookNumericUpDownEnterKey(this);- }-- /// <summary>- /// Recursively attaches <see cref="NumericUpDown_KeyDown"/> to every <see cref="NumericUpDown"/> below- /// <paramref name="root"/> (recursing into GroupBox/TabPage/Panel/... containers), so Enter commits the- /// typed value and moves on instead of beeping. Called once, from <see cref="Form1_Load"/>, on the whole- /// form - a plain loop over Controls rather than a fixed list, so it also covers any NumericUpDown added- /// later without needing to come back and wire it up by hand.- /// </summary>- private void HookNumericUpDownEnterKey(Control root)- {- foreach (Control control in root.Controls)- {- NumericUpDown numericUpDown = control as NumericUpDown;- if (numericUpDown != null)- {- numericUpDown.KeyDown += NumericUpDown_KeyDown;- }- if (control.HasChildren)- {- HookNumericUpDownEnterKey(control);- }- }- }-- /// <summary>- /// Enter in a NumericUpDown: stops the beep (<c>e.SuppressKeyPress</c> - Enter is not a character its edit- /// box accepts, which is what Windows was beeping about) and moves focus on to the next control, the same- /// as Tab would - which also commits whatever was typed, since a NumericUpDown parses/clamps its text on- /// losing focus regardless of how focus was lost.- /// </summary>- private void NumericUpDown_KeyDown(object sender, KeyEventArgs e)- {- if (e.KeyCode != Keys.Return)- {- return;- }- e.SuppressKeyPress = true;- e.Handled = true;- Control control = sender as Control;- if (control != null)- {- base.SelectNextControl(control, true, true, true, true);- }- }-- /// <summary>Disposes every bitmap the form owns: preview frames, scheme thumbnails, the scene image, the empty-canvas placeholder and the output preview.</summary>- private void Form1_FormClosed(object sender, FormClosedEventArgs e)- {- ClearPreviews();- foreach (Bitmap bitmap in _thumbBitmaps)- {- bitmap.Dispose();- }- _thumbBitmaps.Clear();- ReplaceSceneImage(null);- DisposeEmptyPreview();- ClearOutputPreview();- }-- /// <summary>- /// Vetoes closing when the user declines the save-project prompt, declines stopping a- /// running simulation (otherwise it is cancelled and given up to 15 s to exit), or- /// declines discarding unsaved colour-scheme edits.- /// </summary>- private void Form1_FormClosing(object sender, FormClosingEventArgs e)- {- if (!ConfirmSaveProject())- {- e.Cancel = true;- return;- }- if (_runner != null)- {- if (MessageBox.Show(this, "A simulation is running. Stop it and close the program?", "Simulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)- {- e.Cancel = true;- return;- }- // the runner closes the video files before it ends- _runner.Cancel();- _runner.WaitForExit(15000);- }- if (_dirty)- {- if (MessageBox.Show(this, "The current color scheme has unsaved changes. Close anyway?", "Unsaved changes", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)- {- e.Cancel = true;- }- }- }-- /// <summary>- /// Enables/disables everything that depends on a project root being chosen and/or an actual, named- /// project being the current one. <c>grpProjects</c> and the Outputs tab (its own project list, not- /// necessarily the one that is open) only need a root. The scene/simulation groups, the- /// Sources/Probes/Viewer tabs, most of "Quick navigate to" (all but <c>btnGotoConfiguration</c>, which- /// jumps to the always-available Configuration tab), "Simulation Control", "Share with source / probe"- /// and Save all need a real project. The Configuration tab (where the root and the project list- /// themselves live) and the color scheme tab manage the application's own settings, not a project's,- /// so they are never restricted. Disabling a TabPage here is not enough by itself to keep the user out- /// of it - see <see cref="tabMainFunctions_Selecting"/>, which refuses to switch to a disabled tab at- /// all instead of just showing its (disabled) contents. Blinks <c>btnPickRoot</c> while no root is chosen.- /// </summary>- private void UpdateProjectAccess()- {- bool hasRoot = _settings.ProjectRoot.Length > 0;- bool hasProject = _project != null;- grpProjects.Enabled = hasRoot;- tabOutput.Enabled = hasRoot;- // btnPickRoot (moved onto tabConfiguration itself in Form1_Load, so grpProjects.Enabled above cannot- // disable it) blinks light blue, slowly, for exactly the situation it exists for: no project root known- // yet - a fresh install on another computer, before AppSettings.ProjectRoot is set and everything else- // on screen is still disabled.- if (hasRoot)- {- _rootBlinkTimer.Stop();- _rootBlinkOn = false;- btnPickRoot.UseVisualStyleBackColor = true;- }- else- {- _rootBlinkTimer.Start();- }- grpSceneProperties.Enabled = hasProject;- grpSimulationSettings.Enabled = hasProject;- tabSourceList.Enabled = hasProject;- tabProbeList.Enabled = hasProject;- tabViewer.Enabled = hasProject;- // grpNavigateTabs itself stays enabled: btnGotoConfiguration jumps to the always-available Configuration- // tab, so only the other three "quick navigate" buttons need a real project.- btnGotoPreview.Enabled = hasProject;- btnGotoProbes.Enabled = hasProject;- btnGotoSources.Enabled = hasProject;- grpSimulationControlButtons.Enabled = hasProject;- grpShareImage.Enabled = hasProject;- btnSaveConfiguration.Enabled = hasProject;- btnSaveConfiguration2.Enabled = hasProject;- btnSaveAs.Enabled = hasProject;- btnDescription.Enabled = hasProject;- // Changing a TabPage's Enabled does not by itself repaint the tab strip, so a label's color- // (tabMainFunctions_DrawItem) would otherwise stay stuck at its old, disabled gray until something- // unrelated forced a redraw (resizing the window, switching tabs, ...) - force it here instead.- tabMainFunctions.Invalidate();- }-- /// <summary>Every 700 ms while no root is chosen: toggles <c>btnPickRoot</c> between light blue and the normal button colour.</summary>- private void RootBlinkTimer_Tick(object sender, EventArgs e)- {- _rootBlinkOn = !_rootBlinkOn;- btnPickRoot.UseVisualStyleBackColor = false;- btnPickRoot.BackColor = (_rootBlinkOn ? Color.LightBlue : SystemColors.Control);- }-- /// <summary>- /// Refuses to switch to a tab that <see cref="UpdateProjectAccess"/> disabled and tells the user to open a- /// project first. A disabled TabPage still lets itself be clicked into and shows its (disabled) contents- /// unless refused here - WinForms' TabControl has no built-in notion of a locked tab.- /// </summary>- private void tabMainFunctions_Selecting(object sender, TabControlCancelEventArgs e)- {- if (!e.TabPage.Enabled)- {- e.Cancel = true;- MessageBox.Show(this, "Please open or create a project first.", "No project", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- }- }-- /// <summary>- /// Owner-draws a tab header: window colour for the selected tab, control colour otherwise, silver text when- /// the page is disabled. Needed only so a disabled tab's label can be shown in a lighter gray than an- /// enabled one's (<see cref="Form1_Load"/> sets <c>tabMainFunctions.DrawMode</c> to OwnerDrawFixed for this).- /// </summary>- private void tabMainFunctions_DrawItem(object sender, DrawItemEventArgs e)- {- TabPage tabPage = tabMainFunctions.TabPages[e.Index];- Rectangle tabRect = tabMainFunctions.GetTabRect(e.Index);- // the selected tab a shade lighter than the rest, so which one is open is still visible without the- // native visual style this drawing replaces- Color backColor = ((e.Index == tabMainFunctions.SelectedIndex) ? SystemColors.Window : SystemColors.Control);- using (SolidBrush brush = new SolidBrush(backColor))- {- e.Graphics.FillRectangle(brush, tabRect);- }- Color textColor = (tabPage.Enabled ? SystemColors.ControlText : Color.Silver);- TextFormatFlags flags = TextFormatFlags.HorizontalCenter | TextFormatFlags.SingleLine | TextFormatFlags.VerticalCenter;- TextRenderer.DrawText(e.Graphics, tabPage.Text, tabMainFunctions.Font, tabRect, textColor, flags);- }-- /// <summary>- /// Startup: replaces the placeholder <see cref="_settings"/> with the values read from disk, shows- /// the stored project root, and refreshes access state, title and project list. Nothing from any- /// previous project is filled into the form: only the chosen project root folder- /// (<see cref="AppSettings.ProjectRoot"/>) is restored, if one was already chosen on an earlier run -- /// everything that needs a root or a real project stays disabled until then (<see cref="UpdateProjectAccess"/>).- /// </summary>- private void InitializeProject()- {- _settings = AppSettings.Load();- txtRootFolder.Text = _settings.ProjectRoot;- txtProjectName.Text = "";- UpdateProjectAccess();- UpdateTitle();- RefreshProjectList();- }-- /// <summary>- /// File > Open: asks for an existing project folder (browse directly to the main folder of a project,- /// without going through the project list), offers to save the current project, then opens the chosen one.- /// Browsing for the project ROOT folder instead is <c>btnBrowseRoot</c> / File > Choose project root /- /// double-clicking <c>txtRootFolder</c> - see <see cref="ChooseProjectRootToolStripMenuItem_Click"/>.- /// </summary>- private void OpenProject_Click(object sender, EventArgs e)- {- try- {- string folder = BrowseForFolder("Choose the main folder of the project (the folder that contains configuration.json)", txtRootFolder.Text.Trim(), false);- if (folder.Length > 0 && ConfirmSaveProject())- {- SetCurrentProject(ProjectStore.Open(folder));- }- }- catch (Exception ex)- {- MessageBox.Show(this, "The project could not be opened:\r\n\r\n" + ex.Message, "Open project", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- }- }-- /// <summary>File > Save and the "Save changes to project" button: saves the open project (see <see cref="SaveProject"/>).</summary>- private void SaveProject_Click(object sender, EventArgs e)- {- SaveProject();- }-- /// <summary>- /// "Save as": a simple name prompt (<see cref="PromptForText"/>, the same small dialog <c>btnRenameProject</c>- /// uses), not a file dialog - the new project always goes into the current root folder (<c>txtRootFolder</c>),- /// never somewhere else, and there is no file extension to worry about (a project is just a folder, see- /// <see cref="ProjectStore"/>). Saving under a name that already exists in the root is not refused up front:- /// <see cref="SaveProjectTo"/> itself asks to overwrite in that case, same as plain Save would for an existing project.- /// </summary>- private void SaveAs_Click(object sender, EventArgs e)- {- string root = txtRootFolder.Text.Trim();- if (root.Length == 0)- {- MessageBox.Show(this, "Enter a root folder first (double-click the box to browse).", "Save project as", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- string projectName = txtProjectName.Text.Trim();- if (!PromptForText("Save project as", "New project name (saved in the current root folder):", projectName, ref projectName))- {- return;- }- projectName = projectName.Trim();- string error = ProjectStore.ValidateName(projectName);- if (error.Length > 0)- {- MessageBox.Show(this, error, "Save project as", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- return;- }- SaveProjectTo(root, projectName);- }-- /// <summary>- /// Opens <see cref="frmDescription"/> so the user can add/edit a free-form description of the open project,- /// stored in the project's own configuration.json (<see cref="ProjectConfig.Description"/>) - written to disk- /// at once on OK (without touching <see cref="_projectDirty"/>), the same as <c>btnRenameProject</c>'s rename- /// takes effect right away rather than waiting for "Save project". Only enabled while a real (saved) project- /// is open (<see cref="UpdateProjectAccess"/>) - a new, unsaved project has no configuration.json yet to hold it.- /// </summary>- private void btnDescription_Click(object sender, EventArgs e)- {- if (_project == null)- {- return;- }- using (frmDescription dialog = new frmDescription())- {- dialog.DescriptionText = _project.Config.Description;- if (dialog.ShowDialog(this) == DialogResult.OK)- {- _project.Config.Description = dialog.DescriptionText;- _project.Save();- }- }- }-- /// <summary>File > Exit: closes the window (the closing checks run in <see cref="Form1_FormClosing"/>).</summary>- private void ExitProgram_Click(object sender, EventArgs e)- {- base.Close();- }-- /// <summary>Info > Help: shows the <see cref="HelpForm"/> modally.</summary>- private void HelpToolStripMenuItem_Click(object sender, EventArgs e)- {- using (HelpForm helpForm = new HelpForm())- {- helpForm.ShowDialog(this);- }- }-- /// <summary>Info > About: shows the <see cref="AboutForm"/> modally.</summary>- private void AboutToolStripMenuItem_Click(object sender, EventArgs e)- {- using (AboutForm aboutForm = new AboutForm())- {- aboutForm.ShowDialog(this);- }- }-- /// <summary>- /// File > Choose project root, the <c>btnBrowseRoot</c> button, <c>btnPickRoot</c> (the blinking button that- /// is always reachable even with no root yet - see <see cref="Form1_Load"/>/<see cref="UpdateProjectAccess"/>)- /// and a double-click on the (read-only) root text box: all four let the user pick the folder that contains- /// the project folders (<c>txtRootFolder</c> just displays it - <see cref="AppSettings.ProjectRoot"/> is the- /// real, persisted value, restored again on the next start). Once a root is chosen, <c>grpProjects</c> and- /// the Outputs tab become usable and the project list is (re)populated. The open project, if any, is left as it is.- /// </summary>- private void ChooseProjectRootToolStripMenuItem_Click(object sender, EventArgs e)- {- string startFolder = ((_settings.ProjectRoot.Length > 0) ? _settings.ProjectRoot : txtRootFolder.Text.Trim());- string folder = BrowseForFolder("Choose the root folder that contains your project folders", startFolder, true);- if (folder.Length == 0)- {- return;- }- _settings.ProjectRoot = folder;- _settings.Save();- txtRootFolder.Text = folder;- UpdateProjectAccess();- RefreshProjectList();- }-- /// <summary>Clicking the "(Info)" label shows the explanation of 4th-order processing, dispersion and the c-value.</summary>- private void lblInfo_Click(object sender, EventArgs e)- {- MessageBox.Show(this, "The standard 3rd order Laplacian processing inherently leads to large dispersion, meaning that longer wavelengths propagate faster through the medium. Choosing 4th order processing (including sub-step sampling) reduces this effect significantly. However, processing is somewhat slower. Another effect of 4th order processing is that it requires a different propagation speed (c). The value can be specified per project and set in the File menu. For 4th order processing choose 1.00 for c. For standard processing, this value can be quite a bit different. For example, with standard processing for waves with a frequency of 100, c = 0.56, leading in this case to a wavelength of only 9 pixels (instead of 15). Because of the dispersion present in standard processing, the exact value of c is strongly dependent on the frequency. (lower frequencies -> higher c value; higher frequencies -> lower c value).", "4th order Laplacian and wave speed (c)", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- }-- /// <summary>- /// File > Set c-value: prompts for the wave speed (pixels per step), stores it in- /// <see cref="SimulationSettings.WaveSpeedC"/>, marks the project changed if it differs,- /// and refreshes the wavelength read-out on the Sources tab. c is only used to estimate a- /// source's wavelength (<c>lblLambdaIs</c> on the Sources tab).- /// </summary>- private void SetCValueToolStripMenuItem_Click(object sender, EventArgs e)- {- double cValue = 0.0;- if (!PromptForCValue(_simulation.WaveSpeedC, ref cValue))- {- return;- }- if (cValue != _simulation.WaveSpeedC)- {- _simulation.WaveSpeedC = cValue;- MarkProjectChanged();- }- UpdateLambdaLabel();- }-- /// <summary>- /// Shows a hand-built modal dialog with a 3-decimal spinner (0.001 to 1,000,000) for the- /// wave speed c. <paramref name="current"/> is clamped into that range before display.- /// </summary>- /// <param name="current">Value shown when the dialog opens.</param>- /// <param name="result">Receives the entered value on OK, or <paramref name="current"/> on cancel.</param>- /// <returns>True when the user pressed OK.</returns>- private bool PromptForCValue(double current, ref double result)- {- using (Form dlg = new Form())- {- dlg.Text = "Set c-value";- dlg.FormBorderStyle = FormBorderStyle.FixedDialog;- dlg.StartPosition = FormStartPosition.CenterParent;- dlg.MinimizeBox = false;- dlg.MaximizeBox = false;- dlg.ShowInTaskbar = false;- dlg.ClientSize = new Size(340, 116);- Label label = new Label();- label.Text = "Wave propagation speed c (in pixels per step)\r\n(lambda = c / frequency).\r\nOnly used to estimate a source's wavelength in screen pixels";- label.SetBounds(12, 10, 316, 44);- NumericUpDown numValue = new NumericUpDown();- numValue.DecimalPlaces = 3;- numValue.Minimum = 0.001m;- numValue.Maximum = 1000000m;- numValue.Increment = 0.1m;- numValue.SetBounds(12, 60, 110, 22);- double clamped = Math.Max(Convert.ToDouble(numValue.Minimum), Math.Min(Convert.ToDouble(numValue.Maximum), current));- numValue.Value = new decimal(clamped);- Button btnOk = new Button();- btnOk.Text = "OK";- btnOk.DialogResult = DialogResult.OK;- btnOk.SetBounds(152, 80, 84, 26);- Button btnCancel = new Button();- btnCancel.Text = "Cancel";- btnCancel.DialogResult = DialogResult.Cancel;- btnCancel.SetBounds(244, 80, 84, 26);- dlg.Controls.AddRange(new Control[] { label, numValue, btnOk, btnCancel });- dlg.AcceptButton = btnOk;- dlg.CancelButton = btnCancel;- if (dlg.ShowDialog(this) == DialogResult.OK)- {- result = Convert.ToDouble(numValue.Value);- return true;- }- }- result = current;- return false;- }-- /// <summary>- /// Shows a hand-built modal dialog with one single-line text box (pre-filled and selected).- /// Used for new/renamed project, scheme and video names.- /// </summary>- /// <param name="title">Dialog caption.</param>- /// <param name="prompt">Label shown above the text box.</param>- /// <param name="defaultValue">Initial text, shown selected.</param>- /// <param name="result">Receives the untrimmed text on OK, or <paramref name="defaultValue"/> on cancel.</param>- /// <returns>True when the user pressed OK.</returns>- private bool PromptForText(string title, string prompt, string defaultValue, ref string result)- {- using (Form dlg = new Form())- {- dlg.Text = title;- dlg.FormBorderStyle = FormBorderStyle.FixedDialog;- dlg.StartPosition = FormStartPosition.CenterParent;- dlg.MinimizeBox = false;- dlg.MaximizeBox = false;- dlg.ShowInTaskbar = false;- dlg.ClientSize = new Size(340, 110);- Label label = new Label();- label.Text = prompt;- label.SetBounds(12, 10, 316, 20);- TextBox txt = new TextBox();- txt.SetBounds(12, 34, 316, 22);- txt.Text = defaultValue;- txt.SelectAll();- Button btnOk = new Button();- btnOk.Text = "OK";- btnOk.DialogResult = DialogResult.OK;- btnOk.SetBounds(152, 68, 84, 26);- Button btnCancel = new Button();- btnCancel.Text = "Cancel";- btnCancel.DialogResult = DialogResult.Cancel;- btnCancel.SetBounds(244, 68, 84, 26);- dlg.Controls.AddRange(new Control[] { label, txt, btnOk, btnCancel });- dlg.AcceptButton = btnOk;- dlg.CancelButton = btnCancel;- dlg.ActiveControl = txt;- if (dlg.ShowDialog(this) == DialogResult.OK)- {- result = txt.Text;- return true;- }- }- result = defaultValue;- return false;- }-- /// <summary>- /// Saves the current settings under the root folder and project name shown in the text- /// boxes, after validating both (focusing the offending box on failure).- /// </summary>- /// <returns>True when the project was written; false when validation failed, the user cancelled or saving failed.</returns>- private bool SaveProject()- {- string root = txtRootFolder.Text.Trim();- string projectName = txtProjectName.Text.Trim();- if (root.Length == 0)- {- MessageBox.Show(this, "Enter a root folder first (double-click the box to browse).", "Save project", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- txtRootFolder.Focus();- return false;- }- string error = ProjectStore.ValidateName(projectName);- if (error.Length > 0)- {- MessageBox.Show(this, error, "Save project", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- txtProjectName.Focus();- return false;- }- return SaveProjectTo(root, projectName);- }-- /// <summary>- /// Writes the scene, simulation, probe and source settings into the project- /// <c><root>\<projectName></c> and makes it the current project. The target is the- /// open project when it is that same folder; an existing project there after an overwrite- /// confirmation; otherwise a newly created one (offering to create a missing root folder).- /// A scene image from outside the target folder is copied in first- /// (<see cref="PrepareSceneImageFor"/>).- /// </summary>- /// <returns>True when saved; false when the user declined a prompt or an error was shown.</returns>- private bool SaveProjectTo(string root, string projectName)- {- try- {- string rootFolder = ProjectStore.NormalizeFolder(root);- string projectFolder = Path.Combine(rootFolder, projectName);- Project previous = _project;- Project target;- if (previous != null && string.Equals(projectFolder, previous.FolderPath, StringComparison.OrdinalIgnoreCase))- {- target = previous;- }- else if (ProjectStore.IsProjectFolder(projectFolder))- {- if (MessageBox.Show(this, "A project named '" + projectName + "' already exists in the root folder\r\n" + rootFolder + "\r\n\r\nOverwrite its configuration with the current settings?", "Save project", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes)- {- return false;- }- target = ProjectStore.Open(projectFolder);- }- else- {- if (!Directory.Exists(rootFolder))- {- if (MessageBox.Show(this, "The root folder does not exist:\r\n" + rootFolder + "\r\n\r\nCreate it?", "Save project", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)- {- return false;- }- }- target = ProjectStore.Create(rootFolder, projectName);- }- PrepareSceneImageFor(target, previous);- _scene.ToConfig(target.Config);- _simulation.ToConfig(target.Config);- ProbeSettings.ListToConfig(_probes, target.Config);- SourceSettings.ListToConfig(_sources, target.Config);- target.Save();- SetCurrentProject(target);- return true;- }- catch (Exception ex)- {- MessageBox.Show(this, "The project could not be saved:\r\n\r\n" + ex.Message, "Save project", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);- return false;- }- }-- /// <summary>- /// When saving into a different project than the scene image came from, copies the image- /// into <paramref name="target"/>'s scene-image folder (unless it already lies inside the- /// target) and rewrites <see cref="SceneSettings.ImageFile"/> as a path stored relative to- /// the target. No-op when there is no scene image or the target is the previous project.- /// This is the same copy that <see cref="btnLOadSceneImage_Click"/> already does when a project- /// exists; this one catches an image that was picked before the (new) project was ever saved.- /// </summary>- /// <param name="target">The project about to be saved.</param>- /// <param name="previous">The project the image path is currently relative to; null for an unsaved project.</param>- private void PrepareSceneImageFor(Project target, Project previous)- {- if (_scene.ImageFile.Length == 0 || object.ReferenceEquals(target, previous))- {- return;- }- string previousFolder = ((previous == null) ? "" : previous.FolderPath);- string imagePath = SceneSettings.ToFullPath(previousFolder, _scene.ImageFile);- if (File.Exists(imagePath) && !Form1.IsInsideFolder(imagePath, target.FolderPath))- {- imagePath = Form1.CopyIntoSceneImageFolder(target, imagePath);- }- _scene.ImageFile = SceneSettings.ToStoredPath(target.FolderPath, imagePath);- }-- /// <summary>Case-insensitive test whether <paramref name="fullPath"/> lies below <paramref name="folder"/> (both resolved to full paths); false for an empty folder.</summary>- private static bool IsInsideFolder(string fullPath, string folder)- {- if (string.IsNullOrEmpty(folder))- {- return false;- }- string prefix = folder.TrimEnd(new char[]- {- Path.DirectorySeparatorChar,- Path.AltDirectorySeparatorChar- }) + Path.DirectorySeparatorChar.ToString();- return Path.GetFullPath(fullPath).StartsWith(Path.GetFullPath(prefix), StringComparison.OrdinalIgnoreCase);- }-- /// <summary>- /// Copies <paramref name="fullPath"/> into the project's <c>scene_images</c> folder. A file- /// of the same name and the same length is assumed to be the same image and reused; one- /// with a different length gets a " (2)", " (3)", ... suffix instead.- /// </summary>- /// <returns>Full path of the file inside the scene-image folder.</returns>- private static string CopyIntoSceneImageFolder(Project project, string fullPath)- {- Directory.CreateDirectory(project.SceneImageFolder);- string fileName = Path.GetFileName(fullPath);- string destination = Path.Combine(project.SceneImageFolder, fileName);- int suffix = 2;- while (File.Exists(destination) && new FileInfo(destination).Length != new FileInfo(fullPath).Length)- {- destination = Path.Combine(project.SceneImageFolder, Path.GetFileNameWithoutExtension(fileName) + " (" + suffix.ToString(CultureInfo.InvariantCulture) + ")" + Path.GetExtension(fileName));- suffix++;- }- if (!File.Exists(destination))- {- File.Copy(fullPath, destination);- }- return destination;- }-- /// <summary>- /// Before discarding the open project: offers Yes/No/Cancel when it has unsaved changes.- /// </summary>- /// <returns>True when the caller may proceed (nothing to save, saved successfully, or "No"); false on Cancel or a failed save.</returns>- private bool ConfirmSaveProject()- {- // Nothing to save when no named project exists yet (a project only exists once it has been loaded from- // the list or created and named through btnNewProject's dialog) - there is no such thing as an- // "unsaved new project" to ask about any more.- if (_project == null || !_projectDirty)- {- return true;- }- DialogResult answer = MessageBox.Show(this, "There are unsaved changes in the project '" + _project.Name + "'. Save them first?", "Unsaved changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);- if (answer == DialogResult.Yes)- {- return SaveProject();- }- return answer == DialogResult.No;- }-- /// <summary>- /// Resets the in-memory project state to blank defaults: new scene and simulation settings- /// (keeping the damping-edge and object-source check boxes and the steps/decay spinners as- /// they are), no scene image, default probes, no sources, no video files, not dirty.- /// Does not touch <c>grpSceneProperties</c>/<c>grpSimulationSettings</c>/<c>grpProjects.Enabled</c> - a- /// caller that goes on to make a real, named project current (<see cref="SetCurrentProject"/>) re-enables- /// them there; a caller that ends up with no project at all (e.g. deleting the one that was open) should- /// instead disable them, since - per the startup design - there is no such thing as an editable "new- /// project" that does not exist on disk yet.- /// </summary>- private void StartNewProject()- {- _project = null;- _scene = new SceneSettings();- // chkDampingEdge and chkUseObjectSources have no software-chosen default of their own (see their- // docs in SceneSettings) - a new project starts at whatever the controls' own Designer values are- _scene.DampingEdgeEnabled = chkDampingEdge.Checked;- _scene.UseObjectSources = chkUseObjectSources.Checked;- ReplaceSceneImage(null);- txtProjectName.Text = "";- ShowSceneInControls();- _simulation = new SimulationSettings();- // numSimulationSteps and numTimeDecayFactor have no software-chosen default of their own (see their- // docs in SimulationSettings) - a new project starts at whatever the controls' own Designer values are- _simulation.Steps = Convert.ToInt32(numSimulationSteps.Value);- _simulation.TimeDecayFactor = Convert.ToDouble(numTimeDecayFactor.Value);- ShowSimulationInControls();- ResetProbes();- ResetSources();- _fieldVideoFile = "";- _intensityVideoFile = "";- UpdateVideoButtons();- _projectDirty = false;- UpdateTitle();- txtProjectName.Focus();- }-- /// <summary>- /// Makes <paramref name="opened"/> the current project: shows its root and name, persists- /// them in the user settings, clears the Sources/Probes background pictures when the- /// folder differs from the previous project, loads scene, simulation, probes and sources- /// from its configuration, clears the dirty flag and refreshes the project list.- /// Also called by <see cref="SaveProjectTo"/> for a plain "Save project" of the project that is already- /// open (target and the previous <see cref="_project"/> are then the same folder) - the preview-clearing- /// must only run when the project is actually changing, or every "Save configuration" would blank the- /// Sources/Probes tab's picture (see <see cref="ClearPreviewImage"/>) even though nothing about that- /// picture is out of date.- /// </summary>- private void SetCurrentProject(Project opened)- {- bool projectChanged = _project == null || !string.Equals(_project.FolderPath, opened.FolderPath, StringComparison.OrdinalIgnoreCase);- _project = opened;- txtRootFolder.Text = opened.RootFolder;- txtProjectName.Text = opened.Name;- UpdateProjectAccess();- _settings.LastRootFolder = opened.RootFolder;- _settings.LastProjectName = opened.Name;- _settings.Save();- if (projectChanged)- {- // a preview picture (Sources/Probes tab) loaded for the previous project has no relevance to this one -- // clear it so the tab shows this project's own scene image (or a blank placeholder) the next time it is- // visited, rather than a leftover picture from whatever was open before (AutoLoadSceneImageIfEmpty only- // fills a picture that is empty, so a stale one left behind would otherwise never be replaced)- ClearPreviewImage(_picSource);- ClearPreviewImage(_picProbe);- }- LoadSceneFromProject();- _simulation = SimulationSettings.FromConfig(_project.Config);- ShowSimulationInControls();- LoadProbesFromProject();- LoadSourcesFromProject();- _projectDirty = false;- UpdateTitle();- RefreshProjectList();- }-- /// <summary>Removes and disposes the image of <paramref name="pic"/>; tolerates a null box or no image.</summary>- private void ClearPreviewImage(PictureBox pic)- {- if (pic == null || pic.Image == null)- {- return;- }- Image image = pic.Image;- pic.Image = null;- image.Dispose();- pic.Invalidate();- }-- /// <summary>- /// Flags the project as having unsaved changes and updates the title, unless one of the- /// <c>_loading*</c> re-entrancy guards is set (controls are being filled from settings).- /// </summary>- private void MarkProjectChanged()- {- if (_loadingScene || _loadingSim || _loadingProbe || _loadingSource)- {- return;- }- _projectDirty = true;- UpdateTitle();- }-- /// <summary>Sets the window title to "2D wave simulation - name", with " *" when dirty and the run status appended while a simulation runs.</summary>- private void UpdateTitle()- {- string projectLabel = ((_project == null) ? "(new project)" : _project.Name);- Text = "2D wave simulation - " + projectLabel + (_projectDirty ? " *" : "") + ((_simStatus.Length > 0) ? (" | " + _simStatus) : "");- }-- /// <summary>- /// Lets the user choose a folder: type or paste a full path directly into the box, or click "Browse..."- /// for the usual Windows tree picker (a <see cref="FolderBrowserDialog"/>) - rooted at "This PC" rather- /// than the Desktop, so every drive (C:\, D:\, a network drive, anywhere) is one click away instead of- /// buried under Desktop. This replaces a plain <see cref="FolderBrowserDialog"/> call, which on this- /// machine shows no address bar to type a path into and makes other drives awkward to reach from its- /// Desktop-rooted tree. OK is refused for an empty path, and for a non-existent one unless- /// <paramref name="allowNewFolder"/> (a new, not-yet-created one is then fine - the caller decides- /// whether/how to create it).- /// </summary>- /// <param name="description">Text shown above the path box and in the folder browser.</param>- /// <param name="startFolder">Initial contents of the path box.</param>- /// <param name="allowNewFolder">Accept a folder that does not exist yet (and show the "New folder" button in the browser).</param>- /// <returns>The trimmed folder path, or an empty string when cancelled.</returns>- private string BrowseForFolder(string description, string startFolder, bool allowNewFolder)- {- using (Form dlg = new Form())- {- dlg.Text = "Choose a folder";- dlg.FormBorderStyle = FormBorderStyle.FixedDialog;- dlg.StartPosition = FormStartPosition.CenterParent;- dlg.MinimizeBox = false;- dlg.MaximizeBox = false;- dlg.ShowInTaskbar = false;- dlg.ClientSize = new Size(480, 124);-- Label label = new Label();- label.Text = description;- label.SetBounds(12, 10, 456, 34);-- TextBox txt = new TextBox();- txt.SetBounds(12, 50, 362, 22);- txt.Text = startFolder;-- Button btnBrowse = new Button();- btnBrowse.Text = "Browse...";- btnBrowse.SetBounds(380, 49, 88, 24);- btnBrowse.Click += (sender, e) =>- {- using (FolderBrowserDialog folderDialog = new FolderBrowserDialog())- {- folderDialog.Description = description;- folderDialog.ShowNewFolderButton = allowNewFolder;- // MyComputer (not the default Desktop) so every drive is a top-level node, reachable in- // one click instead of nested under Desktop/This PC- folderDialog.RootFolder = Environment.SpecialFolder.MyComputer;- if (Directory.Exists(txt.Text.Trim()))- {- folderDialog.SelectedPath = txt.Text.Trim();- }- if (folderDialog.ShowDialog(dlg) == DialogResult.OK)- {- txt.Text = folderDialog.SelectedPath;- txt.SelectAll();- }- }- };-- Button btnOk = new Button();- btnOk.Text = "OK";- btnOk.SetBounds(228, 86, 84, 26);- btnOk.Click += (sender, e) =>- {- string folder = txt.Text.Trim();- if (folder.Length == 0)- {- MessageBox.Show(dlg, "Enter or browse to a folder first.", "Choose a folder", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- }- else if (!allowNewFolder && !Directory.Exists(folder))- {- MessageBox.Show(dlg, "This folder does not exist:\r\n" + folder, "Choose a folder", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);- }- else- {- dlg.DialogResult = DialogResult.OK;- dlg.Close();- }- };-- Button btnCancel = new Button();- btnCancel.Text = "Cancel";- btnCancel.DialogResult = DialogResult.Cancel;- btnCancel.SetBounds(320, 86, 84, 26);-- dlg.Controls.AddRange(new Control[] { label, txt, btnBrowse, btnOk, btnCancel });- dlg.AcceptButton = btnOk;- dlg.CancelButton = btnCancel;- dlg.ActiveControl = txt;- if (dlg.ShowDialog(this) == DialogResult.OK)- {- return txt.Text.Trim();- }- }- return "";- }-- // ----- Colors tab (Form1.Colors.cs) ------- /// <summary>All schemes read from the folder in <c>txtSchemeFolder</c>; feeds the Colors tab list and the field/intensity scheme combos. Replaced wholesale by <see cref="LoadSchemeList"/>.</summary>- private List<ColorScheme> _schemes;-- /// <summary>The scheme loaded into the editor (a clone of a list entry, or a new unsaved one); null until a scheme is loaded.</summary>- private ColorScheme _current;-- /// <summary>True when <see cref="_current"/> has edits that are not saved to its file; checked again on closing.</summary>- private bool _dirty;-- /// <summary>The scheme selected in <c>ListView1</c>, shown read-only in the editor and preview bar; null when nothing is selected.</summary>- private ColorScheme _previewScheme;-- /// <summary>Index (0 to <see cref="ColorScheme.StopCount"/> - 1) of the colour stop of <see cref="_current"/> that the picker is editing; -1 when none.</summary>- private int _selectedStop;-- /// <summary>Re-entrancy guard: set while <see cref="RefreshEditorState"/> programmatically checks the scheme-type radio buttons.</summary>- private bool _updatingRadios;-- /// <summary>The nine "Color 1".."Color 9" buttons in stop order (filled in <see cref="Form1_Load"/>).</summary>- private Button[] _stopButtons;-- /// <summary>The colour picker embedded in <c>Panel2</c> (created in <see cref="Form1_Load"/>).</summary>- private ColorPickerControl _picker;-- /// <summary>Image list of the <see cref="ThumbWidth"/> x <see cref="ThumbHeight"/> scheme thumbnails shown in <c>ListView1</c>; the bitmaps themselves are owned by <see cref="_thumbBitmaps"/>.</summary>- private readonly ImageList _thumbs;-- // ----- Project lists (Form1.Projects.cs / Form1.Output.cs) ------- /// <summary>Sort column of the Settings-tab project list: 0 = name, 1 = last edited (default).</summary>- private int _projectSortColumn;-- /// <summary>Sort direction of the Settings-tab project list; default descending (newest first).</summary>- private bool _projectSortAscending;-- /// <summary>Sort column of the Manage-output project list: 0 = name, 1 = last edited (default).</summary>- private int _outputProjectSortColumn;-- /// <summary>Sort direction of the Manage-output project list; default descending (newest first).</summary>- private bool _outputProjectSortAscending;-- /// <summary>Sort column of the scheme list: 0 = name, 2 = type (default); column 1 ("Kind") is not sortable.</summary>- private int _schemeSortColumn;-- /// <summary>Sort direction of the scheme list; default ascending.</summary>- private bool _schemeSortAscending;-- /// <summary>Zoomed picture box filling <c>pnlPreview</c> on the Manage-output tab (created in <see cref="InitializeOutputsTab"/>); it owns its image.</summary>- private PictureBox _outputPreviewPic;-- /// <summary>True when <see cref="_outputPreviewPic"/> shows a shell thumbnail of a video (such a picture cannot be shared to the Sources/Probes tabs).</summary>- private bool _outputPreviewIsVideo;-- /// <summary>Sort column of the scene-image file list: 0 = file name, 1 = created date (default).</summary>- private int _sceneSortColumn;-- /// <summary>Sort direction of the scene-image file list; default descending (newest first).</summary>- private bool _sceneSortAscending;-- /// <summary>Sort column of the exported-image file list: 0 = file name, 1 = created date (default).</summary>- private int _imageSortColumn;-- /// <summary>Sort direction of the exported-image file list; default descending (newest first).</summary>- private bool _imageSortAscending;-- /// <summary>Sort column of the exported-video file list: 0 = file name, 1 = created date (default).</summary>- private int _videoSortColumn;-- /// <summary>Sort direction of the exported-video file list; default descending (newest first).</summary>- private bool _videoSortAscending;-- /// <summary>- /// Owner of the thumbnail bitmaps added to <see cref="_thumbs"/>; disposed on every reload and on closing.- /// The ImageList keeps using the bitmaps that were added to it (it re-creates its native image list from- /// them, e.g. after Clear or when the ListView on a hidden tab is created). They must therefore stay- /// alive until the list is rebuilt or the form is closed, and must not be disposed right after Add.- /// </summary>- private readonly List<Bitmap> _thumbBitmaps;-- /// <summary>Scheme thumbnail width in pixels (<see cref="_thumbs"/> image size and <see cref="MakeThumbnail"/>).</summary>- private const int ThumbWidth = 120;-- /// <summary>Scheme thumbnail height in pixels (<see cref="_thumbs"/> image size and <see cref="MakeThumbnail"/>).</summary>- private const int ThumbHeight = 16;-- // ----- Project state ------ //- // A project is a folder inside the root folder; the folder name is the project name (txtProjectName).- // The main folder of a project holds configuration.json and the standard subfolders (see ProjectStore).- //- // The settings on the tabs are kept in memory and only written to configuration.json by "Save project"- // and "Save as". _project is null for a new project that has not been saved yet.-- /// <summary>The open project; null while editing a new project that has never been saved.</summary>- private Project _project;-- /// <summary>Per-user settings (project root, last project). A placeholder from the constructor until <see cref="InitializeProject"/> loads the real values.</summary>- private AppSettings _settings;-- /// <summary>True when scene, simulation, probe or source settings differ from what is saved (title shows " *").</summary>- private bool _projectDirty;-- /// <summary>Current phase of the <c>btnPickRoot</c> blink (true = highlighted).</summary>- private bool _rootBlinkOn;-- /// <summary>- /// 700 ms timer that blinks <c>btnPickRoot</c> light blue, slowly, while no project root is known yet - e.g.- /// right after installing on a different computer, when <see cref="AppSettings.ProjectRoot"/> is still empty- /// and nothing on the Sources/Probes/Viewer tabs works yet. <see cref="UpdateProjectAccess"/> starts/stops- /// this alongside the rest of the "has a root" state; <see cref="RootBlinkTimer_Tick"/> does the actual blinking.- /// </summary>- private readonly global::System.Windows.Forms.Timer _rootBlinkTimer;-- // ----- Manage output tab (Form1.Output.cs) ------- /// <summary>Lower-case extensions listed as scene images on the Manage-output tab.</summary>- private static readonly string[] SceneImageExtensions = new string[] { ".png", ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".gif" };-- /// <summary>Lower-case extensions listed as exported frames on the Manage-output tab.</summary>- private static readonly string[] OutputImageExtensions = new string[] { ".png" };-- /// <summary>Lower-case extensions listed as exported videos on the Manage-output tab.</summary>- private static readonly string[] OutputVideoExtensions = new string[] { ".mp4", ".avi" };-- /// <summary>Re-entrancy guard: set while <see cref="ClearOtherFileListSelections"/> clears the two inactive file lists, so their selection handlers return early.</summary>- private bool _clearingFileListSelection;-- // ----- Scene (Form1.Scene.cs) ------- /// <summary>The scene settings being edited (image or user-defined canvas, damping edge, image sources, refractive index); replaced on project load and new project.</summary>- private SceneSettings _scene;-- /// <summary>Re-entrancy guard: set while scene controls are being filled from <see cref="_scene"/>, so their change handlers do not write back or mark the project dirty.</summary>- private bool _loadingScene;-- /// <summary>The decoded scene image (owned; disposed by <see cref="ReplaceSceneImage"/>); null when none is loaded or the file was unreadable. Its size is the canvas size when <see cref="SceneSettings.UseImage"/> is set.</summary>- private Bitmap _sceneImage;-- /// <summary>Placeholder bitmap shown in <c>picImagePreview</c> for a user-defined (empty) canvas; owned and replaced by <see cref="UpdateScenePreview"/>.</summary>- private Bitmap _emptyPreview;-- /// <summary>Tooltip used to explain rejected canvas-size and damping-edge entries next to their text boxes.</summary>- private readonly ToolTip _sceneTip;-- // ----- Simulation (Form1.Simulation.cs) ------- /// <summary>The simulation settings being edited (steps, brightness/offset, export and preview flags, engine options, wave speed c); replaced on project load and new project.</summary>- private SimulationSettings _simulation;-- /// <summary>Re-entrancy guard: set while simulation controls are filled from <see cref="_simulation"/>, and while a linked control on the other tab is mirrored silently.</summary>- private bool _loadingSim;-- /// <summary>The active simulation runner; null when nothing is running. Its worker-thread events reach the form through <see cref="PostToUi"/>, and every callback compares the runner identity to ignore events from a stale run.</summary>- private SimulationRunner _runner;-- /// <summary>Short run status shown in the window title ("starting...", "step n of m (p%)", "paused - ...", "stopping..."); empty when idle.</summary>- private string _simStatus;-- /// <summary>Full path of the field video written by the last run; empty when none. Enables the "View field video" button.</summary>- private string _fieldVideoFile;-- /// <summary>Full path of the intensity video written by the last run; empty when none. Enables the "View intensity video" button.</summary>- private string _intensityVideoFile;-- /// <summary>Multi-line summary of the brightness, offset and image-source scale used by the last started run; appended to the status tooltip when the run finishes.</summary>- private string _runInfo;-- /// <summary>True while the current run is paused with the Pause button.</summary>- private bool _paused;-- /// <summary>True after Stop was pressed, until the runner reports that it has finished.</summary>- private bool _stopRequested;-- /// <summary>Latest progress text, "step n of m (p%)"; <see cref="_simStatus"/> is derived from it.</summary>- private string _progressText;-- /// <summary>Steps completed according to the latest progress report or run result; used in exported frame file names.</summary>- private int _lastStepsDone;-- /// <summary>ARGB look-up table (from <see cref="ColorLut"/>) used to colour the field in the current or last run; null when the field view was not wanted. Used to render a frame while paused.</summary>- private int[] _lastFieldLut;-- /// <summary>ARGB look-up table (from <see cref="ColorLut"/>) used to colour the intensity in the current or last run; null when the intensity view was not wanted. Used to render a frame while paused.</summary>- private int[] _lastIntensityLut;-- /// <summary>Full canvas-size field frame delivered with the last run's <see cref="SimulationResult"/> (owned); null until a run has finished. Source for "Export frame" when not paused.</summary>- private Bitmap _lastFullFieldFrame;-- /// <summary>Full canvas-size intensity frame delivered with the last run's <see cref="SimulationResult"/> (owned); null until a run has finished. Source for "Export frame" when not paused.</summary>- private Bitmap _lastFullIntensityFrame;-- /// <summary>Live field preview box filling <c>pnlPreviewField</c> (created in <see cref="InitializeSimulationControls"/>). <c>Tag</c> holds the raw preview frame, <c>Image</c> that frame or its overlay composite (see <see cref="SetPreviewFrame"/>).</summary>- private PictureBox _picField;-- /// <summary>Live intensity preview box filling <c>pnlPreviewIntensity</c> (created in <see cref="InitializeSimulationControls"/>). <c>Tag</c> holds the raw preview frame, <c>Image</c> that frame or its overlay composite (see <see cref="SetPreviewFrame"/>).</summary>- private PictureBox _picIntensity;-- /// <summary>Sobel edge image of <see cref="_sceneImage"/> at canvas size (owned; see <see cref="ComputeGlowingEdges"/>); null when there is no scene image. Added on top of previews and exports as the "glowing edges" overlay.</summary>- private Bitmap _glowEdgesImage;-- /// <summary>- /// <see cref="_glowEdgesImage"/> resized to <see cref="_glowOverlayCacheSize"/>, whatever size a preview frame- /// last asked for (<see cref="GetGlowOverlayResized"/>; owned). Rebuilding this by resampling the full- /// scene-image-sized picture on every single visualized step of a run would be wasteful, so it is cached- /// until either the target size or <see cref="_glowEdgesImage"/> itself changes. Null until first requested.- /// </summary>- private Bitmap _glowOverlayCache;-- /// <summary>Pixel size of <see cref="_glowOverlayCache"/>.</summary>- private Size _glowOverlayCacheSize;-- /// <summary>Background picture box on the Sources tab (filling <c>pnlSourceImage</c>). Receives copies of the scene, field or intensity picture via the share buttons; source markers are painted on top and clicks pick a source position.</summary>- private PictureBox _picSource;-- /// <summary>Background picture box on the Probes tab (filling <c>pnlProbeImage</c>). Receives copies of the scene, field or intensity picture via the share buttons; probe markers and graph boxes are painted on top and clicks pick probe positions.</summary>- private PictureBox _picProbe;-- /// <summary>Set once any simulation has finished (originally meant to turn the stop button into a restart button). Not read anywhere at present.</summary>- private bool _hasRun;-- // Windows Explorer's own view-mode numbers (the classic Shell "FOLDERVIEWMODE" enum), used by- // OpenFolderInExplorer and its callers.-- /// <summary>Explorer <c>CurrentViewMode</c> value for the "Large icons" view (FOLDERVIEWMODE <c>FVM_ICON</c>).</summary>- private const int FVM_ICON = 1;-- /// <summary>Explorer <c>CurrentViewMode</c> value for the "Details" view (FOLDERVIEWMODE <c>FVM_DETAILS</c>).</summary>- private const int FVM_DETAILS = 4;-- // ----- Probes (Form1.Probes.cs) ------- /// <summary>Number of probes the UI supports.</summary>- private const int ProbeCount = 2;-- /// <summary>Probe settings being edited, one per probe panel (always exactly two after <see cref="NormalizeProbeCount"/>); replaced on project load and new project.</summary>- private List<ProbeSettings> _probes;-- /// <summary>The designer controls of each probe panel, indexed by probe (built in <see cref="InitializeProbeControls"/>); null before that.</summary>- private Form1.ProbeControlSet[] _probeUi;-- /// <summary>Re-entrancy guard: set while probe controls are filled from <see cref="_probes"/>, so their change handlers do not write back or mark the project dirty.</summary>- private bool _loadingProbe;-- /// <summary>State of position picking on <see cref="_picProbe"/>: 0 = not picking, 1 = waiting for position A, 2 = position B (line probes only), 3 = top-left corner of the graph box.</summary>- private int _pickStep;-- /// <summary>Index of the probe whose positions are being picked; meaningful only while <see cref="_pickStep"/> is non-zero.</summary>- private int _pickIndex;-- /// <summary>Last mouse position (picture-box pixels) over <see cref="_picProbe"/> during pick step 3, used to draw the graph box where it would land; null otherwise.</summary>- private Point? _pickHover;-- /// <summary>Copies of the probe settings handed to the running or last run; preview markers and graphs are drawn from these (with display settings copied from <see cref="_probes"/>). Null before the first run.</summary>- private List<ProbeSettings> _runProbes;-- /// <summary>Canvas size (pixels) of the running or last run, used to map probe positions onto the zoomed previews.</summary>- private Size _runCanvas;-- /// <summary>Total step count of the running or last run (x-axis of full-scale probe graphs).</summary>- private int _runSteps;-- /// <summary>Per-probe samples and line profiles collected during the running or last run; cleared by <see cref="BeginProbeRun"/>, appended on the UI thread in <see cref="ShowProbeSamples"/>.</summary>- private readonly List<ProbeTrace> _probeTraces;-- // ----- Sources (Form1.Sources.cs) ------- /// <summary>The project's object sources, in list order; replaced on project load and new project.</summary>- private List<SourceSettings> _sources;-- /// <summary>Index in <see cref="_sources"/> of the source the editor is bound to; -1 while editing a new, not yet saved source.</summary>- private int _currentSourceIndex;-- /// <summary>Working copy the editor controls are bound to (a clone of the selected source, or a fresh one); stored back into <see cref="_sources"/> by <see cref="CommitSourceEdits"/>.</summary>- private SourceSettings _editing;-- /// <summary>Re-entrancy guard: set while source controls are filled from <see cref="_editing"/>, so they do not mark the source dirty.</summary>- private bool _loadingSource;-- /// <summary>Re-entrancy guard: set while <c>lstSources</c>'s selection is changed programmatically, so the selection handler does not reload the editor.</summary>- private bool _syncingSourceList;-- /// <summary>True while a click on <see cref="_picSource"/> is expected to set the source position.</summary>- private bool _sourcePicking;-- /// <summary>Original caption of <c>btnPickSourcePosition</c>, restored after it has shown "Cancel" during picking.</summary>- private string _pickSourceButtonText;-- /// <summary>Random generator used when composite sources generate randomised elements.</summary>- private readonly Random _sourceRandom;-- /// <summary>- /// <c>btnSaveSource</c>'s own Designer back colour, captured once at startup so <see cref="ClearSourceDirty"/>- /// can restore exactly that (rather than a hardcoded colour) once the pending changes are saved; the button- /// turns orange while the editor has unsaved edits.- /// </summary>- private Color _sourceSaveButtonDefaultBackColor;-- /// <summary>One row of the project list views (stored in the item's <c>Tag</c>).</summary>- private sealed class ProjectListEntry- {- public ProjectListEntry(string name, DateTime lastModified)- {- Name = name;- LastModified = lastModified;- }-- /// <summary>Project (folder) name.</summary>- public readonly string Name;-- /// <summary>Last write time of the project's configuration file, or of the folder when the file is missing (local time).</summary>- public readonly DateTime LastModified;- }-- /// <summary>Win32 <c>SIZE</c> structure passed to <see cref="IShellItemImageFactory.GetImage"/>.</summary>- [StructLayout(LayoutKind.Sequential)]- private struct NativeSize- {- /// <summary>Width in pixels.</summary>- public int cx;-- /// <summary>Height in pixels.</summary>- public int cy;- }-- /// <summary>Subset of the shell's <c>SIIGBF</c> flags for <see cref="IShellItemImageFactory.GetImage"/>.</summary>- [Flags]- private enum ThumbnailOptions- {- /// <summary>No options.</summary>- None = 0,- /// <summary><c>SIIGBF_BIGGERSIZEOK</c>: a larger image than requested is acceptable.</summary>- BiggerSizeOk = 1,- /// <summary><c>SIIGBF_THUMBNAILONLY</c>: return a thumbnail only, never an icon.</summary>- ThumbnailOnly = 8- }-- /// <summary>COM interface used to ask the Windows shell for a file's thumbnail (video previews on the Manage-output tab).</summary>- [Guid("bcc18b79-ba16-442f-80c4-8a59c30c463b")]- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]- [ComImport]- private interface IShellItemImageFactory- {- /// <summary>Returns a GDI bitmap handle of the requested size; the caller owns it and must release it with <c>DeleteObject</c>. Throws on failure (PreserveSig is off).</summary>- void GetImage([In] Form1.NativeSize size, [In] Form1.ThumbnailOptions flags, out IntPtr phbm);- }-- /// <summary>- /// Bundles the designer controls of one probe panel so the two identical panels share the- /// same handler code (see <see cref="InitializeProbeControls"/>). All members are set once- /// in the constructor.- /// </summary>- private sealed class ProbeControlSet- {- public ProbeControlSet(int index, string title, CheckBox chkOn, ComboBox cmbPlaceOn, ComboBox cmbMeasurement, ComboBox cmbProbeType, ComboBox cmbBoxSize, NumericUpDown numAPosX, NumericUpDown numAPosY, NumericUpDown numBPosX, NumericUpDown numBPosY, Button butPick, RadioButton radRunning, RadioButton radFull, CheckBox chkAutoX, CheckBox chkAutoY, TextBox txtMinY, TextBox txtMaxY, CheckBox chkStartAfter, TextBox txtStartAfter, NumericUpDown numRunningWindow, Control[] bOnlyControls)- {- Index = index;- Title = title;- ChkOn = chkOn;- CmbPlaceOn = cmbPlaceOn;- CmbMeasurement = cmbMeasurement;- CmbProbeType = cmbProbeType;- CmbBoxSize = cmbBoxSize;- NumAPosX = numAPosX;- NumAPosY = numAPosY;- NumBPosX = numBPosX;- NumBPosY = numBPosY;- ButPick = butPick;- RadRunning = radRunning;- RadFull = radFull;- ChkAutoX = chkAutoX;- ChkAutoY = chkAutoY;- TxtMinY = txtMinY;- TxtMaxY = txtMaxY;- ChkStartAfter = chkStartAfter;- TxtStartAfter = txtStartAfter;- NumRunningWindow = numRunningWindow;- BOnlyControls = bOnlyControls;- PickButtonText = butPick.Text;- }-- /// <summary>Probe index (0 or 1), also the index into <see cref="_probes"/>.</summary>- public readonly int Index;-- /// <summary>Display name ("Probe 1" / "Probe 2") used in status messages.</summary>- public readonly string Title;-- /// <summary>"Probe on" check box.</summary>- public readonly CheckBox ChkOn;-- /// <summary>Picture the probe samples: Field or Intensity.</summary>- public readonly ComboBox CmbPlaceOn;-- /// <summary>Measured quantity (depends on <see cref="CmbPlaceOn"/>): amplitude, intensity or integrated intensity.</summary>- public readonly ComboBox CmbMeasurement;-- /// <summary>Probe kind: point (A) or line (A-B).</summary>- public readonly ComboBox CmbProbeType;-- /// <summary>Size preset of the graph box drawn on the previews.</summary>- public readonly ComboBox CmbBoxSize;-- /// <summary>X of position A in canvas pixels.</summary>- public readonly NumericUpDown NumAPosX;-- /// <summary>Y of position A in canvas pixels.</summary>- public readonly NumericUpDown NumAPosY;-- /// <summary>X of position B (line probes) in canvas pixels.</summary>- public readonly NumericUpDown NumBPosX;-- /// <summary>Y of position B (line probes) in canvas pixels.</summary>- public readonly NumericUpDown NumBPosY;-- /// <summary>"Pick" button that starts/cancels picking positions on the Probes picture.</summary>- public readonly Button ButPick;-- /// <summary>Running-scale radio button (graph shows a recent window of steps).</summary>- public readonly RadioButton RadRunning;-- /// <summary>Full-scale radio button (graph shows the whole run).</summary>- public readonly RadioButton RadFull;-- /// <summary>Auto-scale X check box.</summary>- public readonly CheckBox ChkAutoX;-- /// <summary>Auto-scale Y check box; when off, <see cref="TxtMinY"/>/<see cref="TxtMaxY"/> apply.</summary>- public readonly CheckBox ChkAutoY;-- /// <summary>Manual Y-axis minimum (invariant-culture number).</summary>- public readonly TextBox TxtMinY;-- /// <summary>Manual Y-axis maximum (invariant-culture number).</summary>- public readonly TextBox TxtMaxY;-- /// <summary>"Start recording at step #" check box.</summary>- public readonly CheckBox ChkStartAfter;-- /// <summary>Step number at which recording starts (integer text).</summary>- public readonly TextBox TxtStartAfter;-- /// <summary>Width of the running-scale window in steps.</summary>- public readonly NumericUpDown NumRunningWindow;-- /// <summary>Controls that are only enabled for line probes (the position-B spinners and their labels).</summary>- public readonly Control[] BOnlyControls;-- /// <summary>Original caption of <see cref="ButPick"/>, restored after it has shown "Cancel".</summary>- public readonly string PickButtonText;- }- }-}diff --git a/Wave_Dude_2D/Form1.resx b/Wave_Dude_2D/Form1.resxdeleted file mode 100644index 7285c15..0000000--- a/Wave_Dude_2D/Form1.resx+++ /dev/null@@ -1,686 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<root>- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />- <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" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </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" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.binary.base64">- <value>- AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0- dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABNTeXN0ZW0uRHJh- d2luZy5JY29uAgAAAAhJY29uRGF0YQhJY29uU2l6ZQcEAh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IG8/t9S- NER5XWrzRmo5784pfU7BzjxgpMIYb0vEcMEFVA3zdiVjFfvniPAjRhiInRgTfiD+2+p+egy1WeOs3mVO- /2eOVyOB115A5s63of/kIse/0hNWp2TXi2/cYoTJ74/ZRkf2XmUwG6OHRQNkssxCFspiHvTnZEkBUkE1- RdUPDFEWS5lqgF6t65gxhnu6WK03WPF6TSfvCq+Y4J8/yvdfDQSZaXh9uQZABv2tjFVxcaF6Rhiu+MfQ- JP/GRD6KZI/l6JoJhvfGMjf+3o+Pct09sOslubyrIzBwabnH6l1v3uuPpL5/vrrkESP9JBP8SI7fjAS+- nkR4/azXJWYjVX7BBG+d9foXLpdt0A7Dv28wwNgEvPK714cRWMZEnhBcGAO56XVNjx+p+0uQV4Tn6np+- eFyv2FvEL+/9MA4wZQKZ/P31o6jLMUFuIYFrUzD+xNto5G2GmCqnW9L0o0Mv1v3n5PbGWX74+lLlT74/- qrP8f3EM3cH/TZty+xgT5y0QOdURP2cers8wQM7LT14S82ePV8n0l779Yz2Rz/8K8e11YYLXfIe/cgy/- 84YJmEr7WxmlHxF3IKv0yZ/pe9NP/VVmuLzi6ff++5z9rwjfJfF/DPheJ/7r3/tJg5Y/divGU/2VE904- NT9WflcYdpRRfP2Mf5X401/4/8fxY+IPx8+p+P/5O/u/O1F6QKTXLp8AAAAASUVORK5CYIIL-</value>- </data>-</root>\ No newline at end of filediff --git a/Wave_Dude_2D/FrameRenderer.cs b/Wave_Dude_2D/FrameRenderer.csdeleted file mode 100644index 389e74d..0000000--- a/Wave_Dude_2D/FrameRenderer.cs+++ /dev/null@@ -1,255 +0,0 @@-using System;-using System.Drawing;-using System.Drawing.Imaging;-using System.Runtime.InteropServices;-using System.Threading.Tasks;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Static helpers that turn the field or the intensity of a wave engine (CPU or GPU) into packed ARGB- /// pixel buffers, like <c>WaveVisualizer.render_field</c> and <c>render_intensity</c> in the Python code:- /// the value is converted to a table index (see <see cref="ColorLut"/>) and the index to a colour. Without- /// a colour table (null) the index itself is used as grey level. The picture can be smaller than the- /// simulation (a preview): every picture pixel then takes the nearest simulation pixel. Also blends a glow- /// overlay on top and wraps the result in a <see cref="Bitmap"/>. Used by <see cref="SimulationRunner"/>- /// (worker thread) and by the video sinks. Row loops run in parallel, so the methods are CPU-bound but- /// not thread-affine.- /// </summary>- internal sealed class FrameRenderer- {- /// <summary>Not instantiable; all members are static.</summary>- private FrameRenderer()- {- }-- /// <summary>- /// Renders the wave field, nearest-neighbour scaled from the engine grid (<see cref="IWaveEngine.Width"/> x- /// <see cref="IWaveEngine.Height"/>) to <paramref name="dw"/> x <paramref name="dh"/>. Reads the engine's padded- /// buffer (row y starts at <c>(y + 1) * Stride + 1</c>); the caller must have called <see cref="IWaveEngine.PrepareFrame"/>.- /// </summary>- /// <param name="sim">Engine whose <see cref="IWaveEngine.FieldData"/> is read.</param>- /// <param name="lut">ARGB palette indexed 0..254 (127 = zero field), or null for greyscale.</param>- /// <param name="brightness">Gain applied before the value is clamped to -1..1.</param>- /// <param name="pixels">Destination, at least <paramref name="dw"/> * <paramref name="dh"/> ARGB ints, row-major.</param>- /// <param name="dw">Destination width in pixels.</param>- /// <param name="dh">Destination height in pixels.</param>- public static void RenderField(IWaveEngine sim, int[] lut, float brightness, int[] pixels, int dw, int dh)- {- float[] field = sim.FieldData;- int stride = sim.Stride;- int sw = sim.Width;- int sh = sim.Height;-- Parallel.For(0, dh, y =>- {- int srcY = (int)((long)y * sh / dh);- int srcRowStart = (srcY + 1) * stride + 1;- int dstRowStart = y * dw;- for (int x = 0; x < dw; x++)- {- int srcX = (int)((long)x * sw / dw);- float value = field[srcRowStart + srcX];- pixels[dstRowStart + x] = Colorize(ColorLut.FieldIndex(value, brightness), lut);- }- });- }-- /// <summary>- /// Renders the accumulated intensity, nearest-neighbour scaled to <paramref name="dw"/> x <paramref name="dh"/>.- /// Each value is mapped as <c>sqrt(value) * brightness</c> (exponent 0.5, as in the Python code), clamped to 1,- /// then scaled to palette index 0..254 (non-positive values map to 0). Same layout rules as <see cref="RenderField"/>.- /// </summary>- /// <param name="sim">Engine whose <see cref="IWaveEngine.IntensityData"/> is read (must not be null).</param>- /// <param name="lut">ARGB palette indexed 0..254, or null for greyscale.</param>- /// <param name="brightness">Gain applied after the square-root compression.</param>- /// <param name="pixels">Destination, at least <paramref name="dw"/> * <paramref name="dh"/> ARGB ints, row-major.</param>- /// <param name="dw">Destination width in pixels.</param>- /// <param name="dh">Destination height in pixels.</param>- public static void RenderIntensity(IWaveEngine sim, int[] lut, float brightness, int[] pixels, int dw, int dh)- {- float[] intensity = sim.IntensityData;- int stride = sim.Stride;- int sw = sim.Width;- int sh = sim.Height;-- Parallel.For(0, dh, y =>- {- int srcY = (int)((long)y * sh / dh);- int srcRowStart = (srcY + 1) * stride + 1;- int dstRowStart = y * dw;- for (int x = 0; x < dw; x++)- {- int srcX = (int)((long)x * sw / dw);- float value = intensity[srcRowStart + srcX];- int index = 0;- if (value > 0f)- {- double scaled = Math.Sqrt(value) * brightness;- if (scaled > 1.0)- {- scaled = 1.0;- }- index = (int)(scaled * 254.0);- }- pixels[dstRowStart + x] = Colorize(index, lut);- }- });- }-- /// <summary>Looks up a palette index in <paramref name="lut"/>, or builds an opaque grey of that level when there is no LUT.</summary>- private static int Colorize(int index, int[] lut)- {- if (lut != null)- {- return lut[index];- }- return unchecked((int)0xFF000000) | (index << 16) | (index << 8) | index;- }-- /// <summary>- /// Reads <paramref name="bmp"/> into a flat array of tightly packed 24-bit pixels, 3 bytes per pixel in memory- /// order B,G,R, row by row without padding, exactly <paramref name="w"/> x <paramref name="h"/>. The bitmap is- /// expected to already be that size in the one place this is used (<see cref="SimulationJob.GlowOverlay"/> in- /// <see cref="SimulationRunner"/>), so this is just a format normalisation, not a real resize: it is drawn- /// unscaled at (0,0) onto a black <paramref name="w"/> x <paramref name="h"/> bitmap. Used to additively blend- /// <c>Form1</c>'s "glowing edges" preview overlay into exported video frames, see <see cref="AddOverlay"/>.- /// </summary>- /// <param name="bmp">Source image, normally already <paramref name="w"/> x <paramref name="h"/>.</param>- /// <param name="w">Width in pixels.</param>- /// <param name="h">Height in pixels.</param>- /// <returns>A new array of <c>w * h * 3</c> bytes.</returns>- public static byte[] ToRgbBytes(Bitmap bmp, int w, int h)- {- byte[] rgb = new byte[w * h * 3];- using (Bitmap normalized = new Bitmap(w, h, PixelFormat.Format24bppRgb))- {- using (Graphics g = Graphics.FromImage(normalized))- {- g.Clear(Color.Black);- g.DrawImageUnscaled(bmp, 0, 0);- }- Rectangle rect = new Rectangle(0, 0, w, h);- BitmapData data = normalized.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);- try- {- int stride = data.Stride;- byte[] raw = new byte[stride * h];- Marshal.Copy(data.Scan0, raw, 0, raw.Length);- for (int y = 0; y < h; y++)- {- int srcRow = y * stride;- int dstRow = y * w * 3;- for (int x = 0; x < w; x++)- {- int src = srcRow + x * 3;- int dst = dstRow + x * 3;- rgb[dst] = raw[src];- rgb[dst + 1] = raw[src + 1];- rgb[dst + 2] = raw[src + 2];- }- }- }- finally- {- normalized.UnlockBits(data);- }- }- return rgb;- }-- /// <summary>- /// Multiplies every byte of a <see cref="ToRgbBytes"/> buffer by <paramref name="gain"/>, rounded and clamped to 255,- /// so that <see cref="AddOverlay"/>'s per-frame, per-pixel work is a plain add instead of repeating a floating-point- /// multiply and a byte conversion on the same bytes for every single exported frame. The gain is fixed for the whole- /// run (frozen at Start Simulation, like everything else in <see cref="SimulationJob"/>), so there is no reason to- /// redo this more than once.- /// </summary>- /// <param name="overlayRgb">Packed B,G,R overlay, or null.</param>- /// <param name="gain">Multiplier; values <= 0 disable the overlay.</param>- /// <returns>A new scaled copy, or null (<see cref="AddOverlay"/> then does nothing) when the input is null or the gain is <= 0.</returns>- public static byte[] ScaleOverlayRgb(byte[] overlayRgb, double gain)- {- if (overlayRgb == null || gain <= 0.0)- {- return null;- }- byte[] scaled = new byte[overlayRgb.Length];- for (int i = 0; i < overlayRgb.Length; i++)- {- scaled[i] = (byte)Math.Round(Math.Min(255.0, overlayRgb[i] * gain));- }- return scaled;- }-- /// <summary>- /// Additively blends a gain-prescaled packed B,G,R overlay (see <see cref="ScaleOverlayRgb"/>) onto ARGB pixels- /// (packed 0xAARRGGBB, as <see cref="RenderField"/>/<see cref="RenderIntensity"/> produce) in place, each channel- /// saturating at 255: never darkens, never touches the alpha byte, and a black overlay pixel (no edge there) leaves- /// the pixel untouched. No-op when the overlay is null. Parallelised by row like <see cref="RenderField"/>/- /// <see cref="RenderIntensity"/>, since this runs once per exported video frame at full simulation resolution and- /// was the actual cost of the glow-edges overlay on a video export; the live preview (<c>Form1</c>'s own- /// <c>ComposeGlowOverlay</c>, same multiply-then-add idea, kept separate since it runs on the UI thread against a- /// <see cref="Bitmap"/>) is comparatively small and only runs a few times a second, so it was never the bottleneck.- /// </summary>- /// <param name="pixels">ARGB buffer of <paramref name="w"/> * <paramref name="h"/> ints, modified in place.</param>- /// <param name="scaledOverlayRgb">Overlay of <paramref name="w"/> * <paramref name="h"/> * 3 bytes, or null.</param>- /// <param name="w">Width in pixels.</param>- /// <param name="h">Height in pixels.</param>- public static void AddOverlay(int[] pixels, byte[] scaledOverlayRgb, int w, int h)- {- if (scaledOverlayRgb == null)- {- return;- }- Parallel.For(0, h, y =>- {- int pixelRow = y * w;- int overlayRow = y * w * 3;- for (int x = 0; x < w; x++)- {- int o = overlayRow + x * 3;- int ob = scaledOverlayRgb[o];- int og = scaledOverlayRgb[o + 1];- int or = scaledOverlayRgb[o + 2];- if (ob == 0 && og == 0 && or == 0)- {- continue;- }- int p = pixelRow + x;- int argb = pixels[p];- int a = argb & unchecked((int)0xFF000000);- int r = Math.Min(255, ((argb >> 16) & 255) + or);- int g = Math.Min(255, ((argb >> 8) & 255) + og);- int b = Math.Min(255, (argb & 255) + ob);- pixels[p] = a | (r << 16) | (g << 8) | b;- }- });- }-- /// <summary>- /// Copies a row-major ARGB buffer into a new 32bpp ARGB <see cref="Bitmap"/> (top-down). The caller owns and- /// must dispose the bitmap; the source array is not referenced afterwards.- /// </summary>- /// <param name="pixels">At least <paramref name="w"/> * <paramref name="h"/> ARGB ints.</param>- /// <param name="w">Bitmap width in pixels.</param>- /// <param name="h">Bitmap height in pixels.</param>- public static Bitmap ToBitmap(int[] pixels, int w, int h)- {- Bitmap bitmap = new Bitmap(w, h, PixelFormat.Format32bppArgb);- BitmapData data = bitmap.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);- try- {- for (int y = 0; y < h; y++)- {- Marshal.Copy(pixels, y * w, IntPtr.Add(data.Scan0, y * data.Stride), w);- }- }- finally- {- bitmap.UnlockBits(data);- }- return bitmap;- }- }-}diff --git a/Wave_Dude_2D/GpuDeviceInfo.cs b/Wave_Dude_2D/GpuDeviceInfo.csdeleted file mode 100644index cc52206..0000000--- a/Wave_Dude_2D/GpuDeviceInfo.cs+++ /dev/null@@ -1,118 +0,0 @@-using System;-using System.Collections.Generic;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Describes one OpenCL GPU device and enumerates the available ones. Produced by <see cref="FindAll"/> and- /// consumed by <see cref="GpuWaveSimulator"/>, which tries the devices in the returned order. The platform and- /// device handles are driver-owned identifiers that need no release.- /// </summary>- internal sealed class GpuDeviceInfo- {- public GpuDeviceInfo()- {- Name = "";- Vendor = "";- }-- /// <summary>- /// Lists every GPU on every OpenCL platform, best candidate first: discrete devices before those sharing- /// host memory, then by descending <see cref="Score"/>. Platforms whose enumeration fails are skipped;- /// a failing platform query yields an empty list. Throws the usual P/Invoke exceptions- /// (<see cref="DllNotFoundException"/> etc.) when OpenCL.dll cannot be loaded.- /// </summary>- public static List<GpuDeviceInfo> FindAll()- {- List<GpuDeviceInfo> devices = new List<GpuDeviceInfo>();- uint platformCount = 0U;- if (OpenClApi.clGetPlatformIDs(0U, null, ref platformCount) != 0 || platformCount == 0U)- {- return devices;- }- IntPtr[] platforms = new IntPtr[platformCount];- uint platformsReturned = 0U;- if (OpenClApi.clGetPlatformIDs(platformCount, platforms, ref platformsReturned) != 0)- {- return devices;- }- foreach (IntPtr platform in platforms)- {- uint deviceCount = 0U;- if (OpenClApi.clGetDeviceIDs(platform, OpenClApi.DeviceTypeGpu, 0U, null, ref deviceCount) != 0 || deviceCount == 0U)- {- continue;- }- IntPtr[] deviceIds = new IntPtr[deviceCount];- uint devicesReturned = 0U;- if (OpenClApi.clGetDeviceIDs(platform, OpenClApi.DeviceTypeGpu, deviceCount, deviceIds, ref devicesReturned) != 0)- {- continue;- }- foreach (IntPtr deviceId in deviceIds)- {- devices.Add(GpuDeviceInfo.Describe(platform, deviceId));- }- }- devices.Sort((a, b) =>- {- // discrete GPUs first, then by score descending- if (a.Discrete != b.Discrete)- {- return a.Discrete ? -1 : 1;- }- return b.Score.CompareTo(a.Score);- });- return devices;- }-- /// <summary>- /// Queries the device properties. Failed queries read as 0 or "", so an unnamed device is called "GPU" and a- /// device whose host-unified-memory flag cannot be read counts as discrete.- /// </summary>- private static GpuDeviceInfo Describe(IntPtr plat, IntPtr id)- {- GpuDeviceInfo info = new GpuDeviceInfo();- info.PlatformId = plat;- info.DeviceId = id;- info.Name = OpenClApi.DeviceString(id, OpenClApi.DeviceName);- info.Vendor = OpenClApi.DeviceString(id, OpenClApi.DeviceVendor);- info.Discrete = OpenClApi.DeviceNumber(id, OpenClApi.DeviceHostUnifiedMemory) == 0UL;- double computeUnits = OpenClApi.DeviceNumber(id, OpenClApi.DeviceMaxComputeUnits);- double clockMhz = OpenClApi.DeviceNumber(id, OpenClApi.DeviceMaxClockFrequency);- info.Score = computeUnits * Math.Max(1.0, clockMhz);- // Mask the sign bit so an odd 64-bit value cannot turn into a negative size.- info.GlobalMemory = (long)(OpenClApi.DeviceNumber(id, OpenClApi.DeviceGlobalMemSize) & 0x7FFFFFFFFFFFFFFFUL);- info.MaxAllocation = (long)(OpenClApi.DeviceNumber(id, OpenClApi.DeviceMaxMemAllocSize) & 0x7FFFFFFFFFFFFFFFUL);- if (info.Name.Length == 0)- {- info.Name = "GPU";- }- return info;- }-- /// <summary>OpenCL platform handle (cl_platform_id) the device belongs to.</summary>- public IntPtr PlatformId;-- /// <summary>OpenCL device handle (cl_device_id).</summary>- public IntPtr DeviceId;-- /// <summary>CL_DEVICE_NAME, or "GPU" when the query fails.</summary>- public string Name;-- /// <summary>CL_DEVICE_VENDOR, or "" when the query fails.</summary>- public string Vendor;-- /// <summary>True for a card with its own memory (the NVIDIA GeForce; CL_DEVICE_HOST_UNIFIED_MEMORY is 0), false for the graphics of the processor (Intel UHD).</summary>- public bool Discrete;-- /// <summary>Compute units times clock (MHz, at least 1): a rough measure of the speed.</summary>- public double Score;-- /// <summary>CL_DEVICE_GLOBAL_MEM_SIZE in bytes.</summary>- public long GlobalMemory;-- /// <summary>CL_DEVICE_MAX_MEM_ALLOC_SIZE in bytes: the largest single buffer the device allows.</summary>- public long MaxAllocation;- }-}diff --git a/Wave_Dude_2D/GpuWaveSimulator.cs b/Wave_Dude_2D/GpuWaveSimulator.csdeleted file mode 100644index 169e80c..0000000--- a/Wave_Dude_2D/GpuWaveSimulator.cs+++ /dev/null@@ -1,1349 +0,0 @@-using System;-using System.Collections.Generic;-using System.Text;--namespace _2D_wave_sim_V01-{- /// <summary>- /// OpenCL implementation of <see cref="IWaveEngine"/>: the 2D wave equation on the graphics card, the same- /// algorithm as <see cref="WaveSimulator"/> (padded grid with a border of one cell, 9-point or sub-stepped- /// 4th-order Laplacian, soft source blending, two-stage intensity average), with the field, the scene maps,- /// the source tables and the probe buffers all resident on the device. Units are those of the CPU engine- /// (dx = dt = 1, c in cells per step, frequencies in radians per step, time in steps):- /// <code>- /// new u = u + (u - previous u) * d + laplacian * c^2 (3x3 kernel 0.066 / 0.184 / -1)- /// sources: u = u * 0.9 + sin(frequency * t) * amplitude * 0.1- /// intensity: two cascaded one-pole filters, I1 = I1 * alpha + u^2 * (1 - alpha), I2 = I2 * alpha + I1 * (1 - alpha),- /// blended (IntensityBlend) into what is shown/exported: Iout = (I1 * (1 - blend) + I2 * blend) * scale- /// </code>- /// alpha is derived once per simulation - see the <see cref="WaveSimulator"/> class summary (why two stages- /// and the blend, not a single, fixed-0.98 filter) and <see cref="SimulationSettings.TimeDecayFactor"/> (why- /// alpha); scale is <see cref="SimulationSettings.IntensityScale"/> (why it exists). The field, the previous- /// field, c², d and the intensity stay in the memory of the graphics card; only when a frame is drawn- /// (<see cref="PrepareFrame"/>) the field and/or intensity are copied back. The arrays have the same layout as- /// those of the CPU engine, so the same renderer draws both.- /// Created through <see cref="TryCreate"/> by <see cref="WaveEngineFactory"/> and driven by- /// <see cref="SimulationRunner"/> on its worker thread, which is the only thread that enqueues work; the UI- /// thread touches only <see cref="PrepareFrame"/>, <see cref="FieldData"/> and <see cref="IntensityData"/>- /// while the runner is paused. Any single thread may drive the engine; it is not safe for concurrent use.- /// </summary>- /// <remarks>- /// <para>- /// Optionally (<c>use4thOrderLaplacian</c>), the <c>wave_step</c> kernel instead computes the Laplacian with a- /// 4th order accurate, 5-point "cross" stencil wherever there is room for it, the same as- /// <see cref="WaveSimulator"/>'s <c>UpdateField</c> on the CPU (see that class's summary for why). Which form to- /// use is baked into the generated kernel source as a compile-time <c>#define</c>, not a runtime branch, so- /// there is no extra cost when it is off.- /// </para>- /// <para>- /// The 4th order stencil needs the same time sub-stepping as the CPU engine to stay stable, for the same- /// reason (see <see cref="WaveSimulator"/>'s class summary): <see cref="AdvanceOneStep"/> launches- /// <c>wave_step</c> <see cref="_subSteps"/> times instead of once when <see cref="_subSteps"/> > 1, with c²- /// scaled by a <c>c2Scale</c> kernel argument (1 / <see cref="_subSteps"/>²) and the d buffer pre-scaled (on- /// the host, once, at <see cref="Build"/> time) to its 1 / <see cref="_subSteps"/>-th root, so- /// <see cref="_subSteps"/> kernel launches move the field by exactly the same physical time and damping as- /// one ordinary launch. The intensity buffer is only updated (via the kernel's <c>track</c> argument) on the- /// last of the <see cref="_subSteps"/> launches, so its own exponential averaging still runs once per- /// <see cref="AdvanceOneStep"/> call, matching the CPU engine and its own earlier calibration.- /// <see cref="_subSteps"/> is 1 (<c>c2Scale</c> exactly 1.0f, an exact no-op multiply, and the d buffer- /// unchanged) whenever the 3x3 kernel is used or this scene's highest c² does not need sub-stepping - see- /// <see cref="WaveSimulator.ComputeSubSteps"/>.- /// </para>- /// <para>- /// The field lives in two ping-pong buffers (<see cref="_field"/>) that take turns as "current field" and- /// "previous field"; every kernel that reads the field exists twice (index 0/1) with the buffers bound in- /// opposite order, so a step merely picks the kernel for <see cref="_current"/> instead of re-binding- /// arguments. Kernel launches are asynchronous; uploads and read-backs are blocking. Every OpenCL handle- /// created here is registered in <see cref="_scene"/> (the simulation program, kernels and buffers) or- /// <see cref="_probes"/> (everything <see cref="SetProbes"/> creates) and released by <see cref="Dispose"/>,- /// by the constructor when building fails, or — for the probe set — when probes are installed again. The- /// managed arrays (<see cref="FieldData"/>, <see cref="IntensityData"/>) are plain host copies.- /// </para>- /// <para>- /// Like <see cref="WaveSimulator"/>, portions of this engine are based on WaveSimulator2D by 0x23- /// (https://github.com/0x23/WaveSimulator2D).- /// </para>- /// </remarks>- internal sealed class GpuWaveSimulator : IWaveEngine, IDisposable- {- /// <summary>- /// Tries the GPUs one after the other, the best first (<see cref="GpuDeviceInfo.FindAll"/>), and returns- /// the first that works. Parameters are those of the <see cref="WaveSimulator"/> constructor.- /// </summary>- /// <param name="scene">Per-cell c² and damping maps plus the image (green-channel) sources.</param>- /// <param name="sourceFrequencyScale">Multiplier in the level-to-angular-frequency mapping (level/255 × 0.5 × scale, radians per step).</param>- /// <param name="sourceAmplitude">Peak amplitude of the image sources (object sources carry their own).</param>- /// <param name="trackIntensity">Whether to allocate and update the intensity buffers; when false <see cref="IntensityData"/> stays null.</param>- /// <param name="use4thOrderLaplacian">Use the 4th-order 5-point-per-axis stencil (with sub-stepping) instead of the 9-point one; see the class summary.</param>- /// <param name="timeDecayFactor"><see cref="SimulationSettings.TimeDecayFactor"/> - see that property's comment; the retention is derived by <see cref="WaveSimulator.IntensityRetention"/>.</param>- /// <param name="intensityScale"><see cref="SimulationSettings.IntensityScale"/> - see that property's comment; multiplier applied to the intensity output.</param>- /// <param name="problems">Receives "" on success, otherwise why no device worked ("no GPU found …" or the- /// per-device failure messages joined by "; ").</param>- /// <param name="objectSources">The generated elements of the object sources (Sources tab), or null/empty for none; those outside the canvas are dropped.</param>- /// <returns>The engine, or null when no device could be used (see <paramref name="problems"/>).</returns>- /// <exception cref="DllNotFoundException">There is no OpenCL driver (OpenCL.dll cannot be loaded).</exception>- public static GpuWaveSimulator TryCreate(SceneData scene, double sourceFrequencyScale, double sourceAmplitude, bool trackIntensity, bool use4thOrderLaplacian, double timeDecayFactor, double intensityScale, ref string problems, List<SourceElement> objectSources = null)- {- problems = "";- List<GpuDeviceInfo> devices = GpuDeviceInfo.FindAll();- if (devices.Count == 0)- {- problems = "no GPU found through OpenCL" + ((IntPtr.Size == 4) ? " (this is a 32-bit process; run the 64-bit build)" : "");- return null;- }- StringBuilder errors = new StringBuilder();- foreach (GpuDeviceInfo device in devices)- {- try- {- return new GpuWaveSimulator(device, scene, sourceFrequencyScale, sourceAmplitude, trackIntensity, use4thOrderLaplacian, timeDecayFactor, intensityScale, objectSources);- }- catch (Exception ex)- {- if (errors.Length > 0)- {- errors.Append("; ");- }- errors.Append(device.Name).Append(": ").Append(ex.Message);- }- }- problems = errors.ToString();- return null;- }-- /// <summary>- /// Records the scene geometry, rejects scenes whose per-cell buffer would exceed the device's maximum- /// allocation, keeps only the object sources inside the canvas and then runs <see cref="Build"/>; if that- /// throws, everything allocated so far is released before the exception propagates.- /// </summary>- /// <exception cref="InvalidOperationException">The scene is too large for the device, or the OpenCL program could not be built.</exception>- private GpuWaveSimulator(GpuDeviceInfo device, SceneData scene, double sourceFrequencyScale, double sourceAmplitude, bool trackIntensity, bool use4thOrderLaplacian, double timeDecayFactor, double intensityScale, List<SourceElement> objectSources)- {- Description = "GPU: " + device.Name + " (OpenCL)";- _device = device;- _width = scene.Width;- _height = scene.Height;- _stride = _width + 2;- _cells = _stride * (_height + 2);- _track = trackIntensity;- _sourceCount = scene.SourceCount;- if (device.MaxAllocation > 0L && (long)_cells * 4L > device.MaxAllocation)- {- throw new InvalidOperationException("the scene is too large for this GPU");- }- // object sources: keep only the elements whose position is inside the canvas (a randomized composite- // element can fall outside), same filtering as the CPU engine (WaveSimulator)- List<SourceElement> sourcesInScene = new List<SourceElement>();- if (objectSources != null)- {- foreach (SourceElement source in objectSources)- {- if (source.PosX >= 0 && source.PosX < _width && source.PosY >= 0 && source.PosY < _height)- {- sourcesInScene.Add(source);- }- }- }- _objSourceCount = sourcesInScene.Count;- _grid2D = new[] { new IntPtr(_width), new IntPtr(_height) };- _grid1D = new[] { new IntPtr(Math.Max(1, _sourceCount)) };- _objGrid1D = new[] { new IntPtr(Math.Max(1, _objSourceCount)) };- _hostField = new float[_cells];- _hostIntensity = trackIntensity ? new float[_cells] : null;- try- {- Build(scene, sourceFrequencyScale, (float)sourceAmplitude, use4thOrderLaplacian, timeDecayFactor, (float)intensityScale, sourcesInScene);- }- catch- {- ReleaseAll();- throw;- }- }-- /// <summary>- /// Creates the context and queue, compiles <see cref="KernelSource"/>, uploads every buffer for the scene- /// and binds the kernel arguments. Mirrors the <see cref="WaveSimulator"/> constructor: c² and damping are- /// copied into the padded layout, the sub-step count and the per-sub-step damping / c² corrections are- /// derived for the 4th-order stencil, the sources are indexed, and the intensity averaging constant is set- /// from the lowest source level in use. When intensity is not tracked the three intensity buffers are- /// 1-float dummies so the kernel arguments are still valid. The kernel arguments that change per step- /// (time, per-sub-step track flag) are left to <see cref="AdvanceOneStep"/>.- /// </summary>- /// <param name="scene">Per-cell c² and damping maps plus the image sources.</param>- /// <param name="sourceFrequencyScale">Multiplier in the level-to-angular-frequency mapping.</param>- /// <param name="sourceAmplitude">Peak amplitude of the image sources.</param>- /// <param name="use4thOrderLaplacian">Compile the program with <c>USE_4TH_ORDER</c> and sub-step accordingly.</param>- /// <param name="timeDecayFactor">Intensity averaging time in units of 100/level steps.</param>- /// <param name="intensityScale">Multiplier applied to the intensity output.</param>- /// <param name="objectSources">Object sources already filtered to those inside the canvas.</param>- /// <exception cref="InvalidOperationException">The OpenCL program could not be built (message includes the build log).</exception>- private void Build(SceneData scene, double sourceFrequencyScale, float sourceAmplitude, bool use4thOrderLaplacian, double timeDecayFactor, float intensityScale, List<SourceElement> objectSources)- {- int err = 0;- IntPtr[] contextProperties = { new IntPtr(OpenClApi.ContextPlatformProperty), _device.PlatformId, IntPtr.Zero };- IntPtr[] deviceIds = { _device.DeviceId };- _context = OpenClApi.clCreateContext(contextProperties, 1U, deviceIds, IntPtr.Zero, IntPtr.Zero, ref err);- OpenClApi.Check(err, "clCreateContext");- _queue = OpenClApi.clCreateCommandQueue(_context, _device.DeviceId, 0UL, ref err);- OpenClApi.Check(err, "clCreateCommandQueue");- _scene.Program = BuildProgram(KernelSource(use4thOrderLaplacian), "the program for the GPU");-- // the scene, with a border of one cell like the CPU engine (padded layout)- float[] c2 = new float[_cells];- float[] damping = new float[_cells];- for (int y = 0; y < _height; y++)- {- Array.Copy(scene.C2, y * _width, c2, (y + 1) * _stride + 1, _width);- Array.Copy(scene.D, y * _width, damping, (y + 1) * _stride + 1, _width);- }- // see the class summary: sub-stepping keeps the 4th order stencil stable without changing the physical- // wave speed or damping - _subSteps stays 1 (no sub-stepping) unless the 4th order stencil is in use and- // this scene's highest c² actually needs it. The d buffer uploaded below is pre-scaled to match (its- // 1 / _subSteps-th root, or unchanged when _subSteps = 1), same as WaveSimulator's _dEffective on the CPU.- _subSteps = use4thOrderLaplacian ? WaveSimulator.ComputeSubSteps(WaveSimulator.MaxOf(c2)) : 1;- // 1 / _subSteps², or exactly 1f when _subSteps = 1 (a bit-for-bit no-op multiply in the kernel)- float c2Mult = 1f;- if (_subSteps > 1)- {- // Damping is applied once per sub-step, so take the sub-step root to keep the per-step decay unchanged.- double exponent = 1.0 / _subSteps;- for (int i = 0; i < damping.Length; i++)- {- damping[i] = (float)Math.Pow(damping[i], exponent);- }- // A sub-step is 1/subSteps long, so c²·dt² shrinks by 1/subSteps².- c2Mult = 1f / (_subSteps * _subSteps);- }- IntPtr c2Buffer = CreateBuffer(c2, _scene);- IntPtr dBuffer = CreateBuffer(damping, _scene);- float[] zeros = new float[_cells];- _field[0] = CreateBuffer(zeros, _scene);- _field[1] = CreateBuffer(zeros, _scene);- // Not tracked: the kernels still need valid buffer arguments, and they never touch them.- float[] intensityInit = _track ? zeros : new float[1];- // the two cascaded exponential-filter stages that make up the intensity - see the class summary and- // WaveSimulator._intensity / _intensityStage1 (CPU engine); used only inside wave_step, never read back -- // what is read back/probed is their blend, _intensityOutBuffer (WaveSimulator._intensityOut on the CPU)- IntPtr intensityBuffer = CreateBuffer(intensityInit, _scene);- IntPtr intensityStage1Buffer = CreateBuffer(intensityInit, _scene);- _intensityOutBuffer = CreateBuffer(intensityInit, _scene);-- // the level-to-frequency table (level 0-255 -> frequency), shared by the image sources and the object sources- IntPtr frequencyBuffer = IntPtr.Zero;- if (_sourceCount > 0 || _objSourceCount > 0)- {- float[] frequencies = new float[256];- for (int level = 0; level <= 255; level++)- {- frequencies[level] = (float)(level / 255.0 * 0.5 * sourceFrequencyScale);- }- frequencyBuffer = CreateBuffer(frequencies, _scene);- }- // the image sources (from the green channel of the scene image)- bool[] levelUsed = new bool[256];- int[] indices = new int[_sourceCount];- int[] levels = new int[_sourceCount];- for (int i = 0; i < _sourceCount; i++)- {- indices[i] = (scene.SourceY[i] + 1) * _stride + scene.SourceX[i] + 1;- levels[i] = scene.SourceLevel[i];- levelUsed[scene.SourceLevel[i]] = true;- }- // the intensity's averaging time constant scales inversely with the frequency of the slowest active source- // (image or object; a level of 0 means "no source" and is excluded) - see WaveSimulator's identical- // computation (CPU engine) and SimulationSettings.TimeDecayFactor's comment for why. This exponential-- // average decay factor replaces the old fixed 0.98f in the kernel.- float intensityAlpha = WaveSimulator.IntensityRetention(timeDecayFactor, WaveSimulator.LowestSourceLevel(levelUsed, objectSources));-- // Kernel k reads field[k] and writes field[1 - k]; argument 4 (sources) / 11 (object sources) is the- // time and argument 8 of wave_step the track flag, both set per launch in AdvanceOneStep.- for (int k = 0; k <= 1; k++)- {- IntPtr step = _stepKernel[k] = CreateKernel(_scene, "wave_step");- SetMem(step, 0U, _field[k]);- SetMem(step, 1U, _field[1 - k]);- SetMem(step, 2U, c2Buffer);- SetMem(step, 3U, dBuffer);- SetMem(step, 4U, intensityBuffer);- SetInt(step, 5U, _width);- SetInt(step, 6U, _height);- SetInt(step, 7U, _stride);- SetInt(step, 8U, _track ? 1 : 0);- SetFloat(step, 9U, c2Mult);- SetFloat(step, 10U, intensityAlpha);- SetMem(step, 11U, intensityStage1Buffer);- SetMem(step, 12U, _intensityOutBuffer);- SetFloat(step, 13U, intensityScale);- }- if (_sourceCount > 0)- {- IntPtr indexBuffer = CreateBuffer(indices, _scene);- IntPtr levelBuffer = CreateBuffer(levels, _scene);- for (int k = 0; k <= 1; k++)- {- IntPtr kernel = _sourceKernel[k] = CreateKernel(_scene, "apply_sources");- SetMem(kernel, 0U, _field[k]);- SetMem(kernel, 1U, indexBuffer);- SetMem(kernel, 2U, levelBuffer);- SetMem(kernel, 3U, frequencyBuffer);- SetFloat(kernel, 5U, sourceAmplitude);- SetInt(kernel, 6U, _sourceCount);- }- }- if (_objSourceCount > 0)- {- BuildObjectSourceKernels(objectSources, frequencyBuffer);- }- }-- /// <summary>- /// Object sources (Sources tab): the flat list of generated point-source elements that are within the- /// canvas, one entry per element. Uploads one table per <see cref="SourceElement"/> property (see the- /// <c>apply_object_sources</c> kernel comment for the layout) and binds the two- /// <c>apply_object_sources</c> kernels. The frequency table (<paramref name="frequencyBuffer"/>, indexed- /// by level) is shared with the image sources since both use the same level-to-frequency scale. The cycle- /// anchors start at 0 and every source gets a non-zero xorshift32 seed.- /// </summary>- private void BuildObjectSourceKernels(List<SourceElement> objectSources, IntPtr frequencyBuffer)- {- int n = _objSourceCount;- int[] index = new int[n], level = new int[n], mode = new int[n], pulseShape = new int[n];- int[] onWidth = new int[n], offWidth = new int[n], detachStep = new int[n];- int[] offWidthBase = new int[n], randomizeOffWidthAmount = new int[n], rngState = new int[n];- float[] amplitude = new float[n], phase = new float[n], cycleAnchor = new float[n];- // a local, host-side RNG just to seed each element's on-GPU xorshift32 generator - xorshift needs a- // nonzero starting state, so 0 is never allowed- Random seedRng = new Random();- for (int i = 0; i < n; i++)- {- SourceElement source = objectSources[i];- index[i] = (source.PosY + 1) * _stride + source.PosX + 1;- level[i] = source.Level;- amplitude[i] = (float)source.Amplitude;- phase[i] = (float)source.PhaseRad;- mode[i] = source.Mode == SourceMode.Pulsed ? 1 : 0;- pulseShape[i] = source.PulseShape == SourcePulseShape.SmoothedSquare ? 1 : 0;- onWidth[i] = source.OnWidthCycles;- offWidth[i] = source.OffWidthCycles;- detachStep[i] = source.DetachAfterStep;- offWidthBase[i] = source.OffWidthBase;- randomizeOffWidthAmount[i] = source.RandomizeOffWidthAmount;- // xorshift32 never leaves state 0, so a zero seed would make the off-width constant.- int seed = seedRng.Next(int.MinValue, int.MaxValue);- rngState[i] = seed == 0 ? 1 : seed;- }- // Buffer arguments by kernel argument index; 0 is the field (per kernel instance), 11 the time- // (per launch) and 12 the count (scalar), see the apply_object_sources signature.- IntPtr[] buffers = new IntPtr[17];- buffers[1] = CreateBuffer(index, _scene);- buffers[2] = CreateBuffer(level, _scene);- buffers[3] = CreateBuffer(amplitude, _scene);- buffers[4] = CreateBuffer(phase, _scene);- buffers[5] = CreateBuffer(mode, _scene);- buffers[6] = CreateBuffer(pulseShape, _scene);- buffers[7] = CreateBuffer(onWidth, _scene);- // the off-width currently in effect for each element, in cycles; read-write on the GPU (see- // apply_object_sources) since an element with RandomizeOffWidthAmount > 0 redraws it there each time it- // completes a cycle- buffers[8] = CreateBuffer(offWidth, _scene);- // "detach source": the step at which each element stops driving the field (releasing its hold on it), or -1 to never- buffers[9] = CreateBuffer(detachStep, _scene);- buffers[10] = frequencyBuffer;- // 13-16 were appended at the end rather than renumbering 0-12, so every SetMem/SetInt call (and the- // per-launch SetFloat for t at index 11 in AdvanceOneStep) kept its existing, already-correct index.- // Runtime state for off-width re-randomization (see SourceElement.RandomizeOffWidthAmount): the- // un-randomized anchor each redraw is centered on, the per-element +/- spread (0 = never redraw), the- // cycle-clock value at which each element's current off+on cycle started, and a per-element xorshift32- // PRNG seed (kernel-side reinterpreted as uint - only the entropy bits matter, not signedness)- buffers[13] = CreateBuffer(offWidthBase, _scene);- buffers[14] = CreateBuffer(randomizeOffWidthAmount, _scene);- buffers[15] = CreateBuffer(cycleAnchor, _scene);- buffers[16] = CreateBuffer(rngState, _scene);- for (int k = 0; k <= 1; k++)- {- IntPtr kernel = _objSourceKernel[k] = CreateKernel(_scene, "apply_object_sources");- SetMem(kernel, 0U, _field[k]);- for (uint a = 1; a < buffers.Length; a++)- {- if (buffers[a] != IntPtr.Zero)- {- SetMem(kernel, a, buffers[a]);- }- }- SetInt(kernel, 12U, n);- }- }-- /// <summary>- /// OpenCL source of the simulation program: <c>wave_step</c>, <c>apply_sources</c> and- /// <c>apply_object_sources</c>, each a GPU transcription of the corresponding <see cref="WaveSimulator"/>- /// routine. <paramref name="use4thOrderLaplacian"/> selects, at compile time (a <c>#define</c>, not a- /// runtime branch), which form of the Laplacian <c>wave_step</c> uses - see the class summary and- /// <see cref="WaveSimulator"/>'s <c>UpdateField</c>, whose CPU-side stencils and boundary logic this mirrors- /// exactly. <c>wave_step</c>'s <c>c2Scale</c> argument is the sub-stepping scale (see the class summary),- /// and its <c>intensityAlpha</c> argument is the intensity's exponential-average decay factor - both are- /// runtime kernel arguments rather than a <c>#define</c>, so they need no text formatting/locale handling- /// here. The only value spliced into the text is <see cref="SourceElement.DetachRampSteps"/>, an integer,- /// which formats the same in every locale; floats are deliberately never spliced.- /// </summary>- private static string KernelSource(bool use4thOrderLaplacian)- {- StringBuilder source = new StringBuilder();- source.AppendLine("#define USE_4TH_ORDER " + (use4thOrderLaplacian ? "1" : "0"));- source.AppendLine();- // wave_step: one leapfrog sub-step, one work item per interior cell (x, y in 0..w-1 / 0..h-1).- // u current field, padded, stride floats per row; the cell is i = (y + 1) * stride + x + 1- // up previous field on entry, overwritten in place with the new value (leapfrog), same layout- // c2, d per-cell c² and per-sub-step damping, same layout- // lap 4th-order 5-point-per-axis stencil for cells at least two away from the border (needs- // USE_4TH_ORDER), otherwise the 9-point stencil (corners 0.066, edges 0.184, centre -1)- // nv = u + (u - up)·d + lap·c2·c2Scale, with c2Scale = 1/subSteps²- // inten1 / inten first and second stage exponential averages of nv², retention intensityAlpha- // intenOut (stage1 + stage2)/2 · intensityScale; the three are only touched when track != 0- source.AppendLine("__kernel void wave_step(__global const float* u, __global float* up, __global const float* c2,");- source.AppendLine(" __global const float* d, __global float* inten,");- source.AppendLine(" const int w, const int h, const int stride, const int track, const float c2Scale,");- source.AppendLine(" const float intensityAlpha, __global float* inten1, __global float* intenOut,");- source.AppendLine(" const float intensityScale)");- source.AppendLine("{");- source.AppendLine(" int x = get_global_id(0);");- source.AppendLine(" int y = get_global_id(1);");- source.AppendLine(" if (x >= w || y >= h) return;");- source.AppendLine(" int i = (y + 1) * stride + x + 1;");- source.AppendLine(" float uc = u[i];");- source.AppendLine(" float lap;");- source.AppendLine("#if USE_4TH_ORDER");- // the 4th order 5-point "cross" stencil (reaches 2 cells away along x and along y), only where the domain- // has that much room - the outermost ring (x = 0, x = w - 1, y = 0, y = h - 1) falls back to the 3x3- // kernel below, the same boundary rule as WaveSimulator.UpdateField on the CPU- source.AppendLine(" if (x >= 1 && x <= w - 2 && y >= 1 && y <= h - 2) {");- source.AppendLine(" lap = (-1.0f / 12.0f) * (u[i - 2] + u[i + 2] + u[i - 2 * stride] + u[i + 2 * stride])");- source.AppendLine(" + (4.0f / 3.0f) * (u[i - 1] + u[i + 1] + u[i - stride] + u[i + stride])");- source.AppendLine(" - 5.0f * uc;");- source.AppendLine(" } else {");- source.AppendLine(" lap = 0.066f * (u[i - stride - 1] + u[i - stride + 1] + u[i + stride - 1] + u[i + stride + 1])");- source.AppendLine(" + 0.184f * (u[i - 1] + u[i + 1] + u[i - stride] + u[i + stride]) - uc;");- source.AppendLine(" }");- source.AppendLine("#else");- source.AppendLine(" lap = 0.066f * (u[i - stride - 1] + u[i - stride + 1] + u[i + stride - 1] + u[i + stride + 1])");- source.AppendLine(" + 0.184f * (u[i - 1] + u[i + 1] + u[i - stride] + u[i + stride]) - uc;");- source.AppendLine("#endif");- source.AppendLine(" float nv = uc + (uc - up[i]) * d[i] + lap * c2[i] * c2Scale;");- source.AppendLine(" up[i] = nv;");- // two cascaded one-pole stages, blended (0.5f - see WaveSimulator.IntensityBlend, CPU engine) into what is- // read back/probed (intenOut) instead of using the full 2-stage cascade outright - see the class summary- source.AppendLine(" if (track != 0) {");- source.AppendLine(" float s1 = inten1[i] * intensityAlpha + nv * nv * (1.0f - intensityAlpha);");- source.AppendLine(" inten1[i] = s1;");- source.AppendLine(" float s2 = inten[i] * intensityAlpha + s1 * (1.0f - intensityAlpha);");- source.AppendLine(" inten[i] = s2;");- source.AppendLine(" intenOut[i] = (s1 * 0.5f + s2 * 0.5f) * intensityScale;");- source.AppendLine(" }");- source.AppendLine("}");- source.AppendLine();- // apply_sources: soft-blends the image sources into the field, one work item per source k < n.- // idx[k] padded cell index of the source; level[k] its green level (index into freq)- // freq 256 angular frequencies (radians per step); t the current step- // u[idx] = 0.9·u + 0.1·sin(freq[level]·t)·amp (same 0.9/0.1 blend as the CPU SourceOpacity)- source.AppendLine("__kernel void apply_sources(__global float* u, __global const int* idx, __global const int* level,");- source.AppendLine(" __global const float* freq, const float t, const float amp, const int n)");- source.AppendLine("{");- source.AppendLine(" int k = get_global_id(0);");- source.AppendLine(" if (k >= n) return;");- source.AppendLine(" int p = idx[k];");- source.AppendLine(" u[p] = u[p] * 0.9f + sin(freq[level[k]] * t) * amp * 0.1f;");- source.AppendLine("}");- source.AppendLine();- // xorshift32: OpenCL has no built-in RNG, so object sources that re-randomize their off-width (see- // SourceElement.RandomizeOffWidthAmount) carry their own per-element state (rngState, seeded host-side,- // nonzero) through this. Matches WaveSimulator's use of SourceSettings.RandomInt only in spirit (a uniform- // draw in [-amount, amount]), not bit-for-bit - the two engines are not expected to reproduce each other.- source.AppendLine("inline uint xorshift32(uint x)");- source.AppendLine("{");- source.AppendLine(" x ^= x << 13;");- source.AppendLine(" x ^= x >> 17;");- source.AppendLine(" x ^= x << 5;");- source.AppendLine(" return x;");- source.AppendLine("}");- source.AppendLine();- // apply_object_sources (Sources tab): soft-blends the object sources into the field, one element per- // work item k < n, same math as WaveSimulator.ApplySources/ComputePulsePosition/PulseEnvelope on the CPU.- // All per-source tables are indexed by k:- // idx, level, amp, phase cell index, frequency level (into freq), amplitude, phase (radians)- // mode 0 = continuous (envelope always 1), 1 = pulsed (Gaussian or smoothed-square- // envelope, "off" preceding "on" within each onWidth/offWidth cycle of the- // element's own frequency)- // pulseShape (0 Gaussian/1 smoothed square), onWidth (cycles)- // offWidth off-width in effect; read-write: for an element with- // offWidthRandomizeAmount[k] > 0 this kernel redraws it (uniformly within- // +/- offWidthRandomizeAmount of offWidthBase) every time that element- // completes a full off+on cycle, advancing its own cycleAnchor[k] to mark- // where the new cycle started- // detachStep step after which the source fades out linearly over- // SourceElement.DetachRampSteps steps (-1 = never); work items past the- // fade return without writing- // offWidthBase ± offWidthRandomizeAmount range of a randomized off-width (amount <= 0 = fixed)- // cycleAnchor, rngState kernel-owned state for the randomized mode: start (cycles) of the- // current period and the xorshift32 state - so, unlike the other- // object-source buffers, offWidth/cycleAnchor/rngState are genuinely- // mutated by the GPU across steps- // The result is u[idx] = 0.9·u + 0.1·sin(phase + f·t)·amp·envelope·detachFade.- source.AppendLine("__kernel void apply_object_sources(__global float* u, __global const int* idx, __global const int* level,");- source.AppendLine(" __global const float* amp, __global const float* phase, __global const int* mode,");- source.AppendLine(" __global const int* pulseShape, __global const int* onWidth, __global int* offWidth,");- source.AppendLine(" __global const int* detachStep,");- source.AppendLine(" __global const float* freq, const float t, const int n,");- source.AppendLine(" __global const int* offWidthBase, __global const int* offWidthRandomizeAmount,");- source.AppendLine(" __global float* cycleAnchor, __global int* rngState)");- source.AppendLine("{");- source.AppendLine(" int k = get_global_id(0);");- source.AppendLine(" if (k >= n) return;");- // "detach source": once the run reaches the element's detach step, its drive is faded out linearly over the- // next DetachRampSteps steps (rather than cut instantly), then it stops driving the field entirely (not even- // writing towards 0) so it releases its hold and stops diffracting waves through that point - matching- // WaveSimulator.ApplySources exactly (SourceElement.DetachRampSteps is the single shared constant, spliced- // into the kernel text).- source.AppendLine(" float detachFade = 1.0f;");- source.AppendLine(" if (detachStep[k] >= 0) {");- source.AppendLine(" float stepsSinceDetach = t - (float)detachStep[k];");- source.AppendLine(" if (stepsSinceDetach >= " + SourceElement.DetachRampSteps.ToString() + ".0f) return;");- source.AppendLine(" if (stepsSinceDetach > 0.0f) detachFade = 1.0f - stepsSinceDetach / " + SourceElement.DetachRampSteps.ToString() + ".0f;");- source.AppendLine(" }");- source.AppendLine(" float f = freq[level[k]];");- source.AppendLine(" float envelope = 1.0f;");- source.AppendLine(" if (mode[k] != 0) {");- source.AppendLine(" int ow = offWidth[k];");- source.AppendLine(" int period = onWidth[k] + ow;");- source.AppendLine(" if (period > 0) {");- source.AppendLine(" float cycleClock = f * t / (2.0f * M_PI_F);");- source.AppendLine(" float pos;");- source.AppendLine(" int isFirstCycle;");- source.AppendLine(" if (offWidthRandomizeAmount[k] <= 0) {");- // shifted so t = 0 lands at pos = ow (the start of the "on" span), not pos = 0 (the start of an "off" span) -- // a single/non-randomized source starting silent for its off-width was never the intent (see- // WaveSimulator.ComputePulsePosition, kept in exact agreement with this kernel)- source.AppendLine(" float adjustedClock = cycleClock + (float)ow;");- source.AppendLine(" isFirstCycle = (floor(adjustedClock / (float)period) == 0.0f) ? 1 : 0;");- source.AppendLine(" pos = adjustedClock - period * floor(adjustedClock / (float)period);");- source.AppendLine(" } else {");- source.AppendLine(" pos = cycleClock - cycleAnchor[k];");- source.AppendLine(" int guard = 0;");- source.AppendLine(" while (pos >= (float)period && guard < 1000) {");- source.AppendLine(" cycleAnchor[k] += (float)period;");- source.AppendLine(" pos -= (float)period;");- source.AppendLine(" uint state = xorshift32((uint)rngState[k]);");- source.AppendLine(" rngState[k] = (int)state;");- source.AppendLine(" int amt = offWidthRandomizeAmount[k];");- source.AppendLine(" int span = 2 * amt + 1;");- source.AppendLine(" int r = (int)(state % (uint)span) - amt;");- source.AppendLine(" ow = offWidthBase[k] + r;");- source.AppendLine(" if (ow < 1) ow = 1;");- source.AppendLine(" offWidth[k] = ow;");- source.AppendLine(" period = onWidth[k] + ow;");- source.AppendLine(" guard++;");- source.AppendLine(" }");- source.AppendLine(" if (pos < 0.0f) pos = 0.0f;");- // the anchor only ever advances (above) once a cycle has actually completed, so it still reading its initial- // 0 means no cycle has completed yet - we are still in the element's very first (off-first) cycle- source.AppendLine(" isFirstCycle = (cycleAnchor[k] == 0.0f) ? 1 : 0;");- source.AppendLine(" }");- source.AppendLine(" if (pulseShape[k] == 0) {");- source.AppendLine(" if (pos < (float)ow) {");- source.AppendLine(" envelope = 0.0f;");- source.AppendLine(" } else {");- source.AppendLine(" float onPos = pos - (float)ow;");- source.AppendLine(" float center = onWidth[k] / 2.0f;");- source.AppendLine(" float sigma = max(onWidth[k] / 6.0f, 1.0e-6f);");- source.AppendLine(" float dd = (onPos - center) / sigma;");- source.AppendLine(" envelope = exp(-0.5f * dd * dd);");- source.AppendLine(" }");- source.AppendLine(" } else {");- source.AppendLine(" // a flat-topped pulse (envelope 1 while on, 0 while off) with a short, FIXED-width");- source.AppendLine(" // (in cycles) smoothed edge at the rise and the fall - fixed, so a long off span");- source.AppendLine(" // sits at (very close to) 0 for nearly all of it instead of lingering. The math is");- source.AppendLine(" // exactly the on-first formula, fed a coordinate shifted so the on span starts at 0.");- source.AppendLine(" float shifted = pos - (float)ow;");- // wrapping shifted forward by a full period makes it continue the falling tail of the on-span that JUST- // ended - correct from the second off-span onward, where that on-span really happened. The very first- // off-span (isFirstCycle) has no real preceding on-emission to continue from, so wrapping there would- // fabricate one: pos = 0 would land exactly on that phantom falling edge and start the run at envelope ~0.5- // instead of ~0, emitting a spurious one-cycle "blip" before the source actually goes quiet. Left un-wrapped- // (deeply negative) instead, dRise/dFall below correctly place it far from both edges, keeping the envelope- // at (very close to) 0 until the real rising edge - matching WaveSimulator.PulseEnvelope exactly.- source.AppendLine(" if (shifted < 0.0f && !isFirstCycle) shifted += (float)period;");- source.AppendLine(" float edgeWidth = 0.35f;");- source.AppendLine(" float dFall = shifted - (float)onWidth[k];");- source.AppendLine(" float dRise = shifted;");- source.AppendLine(" if (dRise > (float)period / 2.0f) dRise -= (float)period;");- source.AppendLine(" float rising = 0.5f + atan(dRise / edgeWidth) / M_PI_F;");- source.AppendLine(" float falling = 0.5f - atan(dFall / edgeWidth) / M_PI_F;");- source.AppendLine(" envelope = rising * falling;");- source.AppendLine(" }");- source.AppendLine(" }");- source.AppendLine(" }");- source.AppendLine(" float v = sin(phase[k] + f * t) * amp[k] * envelope * detachFade;");- source.AppendLine(" int p = idx[k];");- source.AppendLine(" u[p] = u[p] * 0.9f + v * 0.1f;");- source.AppendLine("}");- return source.ToString();- }-- /// <summary>Compiles <paramref name="source"/> for <see cref="_device"/>; <paramref name="what"/> names the program in the error message.</summary>- /// <exception cref="InvalidOperationException">The build failed; the message carries the OpenCL error and the build log.</exception>- private IntPtr BuildProgram(string source, string what)- {- int err = 0;- IntPtr program = OpenClApi.clCreateProgramWithSource(_context, 1U, new[] { source }, null, ref err);- OpenClApi.Check(err, "clCreateProgramWithSource");- string buildOptions = "";- IntPtr[] deviceIds = { _device.DeviceId };- err = OpenClApi.clBuildProgram(program, 1U, deviceIds, ref buildOptions, IntPtr.Zero, IntPtr.Zero);- if (err != 0)- {- string buildLog = OpenClApi.BuildLog(program, _device.DeviceId);- OpenClApi.clReleaseProgram(program);- throw new InvalidOperationException(what + " could not be built (" + OpenClApi.ErrorName(err) + ")" + (buildLog.Length > 0 ? ": " + buildLog : ""));- }- return program;- }-- /// <summary>Creates a read/write device buffer of <paramref name="bytes"/> bytes, registered in <paramref name="owner"/> for release.</summary>- private IntPtr CreateBuffer(long bytes, Resources owner)- {- int err = 0;- IntPtr buffer = OpenClApi.clCreateBuffer(_context, OpenClApi.MemReadWrite, new IntPtr(bytes), IntPtr.Zero, ref err);- OpenClApi.Check(err, "clCreateBuffer");- owner.Buffers.Add(buffer);- return buffer;- }-- /// <summary>Creates a device buffer the size of <paramref name="data"/>, uploads it (blocking) and registers it in <paramref name="owner"/>.</summary>- private IntPtr CreateBuffer(float[] data, Resources owner)- {- IntPtr size = new IntPtr((long)data.Length * 4L);- IntPtr buffer = CreateBuffer(size.ToInt64(), owner);- OpenClApi.Check(OpenClApi.clEnqueueWriteBufferFloat(_queue, buffer, 1U, IntPtr.Zero, size, data, 0U, IntPtr.Zero, IntPtr.Zero), "clEnqueueWriteBuffer");- return buffer;- }-- /// <summary>Int counterpart of <see cref="CreateBuffer(float[], Resources)"/>.</summary>- private IntPtr CreateBuffer(int[] data, Resources owner)- {- IntPtr size = new IntPtr((long)data.Length * 4L);- IntPtr buffer = CreateBuffer(size.ToInt64(), owner);- OpenClApi.Check(OpenClApi.clEnqueueWriteBufferInt(_queue, buffer, 1U, IntPtr.Zero, size, data, 0U, IntPtr.Zero, IntPtr.Zero), "clEnqueueWriteBuffer");- return buffer;- }-- /// <summary>Creates the kernel <paramref name="name"/> from <paramref name="owner"/>'s program and registers it there for release.</summary>- private static IntPtr CreateKernel(Resources owner, string name)- {- int err = 0;- IntPtr kernel = OpenClApi.clCreateKernel(owner.Program, ref name, ref err);- OpenClApi.Check(err, "clCreateKernel " + name);- owner.Kernels.Add(kernel);- return kernel;- }-- /// <summary>Binds a device buffer to kernel argument <paramref name="index"/>.</summary>- private static void SetMem(IntPtr kernel, uint index, IntPtr value)- {- OpenClApi.Check(OpenClApi.clSetKernelArgMem(kernel, index, new IntPtr(IntPtr.Size), ref value), "clSetKernelArg");- }-- /// <summary>Sets an <c>int</c> kernel argument.</summary>- private static void SetInt(IntPtr kernel, uint index, int value)- {- OpenClApi.Check(OpenClApi.clSetKernelArgInt(kernel, index, new IntPtr(4), ref value), "clSetKernelArg");- }-- /// <summary>Sets a <c>float</c> kernel argument.</summary>- private static void SetFloat(IntPtr kernel, uint index, float value)- {- OpenClApi.Check(OpenClApi.clSetKernelArgFloat(kernel, index, new IntPtr(4), ref value), "clSetKernelArg");- }-- /// <summary>Enqueues <paramref name="kernel"/> with the given global work size; <paramref name="what"/> names the launch in the error message.</summary>- private void Enqueue(IntPtr kernel, IntPtr[] globalSize, string what)- {- OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, kernel, (uint)globalSize.Length, null, globalSize, null, 0U, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (" + what + ")");- }-- /// <summary>Blocking device-to-host copy of <paramref name="target"/>.Length floats from <paramref name="buffer"/>; resets the clFinish counter since the read drains the queue.</summary>- private void ReadBack(IntPtr buffer, float[] target, string what)- {- OpenClApi.Check(OpenClApi.clEnqueueReadBufferFloat(_queue, buffer, 1U, IntPtr.Zero, new IntPtr((long)target.Length * 4L), target, 0U, IntPtr.Zero, IntPtr.Zero), "clEnqueueReadBuffer (" + what + ")");- _sinceFinish = 0;- }-- /// <summary>Engine label for the UI/result: "GPU: <device name> (OpenCL)".</summary>- public string Description { get; }-- /// <summary>Scene width in cells (canvas pixels), excluding the padding.</summary>- public int Width => _width;-- /// <summary>Scene height in cells (canvas pixels), excluding the padding.</summary>- public int Height => _height;-- /// <summary>Row pitch of the padded buffers: <see cref="Width"/> + 2.</summary>- public int Stride => _stride;-- /// <summary>- /// Host copy of the field (padded layout). Unlike the CPU engine the array instance never changes, but- /// its contents are only as fresh as the last <see cref="PrepareFrame"/> with <c>needField</c>.- /// </summary>- public float[] FieldData => _hostField;-- /// <summary>Host copy of the scaled intensity (padded layout) as of the last <see cref="PrepareFrame"/> with <c>needIntensity</c>; null when the engine was created without intensity tracking.</summary>- public float[] IntensityData => _hostIntensity;-- /// <summary>- /// Enqueues one simulation step (nothing is waited for): the source kernels bound to the current field- /// blend the sources in once, then <c>wave_step</c> runs <see cref="_subSteps"/> times, alternating- /// between the two kernel instances so each sub-step reads the newest buffer and overwrites the older one- /// (the leapfrog "previous" field). The track flag is set so only the last sub-step updates the intensity- /// (with a single sub-step the flag keeps the value bound in <see cref="Build"/>). Afterwards- /// <see cref="_current"/> points at the newest buffer and <see cref="_time"/> advances by one step.- /// Every <see cref="FinishInterval"/> steps the queue is drained with <c>clFinish</c>, so that the commands- /// do not pile up and errors show up in time.- /// </summary>- public void AdvanceOneStep()- {- int current = _current;- if (_sourceCount > 0)- {- SetFloat(_sourceKernel[current], 4U, (float)_time);- Enqueue(_sourceKernel[current], _grid1D, "sources");- }- if (_objSourceCount > 0)- {- SetFloat(_objSourceKernel[current], 11U, (float)_time);- Enqueue(_objSourceKernel[current], _objGrid1D, "object sources");- }- // _subSteps smaller launches (see the class summary); only the last one updates the intensity buffer, so- // its own exponential averaging still runs once per AdvanceOneStep call, not _subSteps times. On the- // single-launch path the "track" argument keeps the value bound once, at Build time.- for (int subStep = 1; subStep <= _subSteps; subStep++)- {- if (_subSteps > 1)- {- SetInt(_stepKernel[current], 8U, subStep == _subSteps && _track ? 1 : 0);- }- Enqueue(_stepKernel[current], _grid2D, "step");- current = 1 - current;- }- // the buffer that received the new values is now the current field- _current = current;- _time += 1.0;- // now and then wait for the card, so that the commands do not pile up and errors show up in time- if (++_sinceFinish >= FinishInterval)- {- _sinceFinish = 0;- OpenClApi.Check(OpenClApi.clFinish(_queue), "clFinish");- }- }-- /// <summary>- /// Blocking device-to-host copies of the newest field into <see cref="FieldData"/> and/or of the intensity- /// into <see cref="IntensityData"/> (the latter only when tracked). Called by the runner before rendering,- /// and from the UI thread while paused.- /// </summary>- public void PrepareFrame(bool needField, bool needIntensity)- {- if (needField)- {- ReadBack(_field[_current], _hostField, "field");- }- if (needIntensity && _track)- {- ReadBack(_intensityOutBuffer, _hostIntensity, "intensity");- }- }-- /// <summary>- /// OpenCL source of the probe program (built lazily in <see cref="SetProbes"/>): <c>probe_sample</c> for- /// point probes, <c>profile_accumulate</c> and <c>profile_gather</c> for line probes. Together they are- /// the device side of <see cref="WaveSimulator.SampleProbes"/> / <see cref="WaveSimulator.ReadProbeProfiles"/>.- /// </summary>- private static string ProbeKernelSource()- {- StringBuilder source = new StringBuilder();- // probe_sample (point probes): the value of the pixel of every probe, into row "row" of the history;- // one work item per probe p < n (n = all probes, line probes included).- // u, inten newest field and the intensity output, padded layout- // pix pixel index lists of all point probes concatenated- // info 4 ints per probe: [start in pix, count, 1 = sample inten instead of u, 1 = divide by count];- // all 0 for line probes, which therefore write 0- // hist ProbeRows × n floats, row-major: hist[row * n + p] receives this step's value- source.AppendLine("__kernel void probe_sample(__global const float* u, __global const float* inten, __global const int* pix,");- source.AppendLine(" __global const int* info, __global float* hist, const int row, const int n)");- source.AppendLine("{");- source.AppendLine(" int p = get_global_id(0);");- source.AppendLine(" if (p >= n) return;");- source.AppendLine(" int start = info[p * 4];");- source.AppendLine(" int count = info[p * 4 + 1];");- source.AppendLine(" int useI = info[p * 4 + 2];");- source.AppendLine(" int mean = info[p * 4 + 3];");- source.AppendLine(" float s = 0.0f;");- source.AppendLine(" if (useI != 0) {");- source.AppendLine(" for (int k = 0; k < count; k++) s += inten[pix[start + k]];");- source.AppendLine(" } else {");- source.AppendLine(" for (int k = 0; k < count; k++) s += u[pix[start + k]];");- source.AppendLine(" }");- source.AppendLine(" if (mean != 0 && count > 0) s = s / (float)count;");- source.AppendLine(" hist[row * n + p] = s;");- source.AppendLine("}");- source.AppendLine();- // profile_accumulate (line probes): one work item per line-probe pixel k < n (all line probes flattened):- // ppix[k] padded cell index; pmode[k] 0 = field, 1 = intensity, 2 = intensity totals over the steps- // total[k] += inten[ppix[k]] for mode 2 only, and only once step >= pStartStep[k] when pStartFlag[k] is set- // pStartFlag/pStartStep are the probe's "start recording at step #" (0/1 and the step): before that step- // the total is left at zero, so intensity that arrived earlier is purged rather than baked into the total- // once recording starts- source.AppendLine("__kernel void profile_accumulate(__global const float* inten, __global const int* ppix,");- source.AppendLine(" __global const int* pmode, __global const int* pStartFlag, __global const int* pStartStep,");- source.AppendLine(" __global float* total, const int step, const int n)");- source.AppendLine("{");- source.AppendLine(" int k = get_global_id(0);");- source.AppendLine(" if (k >= n) return;");- source.AppendLine(" if (pmode[k] != 2) return;");- source.AppendLine(" if (pStartFlag[k] != 0 && step < pStartStep[k]) return;");- source.AppendLine(" total[k] += inten[ppix[k]];");- source.AppendLine("}");- source.AppendLine();- // profile_gather: one work item per line-probe pixel k < n; same ppix/pmode layout as above.- // outv[k] = total[k] (mode 2), inten[ppix[k]] (mode 1) or u[ppix[k]] (mode 0)- source.AppendLine("__kernel void profile_gather(__global const float* u, __global const float* inten, __global const int* ppix,");- source.AppendLine(" __global const int* pmode, __global const float* total, __global float* outv, const int n)");- source.AppendLine("{");- source.AppendLine(" int k = get_global_id(0);");- source.AppendLine(" if (k >= n) return;");- source.AppendLine(" int m = pmode[k];");- source.AppendLine(" float v;");- source.AppendLine(" if (m == 2) v = total[k];");- source.AppendLine(" else if (m == 1) v = inten[ppix[k]];");- source.AppendLine(" else v = u[ppix[k]];");- source.AppendLine(" outv[k] = v;");- source.AppendLine("}");- return source.ToString();- }-- /// <summary>- /// Installs the probe layout, replacing any previously installed one (whose device resources are released- /// first): builds the probe program (<see cref="ProbeKernelSource"/>), then uploads the pixel tables and- /// creates the kernels for point probes (<see cref="SetUpSeriesProbes"/>) and line probes- /// (<see cref="SetUpProfileProbes"/>). A null or empty sampler just clears the probes.- /// </summary>- /// <exception cref="InvalidOperationException">The sampler needs intensity but this engine does not track it, or the probe program / buffers could not be created (inner exception has the OpenCL error).</exception>- public void SetProbes(ProbeSampler sampler)- {- _probes.Release();- _probeSampler = null;- _probeValues.Clear();- _probeRow = 0;- _profileIntegrates = false;- if (sampler == null || sampler.Count == 0)- {- return;- }- if (sampler.NeedsIntensity && !_track)- {- throw new InvalidOperationException("the intensity is not tracked");- }- try- {- _probes.Program = BuildProgram(ProbeKernelSource(), "the probe program for the GPU");- if (sampler.HasSeries)- {- SetUpSeriesProbes(sampler);- }- if (sampler.HasProfiles)- {- SetUpProfileProbes(sampler);- }- _probeSampler = sampler;- }- catch (Exception ex)- {- _probes.Release();- throw new InvalidOperationException("the probes could not be set up on the GPU: " + ex.Message, ex);- }- }-- /// <summary>- /// Packs the pixel lists of all point (non-profile) probes into one buffer, describes each probe in an info- /// table (point probes average their pixels, so a single-pixel probe yields that pixel's value like- /// <see cref="ProbeSampler.Compute"/>), allocates the <see cref="ProbeRows"/>-row history buffer and creates- /// the two <c>probe_sample</c> kernels.- /// </summary>- private void SetUpSeriesProbes(ProbeSampler sampler)- {- int count = sampler.Count;- int totalPixels = 0;- for (int i = 0; i < count; i++)- {- if (!sampler.IsProfile[i])- {- totalPixels += sampler.Pixels[i].Length;- }- }- int[] pixels = new int[Math.Max(totalPixels, 1)];- int[] info = new int[count * 4];- int offset = 0;- for (int i = 0; i < count; i++)- {- if (!sampler.IsProfile[i])- {- int[] probePixels = sampler.Pixels[i];- Array.Copy(probePixels, 0, pixels, offset, probePixels.Length);- info[i * 4] = offset;- info[i * 4 + 1] = probePixels.Length;- info[i * 4 + 2] = sampler.UseIntensity[i] ? 1 : 0;- info[i * 4 + 3] = 1;- offset += probePixels.Length;- }- }- IntPtr pixelBuffer = CreateBuffer(pixels, _probes);- IntPtr infoBuffer = CreateBuffer(info, _probes);- // Never uploaded: the kernel writes every row before ReadProbeHistory reads it.- _historyBuffer = CreateBuffer((long)ProbeRows * count * 4L, _probes);- for (int k = 0; k <= 1; k++)- {- IntPtr kernel = _probeKernel[k] = CreateKernel(_probes, "probe_sample");- SetMem(kernel, 0U, _field[k]);- SetMem(kernel, 1U, _intensityOutBuffer);- SetMem(kernel, 2U, pixelBuffer);- SetMem(kernel, 3U, infoBuffer);- SetMem(kernel, 4U, _historyBuffer);- SetInt(kernel, 5U, 0);- SetInt(kernel, 6U, count);- }- _probeGrid[0] = new IntPtr(count);- for (int i = 0; i < count; i++)- {- _probeValues.Add(new List<float>());- }- }-- /// <summary>- /// Flattens the pixels of all line probes into per-pixel buffers (index, mode, start flag/step), records- /// where each probe starts in <see cref="_profileStart"/>, zero-initialises the totals and output buffers- /// and creates the two <c>profile_gather</c> kernels. The start-step buffers and the- /// <c>profile_accumulate</c> kernel are only created when at least one probe integrates.- /// </summary>- private void SetUpProfileProbes(ProbeSampler sampler)- {- int count = sampler.Count;- int totalPixels = 0;- for (int i = 0; i < count; i++)- {- if (sampler.IsProfile[i])- {- totalPixels += sampler.Pixels[i].Length;- }- }- int[] pixels = new int[totalPixels];- int[] modes = new int[totalPixels];- int[] startFlags = new int[totalPixels];- int[] startSteps = new int[totalPixels];- _profileStart = new int[count];- int offset = 0;- for (int i = 0; i < count; i++)- {- _profileStart[i] = offset;- if (!sampler.IsProfile[i])- {- continue;- }- int[] probePixels = sampler.Pixels[i];- int mode = sampler.Integrate[i] ? 2 : (sampler.UseIntensity[i] ? 1 : 0);- if (mode == 2)- {- _profileIntegrates = true;- }- int startFlag = sampler.UseStartAfterStep[i] ? 1 : 0;- int startStep = sampler.StartAfterStep[i];- for (int k = 0; k < probePixels.Length; k++)- {- pixels[offset + k] = probePixels[k];- modes[offset + k] = mode;- startFlags[offset + k] = startFlag;- startSteps[offset + k] = startStep;- }- offset += probePixels.Length;- }- _profileCount = totalPixels;- IntPtr pixelBuffer = CreateBuffer(pixels, _probes);- IntPtr modeBuffer = CreateBuffer(modes, _probes);- IntPtr totalBuffer = CreateBuffer(new float[totalPixels], _probes);- _profileOutBuffer = CreateBuffer(new float[totalPixels], _probes);- for (int k = 0; k <= 1; k++)- {- IntPtr kernel = _gatherKernel[k] = CreateKernel(_probes, "profile_gather");- SetMem(kernel, 0U, _field[k]);- SetMem(kernel, 1U, _intensityOutBuffer);- SetMem(kernel, 2U, pixelBuffer);- SetMem(kernel, 3U, modeBuffer);- SetMem(kernel, 4U, totalBuffer);- SetMem(kernel, 5U, _profileOutBuffer);- SetInt(kernel, 6U, totalPixels);- }- if (_profileIntegrates)- {- IntPtr kernel = _accumulateKernel = CreateKernel(_probes, "profile_accumulate");- SetMem(kernel, 0U, _intensityOutBuffer);- SetMem(kernel, 1U, pixelBuffer);- SetMem(kernel, 2U, modeBuffer);- // "start recording at step #" for the integrated line probes: one entry per pixel (same layout as the- // pixel/mode buffers), so profile_accumulate can skip a pixel's contribution before its probe's start step- SetMem(kernel, 3U, CreateBuffer(startFlags, _probes));- SetMem(kernel, 4U, CreateBuffer(startSteps, _probes));- SetMem(kernel, 5U, totalBuffer);- SetInt(kernel, 7U, totalPixels);- }- _profileGrid[0] = new IntPtr(totalPixels);- }-- /// <summary>- /// Called by the runner after every step: enqueues <c>probe_sample</c> for the newest field into the next- /// history row (first draining the history to the host when all <see cref="ProbeRows"/> rows are full),- /// and <c>profile_accumulate</c> with the current step number when any line probe integrates. Nothing is- /// waited for.- /// </summary>- public void SampleProbes()- {- if (_probeSampler == null)- {- return;- }- if (_probeSampler.HasSeries)- {- if (_probeRow >= ProbeRows)- {- ReadProbeHistory();- }- SetInt(_probeKernel[_current], 5U, _probeRow);- Enqueue(_probeKernel[_current], _probeGrid, "probes");- _probeRow++;- }- // the intensity totals of the lines that are integrated: add the intensity of this step (unless it is before- // that probe's "start recording at step #", in which case the kernel leaves the total at zero)- if (_profileIntegrates)- {- SetInt(_accumulateKernel, 6U, (int)Math.Round(_time));- Enqueue(_accumulateKernel, _profileGrid, "totals");- }- }-- /// <summary>- /// Blocking download of the <see cref="_probeRow"/> rows sampled so far from <see cref="_historyBuffer"/>,- /// appending each row's point-probe values to <see cref="_probeValues"/> (line-probe columns are skipped)- /// and rewinding the row counter. No-op when no row is pending.- /// </summary>- private void ReadProbeHistory()- {- if (_probeRow == 0)- {- return;- }- int count = _probeSampler.Count;- float[] history = new float[_probeRow * count];- ReadBack(_historyBuffer, history, "probes");- for (int row = 0; row < _probeRow; row++)- {- for (int p = 0; p < count; p++)- {- if (!_probeSampler.IsProfile[p])- {- _probeValues[p].Add(history[row * count + p]);- }- }- }- _probeRow = 0;- }-- /// <summary>Drains the pending history rows from the device, then returns and clears the point-probe values collected since the previous call.</summary>- /// <returns>One array per probe, one value per step (empty for line probes); an empty outer array when no sampler is set.</returns>- public float[][] TakeProbeSamples()- {- if (_probeSampler == null)- {- return new float[0][];- }- int count = _probeSampler.Count;- float[][] samples = new float[count][];- if (_probeSampler.HasSeries)- {- ReadProbeHistory();- }- for (int i = 0; i < count; i++)- {- if (_probeSampler.IsProfile[i])- {- samples[i] = new float[0];- }- else- {- samples[i] = _probeValues[i].ToArray();- _probeValues[i].Clear();- }- }- return samples;- }-- /// <summary>- /// Runs <c>profile_gather</c> on the newest field and reads the flat result back (blocking: this waits for- /// the card, so do not call it every step), then slices it per line probe; nothing is cleared.- /// </summary>- /// <returns>- /// One array per probe in pixel order along the line, holding the integrated intensity totals or the live- /// field/intensity values; null entries for point probes; an empty outer array when no sampler is set.- /// </returns>- public float[][] ReadProbeProfiles()- {- if (_probeSampler == null)- {- return new float[0][];- }- int count = _probeSampler.Count;- float[][] profiles = new float[count][];- if (!_probeSampler.HasProfiles)- {- return profiles;- }- Enqueue(_gatherKernel[_current], _profileGrid, "profiles");- float[] values = new float[_profileCount];- ReadBack(_profileOutBuffer, values, "profiles");- for (int i = 0; i < count; i++)- {- if (_probeSampler.IsProfile[i])- {- int length = _probeSampler.Pixels[i].Length;- float[] profile = new float[length];- Array.Copy(values, _profileStart[i], profile, 0, length);- profiles[i] = profile;- }- }- return profiles;- }-- /// <summary>Releases every OpenCL handle; called by the runner when the run ends. Safe to call more than once.</summary>- public void Dispose()- {- ReleaseAll();- }-- /// <summary>- /// Releases all device resources: drains the queue, then the probe set, the scene set, the queue and- /// finally the context. OpenCL failures are swallowed, so the method is also usable from the constructor- /// after a partial <see cref="Build"/>, and a second call finds nothing left to release.- /// </summary>- private void ReleaseAll()- {- if (_queue != IntPtr.Zero)- {- // if this fails the driver is gone or in trouble; release what can be released- Quietly(() => OpenClApi.clFinish(_queue));- }- _probes.Release();- _scene.Release();- if (_queue != IntPtr.Zero)- {- Quietly(() => OpenClApi.clReleaseCommandQueue(_queue));- _queue = IntPtr.Zero;- }- if (_context != IntPtr.Zero)- {- Quietly(() => OpenClApi.clReleaseContext(_context));- _context = IntPtr.Zero;- }- }-- /// <summary>Runs an OpenCL release call, ignoring any failure (nothing more can be done; the handle is gone either way).</summary>- private static void Quietly(Action release)- {- try- {- release();- }- catch- {- }- }-- /// <summary>- /// A program with the kernels and buffers created from/for it, released together: the scene set lives as- /// long as the engine, the probe set is replaced by every <see cref="SetProbes"/> call.- /// </summary>- private sealed class Resources- {- /// <summary>The compiled program, or <see cref="IntPtr.Zero"/> when not (yet) built.</summary>- public IntPtr Program;-- /// <summary>Kernels created from <see cref="Program"/>.</summary>- public readonly List<IntPtr> Kernels = new List<IntPtr>();-- /// <summary>Device buffers bound to those kernels.</summary>- public readonly List<IntPtr> Buffers = new List<IntPtr>();-- /// <summary>Releases kernels, buffers and the program (in that order) and forgets them; failures are ignored.</summary>- public void Release()- {- foreach (IntPtr kernel in Kernels)- {- Quietly(() => OpenClApi.clReleaseKernel(kernel));- }- Kernels.Clear();- foreach (IntPtr buffer in Buffers)- {- Quietly(() => OpenClApi.clReleaseMemObject(buffer));- }- Buffers.Clear();- if (Program != IntPtr.Zero)- {- Quietly(() => OpenClApi.clReleaseProgram(Program));- Program = IntPtr.Zero;- }- }- }-- /// <summary>Steps enqueued between two <c>clFinish</c> calls in <see cref="AdvanceOneStep"/>.</summary>- private const int FinishInterval = 16;-- /// <summary>Rows (steps) the probe history buffer holds before it must be read back to the host.</summary>- private const int ProbeRows = 2048;-- /// <summary>The device the context lives on; needed again to build the probe program.</summary>- private readonly GpuDeviceInfo _device;-- /// <summary>Scene width in cells (canvas pixels), without padding.</summary>- private readonly int _width;-- /// <summary>Scene height in cells, without padding.</summary>- private readonly int _height;-- /// <summary>Padded row pitch (<see cref="_width"/> + 2).</summary>- private readonly int _stride;-- /// <summary>Number of floats in every padded per-cell buffer: <see cref="_stride"/> × (<see cref="_height"/> + 2).</summary>- private readonly int _cells;-- /// <summary>Whether the intensity is tracked; when false the intensity buffers are 1-float dummies and <see cref="IntensityData"/> is null.</summary>- private readonly bool _track;-- /// <summary>Number of image (green-channel) sources in the scene.</summary>- private readonly int _sourceCount;-- /// <summary>Number of object sources that lie inside the canvas.</summary>- private readonly int _objSourceCount;-- /// <summary>- /// Leapfrog sub-steps per simulation step - see the class summary; 1 (no sub-stepping) unless the 4th-order- /// stencil is on and this scene's highest c² needs it. Set once, in <see cref="Build"/>.- /// </summary>- private int _subSteps;-- /// <summary>OpenCL context on the chosen device; released last in <see cref="ReleaseAll"/>.</summary>- private IntPtr _context;-- /// <summary>In-order command queue; every launch and transfer goes through it.</summary>- private IntPtr _queue;-- /// <summary>Simulation program (<c>wave_step</c>, <c>apply_sources</c>, <c>apply_object_sources</c>) with its kernels and scene buffers.</summary>- private readonly Resources _scene = new Resources();-- /// <summary>- /// The probes: a second small program (<c>probe_sample</c>, <c>profile_accumulate</c>, <c>profile_gather</c>)- /// measures them on the card, with its kernels and buffers; empty until probes are set. Point probes: one- /// value per step; the values wait in <see cref="_historyBuffer"/> until the next- /// <see cref="TakeProbeSamples"/> (or until the buffer is full). Line probes: the pixels of all lines in one- /// list; the totals (integrated intensity) are kept on the card, the profiles are gathered into- /// <see cref="_profileOutBuffer"/> and copied back when they are asked for (<see cref="ReadProbeProfiles"/>).- /// </summary>- private readonly Resources _probes = new Resources();-- /// <summary>The two ping-pong field buffers (padded, <see cref="_cells"/> floats each); the one at <see cref="_current"/> holds the newest field, the other the previous one.</summary>- private readonly IntPtr[] _field = new IntPtr[2];-- /// <summary>- /// The blend of the two cascaded filter stages (the <c>inten1</c>/<c>inten</c> buffers, which live only- /// inside <c>wave_step</c>), scaled - see the class summary and <c>WaveSimulator._intensityOut</c> (CPU- /// engine). Padded; this is what is actually read back into <see cref="_hostIntensity"/> and sampled by the- /// probe kernels; a 1-float dummy when not tracking.- /// </summary>- private IntPtr _intensityOutBuffer;-- /// <summary><c>wave_step</c> kernel per field index k: reads <see cref="_field"/>[k], writes <see cref="_field"/>[1 - k].</summary>- private readonly IntPtr[] _stepKernel = new IntPtr[2];-- /// <summary><c>apply_sources</c> kernel per field index k, bound to <see cref="_field"/>[k]; unset when the scene has no image sources.</summary>- private readonly IntPtr[] _sourceKernel = new IntPtr[2];-- /// <summary><c>apply_object_sources</c> kernel per field index k, bound to <see cref="_field"/>[k]; unset when there are no object sources.</summary>- private readonly IntPtr[] _objSourceKernel = new IntPtr[2];-- /// <summary>Index (0/1) of the field buffer holding the newest field; flips after every sub-step.</summary>- private int _current;-- /// <summary>Global work size of <c>wave_step</c>: <see cref="_width"/> × <see cref="_height"/> work items, one per interior cell.</summary>- private readonly IntPtr[] _grid2D;-- /// <summary>Global work size of <c>apply_sources</c>: max(1, <see cref="_sourceCount"/>).</summary>- private readonly IntPtr[] _grid1D;-- /// <summary>Global work size of <c>apply_object_sources</c>: max(1, <see cref="_objSourceCount"/>).</summary>- private readonly IntPtr[] _objGrid1D;-- /// <summary>Host copy of the newest field, refreshed by <see cref="PrepareFrame"/>; exposed as <see cref="FieldData"/>.</summary>- private readonly float[] _hostField;-- /// <summary>Host copy of <see cref="_intensityOutBuffer"/>, refreshed by <see cref="PrepareFrame"/>; null when not tracking.</summary>- private readonly float[] _hostIntensity;-- /// <summary>Elapsed time in steps; passed to the source kernels as the float argument <c>t</c>.</summary>- private double _time;-- /// <summary>Steps enqueued since the queue was last drained; reset by every blocking read, which drains the queue anyway.</summary>- private int _sinceFinish;-- /// <summary>Probe layout installed by <see cref="SetProbes"/>, or null when no probes are set.</summary>- private ProbeSampler _probeSampler;-- /// <summary><c>probe_sample</c> kernel per field index k, bound to <see cref="_field"/>[k]; unset without point probes.</summary>- private readonly IntPtr[] _probeKernel = new IntPtr[2];-- /// <summary>Sample history, <see cref="ProbeRows"/> rows × probe count floats, row-major; row r holds the samples of the r-th step since the last read-back.</summary>- private IntPtr _historyBuffer;-- /// <summary>Next row of <see cref="_historyBuffer"/> to write, i.e. the number of rows waiting to be read back.</summary>- private int _probeRow;-- /// <summary>Global work size of <c>probe_sample</c>: one work item per probe.</summary>- private readonly IntPtr[] _probeGrid = new IntPtr[1];-- /// <summary>Point-probe samples read back from the device and not yet taken by <see cref="TakeProbeSamples"/>, one list per probe (stays empty for line probes).</summary>- private readonly List<List<float>> _probeValues = new List<List<float>>();-- /// <summary><c>profile_gather</c> kernel per field index k, bound to <see cref="_field"/>[k]; unset without line probes.</summary>- private readonly IntPtr[] _gatherKernel = new IntPtr[2];-- /// <summary><c>profile_accumulate</c> kernel; created only when some line probe integrates (<see cref="_profileIntegrates"/>).</summary>- private IntPtr _accumulateKernel;-- /// <summary>Per line-probe pixel: value written by <c>profile_gather</c> and read back by <see cref="ReadProbeProfiles"/>.</summary>- private IntPtr _profileOutBuffer;-- /// <summary>Total number of line-probe pixels (length of the profile buffers).</summary>- private int _profileCount;-- /// <summary>Whether any line probe integrates the intensity, i.e. <c>profile_accumulate</c> must run every step.</summary>- private bool _profileIntegrates;-- /// <summary>Per probe: offset of its first pixel in the profile buffers (only meaningful for line probes).</summary>- private int[] _profileStart;-- /// <summary>Global work size of the profile kernels: one work item per line-probe pixel.</summary>- private readonly IntPtr[] _profileGrid = new IntPtr[1];- }-}diff --git a/Wave_Dude_2D/HelpForm.Designer.cs b/Wave_Dude_2D/HelpForm.Designer.csdeleted file mode 100644index 2ee430d..0000000--- a/Wave_Dude_2D/HelpForm.Designer.cs+++ /dev/null@@ -1,83 +0,0 @@-using System;-using System.ComponentModel;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- public partial class HelpForm : global::System.Windows.Forms.Form- {- /// <summary>Releases the designer-managed components when <paramref name="disposing"/> is true, then the form itself.</summary>- /// <param name="disposing">True when called from <see cref="System.ComponentModel.Component.Dispose()"/>; false from the finalizer.</param>- [global::System.Diagnostics.DebuggerNonUserCode]- protected override void Dispose(bool disposing)- {- try- {- bool flag = disposing && this.components != null;- if (flag)- {- this.components.Dispose();- }- }- finally- {- base.Dispose(disposing);- }- }-- [global::System.Diagnostics.DebuggerStepThrough]- private void InitializeComponent()- {- this.rtbHelp = new global::System.Windows.Forms.RichTextBox();- this.pnlButtons = new global::System.Windows.Forms.FlowLayoutPanel();- this.btnClose = new global::System.Windows.Forms.Button();- this.pnlButtons.SuspendLayout();- base.SuspendLayout();- this.rtbHelp.BackColor = global::System.Drawing.SystemColors.Window;- this.rtbHelp.BorderStyle = global::System.Windows.Forms.BorderStyle.None;- this.rtbHelp.Dock = global::System.Windows.Forms.DockStyle.Fill;- this.rtbHelp.Font = new global::System.Drawing.Font("Arial", 12f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.rtbHelp.Location = new global::System.Drawing.Point(0, 0);- this.rtbHelp.Margin = new global::System.Windows.Forms.Padding(12);- this.rtbHelp.Name = "rtbHelp";- this.rtbHelp.ReadOnly = true;- this.rtbHelp.Size = new global::System.Drawing.Size(1039, 843);- this.rtbHelp.TabIndex = 0;- this.rtbHelp.Text = "";- this.pnlButtons.Controls.Add(this.btnClose);- this.pnlButtons.Dock = global::System.Windows.Forms.DockStyle.Bottom;- this.pnlButtons.FlowDirection = global::System.Windows.Forms.FlowDirection.RightToLeft;- this.pnlButtons.Location = new global::System.Drawing.Point(0, 843);- this.pnlButtons.Name = "pnlButtons";- this.pnlButtons.Padding = new global::System.Windows.Forms.Padding(8);- this.pnlButtons.Size = new global::System.Drawing.Size(1039, 46);- this.pnlButtons.TabIndex = 1;- this.btnClose.DialogResult = global::System.Windows.Forms.DialogResult.OK;- this.btnClose.Location = new global::System.Drawing.Point(930, 11);- this.btnClose.Name = "btnClose";- this.btnClose.Size = new global::System.Drawing.Size(90, 30);- this.btnClose.TabIndex = 0;- this.btnClose.Text = "Close";- this.btnClose.UseVisualStyleBackColor = true;- base.AcceptButton = this.btnClose;- base.CancelButton = this.btnClose;- base.ClientSize = new global::System.Drawing.Size(1039, 889);- base.Controls.Add(this.rtbHelp);- base.Controls.Add(this.pnlButtons);- base.MinimizeBox = false;- this.MinimumSize = new global::System.Drawing.Size(560, 400);- base.Name = "HelpForm";- base.ShowIcon = false;- base.ShowInTaskbar = false;- base.StartPosition = global::System.Windows.Forms.FormStartPosition.CenterParent;- this.Text = "Help - Wave Maker 2D";- this.pnlButtons.ResumeLayout(false);- base.ResumeLayout(false);- }-- private RichTextBox rtbHelp;- private FlowLayoutPanel pnlButtons;- private Button btnClose;- private global::System.ComponentModel.IContainer components;- }-}diff --git a/Wave_Dude_2D/HelpForm.cs b/Wave_Dude_2D/HelpForm.csdeleted file mode 100644index 32f843e..0000000--- a/Wave_Dude_2D/HelpForm.cs+++ /dev/null@@ -1,145 +0,0 @@-using System;-using System.Drawing;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- /// <summary>- /// The Info > Help window: a structured description of what each tab of <c>tabMainFunctions</c>- /// does, which controls on it matter most, and what those controls influence elsewhere in the- /// program, plus a dedicated section on the propagation speed c, since its correct value depends- /// on both the Laplacian order and the source frequency and is easy to get wrong.- /// Designer-editable: the layout (<c>rtbHelp</c>, the Close button) lives in- /// <c>HelpForm.Designer.cs</c>; this file only fills <c>rtbHelp</c>'s text, in- /// <see cref="FillHelpText"/> (headings, paragraphs and bullet points built in code). Opened- /// modally from <see cref="Form1.HelpToolStripMenuItem_Click"/>.- /// </summary>- public partial class HelpForm : Form- {- /// <summary>Builds the help text and moves the caret to the top so the box is not scrolled to the end.</summary>- public HelpForm()- {- base.Load += HelpForm_Load;- InitializeComponent();- FillHelpText(rtbHelp);- rtbHelp.SelectionStart = 0;- rtbHelp.SelectionLength = 0;- }-- /// <summary>- /// Writes the actual help text into <paramref name="rtb"/>, one section per tab/topic (the tabs- /// of the main window in UI order, followed by the explanation of the c-value and the menu),- /// using <see cref="AppendHeading"/>/<see cref="AppendBody"/>/<see cref="AppendBullet"/> for- /// simple formatting (bold headings, indented bullets).- /// </summary>- private void FillHelpText(RichTextBox rtb)- {- AppendHeading(rtb, "Wave Dude 2D - Help");- AppendHeading(rtb, "Disclaimer");- AppendBody(rtb, "The current software comes with no warranty or support and is used at your own risk. It is free software, released under the GNU General Public License, version 3 or later: you may use, modify and redistribute it under the terms of that license (see the LICENSE file that comes with the source code). Bugs or suggestions for future improvements can be send to the email address in the 'Info > About' screen");- AppendHeading(rtb, "Getting started: the project root");- AppendBody(rtb, "Every project, its settings, scene, sources, probes and exported files, lives in its own subfolder under one chosen 'project root' folder. Set it with File > Choose project root, or the 'Browse root' button on the Settings tab; the current root is shown above the tabs.");- AppendBody(rtb, "The 'Projects in current root' list (Settings tab) shows every project found there: New project, Load, Rename, Delete and Save as all act on the selected one. File > New / Open / Save and 'Save changes to project' act on whichever project is currently open. Nothing is written to disk until you save your project.Projects can be shared between users by sharing the project folder and copy it to their root folder ");- AppendBody(rtb, "Load, Rename, Delete and Save as all act on the selected one. File > New / Open / Save and 'Save changes to project' act on whichever project is currently open. Nothing is written to disk until you save.");- AppendHeading(rtb, "Settings tab");- AppendBody(rtb, "The main control panel: engine and rendering settings, the medium/scene, and starting a run.");- AppendBullet(rtb, "Use GPU (generally faster)", "switches the simulation engine between CPU and GPU (OpenCL). Faster for larger grids or step counts, but needs a working OpenCL GPU; the CPU engine is the safe fallback.");- AppendBullet(rtb, "Use 4th order Laplacian + sub-sampling", "switches the numerical scheme used to step the wave equation each frame. It runs somewhat slower but strongly reduces numerical dispersion (see 'Propagation speed c' below) - and changes what c should be set to.");- AppendBullet(rtb, "Simulation steps / Visualize every", "how many steps a run performs, and how often (in steps) the live preview and probes are refreshed while it runs. A larger 'visualize every' makes a run finish faster at the cost of a choppier preview.");- AppendBullet(rtb, "Intensity decay factor", "how quickly the accumulated Intensity view forgets past field energy, i.e. how 'persistent' the intensity build-up looks.");- AppendBullet(rtb, "Field/Intensity color scheme, scale and offset", "which color table renders each view (see the Colors tab), and how the raw field/intensity values are stretched (scale) and shifted (offset) into that table's brightness range before coloring. The same scale controls also appear, linked, on the Preview tab.");- AppendBullet(rtb, "Preview video of / Export video of (Field/Intensity)", "which of the two views is shown live while running, and which is written to a video file when the run finishes - independent choices.");- AppendBullet(rtb, "Video quality (%)", "the compression quality used when writing exported video files.");- AppendBullet(rtb, "Refractive index / Damping edge (Scene properties)", "the refractive index shapes the medium the wave travels through (a higher index locally slows the wave - it is what actually sets the per-pixel propagation speed the simulation uses, not c; see below). Damping edge adds an absorbing border so waves leave the grid instead of reflecting off its edges.");- AppendBullet(rtb, "User defined (X/Y) scene vs. Scene image", "whether the medium's layout comes from a simple, hand-set shape or from an imported image (its brightness mapped to refractive index).");- AppendBullet(rtb, "Use object sources / Use image sources, Edit source list", "whether wave sources are the ones built on the Sources tab, or amplitude taken from an image; 'Edit source list' jumps to the Sources tab.");- AppendBody(rtb, "Found at the bottom of everly screen: Quick navigate (jump to Preview/Probes/Sources/Settings), Simulation control (Start Simulation / Pause-Resume), and Share with source/probe (send the current scene, field or intensity picture into the Sources or Probes tools as a background image).");- AppendHeading(rtb, "About Scene Images");- AppendBody(rtb, "Currently, scene images can only be created externally in a program like for example Photoshop. Save the images in a lossless format like .png . To add objects to a scene that the waves can interact with, you can use the red and green channels in the image color palette.");- AppendBullet(rtb, "Red channel (Refractive index)", "can effectively use values ranging from 100 to 255, which represent refractive index values ranging from 1.00 to 2.55. Values lower than 100 will be set to 100 as a minimum. The red channel can be used to refract or reflect waves and create for example lenses.");- AppendBullet(rtb, "Blue channel (Damping)", "reserved for damping - use values between 0 and 255, where zero means no damping and 255 heavy damping. It can be used to create regions that absorb waves like for example borders.");- AppendBullet(rtb, "Green channel (Sources)", "reserved for creating wave sources, where the values 1-255 represent the frequency of the waves emitted by a pixel. If you use in-scene sources, do not use anti-aliasing to create them since this can cause the pixels next to a source to also contain a (lower) value in the green channel. When you want to use in-image sources, you must have 'use image sources' checked in the setup tab.");- AppendHeading(rtb, "Sources tab");- AppendBody(rtb, "Defines every object-type wave source placed in the scene; what Is set here directly drives what the simulation emits. When using ");- AppendBullet(rtb, "Main type: Single vs. composite", "a single source is one emitter; a composite source is a whole array of them, laid out with a chosen spacing and array size - useful for e.g. simulating an extended or phased source.");- AppendBullet(rtb, "Mode: Continuous vs. Pulsed, Frequency, Amplitude, Phase", "a continuous source oscillates forever at the set frequency; a pulsed one also uses the pulse shape/width to taper on and off. Frequency (via the estimated wavelength label) is one of the two things that determine the right value for c - see below.");- AppendBullet(rtb, "Composite array: Spacing, Array size, Randomize (Phase/Position/Frequency/Off state)", "how densely and how far the individual emitters in a composite source are spread, and how much each one's properties should vary at random rather than being identical.");- AppendBullet(rtb, "Place current source / Pick / Copy / Delete / Save source data", "positions a source in the scene, duplicates or removes it, and can save its data separately; 'Detach after' stops further edits in this panel from affecting an already-placed source.");- AppendHeading(rtb, "Probes tab");- AppendBody(rtb, "Two independent probes (Probe 1, Probe 2), each measuring the field or intensity over the course of a run and graphing it.");- AppendBullet(rtb, "Place on: Field / Intensity, Measurement / Probe type", "which picture the probe samples, and what it reports from it (e.g. a value at a point, or an integrated quantity over a box).");- AppendBullet(rtb, "Position A / Position B, Box size, Pick", "where the probe samples - a single point, or a box defined by two corners - set either numerically or by picking on the preview.");- AppendBullet(rtb, "Full scale vs. Running scale, Auto scale X / Y", "whether the probe's graph shows the whole run at once or only a recent 'running' window, and whether its axes rescale automatically as new data comes in.");- AppendBullet(rtb, "Start recording at step #", "delays when the probe starts collecting data, useful for skipping an initial transient before the wave pattern settles.");- AppendHeading(rtb, "Preview tab");- AppendBody(rtb, "Shows the live Field and Intensity pictures while a simulation runs, and is where finished pictures/video are exported.");- AppendBullet(rtb, "Field/intensity scale factor", "the same brightness scale as on the Settings tab - the two are linked, so changing one updates the other.");- AppendBullet(rtb, "Display overlay, overlay brightness", "blends a 'glowing edges' outline (derived from the scene image) on top of either preview, purely as a visual aid to see the scene layout under the field/intensity. This overlay is also baked into an exported frame or video when it is switched on, not just shown live.");- AppendBullet(rtb, "Export video of (Field/Intensity), Export frame as image", "start a video export for the checked view(s) once a run starts, or immediately save the current picture as a PNG. Exported file names end in a plain running number (e.g. _0001) - one higher than the highest such number already in that output folder - rather than a date/time stamp.");- AppendBullet(rtb, "Open image/video folder, View video in media player", "quick access to what has already been exported for this project.");- AppendHeading(rtb, "Manage output tab");- AppendBody(rtb, "An overview of everything a project has produced: scenes, exported images and exported videos, each with its creation date. From here files can be renamed, deleted, previewed, opened in their folder, viewed in the media player, copied to the clipboard, or shared back into the Sources/Probes tabs as a background image; external scene files can also be loaded in.");- AppendHeading(rtb, "Colors tab");- AppendBody(rtb, "Manages the color schemes used to render the Field and Intensity pictures everywhere else in the program.");- AppendBullet(rtb, "Scheme list", "every scheme found in the scheme folder, sortable by clicking the Scheme or Type column header; Type marks whether a scheme is meant for the Field or the Intensity view (the Settings/Preview tabs' color-scheme pickers use this).");- AppendBullet(rtb, "Color Scheme Editor: Color 1..9, color picker", "builds a 9-stop scheme by picking a color for each stop; Save, Save As, Rename and Delete act on the scheme currently being edited.");- AppendBullet(rtb, "Scheme folder, Choose...", "where schemes are read from and saved to; changing it reloads the list.");- AppendHeading(rtb, "Propagation speed (c): the Laplacian order and source frequency");- AppendBody(rtb, "c (File > Set c-value, in pixels per simulation step) is only a display/estimate value: it is used solely to compute the estimated wavelength shown next to a source's frequency on the Sources tab (lambda = c / frequency). The wave speed the simulation actually uses at each point comes from the scene's refractive index instead, and can vary from point to point - c does not change how the run itself behaves, only what that wavelength readout says.");- AppendBody(rtb, "Getting that readout right, however, depends on both the Laplacian order and the source's frequency, because of numerical dispersion - the standard (3rd order) Laplacian makes longer wavelengths propagate faster through the grid than shorter ones, purely as a numerical artifact of the scheme, not a real physical effect.");- AppendBullet(rtb, "4th order Laplacian + sub-sampling (on)", "greatly reduces this dispersion. With it on, set c to 1.00 - the estimate then stays accurate across frequencies.");- AppendBullet(rtb, "Standard 3rd order Laplacian (4th order off)", "dispersion is significant, so the correct c depends strongly on frequency: lower frequencies need a higher c, higher frequencies need a lower c. For example, at a source frequency where the true wavelength is 15 pixels, c must be set to about 0.56 (not 1.00) for the readout to show that; leaving c at 1.00 there would read out roughly 9 pixels instead.");- AppendBody(rtb, "In short: when 4th order is off, re-check (or reduce) c whenever the source frequency changes noticeably. The '(Info)' label next to the 4th order checkbox on the Settings tab repeats this explanation in the program itself.");- AppendHeading(rtb, "Menu");- AppendBody(rtb, "File: New, Open, Choose project root, Set c-value, Save, Exit.\r\nInfo: this Help page, and About.");- AppendBody(rtb, "Enjoy! Jeroen \r\n");- }-- /// <summary>Appends a blank line and then <paramref name="text"/> in bold, near-black type, as a section heading.</summary>- private void AppendHeading(RichTextBox rtb, string text)- {- rtb.SelectionStart = rtb.TextLength;- rtb.SelectionLength = 0;- rtb.SelectionFont = new Font(rtb.Font, FontStyle.Bold);- rtb.SelectionColor = Color.FromArgb(20, 20, 20);- rtb.AppendText("\r\n" + text + "\r\n");- }-- /// <summary>Appends <paramref name="text"/> as a regular black paragraph ending in a line break.</summary>- private void AppendBody(RichTextBox rtb, string text)- {- rtb.SelectionStart = rtb.TextLength;- rtb.SelectionLength = 0;- rtb.SelectionFont = new Font(rtb.Font, FontStyle.Regular);- rtb.SelectionColor = Color.Black;- rtb.AppendText(text + "\r\n");- }-- /// <summary>- /// Appends a single indented "- Label: explanation" line: a dash, <paramref name="label"/> in- /// bold followed by a colon, then <paramref name="explanation"/> in regular type. Used for the- /// per-control breakdowns within a tab's section.- /// </summary>- private void AppendBullet(RichTextBox rtb, string label, string explanation)- {- rtb.SelectionStart = rtb.TextLength;- rtb.SelectionLength = 0;- rtb.SelectionFont = new Font(rtb.Font, FontStyle.Regular);- rtb.SelectionColor = Color.Black;- rtb.AppendText(" - ");- rtb.SelectionStart = rtb.TextLength;- rtb.SelectionLength = 0;- rtb.SelectionFont = new Font(rtb.Font, FontStyle.Bold);- rtb.AppendText(label + ": ");- rtb.SelectionStart = rtb.TextLength;- rtb.SelectionLength = 0;- rtb.SelectionFont = new Font(rtb.Font, FontStyle.Regular);- rtb.AppendText(explanation + "\r\n");- }-- /// <summary>Does nothing; still wired to <see cref="Form.Load"/> by the constructor.</summary>- private void HelpForm_Load(object sender, EventArgs e)- {- }- }-}diff --git a/Wave_Dude_2D/HelpForm.resx b/Wave_Dude_2D/HelpForm.resxdeleted file mode 100644index 7c72981..0000000--- a/Wave_Dude_2D/HelpForm.resx+++ /dev/null@@ -1,61 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<root>- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />- <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" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </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" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>-</root>\ No newline at end of filediff --git a/Wave_Dude_2D/IFrameSink.cs b/Wave_Dude_2D/IFrameSink.csdeleted file mode 100644index 88858ff..0000000--- a/Wave_Dude_2D/IFrameSink.cs+++ /dev/null@@ -1,25 +0,0 @@-using System;--namespace _2D_wave_sim_V01-{- /// <summary>- /// A video file that accepts one rendered frame at a time. Implemented by <see cref="MfVideoWriter"/>- /// (H.264 MP4) and <see cref="AviFrameSink"/> (Motion JPEG AVI); created by <see cref="SimulationRunner"/>- /// and used only from its worker thread. Frames must have the width/height the sink was opened with.- /// </summary>- internal interface IFrameSink : IDisposable- {- /// <summary>- /// Encodes and appends one frame given as a row-major ARGB buffer of width * height ints.- /// The buffer may be reused by the caller once this returns.- /// </summary>- /// <exception cref="InvalidOperationException">The sink has already been closed.</exception>- void AddPixels(int[] pixels);-- /// <summary>Finalizes and closes the file (writes trailers/index). Safe to call more than once; <see cref="IDisposable.Dispose"/> also closes.</summary>- void Close();-- /// <summary>The path actually written (may differ in extension from the one requested, see <see cref="SimulationRunner"/>).</summary>- string FilePath { get; }- }-}diff --git a/Wave_Dude_2D/IMFAttributesNative.cs b/Wave_Dude_2D/IMFAttributesNative.csdeleted file mode 100644index 3098012..0000000--- a/Wave_Dude_2D/IMFAttributesNative.cs+++ /dev/null@@ -1,139 +0,0 @@-using System;-using System.Runtime.InteropServices;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Hand-written COM import of Media Foundation's <c>IMFAttributes</c> (IID 2CD2D921-...), used by- /// <see cref="MfVideoWriter"/> to set media-type attributes. Only the order of the methods matters (it is the- /// order of the entries in the COM method table) and it must not change; only the three <c>Set*</c> members that- /// are actually called carry real signatures, the rest are parameterless placeholders that keep the slots aligned- /// (never call them). All methods return an HRESULT. <see cref="IMFSampleNative"/> repeats all 30 of these slots- /// instead of deriving from this interface, because .NET does not inherit base-interface methods in COM interfaces.- /// </summary>- [Guid("2CD2D921-C447-44A7-A13C-4ADABFC247E3")]- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]- [ComImport]- internal interface IMFAttributesNative- {- /// <summary>Slot for <c>IMFAttributes::GetItem</c> (placeholder).</summary>- [PreserveSig]- int GetItem();-- /// <summary>Slot for <c>IMFAttributes::GetItemType</c> (placeholder).</summary>- [PreserveSig]- int GetItemType();-- /// <summary>Slot for <c>IMFAttributes::CompareItem</c> (placeholder).</summary>- [PreserveSig]- int CompareItem();-- /// <summary>Slot for <c>IMFAttributes::Compare</c> (placeholder).</summary>- [PreserveSig]- int Compare();-- /// <summary>Slot for <c>IMFAttributes::GetUINT32</c> (placeholder).</summary>- [PreserveSig]- int GetUINT32();-- /// <summary>Slot for <c>IMFAttributes::GetUINT64</c> (placeholder).</summary>- [PreserveSig]- int GetUINT64();-- /// <summary>Slot for <c>IMFAttributes::GetDouble</c> (placeholder).</summary>- [PreserveSig]- int GetDouble();-- /// <summary>Slot for <c>IMFAttributes::GetGUID</c> (placeholder).</summary>- [PreserveSig]- int GetGUID();-- /// <summary>Slot for <c>IMFAttributes::GetStringLength</c> (placeholder).</summary>- [PreserveSig]- int GetStringLength();-- /// <summary>Slot for <c>IMFAttributes::GetString</c> (placeholder).</summary>- [PreserveSig]- int GetString();-- /// <summary>Slot for <c>IMFAttributes::GetAllocatedString</c> (placeholder).</summary>- [PreserveSig]- int GetAllocatedString();-- /// <summary>Slot for <c>IMFAttributes::GetBlobSize</c> (placeholder).</summary>- [PreserveSig]- int GetBlobSize();-- /// <summary>Slot for <c>IMFAttributes::GetBlob</c> (placeholder).</summary>- [PreserveSig]- int GetBlob();-- /// <summary>Slot for <c>IMFAttributes::GetAllocatedBlob</c> (placeholder).</summary>- [PreserveSig]- int GetAllocatedBlob();-- /// <summary>Slot for <c>IMFAttributes::GetUnknown</c> (placeholder).</summary>- [PreserveSig]- int GetUnknown();-- /// <summary>Slot for <c>IMFAttributes::SetItem</c> (placeholder).</summary>- [PreserveSig]- int SetItem();-- /// <summary>Slot for <c>IMFAttributes::DeleteItem</c> (placeholder).</summary>- [PreserveSig]- int DeleteItem();-- /// <summary>Slot for <c>IMFAttributes::DeleteAllItems</c> (placeholder).</summary>- [PreserveSig]- int DeleteAllItems();-- /// <summary><c>IMFAttributes::SetUINT32</c>: stores a 32-bit value under <paramref name="guidKey"/> (the GUID is passed by pointer).</summary>- [PreserveSig]- int SetUINT32([MarshalAs(UnmanagedType.LPStruct)] Guid guidKey, int value);-- /// <summary><c>IMFAttributes::SetUINT64</c>: stores a 64-bit value under <paramref name="guidKey"/>.</summary>- [PreserveSig]- int SetUINT64([MarshalAs(UnmanagedType.LPStruct)] Guid guidKey, ulong value);-- /// <summary>Slot for <c>IMFAttributes::SetDouble</c> (placeholder).</summary>- [PreserveSig]- int SetDouble();-- /// <summary><c>IMFAttributes::SetGUID</c>: stores a GUID value under <paramref name="guidKey"/>.</summary>- [PreserveSig]- int SetGUID([MarshalAs(UnmanagedType.LPStruct)] Guid guidKey, [MarshalAs(UnmanagedType.LPStruct)] Guid value);-- /// <summary>Slot for <c>IMFAttributes::SetString</c> (placeholder).</summary>- [PreserveSig]- int SetString();-- /// <summary>Slot for <c>IMFAttributes::SetBlob</c> (placeholder).</summary>- [PreserveSig]- int SetBlob();-- /// <summary>Slot for <c>IMFAttributes::SetUnknown</c> (placeholder).</summary>- [PreserveSig]- int SetUnknown();-- /// <summary>Slot for <c>IMFAttributes::LockStore</c> (placeholder).</summary>- [PreserveSig]- int LockStore();-- /// <summary>Slot for <c>IMFAttributes::UnlockStore</c> (placeholder).</summary>- [PreserveSig]- int UnlockStore();-- /// <summary>Slot for <c>IMFAttributes::GetCount</c> (placeholder).</summary>- [PreserveSig]- int GetCount();-- /// <summary>Slot for <c>IMFAttributes::GetItemByIndex</c> (placeholder).</summary>- [PreserveSig]- int GetItemByIndex();-- /// <summary>Slot for <c>IMFAttributes::CopyAllItems</c> (placeholder).</summary>- [PreserveSig]- int CopyAllItems();- }-}diff --git a/Wave_Dude_2D/IMFMediaBufferNative.cs b/Wave_Dude_2D/IMFMediaBufferNative.csdeleted file mode 100644index 62a5356..0000000--- a/Wave_Dude_2D/IMFMediaBufferNative.cs+++ /dev/null@@ -1,36 +0,0 @@-using System;-using System.Runtime.InteropServices;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Hand-written COM import of Media Foundation's <c>IMFMediaBuffer</c> (IID 045FA593-...), the byte buffer that- /// <see cref="MfVideoWriter.AddPixels"/> fills with one RGB32 frame. Vtable order is frozen; all methods return- /// an HRESULT. Only <see cref="Lock"/>, <see cref="Unlock"/> and <see cref="SetCurrentLength"/> are called.- /// </summary>- [Guid("045FA593-8799-42B8-BC8D-8968C6453507")]- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]- [ComImport]- internal interface IMFMediaBufferNative- {- /// <summary><c>IMFMediaBuffer::Lock</c>: returns the raw data pointer plus the buffer's maximum and current length in bytes; pair with <see cref="Unlock"/>.</summary>- [PreserveSig]- int Lock(ref IntPtr data, ref int maxLength, ref int currentLength);-- /// <summary><c>IMFMediaBuffer::Unlock</c>: releases the pointer obtained from <see cref="Lock"/>.</summary>- [PreserveSig]- int Unlock();-- /// <summary>Slot for <c>IMFMediaBuffer::GetCurrentLength</c> (placeholder, not called).</summary>- [PreserveSig]- int GetCurrentLength();-- /// <summary><c>IMFMediaBuffer::SetCurrentLength</c>: declares how many bytes of the buffer hold valid data.</summary>- [PreserveSig]- int SetCurrentLength(int length);-- /// <summary>Slot for <c>IMFMediaBuffer::GetMaxLength</c> (placeholder, not called).</summary>- [PreserveSig]- int GetMaxLength();- }-}diff --git a/Wave_Dude_2D/IMFSampleNative.cs b/Wave_Dude_2D/IMFSampleNative.csdeleted file mode 100644index c76f573..0000000--- a/Wave_Dude_2D/IMFSampleNative.cs+++ /dev/null@@ -1,196 +0,0 @@-using System;-using System.Runtime.InteropServices;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Hand-written COM import of Media Foundation's <c>IMFSample</c> (IID C40A00F2-...), one time-stamped video frame- /// handed to the sink writer by <see cref="MfVideoWriter.AddPixels"/>. <c>IMFSample</c> derives from <c>IMFAttributes</c>,- /// so the first 30 slots (<c>A01</c>..<c>A30</c>) are placeholders for the inherited attribute methods, followed by the- /// sample's own methods. They are repeated here rather than taken from <see cref="IMFAttributesNative"/> because .NET- /// does not inherit base-interface methods in COM interfaces: a derived <c>ComImport</c> interface's own methods are- /// numbered from the slot after <c>IUnknown</c>, not after the base interface's methods. Vtable order is frozen;- /// all methods return an HRESULT.- /// </summary>- [Guid("C40A00F2-B93A-4D80-AE8C-5A1C634F58E4")]- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]- [ComImport]- internal interface IMFSampleNative- {- /// <summary>Slot for inherited <c>IMFAttributes::GetItem</c> (placeholder, not called).</summary>- [PreserveSig]- int A01();-- /// <summary>Slot for inherited <c>IMFAttributes::GetItemType</c> (placeholder, not called).</summary>- [PreserveSig]- int A02();-- /// <summary>Slot for inherited <c>IMFAttributes::CompareItem</c> (placeholder, not called).</summary>- [PreserveSig]- int A03();-- /// <summary>Slot for inherited <c>IMFAttributes::Compare</c> (placeholder, not called).</summary>- [PreserveSig]- int A04();-- /// <summary>Slot for inherited <c>IMFAttributes::GetUINT32</c> (placeholder, not called).</summary>- [PreserveSig]- int A05();-- /// <summary>Slot for inherited <c>IMFAttributes::GetUINT64</c> (placeholder, not called).</summary>- [PreserveSig]- int A06();-- /// <summary>Slot for inherited <c>IMFAttributes::GetDouble</c> (placeholder, not called).</summary>- [PreserveSig]- int A07();-- /// <summary>Slot for inherited <c>IMFAttributes::GetGUID</c> (placeholder, not called).</summary>- [PreserveSig]- int A08();-- /// <summary>Slot for inherited <c>IMFAttributes::GetStringLength</c> (placeholder, not called).</summary>- [PreserveSig]- int A09();-- /// <summary>Slot for inherited <c>IMFAttributes::GetString</c> (placeholder, not called).</summary>- [PreserveSig]- int A10();-- /// <summary>Slot for inherited <c>IMFAttributes::GetAllocatedString</c> (placeholder, not called).</summary>- [PreserveSig]- int A11();-- /// <summary>Slot for inherited <c>IMFAttributes::GetBlobSize</c> (placeholder, not called).</summary>- [PreserveSig]- int A12();-- /// <summary>Slot for inherited <c>IMFAttributes::GetBlob</c> (placeholder, not called).</summary>- [PreserveSig]- int A13();-- /// <summary>Slot for inherited <c>IMFAttributes::GetAllocatedBlob</c> (placeholder, not called).</summary>- [PreserveSig]- int A14();-- /// <summary>Slot for inherited <c>IMFAttributes::GetUnknown</c> (placeholder, not called).</summary>- [PreserveSig]- int A15();-- /// <summary>Slot for inherited <c>IMFAttributes::SetItem</c> (placeholder, not called).</summary>- [PreserveSig]- int A16();-- /// <summary>Slot for inherited <c>IMFAttributes::DeleteItem</c> (placeholder, not called).</summary>- [PreserveSig]- int A17();-- /// <summary>Slot for inherited <c>IMFAttributes::DeleteAllItems</c> (placeholder, not called).</summary>- [PreserveSig]- int A18();-- /// <summary>Slot for inherited <c>IMFAttributes::SetUINT32</c> (placeholder, not called).</summary>- [PreserveSig]- int A19();-- /// <summary>Slot for inherited <c>IMFAttributes::SetUINT64</c> (placeholder, not called).</summary>- [PreserveSig]- int A20();-- /// <summary>Slot for inherited <c>IMFAttributes::SetDouble</c> (placeholder, not called).</summary>- [PreserveSig]- int A21();-- /// <summary>Slot for inherited <c>IMFAttributes::SetGUID</c> (placeholder, not called).</summary>- [PreserveSig]- int A22();-- /// <summary>Slot for inherited <c>IMFAttributes::SetString</c> (placeholder, not called).</summary>- [PreserveSig]- int A23();-- /// <summary>Slot for inherited <c>IMFAttributes::SetBlob</c> (placeholder, not called).</summary>- [PreserveSig]- int A24();-- /// <summary>Slot for inherited <c>IMFAttributes::SetUnknown</c> (placeholder, not called).</summary>- [PreserveSig]- int A25();-- /// <summary>Slot for inherited <c>IMFAttributes::LockStore</c> (placeholder, not called).</summary>- [PreserveSig]- int A26();-- /// <summary>Slot for inherited <c>IMFAttributes::UnlockStore</c> (placeholder, not called).</summary>- [PreserveSig]- int A27();-- /// <summary>Slot for inherited <c>IMFAttributes::GetCount</c> (placeholder, not called).</summary>- [PreserveSig]- int A28();-- /// <summary>Slot for inherited <c>IMFAttributes::GetItemByIndex</c> (placeholder, not called).</summary>- [PreserveSig]- int A29();-- /// <summary>Slot for inherited <c>IMFAttributes::CopyAllItems</c> (placeholder, not called).</summary>- [PreserveSig]- int A30();-- /// <summary>Slot for <c>IMFSample::GetSampleFlags</c> (placeholder, not called).</summary>- [PreserveSig]- int GetSampleFlags();-- /// <summary>Slot for <c>IMFSample::SetSampleFlags</c> (placeholder, not called).</summary>- [PreserveSig]- int SetSampleFlags();-- /// <summary>Slot for <c>IMFSample::GetSampleTime</c> (placeholder, not called).</summary>- [PreserveSig]- int GetSampleTime();-- /// <summary><c>IMFSample::SetSampleTime</c>: presentation time in 100-nanosecond units.</summary>- [PreserveSig]- int SetSampleTime(long sampleTime);-- /// <summary>Slot for <c>IMFSample::GetSampleDuration</c> (placeholder, not called).</summary>- [PreserveSig]- int GetSampleDuration();-- /// <summary><c>IMFSample::SetSampleDuration</c>: duration in 100-nanosecond units.</summary>- [PreserveSig]- int SetSampleDuration(long duration);-- /// <summary>Slot for <c>IMFSample::GetBufferCount</c> (placeholder, not called).</summary>- [PreserveSig]- int GetBufferCount();-- /// <summary>Slot for <c>IMFSample::GetBufferByIndex</c> (placeholder, not called).</summary>- [PreserveSig]- int GetBufferByIndex();-- /// <summary>Slot for <c>IMFSample::ConvertToContiguousBuffer</c> (placeholder, not called).</summary>- [PreserveSig]- int ConvertToContiguousBuffer();-- /// <summary><c>IMFSample::AddBuffer</c>: appends an <c>IMFMediaBuffer</c> (raw pointer; the sample AddRefs it).</summary>- [PreserveSig]- int AddBuffer(IntPtr buffer);-- /// <summary>Slot for <c>IMFSample::RemoveBufferByIndex</c> (placeholder, not called).</summary>- [PreserveSig]- int RemoveBufferByIndex();-- /// <summary>Slot for <c>IMFSample::RemoveAllBuffers</c> (placeholder, not called).</summary>- [PreserveSig]- int RemoveAllBuffers();-- /// <summary>Slot for <c>IMFSample::GetTotalLength</c> (placeholder, not called).</summary>- [PreserveSig]- int GetTotalLength();-- /// <summary>Slot for <c>IMFSample::CopyToBuffer</c> (placeholder, not called).</summary>- [PreserveSig]- int CopyToBuffer();- }-}diff --git a/Wave_Dude_2D/IMFSinkWriterNative.cs b/Wave_Dude_2D/IMFSinkWriterNative.csdeleted file mode 100644index e55b38d..0000000--- a/Wave_Dude_2D/IMFSinkWriterNative.cs+++ /dev/null@@ -1,60 +0,0 @@-using System;-using System.Runtime.InteropServices;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Hand-written COM import of Media Foundation's <c>IMFSinkWriter</c> (IID 3137F1CD-...), the object that- /// encodes and muxes the MP4 for <see cref="MfVideoWriter"/>. Vtable order is frozen; all methods return an- /// HRESULT. Only the members with parameters (and <see cref="BeginWriting"/> / <see cref="FinalizeWriting"/>) are called.- /// </summary>- [Guid("3137F1CD-FE5E-4805-A5D8-FB477448CB3D")]- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]- [ComImport]- internal interface IMFSinkWriterNative- {- /// <summary><c>IMFSinkWriter::AddStream</c>: adds an output stream with the given encoded media type and returns its index.</summary>- [PreserveSig]- int AddStream(IntPtr mediaType, ref int streamIndex);-- /// <summary><c>IMFSinkWriter::SetInputMediaType</c>: sets the uncompressed input type for a stream (<paramref name="encodingParameters"/> may be null).</summary>- [PreserveSig]- int SetInputMediaType(int streamIndex, IntPtr mediaType, IntPtr encodingParameters);-- /// <summary><c>IMFSinkWriter::BeginWriting</c>: starts the encoder/muxer; must precede <see cref="WriteSample"/>.</summary>- [PreserveSig]- int BeginWriting();-- /// <summary><c>IMFSinkWriter::WriteSample</c>: delivers one time-stamped sample to a stream.</summary>- [PreserveSig]- int WriteSample(int streamIndex, IntPtr sample);-- /// <summary>Slot for <c>IMFSinkWriter::SendStreamTick</c> (placeholder, not called).</summary>- [PreserveSig]- int SendStreamTick();-- /// <summary>Slot for <c>IMFSinkWriter::PlaceMarker</c> (placeholder, not called).</summary>- [PreserveSig]- int PlaceMarker();-- /// <summary>Slot for <c>IMFSinkWriter::NotifyEndOfSegment</c> (placeholder, not called).</summary>- [PreserveSig]- int NotifyEndOfSegment();-- /// <summary>Slot for <c>IMFSinkWriter::Flush</c> (placeholder, not called).</summary>- [PreserveSig]- int Flush();-- /// <summary><c>IMFSinkWriter::Finalize</c>: flushes the encoder and writes the container trailer (named differently to avoid clashing with <see cref="object.Finalize"/>).</summary>- [PreserveSig]- int FinalizeWriting();-- /// <summary>Slot for <c>IMFSinkWriter::GetServiceForStream</c> (placeholder, not called).</summary>- [PreserveSig]- int GetServiceForStream();-- /// <summary>Slot for <c>IMFSinkWriter::GetStatistics</c> (placeholder, not called).</summary>- [PreserveSig]- int GetStatistics();- }-}diff --git a/Wave_Dude_2D/IWaveEngine.cs b/Wave_Dude_2D/IWaveEngine.csdeleted file mode 100644index 77a838b..0000000--- a/Wave_Dude_2D/IWaveEngine.cs+++ /dev/null@@ -1,76 +0,0 @@-using System;--namespace _2D_wave_sim_V01-{- /// <summary>- /// A wave-field solver (CPU <see cref="WaveSimulator"/> or OpenCL <see cref="GpuWaveSimulator"/>), created by- /// <see cref="WaveEngineFactory"/> and driven by <see cref="SimulationRunner"/> on its worker thread. The field and- /// intensity buffers are padded by one cell on each side, so row y of the scene starts at index (y + 1) * Stride + 1.- /// Only <see cref="PrepareFrame"/> and the data properties are also used from the UI thread, and only while the- /// runner is paused (see <see cref="SimulationRunner.RenderCurrentFrame"/>).- /// </summary>- internal interface IWaveEngine- {- /// <summary>Where the simulation runs, for the status bar and result: for example "CPU (8 threads)" or "GPU: NVIDIA GeForce MX130 (OpenCL)".</summary>- string Description { get; }-- /// <summary>Scene width in cells (= canvas pixels), without padding.</summary>- int Width { get; }-- /// <summary>Scene height in cells (= canvas pixels), without padding.</summary>- int Height { get; }-- /// <summary>Row pitch of <see cref="FieldData"/> and <see cref="IntensityData"/>: <see cref="Width"/> + 2. Pixel (x, y) is at (y + 1) * Stride + x + 1.</summary>- int Stride { get; }-- /// <summary>- /// The field of the last completed step, <see cref="Stride"/> * (<see cref="Height"/> + 2) floats. Valid for- /// reading after <see cref="PrepareFrame"/>(true, ...); the CPU engine exposes its live buffer (a different- /// array instance after every sub-step, so re-read the property per frame), the GPU engine a host copy.- /// Do not change.- /// </summary>- float[] FieldData { get; }-- /// <summary>- /// The averaged intensity, same layout as <see cref="FieldData"/>, valid after <see cref="PrepareFrame"/>(..., true);- /// null when intensity tracking was not requested. Do not change.- /// </summary>- float[] IntensityData { get; }-- /// <summary>One time step: apply the sources, update the field (internally several sub-steps with the 4th-order Laplacian), update the intensity.</summary>- void AdvanceOneStep();-- /// <summary>- /// Makes the requested buffers reflect the current state so the renderer can read them: a no-op on the CPU;- /// on the GPU the data is copied from the graphics memory, so only ask for what is going to be drawn. Call- /// before touching <see cref="FieldData"/> / <see cref="IntensityData"/>.- /// </summary>- void PrepareFrame(bool needField, bool needIntensity);-- /// <summary>- /// Installs the probe definitions for this run (the GPU engine compiles its probe kernel here).- /// A null or empty sampler installs nothing.- /// </summary>- /// <exception cref="InvalidOperationException">A probe needs the intensity but it is not tracked, or the GPU probe kernel cannot be built.</exception>- void SetProbes(ProbeSampler sampler);-- /// <summary>- /// Measures the probes in the state after the last <see cref="AdvanceOneStep"/>: one value per step for every- /// point probe, and the running totals of the line probes that integrate the intensity.- /// </summary>- void SampleProbes();-- /// <summary>- /// Returns and clears the values measured for the point probes since the last call, one array per probe (empty for line probes).- /// </summary>- /// <returns>Empty outer array when no probes are installed.</returns>- float[][] TakeProbeSamples();-- /// <summary>- /// The values along the line of every line probe in the current state: the field, the intensity, or the- /// intensity totals of the steps so far. On the GPU this waits for the card, so do not call it every step.- /// </summary>- /// <returns>Null entries for point probes; empty outer array when no probes are installed.</returns>- float[][] ReadProbeProfiles();- }-}diff --git a/Wave_Dude_2D/MfVideoWriter.cs b/Wave_Dude_2D/MfVideoWriter.csdeleted file mode 100644index ddcf9c3..0000000--- a/Wave_Dude_2D/MfVideoWriter.cs+++ /dev/null@@ -1,380 +0,0 @@-using System;-using System.Runtime.InteropServices;--namespace _2D_wave_sim_V01-{- /// <summary>- /// <see cref="IFrameSink"/> that encodes H.264 MP4 through the Media Foundation sink writer- /// (<c>mfplat.dll</c> / <c>mfreadwrite.dll</c>, talked to via the hand-written <c>IMF*Native</c> COM- /// interfaces). The H.264 encoder is the one built into Windows, so no codec or other program is needed- /// and every Windows player opens the file. Created by <see cref="SimulationRunner"/>; a failing- /// constructor (no Media Foundation or H.264 encoder, size not supported) means "no H.264 on this- /// machine" and triggers the AVI fallback. Used from the worker thread only.- /// Media Foundation is started in the constructor and shut down in <see cref="Cleanup"/>.- /// </summary>- internal sealed class MfVideoWriter : IFrameSink- {- /// <summary>Native <c>MFStartup</c>: initializes Media Foundation for this process.</summary>- [DllImport("mfplat.dll", ExactSpelling = true)]- private static extern int MFStartup(int version, int flags);-- /// <summary>Native <c>MFShutdown</c>: counterpart of <see cref="MFStartup"/>.</summary>- [DllImport("mfplat.dll", ExactSpelling = true)]- private static extern int MFShutdown();-- /// <summary>Native <c>MFCreateMediaType</c>: returns a new, empty <c>IMFMediaType</c> (ref count 1) in <paramref name="mediaType"/>.</summary>- [DllImport("mfplat.dll", ExactSpelling = true)]- private static extern int MFCreateMediaType(ref IntPtr mediaType);-- /// <summary>Native <c>MFCreateSample</c>: returns a new, empty <c>IMFSample</c> in <paramref name="sample"/>.</summary>- [DllImport("mfplat.dll", ExactSpelling = true)]- private static extern int MFCreateSample(ref IntPtr sample);-- /// <summary>Native <c>MFCreateMemoryBuffer</c>: allocates a system-memory <c>IMFMediaBuffer</c> of <paramref name="maxLength"/> bytes.</summary>- [DllImport("mfplat.dll", ExactSpelling = true)]- private static extern int MFCreateMemoryBuffer(int maxLength, ref IntPtr buffer);-- /// <summary>Native <c>MFCreateSinkWriterFromURL</c>: creates an <c>IMFSinkWriter</c> for the file at <paramref name="url"/> (container chosen by extension).</summary>- [DllImport("mfreadwrite.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]- private static extern int MFCreateSinkWriterFromURL(string url, IntPtr byteStream, IntPtr attributes, ref IntPtr writer);-- /// <summary>- /// Validates the size, starts Media Foundation, creates the sink writer with one H.264 output stream and an- /// RGB32 input stream, and calls <c>BeginWriting</c>. Width and height are rounded down to even numbers- /// (H.264 4:2:0 needs that); when that changes the size, frames are cropped to the top-left even region.- /// The target bitrate is <c>width * height * fps * bpp</c> with <c>bpp = 0.01 * 50^(quality/100)</c>- /// (0.01 .. 0.5 bits per pixel), clamped to 300 kbit/s .. 200 Mbit/s. On any failure everything is released- /// (including <c>MFShutdown</c>) before the exception propagates.- /// </summary>- /// <param name="filePath">Output .mp4 path.</param>- /// <param name="width">Width of the frames that will be passed to <see cref="AddPixels"/>.</param>- /// <param name="height">Height of the frames that will be passed to <see cref="AddPixels"/>.</param>- /// <param name="framesPerSecond">Playback frame rate.</param>- /// <param name="quality">1..100 (clamped); controls the H.264 bitrate only.</param>- /// <exception cref="NotSupportedException">The even-rounded size is below 16x16 or above 9,437,184 pixels (4096x2304), the limit of the Windows H.264 encoder.</exception>- /// <exception cref="COMException">Media Foundation returned a failure HRESULT (no encoder, bad path, ...).</exception>- public MfVideoWriter(string filePath, int width, int height, int framesPerSecond, int quality)- {- _path = filePath;- _srcWidth = width;- _srcHeight = height;- _width = width & ~1; // the encoded size: H.264 needs even sizes- _height = height & ~1;- _fps = framesPerSecond;- if (_width < 16 || _height < 16)- {- throw new NotSupportedException("The canvas is too small for H.264 video.");- }- if ((long)_width * _height > 4096L * 2304L)- {- throw new NotSupportedException("The canvas is too large for the H.264 encoder of Windows.");- }- if (_width != _srcWidth || _height != _srcHeight)- {- _cropped = new int[_width * _height];- }- Check(MFStartup(MfVersion, 0));- _started = true;- try- {- Check(MFCreateSinkWriterFromURL(filePath, IntPtr.Zero, IntPtr.Zero, ref _writerPtr));- _writer = (IMFSinkWriterNative)Marshal.GetObjectForIUnknown(_writerPtr);- // the quality (1 to 100) sets the bits per pixel of every frame: 0.01 * 50 ^ (quality / 100),- // which is 0.01 at quality 1, 0.15 at 70 and 0.5 at 100 (1920 x 1080 at 60 frames/s: 1 to 62 Mbit/s)- int clampedQuality = Math.Max(1, Math.Min(100, quality));- double bitsPerPixel = 0.01 * Math.Pow(50.0, clampedQuality / 100.0);- long bitrate = (long)Math.Round((double)_width * _height * _fps * bitsPerPixel);- bitrate = Math.Max(300000L, Math.Min(200000000L, bitrate));- IntPtr outputType = MakeType(H264Format, (int)bitrate, false);- int streamIndex = 0;- try- {- Check(_writer.AddStream(outputType, ref streamIndex));- }- finally- {- Marshal.Release(outputType);- }- // the pictures are given as 32 bit pixels; the sink writer converts them for the encoder- IntPtr inputType = MakeType(Rgb32Format, 0, true);- try- {- Check(_writer.SetInputMediaType(streamIndex, inputType, IntPtr.Zero));- }- finally- {- Marshal.Release(inputType);- }- Check(_writer.BeginWriting());- }- catch- {- Cleanup();- throw;- }- }-- /// <summary>The MP4 path given to the constructor.</summary>- public string FilePath => _path;-- /// <summary>- /// Creates a progressive video <c>IMFMediaType</c> for <paramref name="format"/> at the writer's even size,- /// <c>fps/1</c> frame rate and 1:1 pixel aspect ratio. The caller owns the returned reference and must- /// <see cref="Marshal.Release"/> it. The RCW used for the attribute calls is released here.- /// </summary>- /// <param name="format">Subtype GUID: <see cref="H264Format"/> or <see cref="Rgb32Format"/>.</param>- /// <param name="bitrate">Average bitrate in bits/s, written as <c>MF_MT_AVG_BITRATE</c> when > 0.</param>- /// <param name="topDown">When true, sets a positive <c>MF_MT_DEFAULT_STRIDE</c> of <c>width * 4</c> so the top-down ARGB rows are not flipped.</param>- private IntPtr MakeType(Guid format, int bitrate, bool topDown)- {- IntPtr mediaType = IntPtr.Zero;- Check(MFCreateMediaType(ref mediaType));- try- {- IMFAttributesNative attributes = (IMFAttributesNative)Marshal.GetObjectForIUnknown(mediaType);- try- {- Check(attributes.SetGUID(MajorType, VideoType));- Check(attributes.SetGUID(SubType, format));- if (bitrate > 0)- {- Check(attributes.SetUINT32(AvgBitrate, bitrate));- }- Check(attributes.SetUINT32(InterlaceMode, 2)); // MFVideoInterlace_Progressive- Check(attributes.SetUINT64(FrameSize, ((ulong)_width << 32) | (ulong)_height));- Check(attributes.SetUINT64(FrameRate, ((ulong)_fps << 32) | 1UL));- Check(attributes.SetUINT64(PixelAspectRatio, (1UL << 32) | 1UL)); // 1:1- if (topDown)- {- Check(attributes.SetUINT32(DefaultStride, _width * 4));- }- }- finally- {- Marshal.ReleaseComObject(attributes);- }- }- catch- {- Marshal.Release(mediaType);- throw;- }- return mediaType;- }-- /// <summary>- /// Copies the ARGB frame into a new Media Foundation memory buffer (cropping to the even size when needed),- /// wraps it in a sample stamped with time and duration in 100-ns units derived from the frame index and fps,- /// and hands it to stream 0 of the sink writer. Both RCW and raw reference of the buffer and sample are- /// released afterwards; Media Foundation keeps its own reference while encoding.- /// </summary>- /// <param name="pixels">Row-major ARGB buffer of the original (uncropped) width * height.</param>- /// <exception cref="InvalidOperationException">The writer has already been closed.</exception>- /// <exception cref="COMException">A Media Foundation call failed.</exception>- public void AddPixels(int[] pixels)- {- if (_closed)- {- throw new InvalidOperationException("The video file is already closed.");- }- int[] source = pixels;- if (_cropped != null)- {- for (int y = 0; y < _height; y++)- {- Array.Copy(pixels, y * _srcWidth, _cropped, y * _width, _width);- }- source = _cropped;- }- int byteLength = _width * _height * 4;- IntPtr bufferPtr = IntPtr.Zero;- IntPtr samplePtr = IntPtr.Zero;- IMFMediaBufferNative buffer = null;- IMFSampleNative sample = null;- try- {- Check(MFCreateMemoryBuffer(byteLength, ref bufferPtr));- buffer = (IMFMediaBufferNative)Marshal.GetObjectForIUnknown(bufferPtr);- IntPtr data = IntPtr.Zero;- int maxLength = 0;- int currentLength = 0;- Check(buffer.Lock(ref data, ref maxLength, ref currentLength));- try- {- Marshal.Copy(source, 0, data, _width * _height);- }- finally- {- buffer.Unlock();- }- Check(buffer.SetCurrentLength(byteLength));- Check(MFCreateSample(ref samplePtr));- sample = (IMFSampleNative)Marshal.GetObjectForIUnknown(samplePtr);- Check(sample.AddBuffer(bufferPtr));- Check(sample.SetSampleTime(_frames * 10000000L / _fps));- Check(sample.SetSampleDuration(10000000L / _fps));- Check(_writer.WriteSample(0, samplePtr));- _frames++;- }- finally- {- if (sample != null)- {- Marshal.ReleaseComObject(sample);- }- if (samplePtr != IntPtr.Zero)- {- Marshal.Release(samplePtr);- }- if (buffer != null)- {- Marshal.ReleaseComObject(buffer);- }- if (bufferPtr != IntPtr.Zero)- {- Marshal.Release(bufferPtr);- }- }- }-- /// <summary>- /// Finalizes the MP4 (writes the moov box) when at least one frame was written, then releases the sink- /// writer and shuts Media Foundation down. Idempotent. Finalizing is skipped for an empty file because the- /// sink writer rejects it; cleanup still runs.- /// </summary>- /// <exception cref="COMException"><c>Finalize</c> failed; cleanup has still been performed.</exception>- public void Close()- {- if (_closed)- {- return;- }- _closed = true;- try- {- if (_writer != null && _frames > 0)- {- Check(_writer.FinalizeWriting());- }- }- finally- {- Cleanup();- }- }-- /// <summary>- /// Releases the sink writer RCW and the raw reference obtained from <c>MFCreateSinkWriterFromURL</c>- /// (both are needed: <see cref="Marshal.GetObjectForIUnknown"/> added its own reference), then calls- /// <c>MFShutdown</c> once if startup succeeded. Safe to call repeatedly.- /// </summary>- private void Cleanup()- {- if (_writer != null)- {- Marshal.ReleaseComObject(_writer);- _writer = null;- }- if (_writerPtr != IntPtr.Zero)- {- Marshal.Release(_writerPtr);- _writerPtr = IntPtr.Zero;- }- if (_started)- {- _started = false;- MFShutdown();- }- }-- /// <summary>Same as <see cref="Close"/>.</summary>- public void Dispose()- {- Close();- }-- /// <summary>Throws the matching .NET exception for a failed HRESULT (negative value); succeeds silently otherwise.</summary>- private static void Check(int hr)- {- if (hr < 0)- {- Marshal.ThrowExceptionForHR(hr);- }- }-- /// <summary>- /// The version of Media Foundation that is asked for: <c>MF_VERSION</c> of the Windows 7 and later SDK- /// (SDK version 2, API version 0x70), passed to <c>MFStartup</c>.- /// </summary>- private const int MfVersion = 0x00020070;-- /// <summary><c>MF_MT_MAJOR_TYPE</c> attribute key.</summary>- private static readonly Guid MajorType = new Guid("48eba18e-f8c9-4687-bf11-0a74c9f96a8f");-- /// <summary><c>MF_MT_SUBTYPE</c> attribute key.</summary>- private static readonly Guid SubType = new Guid("f7e34c9a-42e8-4714-b74b-cb29d72c35e5");-- /// <summary><c>MF_MT_AVG_BITRATE</c> attribute key (bits per second).</summary>- private static readonly Guid AvgBitrate = new Guid("20332624-fb0d-4d9e-bd0d-cbf6786c102e");-- /// <summary><c>MF_MT_INTERLACE_MODE</c> attribute key.</summary>- private static readonly Guid InterlaceMode = new Guid("e2724bb8-e676-4806-b4b2-a8d6efb44ccd");-- /// <summary><c>MF_MT_FRAME_SIZE</c> attribute key (width in the high 32 bits, height in the low 32).</summary>- private static readonly Guid FrameSize = new Guid("1652c33d-d6b2-4012-b834-72030849a37d");-- /// <summary><c>MF_MT_FRAME_RATE</c> attribute key (numerator high 32 bits, denominator low 32).</summary>- private static readonly Guid FrameRate = new Guid("c459a2e8-3d2c-4e44-b132-fee5156c7bb0");-- /// <summary><c>MF_MT_PIXEL_ASPECT_RATIO</c> attribute key (same packing as the frame rate).</summary>- private static readonly Guid PixelAspectRatio = new Guid("c6376a1e-8d0a-4027-be45-6d9a0ad39bb6");-- /// <summary><c>MF_MT_DEFAULT_STRIDE</c> attribute key (bytes per row; positive = top-down).</summary>- private static readonly Guid DefaultStride = new Guid("644b4e48-1e02-4516-b0eb-c01ca9d49ac6");-- /// <summary><c>MFMediaType_Video</c> major type ('vids').</summary>- private static readonly Guid VideoType = new Guid("73646976-0000-0010-8000-00AA00389B71");-- /// <summary><c>MFVideoFormat_H264</c> subtype ('H264').</summary>- private static readonly Guid H264Format = new Guid("34363248-0000-0010-8000-00AA00389B71");-- /// <summary><c>MFVideoFormat_RGB32</c> subtype (D3DFMT_X8R8G8B8 = 22); matches the ARGB int layout in memory.</summary>- private static readonly Guid Rgb32Format = new Guid("00000016-0000-0010-8000-00AA00389B71");-- /// <summary>Output file path.</summary>- private readonly string _path;-- /// <summary>Width of the frames passed to <see cref="AddPixels"/>, before rounding to even.</summary>- private readonly int _srcWidth;-- /// <summary>Height of the frames passed to <see cref="AddPixels"/>, before rounding to even.</summary>- private readonly int _srcHeight;-- /// <summary>Encoded width (source width rounded down to even).</summary>- private readonly int _width;-- /// <summary>Encoded height (source height rounded down to even).</summary>- private readonly int _height;-- /// <summary>Frames per second; also used to derive sample time/duration.</summary>- private readonly int _fps;-- /// <summary>Scratch buffer of the even size when cropping is needed; null when source and encoded sizes match.</summary>- private readonly int[] _cropped;-- /// <summary>True between a successful <c>MFStartup</c> and the matching <c>MFShutdown</c>.</summary>- private bool _started;-- /// <summary>Raw <c>IMFSinkWriter</c> pointer from <c>MFCreateSinkWriterFromURL</c>; released separately from the RCW.</summary>- private IntPtr _writerPtr;-- /// <summary>RCW over <see cref="_writerPtr"/>; null after <see cref="Cleanup"/>.</summary>- private IMFSinkWriterNative _writer;-- /// <summary>Number of samples written; the next sample's time is <c>_frames / fps</c> seconds.</summary>- private int _frames;-- /// <summary>True once <see cref="Close"/> has run.</summary>- private bool _closed;- }-}diff --git a/Wave_Dude_2D/My/MyApplication.cs b/Wave_Dude_2D/My/MyApplication.csdeleted file mode 100644index c8581e0..0000000--- a/Wave_Dude_2D/My/MyApplication.cs+++ /dev/null@@ -1,51 +0,0 @@-using System;-using System.CodeDom.Compiler;-using System.ComponentModel;-using System.Diagnostics;-using System.Runtime.CompilerServices;-using System.Windows.Forms;-using Microsoft.VisualBasic.ApplicationServices;--namespace _2D_wave_sim_V01.My-{- // Token: 0x02000002 RID: 2- [GeneratedCode("MyTemplate", "11.0.0.0")]- [EditorBrowsable(EditorBrowsableState.Never)]- internal class MyApplication : WindowsFormsApplicationBase- {- // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250- [STAThread]- [DebuggerHidden]- [EditorBrowsable(EditorBrowsableState.Advanced)]- [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]- internal static void Main(string[] Args)- {- try- {- Application.SetCompatibleTextRenderingDefault(WindowsFormsApplicationBase.UseCompatibleTextRendering);- }- finally- {- }- MyProject.Application.Run(Args);- }-- // Token: 0x06000002 RID: 2 RVA: 0x0000208C File Offset: 0x0000028C- [DebuggerStepThrough]- public MyApplication()- : base(AuthenticationMode.Windows)- {- base.IsSingleInstance = false;- base.EnableVisualStyles = true;- base.SaveMySettingsOnExit = true;- base.ShutdownStyle = ShutdownMode.AfterMainFormCloses;- }-- // Token: 0x06000003 RID: 3 RVA: 0x000020B7 File Offset: 0x000002B7- [DebuggerStepThrough]- protected override void OnCreateMainForm()- {- base.MainForm = MyProject.Forms.Form1;- }- }-}diff --git a/Wave_Dude_2D/My/MyComputer.cs b/Wave_Dude_2D/My/MyComputer.csdeleted file mode 100644index 5897512..0000000--- a/Wave_Dude_2D/My/MyComputer.cs+++ /dev/null@@ -1,21 +0,0 @@-using System;-using System.CodeDom.Compiler;-using System.ComponentModel;-using System.Diagnostics;-using Microsoft.VisualBasic.Devices;--namespace _2D_wave_sim_V01.My-{- // Token: 0x02000003 RID: 3- [GeneratedCode("MyTemplate", "11.0.0.0")]- [EditorBrowsable(EditorBrowsableState.Never)]- internal class MyComputer : Computer- {- // Token: 0x06000004 RID: 4 RVA: 0x000020CB File Offset: 0x000002CB- [DebuggerHidden]- [EditorBrowsable(EditorBrowsableState.Never)]- public MyComputer()- {- }- }-}diff --git a/Wave_Dude_2D/My/MyProject.cs b/Wave_Dude_2D/My/MyProject.csdeleted file mode 100644index b3088a7..0000000--- a/Wave_Dude_2D/My/MyProject.cs+++ /dev/null@@ -1,408 +0,0 @@-using System;-using System.CodeDom.Compiler;-using System.Collections;-using System.ComponentModel;-using System.ComponentModel.Design;-using System.Diagnostics;-using System.Reflection;-using System.Runtime.CompilerServices;-using System.Runtime.InteropServices;-using System.Windows.Forms;-using Microsoft.VisualBasic;-using Microsoft.VisualBasic.ApplicationServices;-using Microsoft.VisualBasic.CompilerServices;--namespace _2D_wave_sim_V01.My-{- // Token: 0x02000004 RID: 4- [StandardModule]- [HideModuleName]- [GeneratedCode("MyTemplate", "11.0.0.0")]- internal sealed class MyProject- {- // Token: 0x17000001 RID: 1- // (get) Token: 0x06000006 RID: 6 RVA: 0x0000210C File Offset: 0x0000030C- [HelpKeyword("My.Computer")]- internal static MyComputer Computer- {- [DebuggerHidden]- get- {- return MyProject.m_ComputerObjectProvider.GetInstance;- }- }-- // Token: 0x17000002 RID: 2- // (get) Token: 0x06000007 RID: 7 RVA: 0x00002128 File Offset: 0x00000328- [HelpKeyword("My.Application")]- internal static MyApplication Application- {- [DebuggerHidden]- get- {- return MyProject.m_AppObjectProvider.GetInstance;- }- }-- // Token: 0x17000003 RID: 3- // (get) Token: 0x06000008 RID: 8 RVA: 0x00002144 File Offset: 0x00000344- [HelpKeyword("My.User")]- internal static User User- {- [DebuggerHidden]- get- {- return MyProject.m_UserObjectProvider.GetInstance;- }- }-- // Token: 0x17000004 RID: 4- // (get) Token: 0x06000009 RID: 9 RVA: 0x00002160 File Offset: 0x00000360- [HelpKeyword("My.Forms")]- internal static MyProject.MyForms Forms- {- [DebuggerHidden]- get- {- return MyProject.m_MyFormsObjectProvider.GetInstance;- }- }-- // Token: 0x17000005 RID: 5- // (get) Token: 0x0600000A RID: 10 RVA: 0x0000217C File Offset: 0x0000037C- [HelpKeyword("My.WebServices")]- internal static MyProject.MyWebServices WebServices- {- [DebuggerHidden]- get- {- return MyProject.m_MyWebServicesObjectProvider.GetInstance;- }- }-- // Token: 0x04000001 RID: 1- private static readonly MyProject.ThreadSafeObjectProvider<MyComputer> m_ComputerObjectProvider = new MyProject.ThreadSafeObjectProvider<MyComputer>();-- // Token: 0x04000002 RID: 2- private static readonly MyProject.ThreadSafeObjectProvider<MyApplication> m_AppObjectProvider = new MyProject.ThreadSafeObjectProvider<MyApplication>();-- // Token: 0x04000003 RID: 3- private static readonly MyProject.ThreadSafeObjectProvider<User> m_UserObjectProvider = new MyProject.ThreadSafeObjectProvider<User>();-- // Token: 0x04000004 RID: 4- private static MyProject.ThreadSafeObjectProvider<MyProject.MyForms> m_MyFormsObjectProvider = new MyProject.ThreadSafeObjectProvider<MyProject.MyForms>();-- // Token: 0x04000005 RID: 5- private static readonly MyProject.ThreadSafeObjectProvider<MyProject.MyWebServices> m_MyWebServicesObjectProvider = new MyProject.ThreadSafeObjectProvider<MyProject.MyWebServices>();-- // Token: 0x0200003E RID: 62- [EditorBrowsable(EditorBrowsableState.Never)]- [MyGroupCollection("System.Windows.Forms.Form", "Create__Instance__", "Dispose__Instance__", "My.MyProject.Forms")]- internal sealed class MyForms- {- // Token: 0x060006B9 RID: 1721 RVA: 0x000339A4 File Offset: 0x00031BA4- [DebuggerHidden]- private static T Create__Instance__<T>(T Instance) where T : Form, new()- {- bool flag = Instance == null || Instance.IsDisposed;- if (flag)- {- bool flag2 = MyProject.MyForms.m_FormBeingCreated != null;- if (flag2)- {- bool flag3 = MyProject.MyForms.m_FormBeingCreated.ContainsKey(typeof(T));- if (flag3)- {- throw new InvalidOperationException(Utils.GetResourceString("WinForms_RecursiveFormCreate", new string[0]));- }- }- else- {- MyProject.MyForms.m_FormBeingCreated = new Hashtable();- }- MyProject.MyForms.m_FormBeingCreated.Add(typeof(T), null);- try- {- return new T();- }- catch (TargetInvocationException ex) when (ex.InnerException != null)- {- string resourceString = Utils.GetResourceString("WinForms_SeeInnerException", new string[] { ex.InnerException.Message });- throw new InvalidOperationException(resourceString, ex.InnerException);- }- finally- {- MyProject.MyForms.m_FormBeingCreated.Remove(typeof(T));- }- }- return Instance;- }-- // Token: 0x060006BA RID: 1722 RVA: 0x00033ACC File Offset: 0x00031CCC- [DebuggerHidden]- private void Dispose__Instance__<T>(ref T instance) where T : Form- {- instance.Dispose();- instance = default(T);- }-- // Token: 0x060006BB RID: 1723 RVA: 0x00033AE3 File Offset: 0x00031CE3- [DebuggerHidden]- [EditorBrowsable(EditorBrowsableState.Never)]- public MyForms()- {- }-- // Token: 0x060006BC RID: 1724 RVA: 0x00033AF0 File Offset: 0x00031CF0- [EditorBrowsable(EditorBrowsableState.Never)]- public override bool Equals(object o)- {- return base.Equals(RuntimeHelpers.GetObjectValue(o));- }-- // Token: 0x060006BD RID: 1725 RVA: 0x00033B10 File Offset: 0x00031D10- [EditorBrowsable(EditorBrowsableState.Never)]- public override int GetHashCode()- {- return base.GetHashCode();- }-- // Token: 0x060006BE RID: 1726 RVA: 0x00033B28 File Offset: 0x00031D28- [EditorBrowsable(EditorBrowsableState.Never)]- internal new Type GetType()- {- return typeof(MyProject.MyForms);- }-- // Token: 0x060006BF RID: 1727 RVA: 0x00033B44 File Offset: 0x00031D44- [EditorBrowsable(EditorBrowsableState.Never)]- public override string ToString()- {- return base.ToString();- }-- // Token: 0x170001F1 RID: 497- // (get) Token: 0x060006C0 RID: 1728 RVA: 0x00033B5C File Offset: 0x00031D5C- // (set) Token: 0x060006C4 RID: 1732 RVA: 0x00033BC8 File Offset: 0x00031DC8- public AboutForm AboutForm- {- [DebuggerHidden]- get- {- this.m_AboutForm = MyProject.MyForms.Create__Instance__<AboutForm>(this.m_AboutForm);- return this.m_AboutForm;- }- [DebuggerHidden]- set- {- if (value != this.m_AboutForm)- {- if (value != null)- {- throw new ArgumentException("Property can only be set to Nothing");- }- this.Dispose__Instance__<AboutForm>(ref this.m_AboutForm);- }- }- }-- // Token: 0x170001F2 RID: 498- // (get) Token: 0x060006C1 RID: 1729 RVA: 0x00033B77 File Offset: 0x00031D77- // (set) Token: 0x060006C5 RID: 1733 RVA: 0x00033BF4 File Offset: 0x00031DF4- public Form1 Form1- {- [DebuggerHidden]- get- {- this.m_Form1 = MyProject.MyForms.Create__Instance__<Form1>(this.m_Form1);- return this.m_Form1;- }- [DebuggerHidden]- set- {- if (value != this.m_Form1)- {- if (value != null)- {- throw new ArgumentException("Property can only be set to Nothing");- }- this.Dispose__Instance__<Form1>(ref this.m_Form1);- }- }- }-- // Token: 0x170001F3 RID: 499- // (get) Token: 0x060006C2 RID: 1730 RVA: 0x00033B92 File Offset: 0x00031D92- // (set) Token: 0x060006C6 RID: 1734 RVA: 0x00033C20 File Offset: 0x00031E20- public frmDescription frmDescription- {- [DebuggerHidden]- get- {- this.m_frmDescription = MyProject.MyForms.Create__Instance__<frmDescription>(this.m_frmDescription);- return this.m_frmDescription;- }- [DebuggerHidden]- set- {- if (value != this.m_frmDescription)- {- if (value != null)- {- throw new ArgumentException("Property can only be set to Nothing");- }- this.Dispose__Instance__<frmDescription>(ref this.m_frmDescription);- }- }- }-- // Token: 0x170001F4 RID: 500- // (get) Token: 0x060006C3 RID: 1731 RVA: 0x00033BAD File Offset: 0x00031DAD- // (set) Token: 0x060006C7 RID: 1735 RVA: 0x00033C4C File Offset: 0x00031E4C- public HelpForm HelpForm- {- [DebuggerHidden]- get- {- this.m_HelpForm = MyProject.MyForms.Create__Instance__<HelpForm>(this.m_HelpForm);- return this.m_HelpForm;- }- [DebuggerHidden]- set- {- if (value != this.m_HelpForm)- {- if (value != null)- {- throw new ArgumentException("Property can only be set to Nothing");- }- this.Dispose__Instance__<HelpForm>(ref this.m_HelpForm);- }- }- }-- // Token: 0x0400038A RID: 906- [ThreadStatic]- private static Hashtable m_FormBeingCreated;-- // Token: 0x0400038B RID: 907- [EditorBrowsable(EditorBrowsableState.Never)]- public AboutForm m_AboutForm;-- // Token: 0x0400038C RID: 908- [EditorBrowsable(EditorBrowsableState.Never)]- public Form1 m_Form1;-- // Token: 0x0400038D RID: 909- [EditorBrowsable(EditorBrowsableState.Never)]- public frmDescription m_frmDescription;-- // Token: 0x0400038E RID: 910- [EditorBrowsable(EditorBrowsableState.Never)]- public HelpForm m_HelpForm;- }-- // Token: 0x0200003F RID: 63- [EditorBrowsable(EditorBrowsableState.Never)]- [MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtocol", "Create__Instance__", "Dispose__Instance__", "")]- internal sealed class MyWebServices- {- // Token: 0x060006C8 RID: 1736 RVA: 0x00033C78 File Offset: 0x00031E78- [EditorBrowsable(EditorBrowsableState.Never)]- [DebuggerHidden]- public override bool Equals(object o)- {- return base.Equals(RuntimeHelpers.GetObjectValue(o));- }-- // Token: 0x060006C9 RID: 1737 RVA: 0x00033C98 File Offset: 0x00031E98- [EditorBrowsable(EditorBrowsableState.Never)]- [DebuggerHidden]- public override int GetHashCode()- {- return base.GetHashCode();- }-- // Token: 0x060006CA RID: 1738 RVA: 0x00033CB0 File Offset: 0x00031EB0- [EditorBrowsable(EditorBrowsableState.Never)]- [DebuggerHidden]- internal new Type GetType()- {- return typeof(MyProject.MyWebServices);- }-- // Token: 0x060006CB RID: 1739 RVA: 0x00033CCC File Offset: 0x00031ECC- [EditorBrowsable(EditorBrowsableState.Never)]- [DebuggerHidden]- public override string ToString()- {- return base.ToString();- }-- // Token: 0x060006CC RID: 1740 RVA: 0x00033CE4 File Offset: 0x00031EE4- [DebuggerHidden]- private static T Create__Instance__<T>(T instance) where T : new()- {- bool flag = instance == null;- T t;- if (flag)- {- t = new T();- }- else- {- t = instance;- }- return t;- }-- // Token: 0x060006CD RID: 1741 RVA: 0x00033D0D File Offset: 0x00031F0D- [DebuggerHidden]- private void Dispose__Instance__<T>(ref T instance)- {- instance = default(T);- }-- // Token: 0x060006CE RID: 1742 RVA: 0x00033D17 File Offset: 0x00031F17- [DebuggerHidden]- [EditorBrowsable(EditorBrowsableState.Never)]- public MyWebServices()- {- }- }-- // Token: 0x02000040 RID: 64- [EditorBrowsable(EditorBrowsableState.Never)]- [ComVisible(false)]- internal sealed class ThreadSafeObjectProvider<T> where T : new()- {- // Token: 0x170001F5 RID: 501- // (get) Token: 0x060006CF RID: 1743 RVA: 0x00033D24 File Offset: 0x00031F24- internal T GetInstance- {- [DebuggerHidden]- get- {- bool flag = MyProject.ThreadSafeObjectProvider<T>.m_ThreadStaticValue == null;- if (flag)- {- MyProject.ThreadSafeObjectProvider<T>.m_ThreadStaticValue = new T();- }- return MyProject.ThreadSafeObjectProvider<T>.m_ThreadStaticValue;- }- }-- // Token: 0x060006D0 RID: 1744 RVA: 0x00033D56 File Offset: 0x00031F56- [DebuggerHidden]- [EditorBrowsable(EditorBrowsableState.Never)]- public ThreadSafeObjectProvider()- {- }-- // Token: 0x0400038F RID: 911- [CompilerGenerated]- [ThreadStatic]- private static T m_ThreadStaticValue;- }- }-}diff --git a/Wave_Dude_2D/My/MySettings.Designer.cs b/Wave_Dude_2D/My/MySettings.Designer.csdeleted file mode 100644index effd52a..0000000--- a/Wave_Dude_2D/My/MySettings.Designer.cs+++ /dev/null@@ -1,63 +0,0 @@-using System;-using System.CodeDom.Compiler;-using System.ComponentModel;-using System.Configuration;-using System.Diagnostics;-using System.Runtime.CompilerServices;-using Microsoft.VisualBasic.CompilerServices;--namespace _2D_wave_sim_V01.My-{- // Token: 0x02000006 RID: 6- [CompilerGenerated]- [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]- [EditorBrowsable(EditorBrowsableState.Advanced)]- internal sealed partial class MySettings : ApplicationSettingsBase- {- // Token: 0x06000011 RID: 17 RVA: 0x00002260 File Offset: 0x00000460- [DebuggerNonUserCode]- [EditorBrowsable(EditorBrowsableState.Advanced)]- private static void AutoSaveSettings(object sender, EventArgs e)- {- bool saveMySettingsOnExit = MyProject.Application.SaveMySettingsOnExit;- if (saveMySettingsOnExit)- {- MySettingsProperty.Settings.Save();- }- }-- // Token: 0x17000009 RID: 9- // (get) Token: 0x06000012 RID: 18 RVA: 0x0000228C File Offset: 0x0000048C- public static MySettings Default- {- get- {- bool flag = !MySettings.addedHandler;- if (flag)- {- object obj = MySettings.addedHandlerLockObject;- ObjectFlowControl.CheckForSyncLockOnValueType(obj);- lock (obj)- {- bool flag3 = !MySettings.addedHandler;- if (flag3)- {- MyProject.Application.Shutdown += MySettings.AutoSaveSettings;- MySettings.addedHandler = true;- }- }- }- return MySettings.defaultInstance;- }- }-- // Token: 0x04000008 RID: 8- private static MySettings defaultInstance = (MySettings)SettingsBase.Synchronized(new MySettings());-- // Token: 0x04000009 RID: 9- private static bool addedHandler;-- // Token: 0x0400000A RID: 10- private static object addedHandlerLockObject = RuntimeHelpers.GetObjectValue(new object());- }-}diff --git a/Wave_Dude_2D/My/MySettings.settings b/Wave_Dude_2D/My/MySettings.settingsdeleted file mode 100644index 6108185..0000000--- a/Wave_Dude_2D/My/MySettings.settings+++ /dev/null@@ -1,5 +0,0 @@-<?xml version='1.0' encoding='utf-8'?>-<SettingsFile CurrentProfile="(Default)" GeneratedClassNamespace="_2D_wave_sim_V01.My" GeneratedClassName="MySettings" xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings">- <Profiles />- <Settings />-</SettingsFile>\ No newline at end of filediff --git a/Wave_Dude_2D/My/MySettingsProperty.cs b/Wave_Dude_2D/My/MySettingsProperty.csdeleted file mode 100644index 990dd01..0000000--- a/Wave_Dude_2D/My/MySettingsProperty.cs+++ /dev/null@@ -1,28 +0,0 @@-using System;-using System.ComponentModel.Design;-using System.Diagnostics;-using System.Runtime.CompilerServices;-using Microsoft.VisualBasic;-using Microsoft.VisualBasic.CompilerServices;--namespace _2D_wave_sim_V01.My-{- // Token: 0x02000007 RID: 7- [StandardModule]- [HideModuleName]- [DebuggerNonUserCode]- [CompilerGenerated]- internal sealed class MySettingsProperty- {- // Token: 0x1700000A RID: 10- // (get) Token: 0x06000013 RID: 19 RVA: 0x00002318 File Offset: 0x00000518- [HelpKeyword("My.Settings")]- internal static MySettings Settings- {- get- {- return MySettings.Default;- }- }- }-}diff --git a/Wave_Dude_2D/My/Resources/_2D_wave_sim_V01.Resources.Designer.cs b/Wave_Dude_2D/My/Resources/_2D_wave_sim_V01.Resources.Designer.csdeleted file mode 100644index f6dea1c..0000000--- a/Wave_Dude_2D/My/Resources/_2D_wave_sim_V01.Resources.Designer.cs+++ /dev/null@@ -1,72 +0,0 @@-using System;-using System.CodeDom.Compiler;-using System.ComponentModel;-using System.Diagnostics;-using System.Drawing;-using System.Globalization;-using System.Resources;-using System.Runtime.CompilerServices;-using Microsoft.VisualBasic;-using Microsoft.VisualBasic.CompilerServices;--namespace _2D_wave_sim_V01.My.Resources-{- // Token: 0x02000005 RID: 5- [StandardModule]- [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]- [DebuggerNonUserCode]- [CompilerGenerated]- [HideModuleName]- internal sealed class Resources- {- // Token: 0x17000006 RID: 6- // (get) Token: 0x0600000B RID: 11 RVA: 0x00002198 File Offset: 0x00000398- [EditorBrowsable(EditorBrowsableState.Advanced)]- internal static ResourceManager ResourceManager- {- get- {- bool flag = object.ReferenceEquals(Resources.resourceMan, null);- if (flag)- {- ResourceManager resourceManager = new ResourceManager("_2D_wave_sim_V01.Resources", typeof(Resources).Assembly);- Resources.resourceMan = resourceManager;- }- return Resources.resourceMan;- }- }-- // Token: 0x17000007 RID: 7- // (get) Token: 0x0600000C RID: 12 RVA: 0x000021E0 File Offset: 0x000003E0- // (set) Token: 0x0600000D RID: 13 RVA: 0x000021F7 File Offset: 0x000003F7- [EditorBrowsable(EditorBrowsableState.Advanced)]- internal static CultureInfo Culture- {- get- {- return Resources.resourceCulture;- }- set- {- Resources.resourceCulture = value;- }- }-- // Token: 0x17000008 RID: 8- // (get) Token: 0x0600000E RID: 14 RVA: 0x00002200 File Offset: 0x00000400- internal static Bitmap QR_code- {- get- {- object objectValue = RuntimeHelpers.GetObjectValue(Resources.ResourceManager.GetObject("QR-code", Resources.resourceCulture));- return (Bitmap)objectValue;- }- }-- // Token: 0x04000006 RID: 6- private static ResourceManager resourceMan;-- // Token: 0x04000007 RID: 7- private static CultureInfo resourceCulture;- }-}diff --git a/Wave_Dude_2D/My/Resources/_2D_wave_sim_V01.Resources.resx b/Wave_Dude_2D/My/Resources/_2D_wave_sim_V01.Resources.resxdeleted file mode 100644index 6691558..0000000--- a/Wave_Dude_2D/My/Resources/_2D_wave_sim_V01.Resources.resx+++ /dev/null@@ -1,134 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<root>- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />- <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" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </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" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <data name="QR-code" type="System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.binary.base64">- <value>- AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0- dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJh- d2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAVg8AAAKJUE5HDQoaCgAAAA1JSERSAAAA- gAAAAIAIBgAAAMM+YcsAAAABc1JHQgCuzhzpAAAABGdBTUEAALGPC/xhBQAADwBJREFUeF7tnWuoVUUU- x/1kRJSU9MCkIEpCeoBk70zB7B0FZkGlUGFCUUFJkkZiKGgRYlBRWZRYqSRUZJSYjyizECyTyh6KhZaI- iYr1zVjtc69r/fa5s87cfc7xXF1/+H+4d83Mfpw/M2vWzJrdr1+/fgfbxZ9++ulgo/jqq69M3dtvv93Y- 58yZY+wvvPCCsd90002l63cK//zzT3OvGj/++GOpfItZ+kfLGAIoGAJoACGAtrH0j5YxBFCwYwVw5pln- 8n4qYfTo0eZiFED//v27baeeeqqxeQIgHnzwQVP+gw8+MPbzzz/f2FO84IILTF1i3rx5pToprlu3jk30- CArgmmuuYZFKOOOMM3h/h/4IARQMATQJIYCCfVYAe/bsObhy5cqGuX37dlN/zJgx5mKbN282dnm4q6++- +n/edtttxvbDDz9024TTp0839m3btplrT5482ZR/5ZVXjP2OO+4w9hTvvPPO0rNpPvzww3yJhkOHDjXt- ybNofPHFF91trV692tjkHem25B1qyDvm/aQov6GG/Ma4354FsGrVKhZO8tVXXzX1vR6gCnKdwG+//dbY- U9iwYUPp2XK4ePFiNmlwyimndJc95phjjM3rAUTYvF6KFFhWDxAC6B1DADWEAOqjzwhgzZo1LJwkBeD5- AHJzHLN64qZNm0zdZ5991rRNAdxyyy3GPn/+fNNeCr/++qsZw8877zzT1umnn17yGzRffPFFc629e/ea- 9sXh1e1peD6AvGNt9yi/oUZH+QB6FuCRs4DcHoCkc5TC+++/b+o+9NBDLGIwduxYU56zgD7TA4QACoQA- GmQIoMARIwCpzAZTpADk5rWdAnjmmWcOPv300//zscceM2VlnO2yCelYyVxa2/mS3377bWPXL104ZcoU- Y9d86aWXTFsUwMUXX1yqoykxC/6vJ7u8Aw15R/paFECuD0ABdJQPoLFjxw5TVl5yM1ElEkgBeKRYhw8f- buw5i0EUQFt7gBBAgRBAgwwBFDxiBLB169bS+JXi+vXrTf0qPsAll1xiyn7//fel62nSByAoAO0DPPHE- E8Z24YUXmrryo/B6mpdddpmpLw4ry2hW8QHkHbO9FOU31MjyAarC6wFSswD2AIsWLSqV0eQsgKAA9Czg- 77//Njb2AB4oXpLirDILqIqsHqAqQgAFQwA1hgAKdKwAhIxrV+GJJ55o2uZagLZJWR0/X7hwoWlLNnxo- +6RJk0x9CuDJJ5809UVAuv51113Xbbv22muNTcrqutKWxtKlS4195syZpv7IkSPNvX399demfs5agLwX- fa2q1G3XWPpHy5jqAXJ3BOVGArkaeMIJJ3TbBgwYYGxcDbz55puNnTuCZGFKo5mRwDaw9I+WMQRQIARQ- QwigAwSgx65W88CBA+Zh9X6ADz/80IxVw4YN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A0rU4PqbovXSW- r0LPB9Bp88ztky3ouizP/PFIH4Ck85sUQDt7AC8SSAGQ3BRKcBagyW8HE96GkFzqQ6KYGJL7vQCPXA0k- QgAhgEOFQwD1cdQKgKlhHikASSfXdq4FaBsFwP0A4uQxxq45efLkrLUAnR7+8ccfm7qk7C3Q12J6eC55- nLxu+7333jPX5n3LRhddnj4C1wKyjoqlAA5nD8AdQV4kkLOAKquBJGcBVSOBqYMiuRpI8qBIOpFNnQWE- AAqGABpkCKAx9hkByEvS44nH7du3m/o5PoBQj1XDhg0zNqaHE96eQK6DE9rGI2Ik1VyDXw8nZZ7Pd5O6- tgb3BJLPP/+8eS7G+r09gURSAFWR0wN49HoAgruCubkyhaqrgTwsupnIXQ2sNAuoihBA8xECaBAhgIJZ- Amg1cwTAxSCC5wPkkjHxZoKLQVXITaFEU53AVjMEkM8QQA8IARQIAfSSIYAC/wFb5MZUKGTT4gAAAABJ- RU5ErkJgggs=-</value>- </data>-</root>\ No newline at end of filediff --git a/Wave_Dude_2D/OpenClApi.cs b/Wave_Dude_2D/OpenClApi.csdeleted file mode 100644index a9b9c97..0000000--- a/Wave_Dude_2D/OpenClApi.cs+++ /dev/null@@ -1,337 +0,0 @@-using System;-using System.Globalization;-using System.Runtime.InteropServices;-using System.Text;--namespace _2D_wave_sim_V01-{- /// <summary>- /// The part of the OpenCL 1.2 C interface that the GPU simulation needs, called directly from OpenCL.dll (the- /// ICD loader) plus a few query helpers. OpenCL.dll is installed with the driver of the graphics card (NVIDIA,- /// Intel and AMD all install it), so no extra package is needed. Names and parameters follow the C header- /// (cl.h); <c>size_t</c> is an <see cref="IntPtr"/>, <c>cl_bitfield</c> a <c>ulong</c>, <c>cl_uint</c> a- /// <c>uint</c> and <c>cl_bool</c> a <c>uint</c>. Used by <see cref="GpuDeviceInfo"/> and- /// <see cref="GpuWaveSimulator"/>; every call returns an OpenCL error code (0 = CL_SUCCESS) that callers route- /// through <see cref="Check"/>. Loading the DLL is deferred to the first call, so- /// <see cref="DllNotFoundException"/> and friends surface there.- /// </summary>- internal sealed class OpenClApi- {- // ---- platforms and devices-- /// <summary>clGetPlatformIDs: with <paramref name="platforms"/> null only counts the platforms into <paramref name="numPlatforms"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clGetPlatformIDs(uint numEntries, IntPtr[] platforms, ref uint numPlatforms);-- /// <summary>clGetDeviceIDs: lists the devices of a platform matching <paramref name="deviceType"/> (<see cref="DeviceTypeGpu"/>); with <paramref name="devices"/> null only counts them.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clGetDeviceIDs(IntPtr platform, ulong deviceType, uint numEntries, IntPtr[] devices, ref uint numDevices);-- /// <summary>clGetDeviceInfo: raw bytes of a device property; with <paramref name="paramValue"/> null only reports the size in <paramref name="sizeRet"/>. Wrapped by <see cref="DeviceInfoBytes"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clGetDeviceInfo(IntPtr device, uint paramName, IntPtr paramSize, byte[] paramValue, ref IntPtr sizeRet);-- // ---- context, queue, program, kernels-- /// <summary>clCreateContext: creates a context for the given devices; <paramref name="properties"/> is a zero-terminated key/value list (see <see cref="ContextPlatformProperty"/>). Release with <see cref="clReleaseContext"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern IntPtr clCreateContext(IntPtr[] properties, uint numDevices, IntPtr[] devices, IntPtr notify, IntPtr userData, ref int errcode);-- /// <summary>clCreateCommandQueue (OpenCL 1.x entry point): an in-order queue on one device. Release with <see cref="clReleaseCommandQueue"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern IntPtr clCreateCommandQueue(IntPtr context, IntPtr device, ulong properties, ref int errcode);-- /// <summary>clCreateProgramWithSource: a program from ANSI source strings (<paramref name="lengths"/> null = zero-terminated). Release with <see cref="clReleaseProgram"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern IntPtr clCreateProgramWithSource(IntPtr context, uint count, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] string[] strings, IntPtr[] lengths, ref int errcode);-- /// <summary>clBuildProgram: compiles the program for the given devices; <paramref name="options"/> is passed as an ANSI string (VB-style by-ref marshalling, not modified). On failure see <see cref="BuildLog"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clBuildProgram(IntPtr program, uint numDevices, IntPtr[] devices, [MarshalAs(UnmanagedType.VBByRefStr)] ref string options, IntPtr notify, IntPtr userData);-- /// <summary>clGetProgramBuildInfo: raw bytes of a build property such as <see cref="ProgramBuildLog"/>; with <paramref name="paramValue"/> null only reports the size.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clGetProgramBuildInfo(IntPtr program, IntPtr device, uint paramName, IntPtr paramSize, byte[] paramValue, ref IntPtr sizeRet);-- /// <summary>clCreateKernel: a kernel object for the named <c>__kernel</c> function of a built program. Release with <see cref="clReleaseKernel"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern IntPtr clCreateKernel(IntPtr program, [MarshalAs(UnmanagedType.VBByRefStr)] ref string kernelName, ref int errcode);-- /// <summary>clSetKernelArg for a buffer argument (cl_mem handle; <paramref name="argSize"/> is the pointer size).</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, EntryPoint = "clSetKernelArg", ExactSpelling = true, SetLastError = true)]- internal static extern int clSetKernelArgMem(IntPtr kernel, uint argIndex, IntPtr argSize, ref IntPtr argValue);-- /// <summary>clSetKernelArg for an <c>int</c> argument (<paramref name="argSize"/> = 4).</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, EntryPoint = "clSetKernelArg", ExactSpelling = true, SetLastError = true)]- internal static extern int clSetKernelArgInt(IntPtr kernel, uint argIndex, IntPtr argSize, ref int argValue);-- /// <summary>clSetKernelArg for a <c>float</c> argument (<paramref name="argSize"/> = 4).</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, EntryPoint = "clSetKernelArg", ExactSpelling = true, SetLastError = true)]- internal static extern int clSetKernelArgFloat(IntPtr kernel, uint argIndex, IntPtr argSize, ref float argValue);-- // ---- memory and execution-- /// <summary>clCreateBuffer: a device buffer of <paramref name="size"/> bytes with the given CL_MEM flags (<see cref="MemReadWrite"/>). Release with <see cref="clReleaseMemObject"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern IntPtr clCreateBuffer(IntPtr context, ulong flags, IntPtr size, IntPtr hostPtr, ref int errcode);-- /// <summary>clEnqueueWriteBuffer from a float array; <paramref name="blocking"/> 1 waits for completion, <paramref name="offset"/>/<paramref name="size"/> are in bytes.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, EntryPoint = "clEnqueueWriteBuffer", ExactSpelling = true, SetLastError = true)]- internal static extern int clEnqueueWriteBufferFloat(IntPtr queue, IntPtr buffer, uint blocking, IntPtr offset, IntPtr size, float[] data, uint numEvents, IntPtr waitList, IntPtr evt);-- /// <summary>clEnqueueWriteBuffer from an int array; <paramref name="blocking"/> 1 waits for completion, <paramref name="offset"/>/<paramref name="size"/> are in bytes.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, EntryPoint = "clEnqueueWriteBuffer", ExactSpelling = true, SetLastError = true)]- internal static extern int clEnqueueWriteBufferInt(IntPtr queue, IntPtr buffer, uint blocking, IntPtr offset, IntPtr size, int[] data, uint numEvents, IntPtr waitList, IntPtr evt);-- /// <summary>clEnqueueReadBuffer into a float array; <paramref name="blocking"/> 1 waits for completion, <paramref name="offset"/>/<paramref name="size"/> are in bytes.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, EntryPoint = "clEnqueueReadBuffer", ExactSpelling = true, SetLastError = true)]- internal static extern int clEnqueueReadBufferFloat(IntPtr queue, IntPtr buffer, uint blocking, IntPtr offset, IntPtr size, float[] data, uint numEvents, IntPtr waitList, IntPtr evt);-- /// <summary>clEnqueueNDRangeKernel: launches the kernel over a <paramref name="workDim"/>-dimensional range; <paramref name="localSize"/> null lets the driver pick the work-group size.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clEnqueueNDRangeKernel(IntPtr queue, IntPtr kernel, uint workDim, IntPtr[] globalOffset, IntPtr[] globalSize, IntPtr[] localSize, uint numEvents, IntPtr waitList, IntPtr evt);-- /// <summary>clFinish: blocks until every command queued so far has completed.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clFinish(IntPtr queue);-- // ---- release-- /// <summary>clReleaseMemObject: drops a reference to a buffer created by <see cref="clCreateBuffer"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clReleaseMemObject(IntPtr memObj);-- /// <summary>clReleaseKernel: drops a reference to a kernel created by <see cref="clCreateKernel"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clReleaseKernel(IntPtr kernel);-- /// <summary>clReleaseProgram: drops a reference to a program created by <see cref="clCreateProgramWithSource"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clReleaseProgram(IntPtr program);-- /// <summary>clReleaseCommandQueue: drops a reference to a queue created by <see cref="clCreateCommandQueue"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clReleaseCommandQueue(IntPtr queue);-- /// <summary>clReleaseContext: drops a reference to a context created by <see cref="clCreateContext"/>.</summary>- [DllImport("OpenCL.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]- internal static extern int clReleaseContext(IntPtr context);-- // ---- helpers-- /// <summary>Throws if an OpenCL call did not return CL_SUCCESS.</summary>- /// <param name="code">Return value or errcode output of the OpenCL call.</param>- /// <param name="what">Name of the call, used in the exception message.</param>- /// <exception cref="InvalidOperationException"><paramref name="code"/> is not 0; the message includes <see cref="ErrorName"/>.</exception>- internal static void Check(int code, string what)- {- if (code != 0)- {- throw new InvalidOperationException(what + " failed: " + OpenClApi.ErrorName(code));- }- }-- /// <summary>Human-readable name of an OpenCL error code, e.g. "CL_INVALID_VALUE (-30)"; unknown codes give "error (code)".</summary>- internal static string ErrorName(int code)- {- string name;- switch (code)- {- case -1:- name = "CL_DEVICE_NOT_FOUND";- break;- case -2:- name = "CL_DEVICE_NOT_AVAILABLE";- break;- case -3:- name = "CL_COMPILER_NOT_AVAILABLE";- break;- case -4:- name = "CL_MEM_OBJECT_ALLOCATION_FAILURE (out of GPU memory)";- break;- case -5:- name = "CL_OUT_OF_RESOURCES";- break;- case -6:- name = "CL_OUT_OF_HOST_MEMORY";- break;- case -11:- name = "CL_BUILD_PROGRAM_FAILURE";- break;- case -30:- name = "CL_INVALID_VALUE";- break;- case -33:- name = "CL_INVALID_DEVICE";- break;- case -34:- name = "CL_INVALID_CONTEXT";- break;- case -36:- name = "CL_INVALID_COMMAND_QUEUE";- break;- case -38:- name = "CL_INVALID_MEM_OBJECT";- break;- case -45:- name = "CL_INVALID_PROGRAM_EXECUTABLE";- break;- case -46:- name = "CL_INVALID_KERNEL_NAME";- break;- case -48:- name = "CL_INVALID_KERNEL";- break;- case -49:- name = "CL_INVALID_ARG_INDEX";- break;- case -50:- name = "CL_INVALID_ARG_VALUE";- break;- case -51:- name = "CL_INVALID_ARG_SIZE";- break;- case -52:- name = "CL_INVALID_KERNEL_ARGS";- break;- case -54:- name = "CL_INVALID_WORK_GROUP_SIZE";- break;- case -55:- name = "CL_INVALID_WORK_ITEM_SIZE";- break;- case -61:- name = "CL_INVALID_BUFFER_SIZE";- break;- case -1001:- // Returned by the ICD loader when no vendor driver is registered.- name = "no OpenCL platform (CL_PLATFORM_NOT_FOUND_KHR)";- break;- default:- name = "error";- break;- }- return name + " (" + code.ToString(CultureInfo.InvariantCulture) + ")";- }-- /// <summary>Raw bytes of a clGetDeviceInfo query (size probed first), or null if either call fails or the value is empty.</summary>- /// <param name="device">OpenCL device handle.</param>- /// <param name="paramName">A CL_DEVICE_* constant such as <see cref="DeviceName"/>.</param>- internal static byte[] DeviceInfoBytes(IntPtr device, uint paramName)- {- IntPtr sizeRet = IntPtr.Zero;- if (OpenClApi.clGetDeviceInfo(device, paramName, IntPtr.Zero, null, ref sizeRet) != 0)- {- return null;- }- int size = sizeRet.ToInt32();- if (size <= 0)- {- return null;- }- byte[] value = new byte[size];- IntPtr ignored = IntPtr.Zero;- if (OpenClApi.clGetDeviceInfo(device, paramName, new IntPtr(size), value, ref ignored) != 0)- {- return null;- }- return value;- }-- /// <summary>A string device property decoded as ASCII with the terminating NUL and padding trimmed; "" when the query fails.</summary>- internal static string DeviceString(IntPtr device, uint paramName)- {- byte[] bytes = OpenClApi.DeviceInfoBytes(device, paramName);- return bytes == null ? "" : Encoding.ASCII.GetString(bytes).Trim(new char[] { '\0', ' ' });- }-- /// <summary>- /// A numeric device property: 8-byte values (cl_ulong) are returned as is, 4-byte values (cl_uint, cl_bool)- /// are widened; 0 when the query fails or the value is shorter than 4 bytes.- /// </summary>- internal static ulong DeviceNumber(IntPtr device, uint paramName)- {- byte[] bytes = OpenClApi.DeviceInfoBytes(device, paramName);- if (bytes == null)- {- return 0UL;- }- if (bytes.Length >= 8)- {- return BitConverter.ToUInt64(bytes, 0);- }- if (bytes.Length >= 4)- {- return BitConverter.ToUInt32(bytes, 0);- }- return 0UL;- }-- /// <summary>The compiler log for a program on a device (CL_PROGRAM_BUILD_LOG, trimmed); empty if unavailable or if the query throws.</summary>- internal static string BuildLog(IntPtr program, IntPtr device)- {- try- {- IntPtr sizeRet = IntPtr.Zero;- if (OpenClApi.clGetProgramBuildInfo(program, device, OpenClApi.ProgramBuildLog, IntPtr.Zero, null, ref sizeRet) != 0)- {- return "";- }- int size = sizeRet.ToInt32();- if (size <= 0)- {- return "";- }- byte[] log = new byte[size];- IntPtr ignored = IntPtr.Zero;- if (OpenClApi.clGetProgramBuildInfo(program, device, OpenClApi.ProgramBuildLog, new IntPtr(size), log, ref ignored) != 0)- {- return "";- }- return Encoding.ASCII.GetString(log).Trim(new char[] { '\0', ' ', '\r', '\n' });- }- catch (Exception)- {- return "";- }- }-- // ---- constants, spelled as in cl.h-- /// <summary>CL_DEVICE_TYPE_GPU (1 << 2).</summary>- internal const ulong DeviceTypeGpu = 4UL;-- /// <summary>CL_MEM_READ_WRITE (1 << 0) buffer flag.</summary>- internal const ulong MemReadWrite = 1UL;-- /// <summary>CL_CONTEXT_PLATFORM (0x1084): property key for the platform in <see cref="clCreateContext"/>.</summary>- internal const int ContextPlatformProperty = 0x1084;-- /// <summary>CL_PLATFORM_NAME (0x0902).</summary>- internal const uint PlatformNameInfo = 0x902U;-- /// <summary>CL_DEVICE_MAX_COMPUTE_UNITS (0x1002), cl_uint.</summary>- internal const uint DeviceMaxComputeUnits = 0x1002U;-- /// <summary>CL_DEVICE_MAX_CLOCK_FREQUENCY (0x100C), cl_uint in MHz.</summary>- internal const uint DeviceMaxClockFrequency = 0x100CU;-- /// <summary>CL_DEVICE_MAX_MEM_ALLOC_SIZE (0x1010), cl_ulong bytes.</summary>- internal const uint DeviceMaxMemAllocSize = 0x1010U;-- /// <summary>CL_DEVICE_GLOBAL_MEM_SIZE (0x101F), cl_ulong bytes.</summary>- internal const uint DeviceGlobalMemSize = 0x101FU;-- /// <summary>CL_DEVICE_NAME (0x102B), string.</summary>- internal const uint DeviceName = 0x102BU;-- /// <summary>CL_DEVICE_VENDOR (0x102C), string.</summary>- internal const uint DeviceVendor = 0x102CU;-- /// <summary>CL_DEVICE_HOST_UNIFIED_MEMORY (0x1035), cl_bool: non-zero for devices sharing host memory (integrated GPUs).</summary>- internal const uint DeviceHostUnifiedMemory = 0x1035U;-- /// <summary>CL_PROGRAM_BUILD_LOG (0x1183), string.</summary>- internal const uint ProgramBuildLog = 0x1183U;- }-}diff --git a/Wave_Dude_2D/ProbeBoxSize.cs b/Wave_Dude_2D/ProbeBoxSize.csdeleted file mode 100644index d13d00f..0000000--- a/Wave_Dude_2D/ProbeBoxSize.cs+++ /dev/null@@ -1,22 +0,0 @@-namespace _2D_wave_sim_V01-{- /// <summary>- /// Nominal size of a probe's graph box in canvas pixels (<c>ProbeGraphPainter.NominalBoxSize</c>).- /// The box is shrunk to fit half the canvas width and the full canvas height- /// (<c>ProbeGraphPainter.BoxInCanvas</c>). The numeric value is the index of the "box size"- /// combo box on the Probes tab.- /// </summary>- public enum ProbeBoxSize- {- /// <summary>200 x 100 canvas pixels.</summary>- Tiny = 0,- /// <summary>300 x 150 canvas pixels.</summary>- Small = 1,- /// <summary>400 x 200 canvas pixels (default).</summary>- Medium = 2,- /// <summary>500 x 250 canvas pixels.</summary>- Large = 3,- /// <summary>700 x 350 canvas pixels.</summary>- ExtraLarge = 4- }-}diff --git a/Wave_Dude_2D/ProbeCollector.cs b/Wave_Dude_2D/ProbeCollector.csdeleted file mode 100644index 4a06ab3..0000000--- a/Wave_Dude_2D/ProbeCollector.cs+++ /dev/null@@ -1,160 +0,0 @@-using System.Collections.Generic;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Accumulates probe samples and line profiles from the engine into <see cref="ProbeTrace"/>s and hands- /// incremental batches to the UI. Lives entirely on the simulation worker thread (<c>SimulationRunner.Run</c>):- /// <see cref="Collect"/> / <see cref="CollectProfiles"/> are called after every visualised step and about every- /// 50 ms; <see cref="TakeForUi"/> then packages what arrived since the previous batch into a- /// <see cref="ProbeUpdate"/>, which the runner raises as <c>ProbesUpdated</c> and the form applies to its own- /// traces on the UI thread. The UI thread never touches this object itself; the only cross-thread reader of- /// <see cref="Traces"/> is <c>SimulationRunner.RenderCurrentFrame</c>, which runs while the worker is parked- /// at the pause gate.- /// </summary>- internal sealed class ProbeCollector- {- /// <summary>Creates one empty <see cref="ProbeTrace"/> and one pending sample list per probe of <paramref name="sampler"/>.</summary>- public ProbeCollector(ProbeSampler sampler)- {- _pending = new List<List<float>>();- _sampler = sampler;- Traces = new ProbeTrace[sampler.Count];- _totals = new double[sampler.Count];- _fresh = new bool[sampler.Count];- for (int i = 0; i < sampler.Count; i++)- {- Traces[i] = new ProbeTrace();- _pending.Add(new List<float>());- }- }-- /// <summary>- /// Drains the engine's buffered point-probe samples (<see cref="IWaveEngine.TakeProbeSamples"/>, one value- /// per step since the previous call) into the series traces and the pending UI batch. For cumulative- /// probes (point + IntegratedIntensity) the per-step intensities are replaced in place by their running- /// sum, which stays at 0 for steps before the probe's start step. Does nothing when there are no point- /// probes.- /// </summary>- /// <param name="engine">Engine that buffered the samples since the previous call.</param>- /// <param name="stepsDone">Steps completed so far; recorded as <see cref="ProbeTrace.StepsSampled"/>.</param>- public void Collect(IWaveEngine engine, int stepsDone)- {- if (!_sampler.HasSeries)- {- return;- }- float[][] samples = engine.TakeProbeSamples();- // the number of steps already processed before this batch, so the absolute step of values[j] can be worked- // out below (one value per step, in order) - needed to purge a cumulative total from before "start after step"- int batchStartStep = _lastStepsDone;- for (int i = 0; i < _sampler.Count; i++)- {- if (_sampler.IsProfile[i] || i >= samples.Length)- {- continue;- }- float[] values = samples[i];- if (values == null || values.Length == 0)- {- continue;- }- if (_sampler.Cumulative[i])- {- bool useStartAfterStep = _sampler.UseStartAfterStep[i];- int startAfterStep = _sampler.StartAfterStep[i];- for (int j = 0; j < values.Length; j++)- {- // sample j belongs to step batchStartStep + j + 1 (one sample per step)- if (useStartAfterStep && batchStartStep + j + 1 < startAfterStep)- {- // before recording starts: keep the running total at zero, purging any intensity that- // arrived earlier, so the total does not jump the moment recording starts- _totals[i] = 0.0;- values[j] = 0f;- }- else- {- _totals[i] += values[j];- values[j] = (float)_totals[i];- }- }- }- Traces[i].Series.Add(values);- Traces[i].StepsSampled = stepsDone;- _pending[i].AddRange(values);- }- _lastStepsDone = stepsDone;- }-- /// <summary>- /// Reads the current line-probe profiles from the engine (<see cref="IWaveEngine.ReadProbeProfiles"/>),- /// stores them in the traces and marks them as fresh for the next <see cref="TakeForUi"/>. Does nothing- /// when there are no line probes. The runner only calls this when a frame or UI batch actually needs the- /// profiles, since the GPU engine has to read them back from the device.- /// </summary>- /// <param name="engine">Engine holding the current profiles.</param>- /// <param name="stepsDone">Steps completed so far; recorded as <see cref="ProbeTrace.StepsSampled"/>.</param>- public void CollectProfiles(IWaveEngine engine, int stepsDone)- {- if (!_sampler.HasProfiles)- {- return;- }- float[][] profiles = engine.ReadProbeProfiles();- for (int i = 0; i < _sampler.Count; i++)- {- if (!_sampler.IsProfile[i] || i >= profiles.Length || profiles[i] == null)- {- continue;- }- Traces[i].SetProfile(profiles[i], _sampler.Lengths[i]);- Traces[i].StepsSampled = stepsDone;- _fresh[i] = true;- }- _lastStepsDone = stepsDone;- }-- /// <summary>- /// Drains the pending series samples and any freshly updated profiles into a <see cref="ProbeUpdate"/> for- /// the UI thread. Sample arrays are copied; profile arrays are handed over by reference, which is safe- /// because the engine allocates a new array on every read and nobody writes to it afterwards.- /// </summary>- /// <returns>A batch covering everything since the previous call; never null.</returns>- public ProbeUpdate TakeForUi()- {- int count = _sampler.Count;- float[][] samples = new float[count][];- float[][] profiles = new float[count][];- for (int i = 0; i < count; i++)- {- samples[i] = _pending[i].ToArray();- _pending[i].Clear();- if (_fresh[i])- {- profiles[i] = Traces[i].Profile;- _fresh[i] = false;- }- }- return new ProbeUpdate(samples, profiles, _sampler.Lengths, _lastStepsDone);- }-- /// <summary>Worker-side trace per probe (index parallel to the sampler). Read by <see cref="ProbeOverlay.Burn"/> when burning graphs into exported frames.</summary>- public readonly ProbeTrace[] Traces;-- /// <summary>Per-probe pixel indices, flags and line lengths; immutable.</summary>- private readonly ProbeSampler _sampler;-- /// <summary>Per probe: running sum for cumulative point probes, kept in double to limit drift; unused entries stay 0.</summary>- private readonly double[] _totals;-- /// <summary>Per probe: series values collected since the last <see cref="TakeForUi"/>.</summary>- private readonly List<List<float>> _pending;-- /// <summary>Per probe: true when a new profile arrived since the last <see cref="TakeForUi"/>.</summary>- private readonly bool[] _fresh;-- /// <summary>Steps completed at the most recent collect call; numbers the samples of the next batch and is reported as <see cref="ProbeUpdate.StepsDone"/>.</summary>- private int _lastStepsDone;- }-}diff --git a/Wave_Dude_2D/ProbeGraphPainter.cs b/Wave_Dude_2D/ProbeGraphPainter.csdeleted file mode 100644index d8ee942..0000000--- a/Wave_Dude_2D/ProbeGraphPainter.cs+++ /dev/null@@ -1,823 +0,0 @@-using System;-using System.Collections.Generic;-using System.Drawing;-using System.Drawing.Drawing2D;-using System.Drawing.Text;-using System.Globalization;--namespace _2D_wave_sim_V01-{- /// <summary>- /// GDI+ rendering of probe graphs (a little box with axes and the measured curve) and of the probe position markers:- /// <list type="bullet">- /// <item><description>Point probe: value (Y) against the simulation step (X).</description></item>- /// <item><description>Line probe: value (Y) against the position on the line A-B in pixels (X), at the current step.</description></item>- /// </list>- /// Stateless: every call draws onto the <see cref="Graphics"/> it is given. Used on the UI thread by the- /// main form's paint handlers (painting the form's own copies of the traces onto the picture boxes) and on- /// the simulation worker thread by <see cref="ProbeOverlay"/> (painting the collector's traces into an- /// off-screen bitmap). A <see cref="ProbeTrace"/> must only be painted by the thread that owns it.- /// </summary>- internal sealed class ProbeGraphPainter- {- private ProbeGraphPainter()- {- }-- /// <summary>Unscaled graph box size in canvas pixels for a box size setting; Medium (and any unknown value) is 400 x 200.</summary>- public static Size NominalBoxSize(ProbeBoxSize boxSize)- {- switch (boxSize)- {- case ProbeBoxSize.Tiny:- return new Size(200, 100);- case ProbeBoxSize.Small:- return new Size(300, 150);- case ProbeBoxSize.Large:- return new Size(500, 250);- case ProbeBoxSize.ExtraLarge:- return new Size(700, 350);- }- return new Size(400, 200);- }-- /// <summary>- /// Graph box rectangle for a probe, shrunk (keeping its aspect ratio) so it fits into half the canvas width- /// and the full canvas height, and clamped to stay inside the canvas.- /// </summary>- /// <param name="probe">Settings providing the box size and the wanted box position.</param>- /// <param name="w">Canvas width in pixels.</param>- /// <param name="h">Canvas height in pixels.</param>- /// <returns>The box in canvas pixel coordinates, never smaller than 1 x 1.</returns>- public static Rectangle BoxInCanvas(ProbeSettings probe, int w, int h)- {- Size nominal = ProbeGraphPainter.NominalBoxSize(probe.BoxSize);- double scale = 1.0;- if (nominal.Width > w / 2.0)- {- scale = Math.Min(scale, w / 2.0 / nominal.Width);- }- if (nominal.Height > h)- {- scale = Math.Min(scale, (double)h / nominal.Height);- }- int boxWidth = Math.Max(1, (int)Math.Round(nominal.Width * scale));- int boxHeight = Math.Max(1, (int)Math.Round(nominal.Height * scale));- int boxX = Math.Max(0, Math.Min(w - boxWidth, probe.BoxX));- int boxY = Math.Max(0, Math.Min(h - boxHeight, probe.BoxY));- return new Rectangle(boxX, boxY, boxWidth, boxHeight);- }-- /// <summary>- /// Computes the axis ranges of a probe graph. For series graphs x is the step number (sample i sits at- /// x = i + 1), spanning either the whole run or a running window; for line profiles x is the distance along- /// the line in canvas pixels. y comes from the probe's fixed YMin/YMax (falling back to -1..1 when the- /// range is empty or inverted) or, with AutoScaleY, from the visible data plus a small margin.- /// Also used by the form to freeze auto-scaled y limits into the probe settings.- /// </summary>- /// <param name="probe">Settings that select kind, scale mode, fixed y range and auto-scaling.</param>- /// <param name="trace">Recorded data; may be null, which yields the ranges of an empty graph.</param>- /// <param name="totalSteps">Total steps of the run; upper x limit of full-scale series graphs without AutoScaleX.</param>- /// <param name="xMin">Receives the lower x limit.</param>- /// <param name="xMax">Receives the upper x limit, always greater than <paramref name="xMin"/>.</param>- /// <param name="yMin">Receives the lower y limit.</param>- /// <param name="yMax">Receives the upper y limit, always greater than <paramref name="yMin"/>.</param>- public static void ComputeRanges(ProbeSettings probe, ProbeTrace trace, int totalSteps, ref double xMin, ref double xMax, ref double yMin, ref double yMax)- {- if (probe.Kind == ProbeKind.Line)- {- ProbeGraphPainter.ProfileRanges(probe, trace, ref xMin, ref xMax, ref yMin, ref yMax);- }- else- {- ProbeSeries series = (trace != null) ? trace.Series : null;- double startStep = probe.UseStartAfterStep ? Math.Max(0, probe.StartAfterStep) : 0.0;- ProbeGraphPainter.SeriesRanges(probe, series, totalSteps, startStep, ref xMin, ref xMax, ref yMin, ref yMax);- }- }-- /// <summary>- /// Ranges of a time-series graph. Full mode spans from <paramref name="startStep"/> to the sample count- /// (AutoScaleX) or to the run length. Running mode shows a window of <c>RunningWindow</c> (at least 10)- /// steps that slides with the data; with AutoScaleX it starts narrow and grows to full width, otherwise it- /// is full width from the start. With AutoScaleY the y range is fitted to the samples inside the x range.- /// When "start after step" is used, the values from before that step are trimmed off: xMin never goes- /// below it, so the visible range starts there (with more room for the data that follows, especially with- /// the full scale, which would otherwise show mostly empty space before the data starts).- /// </summary>- /// <param name="probe">Settings that select scale mode, running window, fixed y range and auto-scaling.</param>- /// <param name="series">Sampled values; null is treated as empty.</param>- /// <param name="totalSteps">Total steps of the run.</param>- /// <param name="startStep">First step shown: the probe's start-after step, or 0.</param>- /// <param name="xMin">Receives the lower x limit.</param>- /// <param name="xMax">Receives the upper x limit.</param>- /// <param name="yMin">Receives the lower y limit.</param>- /// <param name="yMax">Receives the upper y limit.</param>- private static void SeriesRanges(ProbeSettings probe, ProbeSeries series, int totalSteps, double startStep, ref double xMin, ref double xMax, ref double yMin, ref double yMax)- {- int count = (series == null) ? 0 : series.Count;- double sampleCount = count;- if (probe.ScaleMode == ProbeScaleMode.Full)- {- xMin = startStep;- xMax = probe.AutoScaleX ? Math.Max(sampleCount, startStep + 1.0) : Math.Max(totalSteps, startStep + 1.0);- }- else- {- double window = Math.Max(10, probe.RunningWindow);- if (probe.AutoScaleX)- {- xMax = Math.Max(sampleCount, startStep + 1.0);- xMin = Math.Max(startStep, xMax - window);- }- else- {- xMax = Math.Max(sampleCount, startStep + window);- xMin = Math.Max(startStep, xMax - window);- }- }- if (xMax <= xMin)- {- xMax = xMin + 1.0;- }- yMin = probe.YMin;- yMax = probe.YMax;- // written this way round so a NaN limit also falls back- if (!(yMax > yMin))- {- yMin = -1.0;- yMax = 1.0;- }- if (probe.AutoScaleY && count > 0)- {- int firstIndex = Math.Max(0, (int)Math.Floor(xMin) - 1);- int lastIndex = Math.Min(count - 1, (int)Math.Ceiling(xMax));- double lo = double.MaxValue;- double hi = double.MinValue;- float[] values = series.Values;- for (int i = firstIndex; i <= lastIndex; i++)- {- float value = values[i];- if (!float.IsNaN(value) && !float.IsInfinity(value))- {- if (value < lo)- {- lo = value;- }- if (value > hi)- {- hi = value;- }- }- }- if (lo <= hi)- {- ProbeGraphPainter.FitRange(lo, hi, false, ref yMin, ref yMax);- }- }- }-- /// <summary>- /// Ranges of a line-profile graph: x spans 0..line length in canvas pixels (0..1 without a trace); y is the- /// fixed range or, with AutoScaleY, fitted to the profile values. Intensity profiles that are entirely- /// non-negative are fitted from 0 upwards.- /// </summary>- /// <param name="probe">Settings providing the fixed y range, auto-scaling and measurement.</param>- /// <param name="trace">Recorded data; null yields an empty graph.</param>- /// <param name="xMin">Receives the lower x limit (always 0).</param>- /// <param name="xMax">Receives the upper x limit.</param>- /// <param name="yMin">Receives the lower y limit.</param>- /// <param name="yMax">Receives the upper y limit.</param>- private static void ProfileRanges(ProbeSettings probe, ProbeTrace trace, ref double xMin, ref double xMax, ref double yMin, ref double yMax)- {- double profileLength = 0.0;- float[] profile = null;- if (trace != null)- {- profileLength = trace.ProfileLength;- profile = trace.Profile;- }- xMin = 0.0;- xMax = (profileLength > 0.0) ? profileLength : 1.0;- yMin = probe.YMin;- yMax = probe.YMax;- // written this way round so a NaN limit also falls back- if (!(yMax > yMin))- {- yMin = -1.0;- yMax = 1.0;- }- if (probe.AutoScaleY && profile != null)- {- double lo = double.MaxValue;- double hi = double.MinValue;- for (int i = 0; i < profile.Length; i++)- {- float value = profile[i];- if (!float.IsNaN(value) && !float.IsInfinity(value))- {- if (value < lo)- {- lo = value;- }- if (value > hi)- {- hi = value;- }- }- }- if (lo <= hi)- {- // an intensity starts at zero- ProbeGraphPainter.FitRange(lo, hi, probe.Measurement != ProbeMeasurement.Amplitude && lo >= 0.0, ref yMin, ref yMax);- }- }- }-- /// <summary>- /// Expands [lo, hi] by an 8% margin so the curve does not touch the plot border. A (nearly) flat range- /// gets a margin of 10% of its magnitude (at least 1e-6) instead, so it never collapses to zero height.- /// </summary>- /// <param name="lo">Smallest data value.</param>- /// <param name="hi">Largest data value, not below <paramref name="lo"/>.</param>- /// <param name="zeroBased">When true the lower limit is pinned to 0 instead of lo minus the margin.</param>- /// <param name="yMin">Receives the lower y limit.</param>- /// <param name="yMax">Receives the upper y limit.</param>- private static void FitRange(double lo, double hi, bool zeroBased, ref double yMin, ref double yMax)- {- double span = hi - lo;- double magnitude = Math.Max(Math.Abs(hi), Math.Abs(lo));- double margin = span * 0.08;- if (span < magnitude * 1E-09 || span < 1E-30)- {- margin = Math.Max(magnitude * 0.1, 1E-06);- }- yMin = zeroBased ? 0.0 : (lo - margin);- yMax = hi + margin;- }-- /// <summary>- /// Returns "nice" (1/2/5 x 10^n) tick positions covering [lo, hi], at most 40 of them. A tick within- /// rounding distance of 0 is snapped to exactly 0 so the zero line can be recognised.- /// </summary>- /// <param name="lo">Lower end of the axis range.</param>- /// <param name="hi">Upper end of the axis range.</param>- /// <param name="target">Approximate number of ticks wanted.</param>- /// <returns>Ascending tick values; empty when the range is empty, inverted or infinite.</returns>- private static List<double> NiceTicks(double lo, double hi, int target)- {- List<double> ticks = new List<double>();- double span = hi - lo;- // written this way round so a NaN span also yields no ticks- if (!(span > 0.0) || double.IsInfinity(span))- {- return ticks;- }- double rawStep = span / Math.Max(1, target);- double magnitude = Math.Pow(10.0, Math.Floor(Math.Log10(rawStep)));- double mantissa = rawStep / magnitude;- double step;- if (mantissa < 1.5)- {- step = 1.0;- }- else if (mantissa < 3.0)- {- step = 2.0;- }- else if (mantissa < 7.0)- {- step = 5.0;- }- else- {- step = 10.0;- }- step *= magnitude;- double tick = Math.Ceiling(lo / step) * step;- int guard = 0;- while (tick <= hi + step * 1E-09 && guard < 40)- {- ticks.Add((Math.Abs(tick) < step * 1E-09) ? 0.0 : tick);- tick += step;- guard++;- }- return ticks;- }-- /// <summary>Formats an axis value with three significant digits (invariant culture); 0 is just "0".</summary>- private static string FormatTick(double v)- {- return (v == 0.0) ? "0" : v.ToString("G3", CultureInfo.InvariantCulture);- }-- /// <summary>Formats an x-axis position: as an integer when the visible <paramref name="span"/> is at least 10 units, otherwise with one decimal.</summary>- private static string FormatPosition(double v, double span)- {- return (span >= 10.0) ? Math.Round(v).ToString("0", CultureInfo.InvariantCulture) : v.ToString("0.#", CultureInfo.InvariantCulture);- }-- /// <summary>- /// Draws one complete probe graph box (background, frame, axes, curve and title bar with live readout)- /// into <paramref name="bounds"/>. Nothing is drawn when the box is smaller than 40 x 30 or the plot area- /// would be smaller than 20 x 15. A line probe with "start after step" shows neither profile nor readout- /// until <see cref="ProbeTrace.StepsSampled"/> has reached that step; series are always drawn. The- /// Graphics state is saved and restored around the call.- /// </summary>- /// <param name="g">Target surface. <paramref name="bounds"/> is in its device pixels: picture-box pixels when painting the form, bitmap pixels for exported frames.</param>- /// <param name="bounds">Outer rectangle of the graph box.</param>- /// <param name="title">Title bar text, trimmed with an ellipsis if it does not fit next to the readout.</param>- /// <param name="probe">Settings that select kind, scaling and the start-after gate.</param>- /// <param name="trace">Recorded data, or null for an empty graph.</param>- /// <param name="totalSteps">Total steps of the run, see <see cref="ComputeRanges"/>.</param>- public static void DrawGraph(Graphics g, Rectangle bounds, string title, ProbeSettings probe, ProbeTrace trace, int totalSteps)- {- if (bounds.Width < 40 || bounds.Height < 30)- {- return;- }- GraphicsState savedState = g.Save();- try- {- g.SmoothingMode = SmoothingMode.AntiAlias;- g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;- using (SolidBrush backgroundBrush = new SolidBrush(Color.FromArgb(235, 14, 16, 22)))- {- g.FillRectangle(backgroundBrush, bounds);- }- using (Pen borderPen = new Pen(Color.FromArgb(170, 200, 200, 210), 1f))- {- g.DrawRectangle(borderPen, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);- }- // Font and margins scale with the box height so small boxes stay legible.- float fontPx = Math.Max(9f, bounds.Height / 14f);- using (Font font = new Font("Segoe UI", fontPx, FontStyle.Regular, GraphicsUnit.Pixel))- {- int leftMargin = (int)Math.Ceiling(fontPx * 4.4f);- int topMargin = (int)Math.Round(fontPx * 2.3f);- int bottomMargin = (int)Math.Round(fontPx * 1.9f);- Rectangle plot = new Rectangle(bounds.X + leftMargin + 6, bounds.Y + topMargin, bounds.Width - leftMargin - 6 - 10, bounds.Height - topMargin - bottomMargin);- if (plot.Width < 20 || plot.Height < 15)- {- return;- }- // a line probe (a profile of the current instant) has nothing meaningful to show before the start step is- // reached, so it stays blank until then; a point probe (a series) is trimmed instead, see SeriesRanges- bool isLine = probe.Kind == ProbeKind.Line;- bool started = !probe.UseStartAfterStep || trace == null || trace.StepsSampled >= probe.StartAfterStep;- ProbeTrace shownTrace = started ? trace : null;- // a point probe's own range/autoscale must see the real trace (it is trimmed by "start after step" inside- // ComputeRanges/SeriesRanges, not hidden); only a line probe uses shownTrace, to stay blank until it starts- double xMin = 0.0;- double xMax = 0.0;- double yMin = 0.0;- double yMax = 0.0;- ProbeGraphPainter.ComputeRanges(probe, isLine ? shownTrace : trace, totalSteps, ref xMin, ref xMax, ref yMin, ref yMax);- ProbeGraphPainter.DrawAxes(g, font, fontPx, bounds, plot, xMin, xMax, yMin, yMax);- float lineWidth = Math.Max(1.2f, bounds.Height / 110f);- if (isLine)- {- if (shownTrace != null)- {- ProbeGraphPainter.DrawProfile(g, plot, shownTrace.Profile, yMin, yMax, lineWidth);- }- }- else if (trace != null)- {- // a point probe is trimmed (xMin), not hidden: its curve is drawn up to the current value even before- // the start step is reached (the range is then just very small)- ProbeGraphPainter.DrawCurve(g, plot, trace.Series, xMin, xMax, yMin, yMax, lineWidth);- }- ProbeGraphPainter.DrawTitle(g, font, bounds, title, ProbeGraphPainter.ValueText(isLine, isLine ? shownTrace : trace), fontPx);- }- }- finally- {- g.Restore(savedState);- }- }-- /// <summary>Short readout shown in the title bar: "max" of the profile or "=" latest series value; empty when there is no valid value.</summary>- private static string ValueText(bool isLine, ProbeTrace trace)- {- if (trace == null)- {- return "";- }- if (isLine)- {- float[] profile = trace.Profile;- if (profile == null || profile.Length == 0)- {- return "";- }- float max = float.MinValue;- for (int i = 0; i < profile.Length; i++)- {- float value = profile[i];- if (!float.IsNaN(value) && !float.IsInfinity(value) && value > max)- {- max = value;- }- }- if (max == float.MinValue)- {- return "";- }- return "max " + ProbeGraphPainter.FormatTick(max);- }- if (trace.Series.Count == 0)- {- return "";- }- float lastValue = trace.Series.LastValue;- if (float.IsNaN(lastValue) || float.IsInfinity(lastValue))- {- return "";- }- return "= " + ProbeGraphPainter.FormatTick(lastValue);- }-- /// <summary>- /// Draws grid lines and labels at the "nice" ticks of both axes (the y = 0 line brighter than the rest),- /// then the plot frame. y labels are right-aligned in the left margin, x labels centred below the plot.- /// </summary>- /// <param name="g">Target surface.</param>- /// <param name="font">Label font.</param>- /// <param name="fontPx">Font height in pixels, used to size the label rectangles.</param>- /// <param name="bounds">Whole graph box.</param>- /// <param name="plot">Plot area inside the box.</param>- /// <param name="xMin">Lower x limit.</param>- /// <param name="xMax">Upper x limit.</param>- /// <param name="yMin">Lower y limit.</param>- /// <param name="yMax">Upper y limit.</param>- private static void DrawAxes(Graphics g, Font font, float fontPx, Rectangle bounds, Rectangle plot, double xMin, double xMax, double yMin, double yMax)- {- using (Pen gridPen = new Pen(Color.FromArgb(46, 255, 255, 255), 1f))- {- using (Pen zeroPen = new Pen(Color.FromArgb(120, 255, 255, 255), 1f))- {- using (SolidBrush labelBrush = new SolidBrush(Color.FromArgb(225, 225, 225, 230)))- {- using (StringFormat yLabelFormat = new StringFormat())- {- using (StringFormat xLabelFormat = new StringFormat())- {- yLabelFormat.Alignment = StringAlignment.Far;- yLabelFormat.LineAlignment = StringAlignment.Center;- yLabelFormat.FormatFlags = StringFormatFlags.NoWrap;- xLabelFormat.Alignment = StringAlignment.Center;- xLabelFormat.FormatFlags = StringFormatFlags.NoWrap;- // value axis- foreach (double tick in ProbeGraphPainter.NiceTicks(yMin, yMax, 4))- {- float py = ProbeGraphPainter.ToPixelY(tick, plot, yMin, yMax);- g.DrawLine((tick == 0.0) ? zeroPen : gridPen, (float)plot.Left, py, (float)plot.Right, py);- g.DrawString(ProbeGraphPainter.FormatTick(tick), font, labelBrush, new RectangleF(bounds.X + 1, py - fontPx * 0.7f, plot.Left - bounds.X - 4, fontPx * 1.4f), yLabelFormat);- }- // step axis (point probe) or position on the line (line probe)- foreach (double tick in ProbeGraphPainter.NiceTicks(xMin, xMax, 5))- {- float px = (float)(plot.Left + (tick - xMin) / (xMax - xMin) * plot.Width);- g.DrawLine(gridPen, px, (float)plot.Top, px, (float)plot.Bottom);- g.DrawString(ProbeGraphPainter.FormatPosition(tick, xMax - xMin), font, labelBrush, new RectangleF(px - fontPx * 2.5f, plot.Bottom + 2, fontPx * 5f, fontPx * 1.4f), xLabelFormat);- }- }- }- }- }- using (Pen framePen = new Pen(Color.FromArgb(130, 200, 200, 210), 1f))- {- g.DrawRectangle(framePen, plot.X, plot.Y, plot.Width, plot.Height);- }- }- }-- /// <summary>- /// Maps a data value to a pixel y inside <paramref name="plot"/> (bottom edge = yMin, top edge = yMax).- /// The result is clamped to +/-30000 because GDI+ fails on coordinates far outside the surface.- /// </summary>- private static float ToPixelY(double v, Rectangle plot, double yMin, double yMax)- {- double py = plot.Bottom - (v - yMin) / (yMax - yMin) * plot.Height;- if (py < -30000.0)- {- py = -30000.0;- }- if (py > 30000.0)- {- py = 30000.0;- }- return (float)py;- }-- /// <summary>- /// Draws a time series: sample i is placed at x = i + 1 (its step number); NaN and infinite samples are- /// skipped. When there are more than two samples per pixel column, each column gets a vertical min/max- /// segment instead of individual points.- /// </summary>- /// <param name="g">Target surface.</param>- /// <param name="plot">Plot area in device pixels.</param>- /// <param name="series">Sampled values; null or empty draws nothing.</param>- /// <param name="xMin">Lower x limit in steps.</param>- /// <param name="xMax">Upper x limit in steps.</param>- /// <param name="yMin">Lower y limit.</param>- /// <param name="yMax">Upper y limit.</param>- /// <param name="lineWidth">Pen width in pixels.</param>- private static void DrawCurve(Graphics g, Rectangle plot, ProbeSeries series, double xMin, double xMax, double yMin, double yMax, float lineWidth)- {- if (series == null || series.Count < 1)- {- return;- }- float[] values = series.Values;- int count = series.Count;- int firstIndex = Math.Max(0, (int)Math.Floor(xMin) - 1);- int lastIndex = Math.Min(count - 1, (int)Math.Ceiling(xMax));- if (lastIndex < firstIndex)- {- return;- }- List<PointF> points = new List<PointF>();- int visibleCount = lastIndex - firstIndex + 1;- double xScale = plot.Width / (xMax - xMin);- if (visibleCount <= plot.Width * 2)- {- // every value gets its own point (value i belongs to step i + 1)- for (int i = firstIndex; i <= lastIndex; i++)- {- float value = values[i];- if (!float.IsNaN(value) && !float.IsInfinity(value))- {- points.Add(new PointF((float)(plot.Left + (i + 1 - xMin) * xScale), ProbeGraphPainter.ToPixelY(value, plot, yMin, yMax)));- }- }- }- else- {- for (int column = 0; column < plot.Width; column++)- {- // long arithmetic: column * visibleCount can exceed the int range for long runs- int binStart = firstIndex + (int)((long)column * (long)visibleCount / (long)plot.Width);- int binEnd = firstIndex + (int)((long)(column + 1) * (long)visibleCount / (long)plot.Width) - 1;- if (binEnd < binStart)- {- binEnd = binStart;- }- float binMin = float.MaxValue;- float binMax = float.MinValue;- int binLast = Math.Min(binEnd, lastIndex);- for (int k = binStart; k <= binLast; k++)- {- float value = values[k];- if (!float.IsNaN(value) && !float.IsInfinity(value))- {- if (value < binMin)- {- binMin = value;- }- if (value > binMax)- {- binMax = value;- }- }- }- if (binMin <= binMax)- {- float px = plot.Left + column + 0.5f;- points.Add(new PointF(px, ProbeGraphPainter.ToPixelY(binMin, plot, yMin, yMax)));- points.Add(new PointF(px, ProbeGraphPainter.ToPixelY(binMax, plot, yMin, yMax)));- }- }- }- ProbeGraphPainter.StrokePoints(g, plot, points, lineWidth);- }-- /// <summary>- /// Draws a line-probe profile stretched over the full plot width (first value at the left edge, last value- /// at the right edge), min/max binned per pixel column when dense. NaN and infinite values are skipped.- /// </summary>- /// <param name="g">Target surface.</param>- /// <param name="plot">Plot area in device pixels.</param>- /// <param name="profile">Values along the line; null or empty draws nothing.</param>- /// <param name="yMin">Lower y limit.</param>- /// <param name="yMax">Upper y limit.</param>- /// <param name="lineWidth">Pen width in pixels.</param>- private static void DrawProfile(Graphics g, Rectangle plot, float[] profile, double yMin, double yMax, float lineWidth)- {- if (profile == null || profile.Length < 1)- {- return;- }- int count = profile.Length;- List<PointF> points = new List<PointF>();- if (count <= plot.Width * 2)- {- for (int i = 0; i < count; i++)- {- float value = profile[i];- if (!float.IsNaN(value) && !float.IsInfinity(value))- {- double fraction = (count > 1) ? (i / (count - 1.0)) : 0.0;- points.Add(new PointF((float)(plot.Left + fraction * plot.Width), ProbeGraphPainter.ToPixelY(value, plot, yMin, yMax)));- }- }- }- else- {- for (int column = 0; column < plot.Width; column++)- {- int binStart = (int)((long)column * (long)count / (long)plot.Width);- int binEnd = (int)((long)(column + 1) * (long)count / (long)plot.Width) - 1;- if (binEnd < binStart)- {- binEnd = binStart;- }- float binMin = float.MaxValue;- float binMax = float.MinValue;- int binLast = Math.Min(binEnd, count - 1);- for (int k = binStart; k <= binLast; k++)- {- float value = profile[k];- if (!float.IsNaN(value) && !float.IsInfinity(value))- {- if (value < binMin)- {- binMin = value;- }- if (value > binMax)- {- binMax = value;- }- }- }- if (binMin <= binMax)- {- float px = plot.Left + column + 0.5f;- points.Add(new PointF(px, ProbeGraphPainter.ToPixelY(binMin, plot, yMin, yMax)));- points.Add(new PointF(px, ProbeGraphPainter.ToPixelY(binMax, plot, yMin, yMax)));- }- }- }- ProbeGraphPainter.StrokePoints(g, plot, points, lineWidth);- }-- /// <summary>- /// Strokes the points as one polyline clipped to the plot area; a single point is drawn as a small dot,- /// an empty list draws nothing. The previous clip region is restored afterwards.- /// </summary>- private static void StrokePoints(Graphics g, Rectangle plot, List<PointF> points, float lineWidth)- {- if (points.Count < 2)- {- if (points.Count == 1)- {- using (SolidBrush dotBrush = new SolidBrush(Color.FromArgb(255, 255, 208, 64)))- {- g.FillEllipse(dotBrush, points[0].X - 2f, points[0].Y - 2f, 4f, 4f);- }- }- return;- }- // g.Clip returns a copy that we own and must dispose.- Region savedClip = g.Clip;- try- {- g.SetClip(plot);- using (Pen curvePen = new Pen(Color.FromArgb(255, 255, 208, 64), lineWidth))- {- curvePen.LineJoin = LineJoin.Round;- g.DrawLines(curvePen, points.ToArray());- }- }- finally- {- g.Clip = savedClip;- savedClip.Dispose();- }- }-- /// <summary>- /// Draws the title strip of the box: the readout right-aligned in its own colour, then the title- /// left-aligned in the remaining width (ellipsis-trimmed), so the readout always stays visible.- /// </summary>- /// <param name="g">Target surface.</param>- /// <param name="font">Title font.</param>- /// <param name="bounds">Outer rectangle of the graph box.</param>- /// <param name="title">Title text.</param>- /// <param name="valueText">Readout from <see cref="ValueText"/>; empty draws no readout.</param>- /// <param name="fontPx">Font height in pixels, used to size the text rectangles.</param>- private static void DrawTitle(Graphics g, Font font, Rectangle bounds, string title, string valueText, float fontPx)- {- using (SolidBrush titleBrush = new SolidBrush(Color.FromArgb(240, 240, 240, 245)))- {- using (SolidBrush valueBrush = new SolidBrush(Color.FromArgb(255, 255, 208, 64)))- {- using (StringFormat valueFormat = new StringFormat())- {- using (StringFormat titleFormat = new StringFormat())- {- valueFormat.Alignment = StringAlignment.Far;- valueFormat.FormatFlags = StringFormatFlags.NoWrap;- titleFormat.Alignment = StringAlignment.Near;- titleFormat.Trimming = StringTrimming.EllipsisCharacter;- titleFormat.FormatFlags = StringFormatFlags.NoWrap;- float valueWidth = 0f;- if (valueText.Length > 0)- {- valueWidth = g.MeasureString(valueText, font).Width;- g.DrawString(valueText, font, valueBrush, new RectangleF(bounds.Right - valueWidth - 8f, bounds.Y + 3, valueWidth + 4f, fontPx * 1.4f), valueFormat);- }- g.DrawString(title, font, titleBrush, new RectangleF(bounds.X + 6, bounds.Y + 3, Math.Max(10f, bounds.Width - valueWidth - 16f), fontPx * 1.4f), titleFormat);- }- }- }- }- }-- /// <summary>- /// Draws the probe position cross(es), the connecting line (line probes) and the index label onto a- /// scaled canvas view, as used by the form's paint handlers where the canvas is shown zoomed in a picture- /// box. Canvas pixel (x, y) maps to device position origin + (x + 0.5) * scale, i.e. the marker sits on- /// the pixel centre. Point probes are labelled with the 1-based index, line probes with "nA" and "nB".- /// </summary>- /// <param name="g">Target surface.</param>- /// <param name="probe">Probe whose positions (canvas pixels) and kind are drawn.</param>- /// <param name="index">Zero-based probe index; shown as index + 1.</param>- /// <param name="originX">Device x of the canvas origin.</param>- /// <param name="originY">Device y of the canvas origin.</param>- /// <param name="scaleX">Device pixels per canvas pixel, horizontally.</param>- /// <param name="scaleY">Device pixels per canvas pixel, vertically.</param>- public static void DrawMarkers(Graphics g, ProbeSettings probe, int index, float originX, float originY, float scaleX, float scaleY)- {- float ax = originX + (probe.PosAX + 0.5f) * scaleX;- float ay = originY + (probe.PosAY + 0.5f) * scaleY;- float bx = originX + (probe.PosBX + 0.5f) * scaleX;- float by = originY + (probe.PosBY + 0.5f) * scaleY;- bool isLine = probe.Kind == ProbeKind.Line;- string label = (index + 1).ToString(CultureInfo.InvariantCulture);- GraphicsState savedState = g.Save();- try- {- g.SmoothingMode = SmoothingMode.AntiAlias;- g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;- using (Pen darkPen = new Pen(Color.FromArgb(210, 0, 0, 0), 3.5f))- {- using (Pen lightPen = new Pen(Color.White, 1.5f))- {- if (isLine)- {- g.DrawLine(darkPen, ax, ay, bx, by);- g.DrawLine(lightPen, ax, ay, bx, by);- }- ProbeGraphPainter.DrawCross(g, darkPen, lightPen, ax, ay);- if (isLine)- {- ProbeGraphPainter.DrawCross(g, darkPen, lightPen, bx, by);- }- }- }- using (Font font = new Font("Segoe UI", 13f, FontStyle.Bold, GraphicsUnit.Pixel))- {- using (SolidBrush shadowBrush = new SolidBrush(Color.FromArgb(220, 0, 0, 0)))- {- using (SolidBrush textBrush = new SolidBrush(Color.White))- {- // a line probe has two ends, so each is labelled with the probe number and which end it is- if (isLine)- {- ProbeGraphPainter.DrawNumber(g, font, shadowBrush, textBrush, label + "A", ax, ay);- ProbeGraphPainter.DrawNumber(g, font, shadowBrush, textBrush, label + "B", bx, by);- }- else- {- ProbeGraphPainter.DrawNumber(g, font, shadowBrush, textBrush, label, ax, ay);- }- }- }- }- }- finally- {- g.Restore(savedState);- }- }-- /// <summary>Draws a plus-shaped cross with arm-length arms centred on (x, y): the wide dark pen first as outline, then the thin light pen on top.</summary>- private static void DrawCross(Graphics g, Pen dark, Pen light, float x, float y)- {- const float arm = 7f;- g.DrawLine(dark, x - arm, y, x + arm, y);- g.DrawLine(dark, x, y - arm, x, y + arm);- g.DrawLine(light, x - arm, y, x + arm, y);- g.DrawLine(light, x, y - arm, x, y + arm);- }-- /// <summary>Draws a marker label above and to the right of (x, y) with a 1-pixel dark drop shadow.</summary>- private static void DrawNumber(Graphics g, Font font, Brush shadow, Brush textBrush, string text, float x, float y)- {- g.DrawString(text, font, shadow, x + 9f, y - 18f);- g.DrawString(text, font, textBrush, x + 8f, y - 19f);- }- }-}diff --git a/Wave_Dude_2D/ProbeKind.cs b/Wave_Dude_2D/ProbeKind.csdeleted file mode 100644index 4ff9b4f..0000000--- a/Wave_Dude_2D/ProbeKind.cs+++ /dev/null@@ -1,14 +0,0 @@-namespace _2D_wave_sim_V01-{- /// <summary>- /// Geometry of a probe. Stored in <see cref="ProbeSettings.Kind"/>; the numeric value is the- /// index of the "probe type" combo box on the Probes tab, so the order must not change.- /// </summary>- public enum ProbeKind- {- /// <summary>Samples the single canvas pixel at position A once per simulation step, producing a time series.</summary>- Point = 0,- /// <summary>Samples every pixel on the Bresenham line from A to B, producing a profile along the line (no time axis).</summary>- Line = 1- }-}diff --git a/Wave_Dude_2D/ProbeMeasurement.cs b/Wave_Dude_2D/ProbeMeasurement.csdeleted file mode 100644index aeabfc7..0000000--- a/Wave_Dude_2D/ProbeMeasurement.cs+++ /dev/null@@ -1,23 +0,0 @@-namespace _2D_wave_sim_V01-{- /// <summary>- /// The quantity a probe records. Which values are allowed depends on <see cref="ProbePlaceOn"/>- /// (see <see cref="ProbeSettings.Normalize"/>): amplitude only on the field picture, the two intensity- /// measurements only on the intensity picture. Every value other than <see cref="Amplitude"/> is read from- /// the intensity buffer (<c>ProbeSampler.UseIntensity</c>). The numeric value is the index of the- /// "measurement" combo box on the Probes tab.- /// </summary>- public enum ProbeMeasurement- {- /// <summary>The instantaneous field value (wave amplitude, signed) at the probe pixel(s).</summary>- Amplitude = 0,- /// <summary>The current value of the engine's running (exponentially decayed) intensity buffer at the probe pixel(s).</summary>- Intensity = 1,- /// <summary>- /// Intensity summed over simulation steps. For a point probe the running sum is formed in- /// <c>ProbeCollector</c>; for a line probe the engine keeps per-pixel totals. Accumulation- /// starts at <see cref="ProbeSettings.StartAfterStep"/> when that option is enabled.- /// </summary>- IntegratedIntensity = 2- }-}diff --git a/Wave_Dude_2D/ProbeOverlay.cs b/Wave_Dude_2D/ProbeOverlay.csdeleted file mode 100644index 60cdbfc..0000000--- a/Wave_Dude_2D/ProbeOverlay.cs+++ /dev/null@@ -1,274 +0,0 @@-using System;-using System.Collections.Generic;-using System.Drawing;-using System.Drawing.Imaging;-using System.Drawing.Text;-using System.Globalization;-using System.Runtime.InteropServices;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Burns probe markers and probe graph boxes directly into a 32-bit ARGB pixel buffer, for frames that go- /// to a video sink or into the final result and therefore have no on-screen Graphics surface. Called by- /// <c>SimulationRunner</c> on the simulation worker thread with the collector's traces- /// (<see cref="ProbeCollector.Traces"/>); also from the UI thread through- /// <c>SimulationRunner.RenderCurrentFrame</c>, but only while the worker is parked at the pause gate, so- /// the traces are never read while they are being written.- /// </summary>- internal sealed class ProbeOverlay- {- private ProbeOverlay()- {- }-- /// <summary>- /// Draws the markers and, where the box is at least 60 x 30 pixels, the graph of every active probe placed- /// on <paramref name="placeOn"/> into <paramref name="pixels"/>. The frame is the whole scene, so the box- /// is where the probe says (in scene pixels). Graphs are rendered by- /// <see cref="ProbeGraphPainter.DrawGraph"/> into a temporary premultiplied bitmap and alpha-blended in.- /// </summary>- /// <param name="pixels">Opaque ARGB frame, row-major, index y * w + x; modified in place.</param>- /// <param name="w">Frame width in pixels (equals the canvas width).</param>- /// <param name="h">Frame height in pixels.</param>- /// <param name="probes">Run probe list.</param>- /// <param name="traces">Trace per probe, index parallel to <paramref name="probes"/>.</param>- /// <param name="placeOn">Surface this frame shows; only probes placed on it are drawn.</param>- /// <param name="totalSteps">Total steps of the run, for the x-axis of full-scale series graphs.</param>- public static void Burn(int[] pixels, int w, int h, IList<ProbeSettings> probes, ProbeTrace[] traces, ProbePlaceOn placeOn, int totalSteps)- {- for (int i = 0; i < probes.Count; i++)- {- ProbeSettings probe = probes[i];- if (probe.PlaceOn != placeOn || !probe.Active)- {- continue;- }- ProbeOverlay.DrawMarkerPixels(pixels, w, h, probe, i);- Rectangle box = ProbeGraphPainter.BoxInCanvas(probe, w, h);- if (box.Width < 60 || box.Height < 30)- {- continue;- }- using (Bitmap graphBitmap = new Bitmap(box.Width, box.Height, PixelFormat.Format32bppPArgb))- {- using (Graphics g = Graphics.FromImage(graphBitmap))- {- g.Clear(Color.Transparent);- ProbeGraphPainter.DrawGraph(g, new Rectangle(0, 0, box.Width, box.Height), probe.Title(i), probe, traces[i], totalSteps);- }- ProbeOverlay.Blend(pixels, w, h, graphBitmap, box);- }- }- }-- /// <summary>- /// Alpha-blends a premultiplied-ARGB bitmap onto the pixel buffer with its top-left corner at the position- /// of <paramref name="rect"/> (buffer coordinates); parts outside the buffer are clipped. Fully transparent- /// source pixels are skipped, result pixels are always opaque.- /// </summary>- private static void Blend(int[] pixels, int w, int h, Bitmap bmp, Rectangle rect)- {- BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb);- try- {- int[] row = new int[bmp.Width];- // (x, y) is a bitmap pixel, (frameX, frameY) the frame pixel it lands on- for (int y = 0; y < bmp.Height; y++)- {- int frameY = rect.Y + y;- if (frameY < 0 || frameY >= h)- {- continue;- }- Marshal.Copy(IntPtr.Add(data.Scan0, y * data.Stride), row, 0, bmp.Width);- for (int x = 0; x < bmp.Width; x++)- {- int frameX = rect.X + x;- if (frameX < 0 || frameX >= w)- {- continue;- }- int src = row[x];- int alpha = (src >> 24) & 255;- if (alpha == 0)- {- continue;- }- int index = frameY * w + frameX;- if (alpha == 255)- {- pixels[index] = src | unchecked((int)0xFF000000);- }- else- {- // src is premultiplied: out = src + dst * (1 - alpha), rounded to nearest- int dst = pixels[index];- int inverseAlpha = 255 - alpha;- int r = Math.Min(255, ((src >> 16) & 255) + (((dst >> 16) & 255) * inverseAlpha + 127) / 255);- int gr = Math.Min(255, ((src >> 8) & 255) + (((dst >> 8) & 255) * inverseAlpha + 127) / 255);- int b = Math.Min(255, (src & 255) + ((dst & 255) * inverseAlpha + 127) / 255);- pixels[index] = unchecked((int)0xFF000000) | (r << 16) | (gr << 8) | b;- }- }- }- }- finally- {- bmp.UnlockBits(data);- }- }-- /// <summary>- /// Draws the probe cross(es) and, for line probes, the connecting line in two passes (a black outline, then- /// a thinner white core), followed by the 1-based index label ("nA"/"nB" for line probes) above and to the- /// right of each cross. Arm length and font size scale with the frame height.- /// </summary>- /// <param name="pixels">Opaque ARGB frame, modified in place.</param>- /// <param name="w">Frame width in pixels.</param>- /// <param name="h">Frame height in pixels.</param>- /// <param name="probe">Probe whose positions (canvas pixels) and kind are drawn.</param>- /// <param name="index">Zero-based probe index; shown as index + 1.</param>- private static void DrawMarkerPixels(int[] pixels, int w, int h, ProbeSettings probe, int index)- {- int arm = Math.Max(6, h / 120);- bool isLine = probe.Kind == ProbeKind.Line;- // black underneath, white on top- for (int pass = 0; pass <= 1; pass++)- {- int color = (pass == 0) ? unchecked((int)0xFF000000) : unchecked((int)0xFFFFFFFF);- int radius = (pass == 0) ? 2 : 1;- if (isLine)- {- ProbeOverlay.DrawThickLine(pixels, w, h, probe.PosAX, probe.PosAY, probe.PosBX, probe.PosBY, color, radius);- }- ProbeOverlay.DrawCrossPixels(pixels, w, h, probe.PosAX, probe.PosAY, arm, color, radius);- if (isLine)- {- ProbeOverlay.DrawCrossPixels(pixels, w, h, probe.PosBX, probe.PosBY, arm, color, radius);- }- }- // the number of the probe next to the cross; a line probe's two ends are labelled with which end they are- string label = (index + 1).ToString(CultureInfo.InvariantCulture);- float fontPx = Math.Max(12f, h / 60f);- if (isLine)- {- ProbeOverlay.BurnLabel(pixels, w, h, label + "A", probe.PosAX + arm + 2, probe.PosAY - arm - (int)Math.Round(fontPx * 1.4f), fontPx);- ProbeOverlay.BurnLabel(pixels, w, h, label + "B", probe.PosBX + arm + 2, probe.PosBY - arm - (int)Math.Round(fontPx * 1.4f), fontPx);- }- else- {- ProbeOverlay.BurnLabel(pixels, w, h, label, probe.PosAX + arm + 2, probe.PosAY - arm - (int)Math.Round(fontPx * 1.4f), fontPx);- }- }-- /// <summary>- /// Renders <paramref name="text"/> with a drop shadow into a temporary bitmap (sized with a throwaway 1 x 1- /// measuring bitmap) and blends it in with its top-left corner at (<paramref name="x"/>, <paramref name="y"/>)- /// in buffer coordinates.- /// </summary>- /// <param name="pixels">Opaque ARGB frame, modified in place.</param>- /// <param name="w">Frame width in pixels.</param>- /// <param name="h">Frame height in pixels.</param>- /// <param name="text">Label text.</param>- /// <param name="x">Left edge of the label in buffer pixels.</param>- /// <param name="y">Top edge of the label in buffer pixels.</param>- /// <param name="fontPx">Font height in pixels.</param>- private static void BurnLabel(int[] pixels, int w, int h, string text, int x, int y, float fontPx)- {- using (Font font = new Font("Segoe UI", fontPx, FontStyle.Bold, GraphicsUnit.Pixel))- {- int labelWidth;- int labelHeight;- using (Bitmap measureBitmap = new Bitmap(1, 1))- {- using (Graphics measureGraphics = Graphics.FromImage(measureBitmap))- {- SizeF textSize = measureGraphics.MeasureString(text, font);- labelWidth = (int)Math.Ceiling(textSize.Width) + 4;- labelHeight = (int)Math.Ceiling(textSize.Height) + 4;- }- }- using (Bitmap labelBitmap = new Bitmap(labelWidth, labelHeight, PixelFormat.Format32bppPArgb))- {- using (Graphics g = Graphics.FromImage(labelBitmap))- {- g.Clear(Color.Transparent);- g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;- using (SolidBrush shadowBrush = new SolidBrush(Color.FromArgb(220, 0, 0, 0)))- {- using (SolidBrush textBrush = new SolidBrush(Color.White))- {- g.DrawString(text, font, shadowBrush, 3f, 3f);- g.DrawString(text, font, textBrush, 2f, 2f);- }- }- }- ProbeOverlay.Blend(pixels, w, h, labelBitmap, new Rectangle(x, y, labelWidth, labelHeight));- }- }- }-- /// <summary>Draws a plus-shaped cross centred on (x, y) with arms of <paramref name="arm"/> pixels, using <see cref="DrawThickLine"/>.</summary>- private static void DrawCrossPixels(int[] pixels, int w, int h, int x, int y, int arm, int color, int radius)- {- ProbeOverlay.DrawThickLine(pixels, w, h, x - arm, y, x + arm, y, color, radius);- ProbeOverlay.DrawThickLine(pixels, w, h, x, y - arm, x, y + arm, color, radius);- }-- /// <summary>- /// Bresenham line from (x0, y0) to (x1, y1), both inclusive, stamped with a square brush of side- /// 2 * <paramref name="radius"/> + 1; pixels outside the buffer are skipped. Gives up after 100000 steps- /// as a safety net against runaway coordinates.- /// </summary>- /// <param name="pixels">Opaque ARGB frame, modified in place.</param>- /// <param name="w">Frame width in pixels.</param>- /// <param name="h">Frame height in pixels.</param>- /// <param name="x0">Start x in buffer pixels.</param>- /// <param name="y0">Start y in buffer pixels.</param>- /// <param name="x1">End x in buffer pixels.</param>- /// <param name="y1">End y in buffer pixels.</param>- /// <param name="color">ARGB value written to every covered pixel (no blending).</param>- /// <param name="radius">Brush half-width in pixels; 0 draws a one-pixel line.</param>- private static void DrawThickLine(int[] pixels, int w, int h, int x0, int y0, int x1, int y1, int color, int radius)- {- int dx = Math.Abs(x1 - x0);- int dy = -Math.Abs(y1 - y0);- int stepX = (x0 < x1) ? 1 : -1;- int stepY = (y0 < y1) ? 1 : -1;- int error = dx + dy;- int guard = 0;- while (true)- {- for (int oy = -radius; oy <= radius; oy++)- {- for (int ox = -radius; ox <= radius; ox++)- {- int px = x0 + ox;- int py = y0 + oy;- if (px >= 0 && px < w && py >= 0 && py < h)- {- pixels[py * w + px] = color;- }- }- }- if ((x0 == x1 && y0 == y1) || guard > 100000)- {- break;- }- guard++;- int error2 = 2 * error;- if (error2 >= dy)- {- error += dy;- x0 += stepX;- }- if (error2 <= dx)- {- error += dx;- y0 += stepY;- }- }- }- }-}diff --git a/Wave_Dude_2D/ProbePlaceOn.cs b/Wave_Dude_2D/ProbePlaceOn.csdeleted file mode 100644index 41af884..0000000--- a/Wave_Dude_2D/ProbePlaceOn.cs+++ /dev/null@@ -1,15 +0,0 @@-namespace _2D_wave_sim_V01-{- /// <summary>- /// Which simulation output a probe belongs to: it decides both the buffer that is sampled and- /// the preview picture / exported video on which the probe markers and graph box are drawn.- /// The numeric value is the index of the "place on" combo box on the Probes tab.- /// </summary>- public enum ProbePlaceOn- {- /// <summary>The wave field (amplitude) output. Only <see cref="ProbeMeasurement.Amplitude"/> is valid here.</summary>- Field = 0,- /// <summary>The intensity output. Allows <see cref="ProbeMeasurement.Intensity"/> and <see cref="ProbeMeasurement.IntegratedIntensity"/>.</summary>- Intensity = 1- }-}diff --git a/Wave_Dude_2D/ProbeSampler.cs b/Wave_Dude_2D/ProbeSampler.csdeleted file mode 100644index d0e43d8..0000000--- a/Wave_Dude_2D/ProbeSampler.cs+++ /dev/null@@ -1,205 +0,0 @@-using System;-using System.Collections.Generic;--namespace _2D_wave_sim_V01-{- /// <summary>- /// What a simulation engine has to measure for the probes: precomputed per-probe pixel indices (into the- /// padded field grid, see <see cref="IWaveEngine"/>) and what is read there, the field or the intensity.- /// <list type="bullet">- /// <item><description>Point probe: one pixel; the engine measures its value at every step (a series).</description></item>- /// <item><description>Point, integrated: the same, but the values are added up over time (done by <see cref="ProbeCollector"/>).</description></item>- /// <item><description>Line probe: the pixels on the line A-B; the engine gives the values along the line when asked (a profile).</description></item>- /// <item><description>Line, integrated: the engine adds the intensity of every pixel of the line up over the steps.</description></item>- /// </list>- /// Built once per run by <see cref="Build"/> on the simulation worker thread from the run's probe list and- /// canvas size, then handed to the engine (<see cref="IWaveEngine.SetProbes"/>) and to the- /// <see cref="ProbeCollector"/>. All per-probe arrays are indexed by the probe's position in that list.- /// Immutable after construction, so it may be read from any thread.- /// </summary>- internal sealed class ProbeSampler- {- /// <summary>Stores the per-probe arrays and derives the aggregate <see cref="NeedsIntensity"/>, <see cref="HasSeries"/> and <see cref="HasProfiles"/> flags.</summary>- private ProbeSampler(int[][] pixels, bool[] isProfile, bool[] useIntensity, bool[] cumulative, bool[] integrate, double[] lengths, bool[] useStartAfterStep, int[] startAfterStep)- {- Count = pixels.Length;- Pixels = pixels;- IsProfile = isProfile;- UseIntensity = useIntensity;- Cumulative = cumulative;- Integrate = integrate;- Lengths = lengths;- UseStartAfterStep = useStartAfterStep;- StartAfterStep = startAfterStep;- for (int i = 0; i < Count; i++)- {- if (useIntensity[i])- {- NeedsIntensity = true;- }- if (isProfile[i])- {- HasProfiles = true;- }- else- {- HasSeries = true;- }- }- }-- /// <summary>- /// Builds the sampler for a canvas of <paramref name="w"/> x <paramref name="h"/> pixels. Probe positions- /// are clamped into the canvas; point probes get a single pixel index, line probes the Bresenham path from- /// A to B. The padded grid stride is <paramref name="w"/> + 2.- /// </summary>- /// <param name="probes">Run probe list; the per-probe arrays of the result use the same order.</param>- /// <param name="w">Canvas width in pixels.</param>- /// <param name="h">Canvas height in pixels.</param>- public static ProbeSampler Build(IList<ProbeSettings> probes, int w, int h)- {- int count = probes.Count;- int[][] pixels = new int[count][];- bool[] isProfile = new bool[count];- bool[] useIntensity = new bool[count];- bool[] cumulative = new bool[count];- bool[] integrate = new bool[count];- double[] lengths = new double[count];- bool[] useStartAfterStep = new bool[count];- int[] startAfterStep = new int[count];- int stride = w + 2;- for (int i = 0; i < count; i++)- {- ProbeSettings probe = probes[i];- int ax = ProbeSampler.Clamp(probe.PosAX, w - 1);- int ay = ProbeSampler.Clamp(probe.PosAY, h - 1);- bool isIntegrated = probe.Measurement == ProbeMeasurement.IntegratedIntensity;- if (probe.Kind == ProbeKind.Line)- {- int bx = ProbeSampler.Clamp(probe.PosBX, w - 1);- int by = ProbeSampler.Clamp(probe.PosBY, h - 1);- pixels[i] = ProbeSampler.LinePixels(ax, ay, bx, by, stride);- isProfile[i] = true;- integrate[i] = isIntegrated;- double dx = bx - ax;- double dy = by - ay;- lengths[i] = Math.Sqrt(dx * dx + dy * dy);- }- else- {- pixels[i] = new int[] { (ay + 1) * stride + ax + 1 };- cumulative[i] = isIntegrated;- }- // Intensity and IntegratedIntensity both read the intensity buffer.- useIntensity[i] = probe.Measurement != ProbeMeasurement.Amplitude;- useStartAfterStep[i] = probe.UseStartAfterStep;- startAfterStep[i] = probe.StartAfterStep;- }- return new ProbeSampler(pixels, isProfile, useIntensity, cumulative, integrate, lengths, useStartAfterStep, startAfterStep);- }-- /// <summary>Clamps <paramref name="value"/> into [0, <paramref name="maxValue"/>].</summary>- private static int Clamp(int value, int maxValue)- {- if (value < 0)- {- return 0;- }- if (value > maxValue)- {- return maxValue;- }- return value;- }-- /// <summary>Bresenham walk from (x0, y0) to (x1, y1), both inclusive, returning padded-grid indices in walking order (A first).</summary>- /// <param name="x0">Start x in canvas pixels.</param>- /// <param name="y0">Start y in canvas pixels.</param>- /// <param name="x1">End x in canvas pixels.</param>- /// <param name="y1">End y in canvas pixels.</param>- /// <param name="stride">Row length of the padded grid (canvas width + 2).</param>- private static int[] LinePixels(int x0, int y0, int x1, int y1, int stride)- {- List<int> indices = new List<int>();- int dx = Math.Abs(x1 - x0);- int dy = -Math.Abs(y1 - y0);- int stepX = (x0 < x1) ? 1 : -1;- int stepY = (y0 < y1) ? 1 : -1;- int err = dx + dy;- while (true)- {- indices.Add((y0 + 1) * stride + x0 + 1);- if (x0 == x1 && y0 == y1)- {- break;- }- int e2 = 2 * err;- if (e2 >= dy)- {- err += dy;- x0 += stepX;- }- if (e2 <= dx)- {- err += dx;- y0 += stepY;- }- }- return indices.ToArray();- }-- /// <summary>- /// Reads the current value of a point probe from a padded-grid buffer. Used by the CPU engine- /// (<c>WaveSimulator.SampleProbes</c>) on the worker thread after every step.- /// </summary>- /// <param name="probeIndex">Index of a point probe.</param>- /// <param name="data">Padded field or intensity buffer, chosen by the caller according to <see cref="UseIntensity"/>.</param>- /// <returns>The value at the probe's first pixel, or 0 when <paramref name="data"/> is null.</returns>- public float Compute(int probeIndex, float[] data)- {- return (data == null) ? 0f : data[Pixels[probeIndex][0]];- }-- /// <summary>Number of probes; the length of every per-probe array.</summary>- public readonly int Count;-- /// <summary>Per probe: indices into the padded field/intensity buffer. A single entry for point probes, the whole A-to-B pixel path for line probes.</summary>- public readonly int[][] Pixels;-- /// <summary>Per probe: true for line probes (which deliver a profile), false for point probes (which deliver a time series).</summary>- public readonly bool[] IsProfile;-- /// <summary>Per probe: true when the measurement is Intensity or IntegratedIntensity, i.e. the intensity buffer is sampled instead of the field.</summary>- public readonly bool[] UseIntensity;-- /// <summary>Per probe: point probe with IntegratedIntensity; <see cref="ProbeCollector.Collect"/> turns its per-step intensity samples into a running sum.</summary>- public readonly bool[] Cumulative;-- /// <summary>Per probe: line probe with IntegratedIntensity; the engine accumulates per-pixel intensity totals over the steps.</summary>- public readonly bool[] Integrate;-- /// <summary>Per probe: Euclidean length of the (clamped) probe line in canvas pixels; 0 for point probes.</summary>- public readonly double[] Lengths;-- /// <summary>True when any probe samples the intensity; the runner then forces intensity tracking on in the engine.</summary>- public readonly bool NeedsIntensity;-- /// <summary>True when at least one point probe exists.</summary>- public readonly bool HasSeries;-- /// <summary>True when at least one line probe exists.</summary>- public readonly bool HasProfiles;-- /// <summary>- /// Per probe: whether "start recording at step #" is on. Used to purge (never accumulate) the running- /// total of an integrated (cumulative) probe from before <see cref="StartAfterStep"/>, so the total shown- /// once recording starts is not inflated by intensity that arrived before it - see- /// <see cref="ProbeCollector.Collect"/>, <see cref="WaveSimulator.SampleProbes"/> and- /// <see cref="GpuWaveSimulator"/>'s <c>profile_accumulate</c> kernel.- /// </summary>- public readonly bool[] UseStartAfterStep;-- /// <summary>Per probe: the step at which recording starts (the total before it is purged); only meaningful when <see cref="UseStartAfterStep"/> is set.</summary>- public readonly int[] StartAfterStep;- }-}diff --git a/Wave_Dude_2D/ProbeScaleMode.cs b/Wave_Dude_2D/ProbeScaleMode.csdeleted file mode 100644index 68e4f65..0000000--- a/Wave_Dude_2D/ProbeScaleMode.cs+++ /dev/null@@ -1,15 +0,0 @@-namespace _2D_wave_sim_V01-{- /// <summary>- /// How the X (step) axis of a point probe's time-series graph is chosen; see- /// <c>ProbeGraphPainter.ComputeRanges</c>. Line probes ignore it (their X axis is the- /// distance along the line) and the UI disables the radio buttons for them.- /// </summary>- public enum ProbeScaleMode- {- /// <summary>Shows a sliding window of the last <see cref="ProbeSettings.RunningWindow"/> steps.</summary>- Running = 0,- /// <summary>Shows the whole run: from the start step to the total step count (or to the samples so far when <see cref="ProbeSettings.AutoScaleX"/> is set).</summary>- Full = 1- }-}diff --git a/Wave_Dude_2D/ProbeSeries.cs b/Wave_Dude_2D/ProbeSeries.csdeleted file mode 100644index 19ed392..0000000--- a/Wave_Dude_2D/ProbeSeries.cs+++ /dev/null@@ -1,59 +0,0 @@-using System;--namespace _2D_wave_sim_V01-{- /// <summary>- /// The measured values of one point probe: a growable buffer with one value per simulation step, in step- /// order (value i belongs to step i + 1). Not thread-safe: each instance belongs to one- /// <see cref="ProbeTrace"/> and is only touched by that trace's owning thread.- /// </summary>- internal sealed class ProbeSeries- {- public ProbeSeries()- {- _values = new float[1024];- }-- /// <summary>Number of valid values; only the first <see cref="Count"/> entries of <see cref="Values"/> are meaningful.</summary>- public int Count => _count;-- /// <summary>- /// Backing array, exposed without copying. Its length is the capacity, not the sample count, so read only- /// indices below <see cref="Count"/>. The reference changes whenever the buffer grows. Do not change.- /// </summary>- public float[] Values => _values;-- /// <summary>Most recently added value, or NaN when the series is empty.</summary>- public float LastValue => _count == 0 ? float.NaN : _values[_count - 1];-- /// <summary>Appends values in step order, at least doubling the backing array when it is full. Null or empty input is ignored.</summary>- public void Add(float[] items)- {- if (items == null || items.Length == 0)- {- return;- }- int newCount = _count + items.Length;- if (newCount > _values.Length)- {- float[] grown = new float[Math.Max(newCount, _values.Length * 2)];- Array.Copy(_values, grown, _count);- _values = grown;- }- Array.Copy(items, 0, _values, _count, items.Length);- _count = newCount;- }-- /// <summary>Discards all values but keeps the allocated storage.</summary>- public void Clear()- {- _count = 0;- }-- /// <summary>Backing storage; starts at 1024 entries, grows by at least doubling and never shrinks.</summary>- private float[] _values;-- /// <summary>Number of valid entries at the start of <see cref="_values"/>.</summary>- private int _count;- }-}diff --git a/Wave_Dude_2D/ProbeSettings.cs b/Wave_Dude_2D/ProbeSettings.csdeleted file mode 100644index 20cd378..0000000--- a/Wave_Dude_2D/ProbeSettings.cs+++ /dev/null@@ -1,438 +0,0 @@-using System;-using System.Collections;-using System.Collections.Generic;-using System.Globalization;--namespace _2D_wave_sim_V01-{- /// <summary>- /// User-editable configuration of one probe: where it measures, what it measures and how its- /// graph is shown. Edited on the Probes tab (<c>Form1.Probes.cs</c>), persisted in the project- /// config (<see cref="ListToConfig"/> / <see cref="ListFromConfig"/>) and handed to the- /// simulation as a <see cref="Clone"/> so the worker thread never sees the copy being edited.- /// All positions are canvas pixels (0-based column/row of the simulation grid, origin top-left).- /// </summary>- public sealed class ProbeSettings- {- /// <summary>Creates an inactive point probe on the field at (100,100) with a medium graph box at (450,20) and auto scaling on both axes.</summary>- public ProbeSettings()- {- PlaceOn = ProbePlaceOn.Field;- Measurement = ProbeMeasurement.Amplitude;- Kind = ProbeKind.Point;- PosAX = 100;- PosAY = 100;- PosBX = 300;- PosBY = 100;- BoxSize = ProbeBoxSize.Medium;- BoxX = 450;- BoxY = 20;- Active = false;- ScaleMode = ProbeScaleMode.Running;- AutoScaleX = true;- AutoScaleY = true;- YMin = -1.0;- YMax = 1.0;- RunningWindow = ProbeSettings.DefaultRunningWindow;- UseStartAfterStep = false;- StartAfterStep = 0;- }-- /// <summary>Gets or sets the output (field or intensity) the probe samples and is drawn on.</summary>- public ProbePlaceOn PlaceOn { get; set; }-- /// <summary>Gets or sets the recorded quantity. Must be consistent with <see cref="PlaceOn"/>; <see cref="Normalize"/> enforces that.</summary>- public ProbeMeasurement Measurement { get; set; }-- /// <summary>Gets or sets whether this is a point probe (A only) or a line probe (A to B).</summary>- public ProbeKind Kind { get; set; }-- /// <summary>Gets or sets the X of position A in canvas pixels (the probe pixel, or the start of the line).</summary>- public int PosAX { get; set; }-- /// <summary>Gets or sets the Y of position A in canvas pixels.</summary>- public int PosAY { get; set; }-- /// <summary>Gets or sets the X of position B in canvas pixels (end of the line; unused for point probes).</summary>- public int PosBX { get; set; }-- /// <summary>Gets or sets the Y of position B in canvas pixels (end of the line; unused for point probes).</summary>- public int PosBY { get; set; }-- /// <summary>Gets or sets the nominal size of the graph box drawn over the output picture.</summary>- public ProbeBoxSize BoxSize { get; set; }-- /// <summary>Gets or sets the left edge of the graph box in canvas pixels. May lie outside the canvas; the painter clamps the box to stay inside.</summary>- public int BoxX { get; set; }-- /// <summary>Gets or sets the top edge of the graph box in canvas pixels (clamped by the painter like <see cref="BoxX"/>).</summary>- public int BoxY { get; set; }-- /// <summary>- /// Gets or sets whether the probe is switched on: when false it is not sampled or shown in a simulation,- /// but its settings are kept ("On" checkbox). Off by default (the constructor's default, used for both- /// probes of a new project - see <c>NewProbeList</c> in <c>Form1.Probes.cs</c>). A probe loaded from a- /// project saved before <c>active</c> was written for it still comes back on (<see cref="FromDictionary"/>'s- /// own separate, hard-coded fallback), so that project keeps its exact previous behaviour instead of- /// silently picking up the new-project default.- /// </summary>- public bool Active { get; set; }-- /// <summary>Gets or sets how the step axis of a point probe's time series is chosen; ignored for line probes.</summary>- public ProbeScaleMode ScaleMode { get; set; }-- /// <summary>Gets or sets whether the step axis follows the samples recorded so far instead of the full step count / window; ignored for line probes.</summary>- public bool AutoScaleX { get; set; }-- /// <summary>Gets or sets whether the value axis is fitted to the visible data; when false <see cref="YMin"/>/<see cref="YMax"/> are used.</summary>- public bool AutoScaleY { get; set; }-- /// <summary>Gets or sets the lower bound of the value axis, in the units of <see cref="Measurement"/>. Only used when <see cref="AutoScaleY"/> is false.</summary>- public double YMin { get; set; }-- /// <summary>Gets or sets the upper bound of the value axis; must be greater than <see cref="YMin"/> or <see cref="Normalize"/> resets both to -1..1.</summary>- public double YMax { get; set; }-- /// <summary>Gets or sets the width of the sliding step window for <see cref="ProbeScaleMode.Running"/>, in simulation steps (10 .. <see cref="MaxRunningWindow"/>).</summary>- public int RunningWindow { get; set; }-- /// <summary>- /// Gets or sets whether the graph shows no data from before step <see cref="StartAfterStep"/> (0 = from the- /// start). Sampling itself is not gated: the probe keeps being sampled, a point probe's graph is trimmed to- /// start there and a line probe's stays blank until then (see <see cref="ProbeGraphPainter.DrawGraph"/>),- /// and the running total of an integrated probe is kept at zero before it (<see cref="ProbeCollector.Collect"/>).- /// </summary>- public bool UseStartAfterStep { get; set; }-- /// <summary>Gets or sets the simulation step (0-based, never negative) at which recording starts when <see cref="UseStartAfterStep"/> is set (0 = from the start).</summary>- public int StartAfterStep { get; set; }-- /// <summary>Returns an independent copy. All members are value types, so the memberwise clone is a full copy.</summary>- public ProbeSettings Clone()- {- return (ProbeSettings)base.MemberwiseClone();- }-- /// <summary>- /// Copies only the graph/display settings (active flag, box size and position, scaling, Y range,- /// running window, start-after gating) from <paramref name="other"/>, leaving position, kind and- /// measurement untouched. Used to show a running simulation's probes with the display settings- /// the user is editing right now.- /// </summary>- public void CopyDisplayFrom(ProbeSettings other)- {- Active = other.Active;- BoxSize = other.BoxSize;- BoxX = other.BoxX;- BoxY = other.BoxY;- ScaleMode = other.ScaleMode;- AutoScaleX = other.AutoScaleX;- AutoScaleY = other.AutoScaleY;- YMin = other.YMin;- YMax = other.YMax;- RunningWindow = other.RunningWindow;- UseStartAfterStep = other.UseStartAfterStep;- StartAfterStep = other.StartAfterStep;- }-- /// <summary>- /// Forces the settings into a consistent state: the field only allows- /// <see cref="ProbeMeasurement.Amplitude"/>, the intensity output never does (amplitude is- /// turned into <see cref="ProbeMeasurement.Intensity"/>); an empty, inverted or NaN Y range becomes- /// -1..1; <see cref="RunningWindow"/> is clamped to 10..<see cref="MaxRunningWindow"/> and- /// <see cref="StartAfterStep"/> to zero or more.- /// </summary>- public void Normalize()- {- if (PlaceOn == ProbePlaceOn.Field)- {- Measurement = ProbeMeasurement.Amplitude;- }- else if (Measurement == ProbeMeasurement.Amplitude)- {- Measurement = ProbeMeasurement.Intensity;- }- // written this way round so a NaN limit also falls back- if (!(YMax > YMin))- {- YMin = -1.0;- YMax = 1.0;- }- if (RunningWindow < 10)- {- RunningWindow = 10;- }- if (RunningWindow > ProbeSettings.MaxRunningWindow)- {- RunningWindow = ProbeSettings.MaxRunningWindow;- }- if (StartAfterStep < 0)- {- StartAfterStep = 0;- }- }-- /// <summary>The UI label of <see cref="Measurement"/> ("Amplitude", "Intensity" or "Integrated intensity").</summary>- public string MeasurementText()- {- switch (Measurement)- {- case ProbeMeasurement.Amplitude:- return "Amplitude";- case ProbeMeasurement.IntegratedIntensity:- return "Integrated intensity";- default:- return "Intensity";- }- }-- /// <summary>Title shown in the graph box, e.g. "Probe 1 - Amplitude". The number is also drawn at the probe in the picture.</summary>- /// <param name="index">0-based probe index; the title shows it 1-based.</param>- public string Title(int index)- {- return "Probe " + (index + 1).ToString(CultureInfo.InvariantCulture) + " - " + MeasurementText();- }-- /// <summary>- /// Reads the probe list from the <c>probes</c> section of a project config. Entries in the- /// section's <c>items</c> list that are not dictionaries are skipped; each read probe is- /// normalized. Never returns an empty list: a single default probe is returned when the- /// section is missing or holds no usable entries.- /// </summary>- public static List<ProbeSettings> ListFromConfig(ProjectConfig config)- {- List<ProbeSettings> probes = new List<ProbeSettings>();- if (config.ContainsKey(ProbeSettings.SectionName))- {- Dictionary<string, object> section = config.GetSection(ProbeSettings.SectionName);- object items;- if (section.TryGetValue("items", out items))- {- IEnumerable sequence = items as IEnumerable;- if (sequence != null && !(items is string))- {- foreach (object entry in sequence)- {- Dictionary<string, object> values = entry as Dictionary<string, object>;- if (values != null)- {- probes.Add(ProbeSettings.FromDictionary(values));- }- }- }- }- }- if (probes.Count == 0)- {- probes.Add(new ProbeSettings());- }- return probes;- }-- /// <summary>Writes <paramref name="probes"/> into the <c>probes</c> section of <paramref name="config"/> as <c>count</c> plus an <c>items</c> list of dictionaries.</summary>- public static void ListToConfig(List<ProbeSettings> probes, ProjectConfig config)- {- Dictionary<string, object> section = config.GetSection(ProbeSettings.SectionName);- List<object> items = new List<object>();- foreach (ProbeSettings probe in probes)- {- items.Add(probe.ToDictionary());- }- section["count"] = items.Count;- section["items"] = items;- }-- /// <summary>- /// Serializes the probe to the config dictionary form. Enum values are stored as lower-case- /// snake_case strings (<c>field</c>/<c>intensity</c>, <c>amplitude</c>/<c>intensity</c>/- /// <c>integrated_intensity</c>, <c>point</c>/<c>line</c>, <c>tiny</c>..<c>extra_large</c>,- /// <c>running</c>/<c>full</c>); numbers and booleans as-is.- /// </summary>- private Dictionary<string, object> ToDictionary()- {- Dictionary<string, object> values = new Dictionary<string, object>();- values["active"] = Active;- values["place_on"] = ((PlaceOn == ProbePlaceOn.Field) ? "field" : "intensity");- switch (Measurement)- {- case ProbeMeasurement.Amplitude:- values["measurement"] = "amplitude";- break;- case ProbeMeasurement.IntegratedIntensity:- values["measurement"] = "integrated_intensity";- break;- default:- values["measurement"] = "intensity";- break;- }- values["probe_type"] = ((Kind == ProbeKind.Line) ? "line" : "point");- values["ax"] = PosAX;- values["ay"] = PosAY;- values["bx"] = PosBX;- values["by"] = PosBY;- switch (BoxSize)- {- case ProbeBoxSize.Tiny:- values["box_size"] = "tiny";- break;- case ProbeBoxSize.Small:- values["box_size"] = "small";- break;- case ProbeBoxSize.Large:- values["box_size"] = "large";- break;- case ProbeBoxSize.ExtraLarge:- values["box_size"] = "extra_large";- break;- default:- values["box_size"] = "medium";- break;- }- values["box_x"] = BoxX;- values["box_y"] = BoxY;- values["scale_mode"] = ((ScaleMode == ProbeScaleMode.Full) ? "full" : "running");- values["auto_scale_x"] = AutoScaleX;- values["auto_scale_y"] = AutoScaleY;- values["y_min"] = YMin;- values["y_max"] = YMax;- values["running_window"] = RunningWindow;- values["use_start_after_step"] = UseStartAfterStep;- values["start_after_step"] = StartAfterStep;- return values;- }-- /// <summary>- /// Inverse of <see cref="ToDictionary"/>. Missing, unparsable or out-of-range values fall back to- /// defaults (note that a missing <c>active</c> defaults to <c>true</c>, unlike the constructor),- /// unknown enum strings map to the default enum value, and the result is normalized.- /// </summary>- private static ProbeSettings FromDictionary(Dictionary<string, object> d)- {- ProbeSettings probe = new ProbeSettings();- probe.Active = ProbeSettings.ReadBool(d, "active", true);- probe.PlaceOn = ((ProbeSettings.ReadText(d, "place_on", "field") == "intensity") ? ProbePlaceOn.Intensity : ProbePlaceOn.Field);- switch (ProbeSettings.ReadText(d, "measurement", "amplitude"))- {- case "intensity":- probe.Measurement = ProbeMeasurement.Intensity;- break;- case "integrated_intensity":- probe.Measurement = ProbeMeasurement.IntegratedIntensity;- break;- default:- probe.Measurement = ProbeMeasurement.Amplitude;- break;- }- probe.Kind = ((ProbeSettings.ReadText(d, "probe_type", "point") == "line") ? ProbeKind.Line : ProbeKind.Point);- probe.PosAX = ProbeSettings.ReadInt(d, "ax", 100, 0, 100000);- probe.PosAY = ProbeSettings.ReadInt(d, "ay", 100, 0, 100000);- probe.PosBX = ProbeSettings.ReadInt(d, "bx", 300, 0, 100000);- probe.PosBY = ProbeSettings.ReadInt(d, "by", 100, 0, 100000);- switch (ProbeSettings.ReadText(d, "box_size", "medium"))- {- case "tiny":- probe.BoxSize = ProbeBoxSize.Tiny;- break;- case "small":- probe.BoxSize = ProbeBoxSize.Small;- break;- case "large":- probe.BoxSize = ProbeBoxSize.Large;- break;- case "extra_large":- probe.BoxSize = ProbeBoxSize.ExtraLarge;- break;- default:- probe.BoxSize = ProbeBoxSize.Medium;- break;- }- probe.BoxX = ProbeSettings.ReadInt(d, "box_x", 450, 0, 100000);- probe.BoxY = ProbeSettings.ReadInt(d, "box_y", 20, 0, 100000);- probe.ScaleMode = ((ProbeSettings.ReadText(d, "scale_mode", "running") == "full") ? ProbeScaleMode.Full : ProbeScaleMode.Running);- probe.AutoScaleX = ProbeSettings.ReadBool(d, "auto_scale_x", true);- probe.AutoScaleY = ProbeSettings.ReadBool(d, "auto_scale_y", true);- probe.YMin = ProbeSettings.ReadDouble(d, "y_min", -1.0, -1E+30, 1E+30);- probe.YMax = ProbeSettings.ReadDouble(d, "y_max", 1.0, -1E+30, 1E+30);- probe.RunningWindow = ProbeSettings.ReadInt(d, "running_window", ProbeSettings.DefaultRunningWindow, 10, ProbeSettings.MaxRunningWindow);- probe.UseStartAfterStep = ProbeSettings.ReadBool(d, "use_start_after_step", false);- probe.StartAfterStep = ProbeSettings.ReadInt(d, "start_after_step", 0, 0, 1000000000);- probe.Normalize();- return probe;- }-- /// <summary>Reads a config value as text (invariant culture for non-strings); <paramref name="fallback"/> when missing or null.</summary>- private static string ReadText(Dictionary<string, object> d, string key, string fallback)- {- object value;- if (d.TryGetValue(key, out value) && value != null)- {- return Convert.ToString(value, CultureInfo.InvariantCulture);- }- return fallback;- }-- /// <summary>Reads a config value that must already be a <see cref="bool"/>; anything else yields <paramref name="fallback"/>.</summary>- private static bool ReadBool(Dictionary<string, object> d, string key, bool fallback)- {- object value;- if (d.TryGetValue(key, out value) && value is bool)- {- return (bool)value;- }- return fallback;- }-- /// <summary>Reads an integer config value (invariant-culture conversion). Missing, unconvertible or out-of-range values yield <paramref name="fallback"/>.</summary>- private static int ReadInt(Dictionary<string, object> d, string key, int fallback, int minValue, int maxValue)- {- object raw;- if (d.TryGetValue(key, out raw) && raw != null)- {- try- {- int value = Convert.ToInt32(raw, CultureInfo.InvariantCulture);- if (value >= minValue && value <= maxValue)- {- return value;- }- }- catch (Exception ex) when (ex is FormatException || ex is InvalidCastException || ex is OverflowException)- {- // use the fallback- }- }- return fallback;- }-- /// <summary>Reads a double config value (invariant-culture conversion). Missing, unconvertible or out-of-range values yield <paramref name="fallback"/>.</summary>- private static double ReadDouble(Dictionary<string, object> d, string key, double fallback, double minValue, double maxValue)- {- object raw;- if (d.TryGetValue(key, out raw) && raw != null)- {- try- {- double value = Convert.ToDouble(raw, CultureInfo.InvariantCulture);- if (value >= minValue && value <= maxValue)- {- return value;- }- }- catch (Exception ex) when (ex is FormatException || ex is InvalidCastException || ex is OverflowException)- {- // use the fallback- }- }- return fallback;- }-- /// <summary>Name of the project config section that holds the probe list.</summary>- public const string SectionName = "probes";-- /// <summary>Default <see cref="RunningWindow"/>, in simulation steps.</summary>- public const int DefaultRunningWindow = 500;-- /// <summary>Largest allowed <see cref="RunningWindow"/>, in simulation steps (also the spinner maximum on the Probes tab).</summary>- public const int MaxRunningWindow = 1000000;- }-}diff --git a/Wave_Dude_2D/ProbeTrace.cs b/Wave_Dude_2D/ProbeTrace.csdeleted file mode 100644index 26524d7..0000000--- a/Wave_Dude_2D/ProbeTrace.cs+++ /dev/null@@ -1,44 +0,0 @@-namespace _2D_wave_sim_V01-{- /// <summary>- /// Everything recorded for one probe during a run: the time series and, for line probes, the latest profile.- /// Two independent sets exist per run: <see cref="ProbeCollector.Traces"/> is owned by the simulation worker- /// thread (and read by <see cref="ProbeOverlay"/> for exported frames); the main form keeps its own copies,- /// filled from <see cref="ProbeUpdate"/> batches on the UI thread and painted by <see cref="ProbeGraphPainter"/>.- /// An instance is never shared between threads.- /// </summary>- internal sealed class ProbeTrace- {- public ProbeTrace()- {- Series = new ProbeSeries();- }-- /// <summary>Number of simulation steps completed when this trace was last updated; used to gate "start after step" line probes in the painter.</summary>- public int StepsSampled { get; set; }-- /// <summary>Latest line-probe profile (one value per pixel along the line, A to B), or null until the first profile arrives and always for point probes.</summary>- public float[] Profile => _profile;-- /// <summary>Length of the probe line in canvas pixels (distance A to B); 0 for point probes. Used as the x-axis span of the profile graph.</summary>- public double ProfileLength => _profileLength;-- /// <summary>Replaces the current profile. The array is kept by reference, not copied, so callers must not modify it afterwards.</summary>- /// <param name="values">Sampled values along the line, A to B.</param>- /// <param name="length">Line length in canvas pixels.</param>- public void SetProfile(float[] values, double length)- {- _profile = values;- _profileLength = length;- }-- /// <summary>Latest profile array; null until <see cref="SetProfile"/> is first called.</summary>- private float[] _profile;-- /// <summary>Line length in canvas pixels belonging to <see cref="_profile"/>.</summary>- private double _profileLength;-- /// <summary>Time series of a point probe, one value per sampled step; stays empty for line probes.</summary>- public readonly ProbeSeries Series;- }-}diff --git a/Wave_Dude_2D/ProbeUpdate.cs b/Wave_Dude_2D/ProbeUpdate.csdeleted file mode 100644index a12cbb1..0000000--- a/Wave_Dude_2D/ProbeUpdate.cs+++ /dev/null@@ -1,38 +0,0 @@-namespace _2D_wave_sim_V01-{- /// <summary>- /// One batch of probe results handed from the simulation worker thread to the UI. Created by- /// <see cref="ProbeCollector.TakeForUi"/> on the worker, raised through <c>SimulationRunner.ProbesUpdated</c>- /// and applied to the form's own <see cref="ProbeTrace"/>s on the UI thread (marshalled via <c>PostToUi</c>).- /// Never modified after construction, so no locking is needed.- /// </summary>- internal sealed class ProbeUpdate- {- public ProbeUpdate(float[][] samples, float[][] profiles, double[] lengths, int stepsDone)- {- Samples = samples;- Profiles = profiles;- Lengths = lengths;- StepsDone = stepsDone;- }-- /// <summary>- /// Per probe (index parallel to the run's probe list): the series values sampled since the previous batch,- /// in step order. Freshly allocated per batch; empty (never null) for line probes or when nothing new arrived.- /// </summary>- public readonly float[][] Samples;-- /// <summary>- /// Per probe: the new line profile when it was refreshed since the previous batch, otherwise null. The array- /// is the very instance the worker's trace holds; it is never written to after the engine produced it, so- /// sharing it is safe.- /// </summary>- public readonly float[][] Profiles;-- /// <summary>Per probe: line length in canvas pixels (0 for point probes). This is the <see cref="ProbeSampler.Lengths"/> array itself, shared read-only by all batches.</summary>- public readonly double[] Lengths;-- /// <summary>Simulation steps completed when the batch was taken; becomes <see cref="ProbeTrace.StepsSampled"/> on the UI side.</summary>- public readonly int StepsDone;- }-}diff --git a/Wave_Dude_2D/Project.cs b/Wave_Dude_2D/Project.csdeleted file mode 100644index bbc1ed2..0000000--- a/Wave_Dude_2D/Project.cs+++ /dev/null@@ -1,77 +0,0 @@-using System;-using System.IO;--namespace _2D_wave_sim_V01-{- /// <summary>- /// An opened project on disk: its folder, the well-known sub-folders inside it and the- /// in-memory <see cref="ProjectConfig"/>. Instances are created only by- /// <see cref="ProjectStore"/> (open, create, rename); <see cref="Form1"/> holds the current- /// one, edits <see cref="Config"/> and calls <see cref="Save"/>. The project name is always- /// the folder name. None of the folder properties create the directory they point to.- /// </summary>- public sealed class Project- {- /// <summary>- /// Wraps an existing folder and its configuration, and immediately stamps- /// <see cref="ProjectConfig.ProjectName"/> with the folder name so a copied or renamed- /// project folder is self-consistent even before it is saved.- /// </summary>- /// <param name="folderPath">Full path of the project folder; its last segment is the project name.</param>- /// <param name="config">The configuration loaded from, or to be written to, that folder.</param>- internal Project(string folderPath, ProjectConfig config)- {- _folderPath = folderPath;- _config = config;- // the folder name is the one and only project name- _config.ProjectName = Name;- }-- /// <summary>Project name, i.e. the name of the project folder.</summary>- public string Name => Path.GetFileName(_folderPath);-- /// <summary>Full path of the project folder.</summary>- public string FolderPath => _folderPath;-- /// <summary>Parent of the project folder (the project root), or an empty string when the folder has no parent.</summary>- public string RootFolder => Path.GetDirectoryName(_folderPath) ?? "";-- /// <summary>The configuration loaded from (or to be written to) <see cref="ConfigFilePath"/>; mutable, shared with the editor.</summary>- public ProjectConfig Config => _config;-- /// <summary>Full path of the configuration file (<see cref="ProjectConfig.FileName"/>) inside the project folder.</summary>- public string ConfigFilePath => Path.Combine(_folderPath, ProjectConfig.FileName);-- /// <summary>- /// The <see cref="ProjectStore.AssetsFolderName"/> sub-folder: where the user can keep any third-party- /// files used by the project (e.g. the original Photoshop file of a scene image). Not read or written by- /// the simulator itself.- /// </summary>- public string AssetsFolder => Path.Combine(_folderPath, ProjectStore.AssetsFolderName);-- /// <summary>The <see cref="ProjectStore.OutputFramesFolderName"/> sub-folder where exported PNG frames are written.</summary>- public string OutputFramesFolder => Path.Combine(_folderPath, ProjectStore.OutputFramesFolderName);-- /// <summary>The <see cref="ProjectStore.OutputVideoFolderName"/> sub-folder where exported videos are written.</summary>- public string OutputVideoFolder => Path.Combine(_folderPath, ProjectStore.OutputVideoFolderName);-- /// <summary>The <see cref="ProjectStore.SceneImageFolderName"/> sub-folder into which scene images chosen from elsewhere are copied.</summary>- public string SceneImageFolder => Path.Combine(_folderPath, ProjectStore.SceneImageFolderName);-- /// <summary>- /// Re-stamps the project name and writes <see cref="Config"/> to <see cref="ConfigFilePath"/>- /// (atomically, via <see cref="ProjectConfig.Save(string)"/>).- /// </summary>- public void Save()- {- _config.ProjectName = Name;- _config.Save(ConfigFilePath);- }-- /// <summary>Full path of the project folder; its last segment is the project name.</summary>- private readonly string _folderPath;-- /// <summary>The project's configuration; never null.</summary>- private readonly ProjectConfig _config;- }-}diff --git a/Wave_Dude_2D/ProjectConfig.cs b/Wave_Dude_2D/ProjectConfig.csdeleted file mode 100644index 5552dfc..0000000--- a/Wave_Dude_2D/ProjectConfig.cs+++ /dev/null@@ -1,437 +0,0 @@-using System;-using System.Collections;-using System.Collections.Generic;-using System.Globalization;-using System.IO;-using System.Text;-using System.Web.Script.Serialization;--namespace _2D_wave_sim_V01-{- /// <summary>- /// The contents of a project's configuration.json: a flat dictionary of top-level values- /// (format version, project name, created/modified timestamps, description; always present) plus named- /// sub-dictionaries ("sections") that <see cref="SceneSettings"/>, <see cref="SimulationSettings"/>,- /// <see cref="ProbeSettings"/> and <see cref="SourceSettings"/> read and write through- /// <see cref="GetSection"/>. Every tab that gets functionality later stores its own settings as a section- /// the same way, for example:- /// <code>- /// var section = project.Config.GetSection("probes");- /// section["count"] = 3;- /// project.Save();- /// </code>- /// Forward compatibility: keys that this version of the program does not know are kept and written back- /// unchanged, so a file written by a newer version is not damaged by an older one (it is refused when its- /// format_version is newer). Owned by a <see cref="Project"/>; created by <see cref="ProjectStore"/>.- /// Reading uses <see cref="JavaScriptSerializer"/>; writing is done by hand so the file stays- /// stable, indented and human-readable. Values are stored as the serializer produces them- /// (string, int, long, decimal, double, bool, nested dictionaries and object arrays), so the- /// typed getters convert with the invariant culture.- /// </summary>- public sealed class ProjectConfig- {- /// <summary>Creates an empty configuration for a new project, stamping the current format version and the UTC created/modified time.</summary>- public ProjectConfig(string projectName)- {- string now = ProjectConfig.Timestamp(DateTime.UtcNow);- _values = new Dictionary<string, object>();- _values[KeyFormatVersion] = CurrentFormatVersion;- _values[KeyProjectName] = projectName;- _values[KeyCreated] = now;- _values[KeyModified] = now;- }-- /// <summary>Wraps a deserialised dictionary (used by <see cref="Load"/>); adds the format version if the file had none.</summary>- private ProjectConfig(Dictionary<string, object> values)- {- _values = values;- if (!_values.ContainsKey(KeyFormatVersion))- {- _values[KeyFormatVersion] = CurrentFormatVersion;- }- }-- /// <summary>Format version stored in the file; <see cref="CurrentFormatVersion"/> when missing or unreadable.</summary>- public int FormatVersion => GetInteger(KeyFormatVersion, CurrentFormatVersion);-- /// <summary>Gets or sets the project name ("" when missing). <see cref="Project.Save"/> overwrites it with the folder name before saving.</summary>- public string ProjectName- {- get => GetString(KeyProjectName, "");- set => _values[KeyProjectName] = value;- }-- /// <summary>UTC creation timestamp as "yyyy-MM-ddTHH:mm:ssZ", or "" when missing.</summary>- public string Created => GetString(KeyCreated, "");-- /// <summary>UTC timestamp of the last <see cref="Save"/> as "yyyy-MM-ddTHH:mm:ssZ", or "" when missing.</summary>- public string Modified => GetString(KeyModified, "");-- /// <summary>Gets or sets the free-text project description (Form1's <c>btnDescription</c> / <see cref="frmDescription"/>); "" when none was set.</summary>- public string Description- {- get => GetString(KeyDescription, "");- set => _values[KeyDescription] = value;- }-- /// <summary>True when a top-level value or section named <paramref name="key"/> exists (even if its value is null).</summary>- public bool ContainsKey(string key)- {- return _values.ContainsKey(key);- }-- /// <summary>Top-level value <paramref name="key"/> converted to a string with the invariant culture, or <paramref name="fallback"/> when missing or null.</summary>- public string GetString(string key, string fallback)- {- object value;- if (_values.TryGetValue(key, out value) && value != null)- {- return Convert.ToString(value, CultureInfo.InvariantCulture);- }- return fallback;- }-- /// <summary>Top-level value <paramref name="key"/> converted to an int with the invariant culture, or <paramref name="fallback"/> when missing, null, not numeric or out of range.</summary>- public int GetInteger(string key, int fallback)- {- object value;- if (_values.TryGetValue(key, out value) && value != null)- {- try- {- return Convert.ToInt32(value, CultureInfo.InvariantCulture);- }- catch (Exception ex) when (ex is FormatException || ex is InvalidCastException || ex is OverflowException)- {- return fallback;- }- }- return fallback;- }-- /// <summary>Sets (or replaces) the top-level value <paramref name="key"/>; a dictionary value becomes a section. Allowed values: string, bool, numbers, null, a <c>Dictionary<string, object></c>, or a list or array of these.</summary>- public void SetValue(string key, object value)- {- _values[key] = value;- }-- /// <summary>- /// Returns the named sub-dictionary, creating an empty one (and storing it) if it is missing- /// or the existing value is not a dictionary. Callers edit the returned dictionary in place.- /// </summary>- public Dictionary<string, object> GetSection(string name)- {- object existing;- if (_values.TryGetValue(name, out existing))- {- Dictionary<string, object> section = existing as Dictionary<string, object>;- if (section != null)- {- return section;- }- }- Dictionary<string, object> created = new Dictionary<string, object>();- _values[name] = created;- return created;- }-- /// <summary>Reads and parses a configuration.json (UTF-8, any size).</summary>- /// <exception cref="InvalidDataException">The file is not valid JSON, its root is not an object, or its format version is newer than <see cref="CurrentFormatVersion"/>.</exception>- public static ProjectConfig Load(string filePath)- {- string json = File.ReadAllText(filePath, Encoding.UTF8);- JavaScriptSerializer serializer = new JavaScriptSerializer();- serializer.MaxJsonLength = int.MaxValue;- Dictionary<string, object> values = null;- try- {- values = serializer.DeserializeObject(json) as Dictionary<string, object>;- }- catch (Exception ex) when (ex is ArgumentException || ex is InvalidOperationException)- {- throw new InvalidDataException("The file " + Path.GetFileName(filePath) + " is not valid JSON: " + ex.Message, ex);- }- if (values == null)- {- throw new InvalidDataException("The file " + Path.GetFileName(filePath) + " is not a project configuration (a JSON object was expected).");- }- ProjectConfig config = new ProjectConfig(values);- if (config.FormatVersion > CurrentFormatVersion)- {- throw new InvalidDataException("The file " + Path.GetFileName(filePath) + " was made by a newer version of the program (format " + config.FormatVersion.ToString(CultureInfo.InvariantCulture) + ").");- }- return config;- }-- /// <summary>- /// Writes the configuration to <paramref name="filePath"/> as indented JSON (UTF-8 without BOM),- /// first stamping the current format version and the UTC "modified" time. The text goes to- /// <c>filePath + ".tmp"</c> and is then moved over the old file, so a crash mid-write cannot- /// leave a truncated configuration. Missing parent folders are created.- /// </summary>- public void Save(string filePath)- {- _values[KeyFormatVersion] = CurrentFormatVersion;- _values[KeyModified] = ProjectConfig.Timestamp(DateTime.UtcNow);- StringBuilder sb = new StringBuilder();- ProjectConfig.WriteObject(sb, _values, 0);- sb.AppendLine();- string directory = Path.GetDirectoryName(filePath);- if (!string.IsNullOrEmpty(directory))- {- Directory.CreateDirectory(directory);- }- // write to a temporary file first so a failed save never leaves a half-written configuration behind- string tempPath = filePath + ".tmp";- File.WriteAllText(tempPath, sb.ToString(), new UTF8Encoding(false));- if (File.Exists(filePath))- {- File.Delete(filePath);- }- File.Move(tempPath, filePath);- }-- /// <summary>Formats a UTC time as "yyyy-MM-ddTHH:mm:ssZ" (the value is not converted; pass UTC).</summary>- private static string Timestamp(DateTime value)- {- return value.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'", CultureInfo.InvariantCulture);- }-- /// <summary>- /// Appends one JSON value. Dictionaries and non-string enumerables recurse into- /// <see cref="WriteObject"/> / <see cref="WriteArray"/>; numbers use the invariant culture- /// (doubles with round-trip "R" format, NaN/infinity become <c>null</c>); DateTime is written- /// as a UTC timestamp string; other objects are written as their quoted string form; unknown- /// type codes become <c>null</c>. <paramref name="level"/> is the nesting depth, used only to- /// indent nested containers.- /// </summary>- private static void WriteValue(StringBuilder sb, object value, int level)- {- if (value == null)- {- sb.Append("null");- return;- }- switch (Type.GetTypeCode(value.GetType()))- {- case TypeCode.Object:- {- IDictionary dict = value as IDictionary;- IEnumerable list = value as IEnumerable;- if (dict != null)- {- ProjectConfig.WriteObject(sb, dict, level);- }- else if (list != null)- {- ProjectConfig.WriteArray(sb, list, level);- }- else- {- sb.Append(ProjectConfig.Quote(Convert.ToString(value, CultureInfo.InvariantCulture)));- }- break;- }- case TypeCode.Boolean:- sb.Append(Convert.ToBoolean(value, CultureInfo.InvariantCulture) ? "true" : "false");- break;- case TypeCode.Char:- case TypeCode.String:- sb.Append(ProjectConfig.Quote(Convert.ToString(value, CultureInfo.InvariantCulture)));- break;- case TypeCode.SByte:- case TypeCode.Byte:- case TypeCode.Int16:- case TypeCode.UInt16:- case TypeCode.Int32:- case TypeCode.UInt32:- case TypeCode.Int64:- case TypeCode.UInt64:- case TypeCode.Decimal:- sb.Append(Convert.ToString(value, CultureInfo.InvariantCulture));- break;- case TypeCode.Single:- case TypeCode.Double:- {- double number = Convert.ToDouble(value, CultureInfo.InvariantCulture);- if (double.IsNaN(number) || double.IsInfinity(number))- {- sb.Append("null");- }- else- {- sb.Append(number.ToString("R", CultureInfo.InvariantCulture));- }- break;- }- case TypeCode.DateTime:- sb.Append(ProjectConfig.Quote(ProjectConfig.Timestamp(Convert.ToDateTime(value, CultureInfo.InvariantCulture).ToUniversalTime())));- break;- default:- sb.Append("null");- break;- }- }-- /// <summary>Appends a dictionary as a JSON object, one <c>"key": value</c> pair per line indented by <paramref name="level"/> + 1; an empty dictionary becomes <c>{}</c>. Keys keep the dictionary's enumeration order.</summary>- private static void WriteObject(StringBuilder sb, IDictionary dict, int level)- {- if (dict.Count == 0)- {- sb.Append("{}");- return;- }- sb.AppendLine("{");- int written = 0;- foreach (DictionaryEntry entry in dict)- {- written++;- sb.Append(ProjectConfig.Indent(level + 1));- sb.Append(ProjectConfig.Quote(Convert.ToString(entry.Key, CultureInfo.InvariantCulture)));- sb.Append(": ");- ProjectConfig.WriteValue(sb, entry.Value, level + 1);- if (written < dict.Count)- {- sb.Append(",");- }- sb.AppendLine();- }- sb.Append(ProjectConfig.Indent(level));- sb.Append("}");- }-- /// <summary>- /// Appends an enumerable as a JSON array. Arrays of scalars only are written on one line- /// (<c>[1, 2, 3]</c>); arrays containing a dictionary or a nested non-string enumerable put- /// one element per line. Empty arrays become <c>[]</c>.- /// </summary>- private static void WriteArray(StringBuilder sb, IEnumerable list, int level)- {- List<object> items = new List<object>();- bool allScalar = true;- foreach (object item in list)- {- items.Add(item);- if (item != null && (item is IDictionary || (item is IEnumerable && !(item is string))))- {- allScalar = false;- }- }- if (items.Count == 0)- {- sb.Append("[]");- }- else if (allScalar)- {- sb.Append("[");- for (int i = 0; i < items.Count; i++)- {- if (i > 0)- {- sb.Append(", ");- }- ProjectConfig.WriteValue(sb, items[i], level + 1);- }- sb.Append("]");- }- else- {- sb.AppendLine("[");- for (int i = 0; i < items.Count; i++)- {- sb.Append(ProjectConfig.Indent(level + 1));- ProjectConfig.WriteValue(sb, items[i], level + 1);- if (i < items.Count - 1)- {- sb.Append(",");- }- sb.AppendLine();- }- sb.Append(ProjectConfig.Indent(level));- sb.Append("]");- }- }-- /// <summary>Two spaces of indentation per nesting level.</summary>- private static string Indent(int level)- {- return new string(' ', level * 2);- }-- /// <summary>- /// Returns <paramref name="text"/> as a double-quoted JSON string literal, escaping tab, LF,- /// CR, quote and backslash with their short forms and any other control character as- /// <c>\uXXXX</c>. Non-ASCII characters are written unescaped (the file is UTF-8). Null- /// becomes <c>""</c>.- /// </summary>- private static string Quote(string text)- {- if (text == null)- {- return "\"\"";- }- StringBuilder sb = new StringBuilder();- sb.Append('"');- foreach (char c in text)- {- switch (c)- {- case '\t':- sb.Append("\\t");- break;- case '\n':- sb.Append("\\n");- break;- case '\r':- sb.Append("\\r");- break;- case '"':- sb.Append("\\\"");- break;- case '\\':- sb.Append("\\\\");- break;- default:- if (c < ' ')- {- sb.Append("\\u").Append(((int)c).ToString("x4", CultureInfo.InvariantCulture));- }- else- {- sb.Append(c);- }- break;- }- }- sb.Append('"');- return sb.ToString();- }-- /// <summary>File name of the configuration inside a project folder.</summary>- public const string FileName = "configuration.json";-- /// <summary>File name of the pre-JSON configuration; an empty one marks a legacy project folder that <see cref="ProjectStore.Open"/> upgrades.</summary>- public const string LegacyFileName = "Configuration.txt";-- /// <summary>Version of the file layout that this build writes; files with a higher version are refused by <see cref="Load"/>. Increase it when a change makes old files incompatible.</summary>- public const int CurrentFormatVersion = 1;-- /// <summary>JSON key of the format version (int).</summary>- private const string KeyFormatVersion = "format_version";-- /// <summary>JSON key of the project name (string).</summary>- private const string KeyProjectName = "project_name";-- /// <summary>JSON key of the creation timestamp (string, UTC).</summary>- private const string KeyCreated = "created";-- /// <summary>JSON key of the last-saved timestamp (string, UTC).</summary>- private const string KeyModified = "modified";-- /// <summary>JSON key of the description (string).</summary>- private const string KeyDescription = "description";-- /// <summary>The top-level JSON object: scalar values and section dictionaries keyed by name. Never null; shared by reference with the sections handed out by <see cref="GetSection"/>. Insertion ordered in practice, so the file keeps a stable, readable order.</summary>- private readonly Dictionary<string, object> _values;- }-}diff --git a/Wave_Dude_2D/ProjectStore.cs b/Wave_Dude_2D/ProjectStore.csdeleted file mode 100644index 32965f9..0000000--- a/Wave_Dude_2D/ProjectStore.cs+++ /dev/null@@ -1,302 +0,0 @@-using System;-using System.Collections.Generic;-using System.IO;-using System.Linq;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Static helper that creates, opens, lists, renames and deletes project folders under a root- /// folder, and is the only code that constructs <see cref="Project"/> instances. A project folder- /// is any folder directly below the root that contains a configuration.json (or an empty legacy- /// Configuration.txt, which <see cref="Open"/> upgrades in place); the folder name is the project name.- /// The main folder of a project contains configuration.json and the sub-folders- /// <see cref="AssetsFolderName"/>, <see cref="OutputFramesFolderName"/>, <see cref="OutputVideoFolderName"/>- /// and <see cref="SceneImageFolderName"/>. The configuration is entirely in configuration.json; assets is- /// instead where the user can keep any third-party files used by the project, such as the original- /// Photoshop file of a scene image. Used by the Projects and Outputs tabs and by the File menu; all- /// methods are synchronous and do their own disk I/O.- /// </summary>- public sealed class ProjectStore- {- /// <summary>Not instantiable; all members are static.</summary>- private ProjectStore()- {- }-- /// <summary>- /// Checks that <paramref name="projectName"/> can be used as a folder name on Windows: not- /// blank, no surrounding whitespace, no trailing dot, at most <see cref="MaxNameLength"/>- /// characters, no characters from <see cref="Path.GetInvalidFileNameChars"/>, and not a- /// reserved device name (CON, NUL, COM1, ...; the part before the first dot is checked).- /// The name is never changed silently.- /// </summary>- /// <returns>A user-facing error message, or "" when the name is acceptable.</returns>- public static string ValidateName(string projectName)- {- if (string.IsNullOrWhiteSpace(projectName))- {- return "Enter a project name.";- }- if (projectName != projectName.Trim())- {- return "The project name must not start or end with a space.";- }- if (projectName.EndsWith(".", StringComparison.Ordinal))- {- return "The project name must not end with a dot.";- }- if (projectName.Length > ProjectStore.MaxNameLength)- {- return "The project name is too long (at most " + ProjectStore.MaxNameLength.ToString() + " characters).";- }- char[] invalidChars = Path.GetInvalidFileNameChars();- foreach (char ch in projectName)- {- if (Array.IndexOf(invalidChars, ch) >= 0)- {- if (ch < ' ')- {- return "The project name contains a control character.";- }- return "The project name contains the character '" + ch.ToString() + "', which is not allowed in a folder name.";- }- }- string baseName = projectName.Split('.')[0].ToUpperInvariant();- if (Array.IndexOf(ProjectStore.ReservedNames, baseName) >= 0)- {- return "'" + projectName + "' is a reserved name in Windows and cannot be used as a folder name.";- }- return "";- }-- /// <summary>Full path of the folder a project named <paramref name="projectName"/> has (or would have) under <paramref name="rootFolder"/>. Does not touch the disk.</summary>- public static string FolderPathFor(string rootFolder, string projectName)- {- return Path.Combine(ProjectStore.NormalizeFolder(rootFolder), projectName);- }-- /// <summary>True when <paramref name="folderPath"/> exists and contains a configuration.json or a legacy Configuration.txt.</summary>- public static bool IsProjectFolder(string folderPath)- {- if (string.IsNullOrWhiteSpace(folderPath) || !Directory.Exists(folderPath))- {- return false;- }- return File.Exists(Path.Combine(folderPath, ProjectConfig.FileName)) || File.Exists(Path.Combine(folderPath, ProjectConfig.LegacyFileName));- }-- /// <summary>- /// Opens the project in <paramref name="folderPath"/> and makes sure its standard sub-folders- /// exist. A folder that only has an empty legacy Configuration.txt is upgraded:- /// a fresh configuration.json is written and the legacy file deleted.- /// </summary>- /// <exception cref="DirectoryNotFoundException">The folder does not exist.</exception>- /// <exception cref="InvalidDataException">The folder has no configuration file, its legacy- /// Configuration.txt is not empty, or configuration.json is malformed or from a newer format- /// version (see <see cref="ProjectConfig.Load"/>).</exception>- public static Project Open(string folderPath)- {- string folder = ProjectStore.NormalizeFolder(folderPath);- if (!Directory.Exists(folder))- {- throw new DirectoryNotFoundException("The folder '" + folder + "' does not exist.");- }- string configPath = Path.Combine(folder, ProjectConfig.FileName);- string legacyPath = Path.Combine(folder, ProjectConfig.LegacyFileName);- Project project;- if (File.Exists(configPath))- {- project = new Project(folder, ProjectConfig.Load(configPath));- }- else- {- if (!File.Exists(legacyPath))- {- throw new InvalidDataException("The folder '" + Path.GetFileName(folder) + "' is not a project folder: it contains no " + ProjectConfig.FileName + ".");- }- if (File.ReadAllText(legacyPath).Trim().Length > 0)- {- throw new InvalidDataException("The file " + ProjectConfig.LegacyFileName + " is not empty and has no known format, so it was not replaced.");- }- project = new Project(folder, new ProjectConfig(Path.GetFileName(folder)));- project.Save();- File.Delete(legacyPath);- }- ProjectStore.EnsureSubFolders(folder);- return project;- }-- /// <summary>- /// Creates the folder <c>rootFolder\projectName</c> with its standard sub-folders and an- /// initial configuration.json, and returns the opened project. An existing folder is- /// accepted only when it is completely empty.- /// </summary>- /// <exception cref="ArgumentException">The name fails <see cref="ValidateName"/> or the root folder is blank.</exception>- /// <exception cref="IOException">A project of that name already exists, or the folder exists and is not empty.</exception>- public static Project Create(string rootFolder, string projectName)- {- string error = ProjectStore.ValidateName(projectName);- if (error.Length > 0)- {- throw new ArgumentException(error, "projectName");- }- if (string.IsNullOrWhiteSpace(rootFolder))- {- throw new ArgumentException("Enter a root folder.", "rootFolder");- }- string folder = ProjectStore.FolderPathFor(rootFolder, projectName);- if (ProjectStore.IsProjectFolder(folder))- {- throw new IOException("A project named '" + projectName + "' already exists in this root folder. Use 'Open existing' to open it.");- }- if (Directory.Exists(folder) && Directory.EnumerateFileSystemEntries(folder).Any())- {- throw new IOException("The folder '" + folder + "' already exists and is not empty, so it cannot be used for a new project.");- }- Directory.CreateDirectory(folder);- ProjectStore.EnsureSubFolders(folder);- Project project = new Project(folder, new ProjectConfig(projectName));- project.Save();- return project;- }-- /// <summary>- /// Names (folder names, not paths) of all project folders directly below- /// <paramref name="rootFolder"/>, sorted case-insensitively.- /// </summary>- /// <returns>An empty list when the root is blank, missing or cannot be enumerated (I/O or access errors are swallowed).</returns>- public static List<string> ListProjects(string rootFolder)- {- List<string> names = new List<string>();- if (string.IsNullOrWhiteSpace(rootFolder) || !Directory.Exists(rootFolder))- {- return names;- }- try- {- foreach (string folder in Directory.GetDirectories(rootFolder))- {- if (ProjectStore.IsProjectFolder(folder))- {- names.Add(Path.GetFileName(folder));- }- }- }- catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException)- {- return new List<string>();- }- names.Sort((a, b) => string.Compare(a, b, StringComparison.OrdinalIgnoreCase));- return names;- }-- /// <summary>Deletes a project folder and everything inside it.</summary>- /// <exception cref="InvalidDataException">The folder is not a project folder (safety check so arbitrary folders cannot be removed).</exception>- public static void Delete(string folderPath)- {- string folder = ProjectStore.NormalizeFolder(folderPath);- if (!ProjectStore.IsProjectFolder(folder))- {- throw new InvalidDataException("The folder '" + Path.GetFileName(folder) + "' is not a project folder, so it was not deleted.");- }- Directory.Delete(folder, true);- }-- /// <summary>- /// Renames the project folder <paramref name="folderPath"/> to <paramref name="newProjectName"/>- /// within the same root and returns the new folder path. A name that differs only in case- /// is treated as unchanged and the original path is returned without touching the disk.- /// </summary>- /// <exception cref="InvalidDataException">The folder is not a project folder.</exception>- /// <exception cref="ArgumentException">The new name fails <see cref="ValidateName"/>.</exception>- /// <exception cref="IOException">A file or folder with the new name already exists.</exception>- public static string Rename(string folderPath, string newProjectName)- {- string folder = ProjectStore.NormalizeFolder(folderPath);- if (!ProjectStore.IsProjectFolder(folder))- {- throw new InvalidDataException("The folder '" + Path.GetFileName(folder) + "' is not a project folder, so it was not renamed.");- }- string error = ProjectStore.ValidateName(newProjectName);- if (error.Length > 0)- {- throw new ArgumentException(error, "newProjectName");- }- string rootFolder = Path.GetDirectoryName(folder);- string newFolder = ProjectStore.FolderPathFor(rootFolder, newProjectName);- if (string.Equals(folder, newFolder, StringComparison.OrdinalIgnoreCase))- {- // only a case change, or unchanged- return folder;- }- if (Directory.Exists(newFolder) || File.Exists(newFolder))- {- throw new IOException("'" + newProjectName + "' already exists in this root folder. Choose a different name.");- }- Directory.Move(folder, newFolder);- return newFolder;- }-- /// <summary>Creates the standard sub-folders (<see cref="SubFolderNames"/>) inside a project folder; I/O and access errors are not fatal here.</summary>- private static void EnsureSubFolders(string folder)- {- try- {- foreach (string name in ProjectStore.SubFolderNames)- {- Directory.CreateDirectory(Path.Combine(folder, name));- }- }- catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException)- {- // not fatal: a folder that cannot be created is reported when it is needed- }- }-- /// <summary>- /// Canonical form of a folder path for comparisons: trimmed, made absolute, and without a- /// trailing separator (except for a bare drive root such as <c>C:\</c>).- /// </summary>- internal static string NormalizeFolder(string folderPath)- {- string path = Path.GetFullPath(folderPath.Trim());- string pathRoot = Path.GetPathRoot(path);- if (path.Length > pathRoot.Length)- {- path = path.TrimEnd(new char[]- {- Path.DirectorySeparatorChar,- Path.AltDirectorySeparatorChar- });- }- return path;- }-- /// <summary>Sub-folder where the user keeps any third-party files that belong to the project, such as the original Photoshop file of a scene image; never read or written by the simulator itself (counted in the delete warning).</summary>- public const string AssetsFolderName = "assets";-- /// <summary>Sub-folder the simulation writes rendered PNG frames into.</summary>- public const string OutputFramesFolderName = "output_frames";-- /// <summary>Sub-folder the simulation writes video files into.</summary>- public const string OutputVideoFolderName = "output_video";-- /// <summary>Sub-folder that holds the project's scene images (imported images are copied here).</summary>- public const string SceneImageFolderName = "scene_images";-- /// <summary>Maximum length of a project name in characters.</summary>- private const int MaxNameLength = 100;-- /// <summary>The sub-folders every project folder gets, in creation order.</summary>- private static readonly string[] SubFolderNames = new string[] { AssetsFolderName, OutputFramesFolderName, OutputVideoFolderName, SceneImageFolderName };-- /// <summary>Names that Windows does not allow for a file or folder (compared upper-case against the part before the first dot).</summary>- private static readonly string[] ReservedNames = new string[]- {- "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6",- "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7",- "LPT8", "LPT9"- };- }-}diff --git a/Wave_Dude_2D/Properties/AssemblyInfo.cs b/Wave_Dude_2D/Properties/AssemblyInfo.csdeleted file mode 100644index ecb4496..0000000--- a/Wave_Dude_2D/Properties/AssemblyInfo.cs+++ /dev/null@@ -1,17 +0,0 @@-using System;-using System.Diagnostics;-using System.Reflection;-using System.Runtime.CompilerServices;-using System.Runtime.InteropServices;-using System.Runtime.Versioning;--[assembly: AssemblyVersion("1.0.0.0")]-[assembly: AssemblyTitle("Wave_Dude_2D")]-[assembly: AssemblyDescription("")]-[assembly: AssemblyCompany("")]-[assembly: AssemblyProduct("Wave_Dude_2D")]-[assembly: AssemblyCopyright("Copyright © 2026")]-[assembly: AssemblyTrademark("")]-[assembly: ComVisible(false)]-[assembly: Guid("51c8e121-f5ae-493a-bd03-487bca68a6fc")]-[assembly: AssemblyFileVersion("1.0.0.0")]diff --git a/Wave_Dude_2D/SceneData.cs b/Wave_Dude_2D/SceneData.csdeleted file mode 100644index 7dd2fcb..0000000--- a/Wave_Dude_2D/SceneData.cs+++ /dev/null@@ -1,223 +0,0 @@-using System;-using System.Collections.Generic;-using System.Drawing;-using System.Drawing.Imaging;-using System.Runtime.InteropServices;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Per-pixel simulation input derived from a scene image: squared wave speed (<see cref="C2"/>,- /// <c>(1 / refractive index)^2</c>; the time step is 1), damping factor (<see cref="D"/>, the factor on the- /// velocity: 1 = no damping, 0 = the wave is stopped) and the positions / levels of image-defined sources- /// (the value of the green channel sets the frequency).- /// The rules are those of the Python classes <c>StaticImageScene</c>, <c>StaticRefractiveIndex</c> and- /// <c>StaticDampening</c>: red channel = refractive index * 100 (clamped to 0.9..10), green = every pixel- /// above 0 is a sinusoidal source whose level is the green value, blue = damping strength (0 = none,- /// 255 = full; stored as <c>D = 1 - blue / 255</c>), damping edge = a border of the given thickness with- /// damping factor <c>sqrt(i / thickness)</c> at i pixels from the edge.- /// Created by <see cref="SimulationRunner"/> on its worker thread- /// via <see cref="FromImage"/> or <see cref="Empty"/> and then copied into the padded grids of- /// <see cref="WaveSimulator"/> / <see cref="GpuWaveSimulator"/>. The arrays are row-major- /// (<c>y * Width + x</c>) without padding and are not modified after construction.- /// </summary>- internal sealed class SceneData- {- private SceneData(int w, int h, float[] c2, float[] d, int[] srcX, int[] srcY, byte[] srcLevel)- {- Width = w;- Height = h;- C2 = c2;- D = d;- SourceX = srcX;- SourceY = srcY;- SourceLevel = srcLevel;- }-- /// <summary>Number of image-defined source pixels (length of <see cref="SourceX"/>, <see cref="SourceY"/> and <see cref="SourceLevel"/>).</summary>- public int SourceCount => SourceX.Length;-- /// <summary>- /// Decodes <paramref name="image"/> (any pixel format; read as 32bpp ARGB) into per-pixel squared- /// speed and damping factor and, when <paramref name="useSources"/> is set, collects every pixel- /// with green > 0 as a source whose level is that green value, in row-major order. Finally- /// fades the damping in a border of <paramref name="dampingEdge"/> pixels (see <see cref="ApplyBorder"/>).- /// The bitmap is only locked for reading and is not disposed.- /// </summary>- /// <param name="image">Scene image; its size becomes the canvas size.</param>- /// <param name="useSources">Collect green pixels as sources; otherwise the source arrays are empty.</param>- /// <param name="dampingEdge">Thickness of the absorbing border in pixels; 0 or less for none.</param>- public static SceneData FromImage(Bitmap image, bool useSources, int dampingEdge)- {- int width = image.Width;- int height = image.Height;- float[] c2 = new float[width * height];- float[] d = new float[width * height];- List<int> sourceX = new List<int>();- List<int> sourceY = new List<int>();- List<byte> sourceLevel = new List<byte>();- BitmapData data = image.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);- try- {- byte[] row = new byte[width * 4];- for (int y = 0; y < height; y++)- {- Marshal.Copy(IntPtr.Add(data.Scan0, y * data.Stride), row, 0, width * 4);- for (int x = 0; x < width; x++)- {- int offset = x * 4;- // Format32bppArgb is stored as B, G, R, A- int blue = row[offset];- int green = row[offset + 1];- int red = row[offset + 2];- double refractiveIndex = red / 100.0;- if (refractiveIndex < 0.9)- {- refractiveIndex = 0.9;- }- if (refractiveIndex > 10.0)- {- refractiveIndex = 10.0;- }- double speed = 1.0 / refractiveIndex;- int index = y * width + x;- c2[index] = (float)(speed * speed);- d[index] = (float)(1.0 - blue / 255.0);- if (useSources && green > 0)- {- sourceX.Add(x);- sourceY.Add(y);- sourceLevel.Add((byte)green);- }- }- }- }- finally- {- image.UnlockBits(data);- }- SceneData.ApplyBorder(d, width, height, dampingEdge);- return new SceneData(width, height, c2, d, sourceX.ToArray(), sourceY.ToArray(), sourceLevel.ToArray());- }-- /// <summary>- /// Creates a uniform, user defined <paramref name="w"/> x <paramref name="h"/> scene without sources: the- /// speed is derived from <paramref name="refractiveIndex"/> (clamped to 0.9..10) and the damping- /// factor is 1 (none) everywhere except in the <paramref name="dampingEdge"/> border.- /// </summary>- /// <param name="w">Canvas width in pixels.</param>- /// <param name="h">Canvas height in pixels.</param>- /// <param name="dampingEdge">Thickness of the absorbing border in pixels; 0 or less for none.</param>- /// <param name="refractiveIndex">Background refractive index (1.0 by default, the same rule as a scene image's red channel: index = red / 100).</param>- public static SceneData Empty(int w, int h, int dampingEdge, double refractiveIndex = 1.0)- {- double clampedIndex = refractiveIndex;- if (clampedIndex < 0.9)- {- clampedIndex = 0.9;- }- if (clampedIndex > 10.0)- {- clampedIndex = 10.0;- }- float speed = (float)(1.0 / clampedIndex);- float[] c2 = new float[w * h];- float[] d = new float[w * h];- for (int i = 0; i < c2.Length; i++)- {- c2[i] = speed * speed;- d[i] = 1f;- }- SceneData.ApplyBorder(d, w, h, dampingEdge);- return new SceneData(w, h, c2, d, new int[0], new int[0], new byte[0]);- }-- /// <summary>- /// Counts the pixels of <paramref name="image"/> with green > 0, i.e. the number of sources- /// <see cref="FromImage"/> would collect. Used by <see cref="Form1"/> on the UI thread before a- /// run to warn when image sources are enabled but the image contains none.- /// </summary>- public static int CountSources(Bitmap image)- {- int width = image.Width;- int height = image.Height;- int count = 0;- BitmapData data = image.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);- try- {- byte[] row = new byte[width * 4];- for (int y = 0; y < height; y++)- {- Marshal.Copy(IntPtr.Add(data.Scan0, y * data.Stride), row, 0, width * 4);- for (int x = 0; x < width; x++)- {- if (row[x * 4 + 1] > 0)- {- count++;- }- }- }- }- finally- {- image.UnlockBits(data);- }- return count;- }-- /// <summary>- /// Damping edge, as in <c>StaticDampening</c>: overwrites the damping factor in a frame of- /// <paramref name="thickness"/> pixels (capped at half the smaller side) around the edge of the- /// <paramref name="w"/> x <paramref name="h"/> grid with <c>sqrt(i / thickness)</c>, where i is the- /// distance from the edge, so the outermost ring stops the wave completely and the factor rises to 1- /// inside. Does nothing for a thickness of 0 or less.- /// </summary>- /// <param name="d">Damping array, row-major, modified in place.</param>- /// <param name="w">Grid width in pixels.</param>- /// <param name="h">Grid height in pixels.</param>- /// <param name="thickness">Requested border thickness in pixels.</param>- internal static void ApplyBorder(float[] d, int w, int h, int thickness)- {- int border = Math.Min(thickness, Math.Min(w, h) / 2);- if (border <= 0)- {- return;- }- for (int i = 0; i < border; i++)- {- float factor = (float)Math.Sqrt((double)i / border);- for (int x = i; x <= w - 1 - i; x++)- {- d[i * w + x] = factor;- d[(h - 1 - i) * w + x] = factor;- }- for (int y = i; y <= h - 1 - i; y++)- {- d[y * w + i] = factor;- d[y * w + (w - 1 - i)] = factor;- }- }- }-- /// <summary>Canvas width in pixels.</summary>- public readonly int Width;-- /// <summary>Canvas height in pixels.</summary>- public readonly int Height;-- /// <summary>Squared wave speed per pixel (<c>1 / n^2</c> for refractive index n, so 1 for n = 1), row-major.</summary>- public readonly float[] C2;-- /// <summary>Damping factor per pixel, 0..1 where 1 = no damping, row-major.</summary>- public readonly float[] D;-- /// <summary>X canvas coordinate of each image-defined source pixel; parallel to <see cref="SourceY"/> and <see cref="SourceLevel"/>.</summary>- public readonly int[] SourceX;-- /// <summary>Y canvas coordinate of each image-defined source pixel.</summary>- public readonly int[] SourceY;-- /// <summary>Green channel value (1..255) of each image-defined source pixel; the engines treat it as the source's level.</summary>- public readonly byte[] SourceLevel;- }-}diff --git a/Wave_Dude_2D/SceneSettings.cs b/Wave_Dude_2D/SceneSettings.csdeleted file mode 100644index ab01482..0000000--- a/Wave_Dude_2D/SceneSettings.cs+++ /dev/null@@ -1,279 +0,0 @@-using System;-using System.Collections.Generic;-using System.Globalization;-using System.IO;--namespace _2D_wave_sim_V01-{- /// <summary>- /// The "scene" section of a project (Configuration tab): where the canvas comes from (an image or a blank- /// user-sized canvas), the damping border and the source options. Edited by <c>Form1</c> on the UI thread and- /// persisted through <see cref="ProjectConfig"/>; the runner turns it into a <see cref="SceneData"/> when a run- /// starts. The size of a scene image is not stored: it is read from the image itself. There is no scene-level- /// "use probes" switch: each probe has its own "On" checkbox (<see cref="ProbeSettings.Active"/>) instead.- /// </summary>- public sealed class SceneSettings- {- /// <summary>- /// Creates settings with the defaults of the Python example: a blank 1920 × 1080 canvas, 64 px damping- /// edge, no sources. <see cref="DampingEdgeEnabled"/> and <see cref="UseObjectSources"/> deliberately have- /// no software-chosen default of their own and stay false here, the same as- /// <see cref="SimulationSettings.Steps"/> / <see cref="SimulationSettings.TimeDecayFactor"/>: a new project- /// starts at whatever the Designer Checked value of <c>chkDampingEdge</c> / <c>chkUseObjectSources</c> is,- /// which <c>StartNewProject</c> (Form1) reads right after creating this instance.- /// </summary>- public SceneSettings()- {- UseImage = false;- ImageFile = "";- UserWidth = DefaultWidth;- UserHeight = DefaultHeight;- DampingEdgeSize = DefaultDampingEdgeSize;- UseSources = false;- ImageSourceScale = DefaultImageSourceScale;- BackgroundRefractiveIndex = DefaultBackgroundRefractiveIndex;- }-- /// <summary>True to build the canvas from <see cref="ImageFile"/>; false for a blank <see cref="UserWidth"/> × <see cref="UserHeight"/> canvas.</summary>- public bool UseImage { get; set; }-- /// <summary>Scene image path as stored in the project: relative to the project folder when inside it (forward slashes; see <see cref="ToStoredPath"/>), otherwise a full path; "" when none.</summary>- public string ImageFile { get; set; }-- /// <summary>Width in canvas pixels of a user-defined canvas.</summary>- public int UserWidth { get; set; }-- /// <summary>Height in canvas pixels of a user-defined canvas.</summary>- public int UserHeight { get; set; }-- /// <summary>- /// Whether a damping frame is applied around the canvas edge. No software-chosen default of its own, the- /// same as <see cref="SimulationSettings.Steps"/> / <see cref="SimulationSettings.TimeDecayFactor"/>: a new- /// project starts at whatever <c>chkDampingEdge</c>'s own Designer Checked value is (see- /// <c>StartNewProject</c>, Form1). The false used by <see cref="FromConfig"/> is only the fallback for an- /// existing project saved before this setting existed.- /// </summary>- public bool DampingEdgeEnabled { get; set; }-- /// <summary>Thickness of the damping frame in canvas pixels.</summary>- public int DampingEdgeSize { get; set; }-- /// <summary>Whether green pixels of the scene image act as wave sources.</summary>- public bool UseSources { get; set; }-- /// <summary>Peak amplitude of the image sources (passed to the engine as the source amplitude; <c>source_amplitude</c> of <c>StaticImageScene</c> in the Python code).</summary>- public double ImageSourceScale { get; set; }-- /// <summary>- /// Whether the object sources of the source list are used in the run. No software-chosen default of its- /// own, the same as <see cref="DampingEdgeEnabled"/>: a new project starts at whatever- /// <c>chkUseObjectSources</c>' own Designer Checked value is (see <c>StartNewProject</c>, Form1); the false- /// used by <see cref="FromConfig"/> is only the fallback for a project saved before this setting existed.- /// </summary>- public bool UseObjectSources { get; set; }-- /// <summary>Refractive index of a user-defined canvas's background (c = 1/n cells per step), 1.0 to 2.55 (a red channel value of 100 to 255, as in a scene image, which has its own value per pixel from its red channel).</summary>- public double BackgroundRefractiveIndex { get; set; }-- /// <summary>- /// Reads the "scene" section of <paramref name="config"/>. Missing keys and out-of-range values fall back to- /// the defaults; a missing section yields a default instance. The false fallbacks for- /// <c>damping_edge_enabled</c> and <c>use_object_sources</c> are deliberate: they keep a project saved before- /// those keys existed at its previous behaviour (see <see cref="DampingEdgeEnabled"/>).- /// </summary>- public static SceneSettings FromConfig(ProjectConfig config)- {- SceneSettings settings = new SceneSettings();- if (!config.ContainsKey(SectionName))- {- return settings;- }- Dictionary<string, object> section = config.GetSection(SectionName);- settings.UseImage = string.CompareOrdinal(SceneSettings.ReadText(section, "mode", ModeUserDefined), ModeImage) == 0;- settings.ImageFile = SceneSettings.ReadText(section, "image_file", "");- settings.UserWidth = SceneSettings.ReadInt(section, "user_width", DefaultWidth, MinCanvasSize, MaxCanvasSize);- settings.UserHeight = SceneSettings.ReadInt(section, "user_height", DefaultHeight, MinCanvasSize, MaxCanvasSize);- settings.DampingEdgeEnabled = SceneSettings.ReadBool(section, "damping_edge_enabled", false);- settings.DampingEdgeSize = SceneSettings.ReadInt(section, "damping_edge_size_px", DefaultDampingEdgeSize, 1, MaxDampingEdgeSize);- settings.UseSources = SceneSettings.ReadBool(section, "use_sources", false);- settings.ImageSourceScale = SceneSettings.ReadDouble(section, "image_source_scale", DefaultImageSourceScale, 0.0, MaxImageSourceScale);- settings.UseObjectSources = SceneSettings.ReadBool(section, "use_object_sources", false);- settings.BackgroundRefractiveIndex = SceneSettings.ReadDouble(section, "background_refractive_index", DefaultBackgroundRefractiveIndex, MinBackgroundRefractiveIndex, MaxBackgroundRefractiveIndex);- return settings;- }-- /// <summary>Writes every value into the "scene" section of <paramref name="config"/>, creating the section if needed.</summary>- public void ToConfig(ProjectConfig config)- {- Dictionary<string, object> section = config.GetSection(SectionName);- section["mode"] = (UseImage ? ModeImage : ModeUserDefined);- section["image_file"] = ImageFile;- section["user_width"] = UserWidth;- section["user_height"] = UserHeight;- section["damping_edge_enabled"] = DampingEdgeEnabled;- section["damping_edge_size_px"] = DampingEdgeSize;- section["use_sources"] = UseSources;- section["image_source_scale"] = ImageSourceScale;- section["use_object_sources"] = UseObjectSources;- section["background_refractive_index"] = BackgroundRefractiveIndex;- }-- /// <summary>- /// Converts a full path to the form stored in the project file: relative to the project folder- /// (with forward slashes) when it lies inside it (case-insensitive prefix match), otherwise unchanged.- /// </summary>- /// <param name="projectFolder">Project folder; when null or empty <paramref name="fullPath"/> is returned as is.</param>- /// <param name="fullPath">Absolute path of the scene image.</param>- public static string ToStoredPath(string projectFolder, string fullPath)- {- if (string.IsNullOrEmpty(projectFolder))- {- return fullPath;- }- string folderPrefix = projectFolder.TrimEnd(new char[]- {- Path.DirectorySeparatorChar,- Path.AltDirectorySeparatorChar- }) + Path.DirectorySeparatorChar.ToString();- if (fullPath.StartsWith(folderPrefix, StringComparison.OrdinalIgnoreCase))- {- return fullPath.Substring(folderPrefix.Length).Replace(Path.DirectorySeparatorChar, '/');- }- return fullPath;- }-- /// <summary>- /// Inverse of <see cref="ToStoredPath"/>: resolves a stored (possibly relative, forward-slash) path- /// against the project folder. Rooted paths are returned unchanged.- /// </summary>- /// <returns>The full path, or "" when <paramref name="storedPath"/> is null or empty.</returns>- public static string ToFullPath(string projectFolder, string storedPath)- {- if (string.IsNullOrEmpty(storedPath))- {- return "";- }- if (Path.IsPathRooted(storedPath))- {- return storedPath;- }- return Path.Combine(projectFolder, storedPath.Replace('/', Path.DirectorySeparatorChar));- }-- /// <summary>The value under <paramref name="key"/> converted to text (invariant culture), or the fallback when absent or null.</summary>- private static string ReadText(Dictionary<string, object> section, string key, string fallback)- {- object value;- if (section.TryGetValue(key, out value) && value != null)- {- return Convert.ToString(value, CultureInfo.InvariantCulture);- }- return fallback;- }-- /// <summary>The value under <paramref name="key"/> if it is an actual <see cref="bool"/>; anything else yields the fallback.</summary>- private static bool ReadBool(Dictionary<string, object> section, string key, bool fallback)- {- object value;- if (section.TryGetValue(key, out value) && value is bool)- {- return Convert.ToBoolean(value);- }- return fallback;- }-- /// <summary>- /// The value under <paramref name="key"/> converted to a double (invariant culture) when it converts and- /// lies within [<paramref name="minValue"/>, <paramref name="maxValue"/>]; otherwise the fallback.- /// </summary>- private static double ReadDouble(Dictionary<string, object> section, string key, double fallback, double minValue, double maxValue)- {- object value;- if (section.TryGetValue(key, out value) && value != null)- {- try- {- double parsed = Convert.ToDouble(value, CultureInfo.InvariantCulture);- if (parsed >= minValue && parsed <= maxValue)- {- return parsed;- }- }- catch (Exception ex) when (ex is FormatException || ex is InvalidCastException || ex is OverflowException)- {- // use the fallback- }- }- return fallback;- }-- /// <summary>- /// The value under <paramref name="key"/> converted to an int (invariant culture) when it converts and- /// lies within [<paramref name="minValue"/>, <paramref name="maxValue"/>]; otherwise the fallback.- /// </summary>- private static int ReadInt(Dictionary<string, object> section, string key, int fallback, int minValue, int maxValue)- {- object value;- if (section.TryGetValue(key, out value) && value != null)- {- try- {- int parsed = Convert.ToInt32(value, CultureInfo.InvariantCulture);- if (parsed >= minValue && parsed <= maxValue)- {- return parsed;- }- }- catch (Exception ex) when (ex is FormatException || ex is InvalidCastException || ex is OverflowException)- {- // use the fallback- }- }- return fallback;- }-- /// <summary>Name of this section in the project file.</summary>- public const string SectionName = "scene";-- /// <summary>Value of the "mode" key when the canvas comes from an image.</summary>- public const string ModeImage = "image";-- /// <summary>Value of the "mode" key for a blank user-sized canvas.</summary>- public const string ModeUserDefined = "user_defined";-- // the defaults are those of the Python example (1920 x 1080 canvas, 64 px damping edge)-- /// <summary>Default <see cref="UserWidth"/> in canvas pixels.</summary>- public const int DefaultWidth = 1920;-- /// <summary>Default <see cref="UserHeight"/> in canvas pixels.</summary>- public const int DefaultHeight = 1080;-- /// <summary>Default <see cref="DampingEdgeSize"/> in canvas pixels.</summary>- public const int DefaultDampingEdgeSize = 64;-- /// <summary>Smallest accepted canvas width or height in pixels.</summary>- public const int MinCanvasSize = 8;-- /// <summary>Largest accepted canvas width or height in pixels.</summary>- public const int MaxCanvasSize = 16384;-- /// <summary>Largest accepted <see cref="DampingEdgeSize"/> in pixels.</summary>- public const int MaxDampingEdgeSize = 8192;-- /// <summary>Default <see cref="ImageSourceScale"/>.</summary>- public const double DefaultImageSourceScale = 1.0;-- /// <summary>Largest accepted <see cref="ImageSourceScale"/>.</summary>- public const double MaxImageSourceScale = 1000.0;-- /// <summary>Default <see cref="BackgroundRefractiveIndex"/> of a user-defined (image-less) scene's background; the range is 1.0 to 2.55 (a red channel value of 100 to 255, as in a scene image).</summary>- public const double DefaultBackgroundRefractiveIndex = 1.0;-- /// <summary>Smallest accepted <see cref="BackgroundRefractiveIndex"/>.</summary>- public const double MinBackgroundRefractiveIndex = 1.0;-- /// <summary>Largest accepted <see cref="BackgroundRefractiveIndex"/>.</summary>- public const double MaxBackgroundRefractiveIndex = 2.55;- }-}diff --git a/Wave_Dude_2D/SimulationJob.cs b/Wave_Dude_2D/SimulationJob.csdeleted file mode 100644index 0359d92..0000000--- a/Wave_Dude_2D/SimulationJob.cs+++ /dev/null@@ -1,96 +0,0 @@-using System.Collections.Generic;-using System.Drawing;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Everything the background worker needs to run one simulation: scene, settings, colour LUTs, output paths and probes.- /// Built by <c>Form1.StartSimulation</c> on the UI thread, then owned exclusively by <see cref="SimulationRunner"/>'s- /// worker thread, which also disposes the bitmaps. Scene size and all pixel values are in canvas (scene image) pixels.- /// </summary>- internal sealed class SimulationJob- {- public SimulationJob()- {- BackgroundRefractiveIndex = 1.0;- SourceAmplitude = 1.0;- FieldVideoPath = "";- IntensityVideoPath = "";- }-- /// <summary>- /// Private copy of the scene image (red = refractive index, green = source level, blue = damping); null for an empty- /// canvas of <see cref="Width"/> x <see cref="Height"/>. The runner disposes it as soon as the <see cref="SceneData"/> is built.- /// </summary>- public Bitmap Image;-- /// <summary>Canvas width in pixels; only used when <see cref="Image"/> is null.</summary>- public int Width;-- /// <summary>Canvas height in pixels; only used when <see cref="Image"/> is null.</summary>- public int Height;-- /// <summary>Refractive index of the whole empty canvas (not used with an image); defaults to 1.0.</summary>- public double BackgroundRefractiveIndex;-- /// <summary>Whether pixels with a green value above 0 in <see cref="Image"/> act as sources.</summary>- public bool UseSources;-- /// <summary>Amplitude multiplier for the image-defined sources (the scene's image source scale); defaults to 1.0.</summary>- public double SourceAmplitude;-- /// <summary>Thickness in pixels of the absorbing border around the canvas; 0 = none.</summary>- public int DampingEdge;-- /// <summary>Snapshot (clone) of the simulation settings, so later edits in the UI do not affect the running job.</summary>- public SimulationSettings Settings;-- /// <summary>Colour table (<see cref="ColorLut.Size"/> packed ARGB values) for field frames, or null for grey levels (<see cref="FrameRenderer"/> then uses the table index itself as the grey level).</summary>- public int[] FieldLut;-- /// <summary>Colour table (<see cref="ColorLut.Size"/> packed ARGB values) for intensity frames, or null for grey levels.</summary>- public int[] IntensityLut;-- /// <summary>Full path of the field video to write (.mp4, may fall back to .avi); empty = do not export the field.</summary>- public string FieldVideoPath;-- /// <summary>Full path of the intensity video to write (.mp4, may fall back to .avi); empty = do not export the intensity.</summary>- public string IntensityVideoPath;-- /// <summary>Probes to sample during the run; null or empty when there are none.</summary>- public List<ProbeSettings> Probes;-- /// <summary>Object sources (added on the Sources tab) to drive in addition to the image sources; may be null.</summary>- public List<SourceElement> ObjectSources;-- /// <summary>Maximum preview width in picture-box pixels; the runner shrinks previews to fit (keeping the aspect ratio) but never enlarges them.</summary>- public int PreviewWidth;-- /// <summary>Maximum preview height in picture-box pixels; see <see cref="PreviewWidth"/>.</summary>- public int PreviewHeight;-- /// <summary>- /// The Viewer tab's "glowing edges" overlay (<c>Form1</c>'s <c>_glowEdgesImage</c>), exactly the size of the simulation- /// canvas; null when there is none (no scene image), or when both gains below are 0 (the overlay is switched off for- /// both Field and Intensity). Frozen at the start of the run, the same as <see cref="Settings"/>; the runner owns and- /// disposes it (converted to bytes before the first step). See <see cref="FrameRenderer.AddOverlay"/>.- /// </summary>- public Bitmap GlowOverlay;-- /// <summary>- /// How strongly to blend <see cref="GlowOverlay"/> into the Field video, frozen at the start of the run from- /// <c>Form1</c>'s <c>numBrightnessFieldOverlay</c> and <c>chkDiplayOverlayInField</c> (0 when unchecked, see- /// <c>Form1.FieldOverlayGain</c>). Only affects the exported videos: the live preview keeps blending its own copy of the- /// overlay in on the UI thread (<c>Form1.ShowPreview</c>/<c>ComposeGlowOverlay</c>), which can track the checkbox/brightness- /// box live; a running export cannot, so it uses whatever these were at the moment Start Simulation was pressed.- /// </summary>- public double FieldOverlayGain;-- /// <summary>- /// How strongly to blend <see cref="GlowOverlay"/> into the Intensity video, frozen at the start of the run from- /// <c>numBrightnessIntensityOverlay</c> and <c>chkDiplayOverlayInIntensity</c> (0 when unchecked); see- /// <see cref="FieldOverlayGain"/> for why only the exported video is affected.- /// </summary>- public double IntensityOverlayGain;- }-}diff --git a/Wave_Dude_2D/SimulationResult.cs b/Wave_Dude_2D/SimulationResult.csdeleted file mode 100644index 252bc04..0000000--- a/Wave_Dude_2D/SimulationResult.cs+++ /dev/null@@ -1,72 +0,0 @@-using System;-using System.Collections.Generic;-using System.Drawing;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Outcome of one simulation run. Filled by <see cref="SimulationRunner"/> on its worker thread and- /// handed to the form through the <c>Finished</c> event (marshalled to the UI thread by- /// <c>Form1.PostToUi</c>); after that only the UI thread touches it. String members are never null- /// (empty means "none"). The receiver takes ownership of the two bitmaps.- /// </summary>- internal sealed class SimulationResult- {- public SimulationResult()- {- Message = "";- Files = new List<string>();- FieldFile = "";- IntensityFile = "";- Engine = "";- EngineNote = "";- }-- /// <summary>How the run ended.</summary>- public SimulationStatus Status;-- /// <summary>- /// Failure reason when <see cref="Status"/> is <see cref="SimulationStatus.Failed"/>; for other outcomes it may- /// carry the note that MP4 encoding was unavailable and .avi files were written instead. Empty when there is nothing to say.- /// </summary>- public string Message;-- /// <summary>Number of time steps actually computed (equals the requested steps when completed).</summary>- public int StepsDone;-- /// <summary>Wall-clock time of the run, excluding the time spent paused.</summary>- public TimeSpan Elapsed;-- /// <summary>Full paths of the video files that were written, in the order field then intensity (after any .mp4 to .avi fallback).</summary>- public List<string> Files;-- /// <summary>Full path of the field video, or empty when the field was not exported.</summary>- public string FieldFile;-- /// <summary>Full path of the intensity video, or empty when the intensity was not exported.</summary>- public string IntensityFile;-- /// <summary>- /// Where the simulation ran, the <see cref="IWaveEngine.Description"/> of the engine ("CPU (8 threads)",- /// "GPU: NVIDIA GeForce MX130 (OpenCL)"); empty when engine creation itself failed.- /// </summary>- public string Engine;-- /// <summary>Note from <see cref="WaveEngineFactory.Create"/>: why the GPU was not used when it was asked for; empty when there is none.</summary>- public string EngineNote;-- /// <summary>- /// A full simulation-resolution snapshot of the field (with probe overlays burned in), rendered right before the engine- /// was closed down, so a still export (the Preview tab's "Export current Field/Intensity frame" buttons) has something to- /// save even once the run has fully stopped and the live engine no longer exists. Null when the run failed before an- /// engine was created or rendering failed. The receiver owns the bitmap.- /// </summary>- public Bitmap LastFieldFrame;-- /// <summary>- /// The same snapshot of the intensity; null when the intensity was not tracked for this run (or, as for- /// <see cref="LastFieldFrame"/>, no engine was created or rendering failed). The receiver owns the bitmap.- /// </summary>- public Bitmap LastIntensityFrame;- }-}diff --git a/Wave_Dude_2D/SimulationRunner.cs b/Wave_Dude_2D/SimulationRunner.csdeleted file mode 100644index 9c33b36..0000000--- a/Wave_Dude_2D/SimulationRunner.cs+++ /dev/null@@ -1,608 +0,0 @@-using System;-using System.Diagnostics;-using System.Drawing;-using System.IO;-using System.Threading;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Runs a <see cref="SimulationJob"/> on a dedicated background thread ("Wave simulation"), as the loop- /// in <c>main_curr.py</c>: for every step update the scene (sources), update the field and the intensity;- /// every N steps render a frame for the previews and the videos, collecting probe data and raising- /// progress / preview events as it goes. Created and started by <c>Form1</c> (one instance per run);- /// the form keeps the reference in <c>_runner</c> so stale callbacks from an older run can be ignored.- /// </summary>- /// <remarks>- /// <para><b>Event contract.</b> Every event (<see cref="ProgressChanged"/>, <see cref="EngineReady"/>,- /// <see cref="ProbesUpdated"/>, <see cref="PreviewReady"/>, <see cref="Finished"/>) is raised- /// synchronously on the <em>worker thread</em>, never on the UI thread. Handlers must marshal to the UI- /// themselves; <c>Form1</c> does so through <c>PostToUi</c> (<c>BeginInvoke</c>). Order of events:- /// <see cref="EngineReady"/> once (after the engine is built, before any frames), then interleaved- /// <see cref="ProgressChanged"/> / <see cref="ProbesUpdated"/> / <see cref="PreviewReady"/>, then a- /// final <see cref="ProgressChanged"/> and exactly one <see cref="Finished"/>. If engine creation fails,- /// only <see cref="ProgressChanged"/> and <see cref="Finished"/> are raised.</para>- /// <para><b>Pause / cancel handshake.</b> <see cref="_gate"/> is a <see cref="ManualResetEventSlim"/>- /// that is set while running. <see cref="PauseRun"/> resets it; the worker notices at the top of the- /// next step, reports the exact step count, stops the elapsed-time stopwatch and blocks on the gate.- /// <see cref="ResumeRun"/> sets it again. <see cref="Cancel"/> sets the <see cref="_cancel"/> flag and- /// also sets the gate so a paused run wakes up; the loop exits before the next step with- /// <see cref="SimulationStatus.Cancelled"/> and the video files are still closed properly.</para>- /// <para><b>Preview handshake.</b> The worker only renders a new preview when at least- /// <see cref="PreviewIntervalMs"/> have elapsed since the last one and <see cref="_previewPending"/>- /// is <= 0. Before raising <see cref="PreviewReady"/> it sets <see cref="_previewPending"/> to the- /// number of bitmaps it is about to hand out (1 or 2); the UI must call <see cref="PreviewShown"/> once- /// per bitmap it received (also when it discards it), which decrements the counter. This stops the- /// worker from flooding the UI message queue with bitmaps faster than they can be displayed.</para>- /// </remarks>- internal sealed class SimulationRunner- {- /// <summary>- /// Raised on the worker thread at most every 100 ms with (steps done, total steps), plus once when- /// pausing (with the exact count) and once just before <see cref="Finished"/>.- /// </summary>- public event SimulationRunner.ProgressChangedEventHandler ProgressChanged;-- /// <summary>- /// Raised once on the worker thread after <see cref="WaveEngineFactory.Create"/> succeeded, with the- /// engine description (e.g. CPU/GPU) and an optional note (empty string when there is none).- /// </summary>- public event SimulationRunner.EngineReadyEventHandler EngineReady;-- /// <summary>- /// Raised on the worker thread at most every 50 ms (and once at the end) with the new probe measurements- /// drained since the previous update: the new values of the point probes and the last profile of the line- /// probes. The receiver owns the arrays. Only raised when the job has probes.- /// </summary>- public event SimulationRunner.ProbesUpdatedEventHandler ProbesUpdated;-- /// <summary>- /// Raised on the worker thread with a freshly allocated preview <see cref="Bitmap"/> (field or- /// intensity, scaled to fit the preview box). The handler owns the bitmap and must call- /// <see cref="PreviewShown"/> for every bitmap it receives. Preview bitmaps carry no glow or probe- /// overlay; the UI composes those.- /// </summary>- public event SimulationRunner.PreviewReadyEventHandler PreviewReady;-- /// <summary>- /// Raised exactly once on the worker thread as the very last action of the run, after the video- /// files are closed and the engine is disposed. The receiver owns the bitmaps in the result.- /// </summary>- public event SimulationRunner.FinishedEventHandler Finished;-- /// <summary>Stores the job and creates the pause gate in the "running" (set) state.</summary>- public SimulationRunner(SimulationJob job)- {- _gate = new ManualResetEventSlim(true);- _job = job;- }-- /// <summary>Starts the background worker thread; returns immediately. Call once.</summary>- public void Start()- {- _thread = new Thread(new ThreadStart(Run));- _thread.IsBackground = true;- _thread.Name = "Wave simulation";- _thread.Start();- }-- /// <summary>- /// Asks the run to stop after the current step (thread-safe, callable from the UI thread). Also opens- /// the pause gate so a paused run can wake up and finish; the run then ends with- /// <see cref="SimulationStatus.Cancelled"/>, the videos are closed properly and <see cref="Finished"/>- /// is still raised.- /// </summary>- public void Cancel()- {- Interlocked.Exchange(ref _cancel, 1);- _gate.Set(); // a paused run must wake up to stop- }-- /// <summary>- /// Holds the run before the next step: closes the gate so the worker blocks (it finishes the step in- /// progress first). The videos stay open. While paused, <see cref="RenderCurrentFrame"/> may be used.- /// </summary>- public void PauseRun()- {- _gate.Reset();- }-- /// <summary>Opens the gate so a paused worker continues.</summary>- public void ResumeRun()- {- _gate.Set();- }-- /// <summary>- /// Acknowledges one <see cref="PreviewReady"/> bitmap (UI thread). When all outstanding bitmaps are- /// acknowledged the worker may produce the next preview.- /// </summary>- public void PreviewShown()- {- Interlocked.Decrement(ref _previewPending);- }-- /// <summary>- /// Blocks until the worker thread has ended or the timeout elapses.- /// </summary>- /// <returns><c>true</c> if the thread ended (or was never started), <c>false</c> on timeout.</returns>- public bool WaitForExit(int milliseconds)- {- Thread thread = _thread;- return thread == null || thread.Join(milliseconds);- }-- /// <summary>- /// Renders the current field or intensity frame at full engine resolution on demand (for a still-image- /// export), with probe markers burned in but without the glow overlay. Intended for the UI thread, and- /// only while the run is paused: it reads the engine buffers directly, which is only safe because the- /// worker is then guaranteed to be parked on the gate and not touching the engine's arrays.- /// </summary>- /// <param name="isField"><c>true</c> for the wave field, <c>false</c> for the intensity.</param>- /// <param name="lut">ARGB palette with at least 255 entries, or null for greyscale.</param>- /// <param name="brightness">Gain applied to the raw values before palette lookup.</param>- /// <returns>- /// A new <see cref="Bitmap"/> owned by the caller, or null when the run is not paused, no engine- /// exists yet, or intensity was requested but the engine does not accumulate it.- /// </returns>- public Bitmap RenderCurrentFrame(bool isField, int[] lut, float brightness)- {- if (_gate.IsSet)- {- return null; // running (not paused): unsafe to read- }- IWaveEngine sim = _sim;- if (sim == null)- {- return null;- }- if (!isField && sim.IntensityData == null)- {- return null;- }- int width = sim.Width;- int height = sim.Height;- sim.PrepareFrame(isField, !isField);- int[] pixels = new int[width * height];- if (isField)- {- FrameRenderer.RenderField(sim, lut, brightness, pixels, width, height);- if (_collector != null)- {- ProbeOverlay.Burn(pixels, width, height, _job.Probes, _collector.Traces, ProbePlaceOn.Field, _job.Settings.Steps);- }- }- else- {- FrameRenderer.RenderIntensity(sim, lut, brightness, pixels, width, height);- if (_collector != null)- {- ProbeOverlay.Burn(pixels, width, height, _job.Probes, _collector.Traces, ProbePlaceOn.Intensity, _job.Settings.Steps);- }- }- return FrameRenderer.ToBitmap(pixels, width, height);- }-- /// <summary>- /// Worker thread body. Builds the scene and engine, opens the video sinks, steps the simulation,- /// and in <c>finally</c> closes the sinks, captures the last full-size frames into the result and- /// disposes the engine. Never throws: failures end up in <see cref="SimulationResult.Status"/> /- /// <see cref="SimulationResult.Message"/>. The job's <see cref="SimulationJob.Image"/> and- /// <see cref="SimulationJob.GlowOverlay"/> bitmaps are disposed here once consumed.- /// </summary>- private void Run()- {- SimulationResult result = new SimulationResult();- Stopwatch stopwatch = Stopwatch.StartNew();- IFrameSink fieldSink = null;- IFrameSink intensitySink = null;- IWaveEngine engine = null;- // declared here, outside the try, because finally also needs them for the last-frame probe overlay- ProbeCollector collector = null;- int totalSteps = 0;- try- {- SimulationSettings settings = _job.Settings;- bool writeField = _job.FieldVideoPath.Length > 0;- bool writeIntensity = _job.IntensityVideoPath.Length > 0;- bool needIntensity = writeIntensity || settings.PreviewIntensity;-- // the scene and the simulator- SceneData scene;- if (_job.Image != null)- {- scene = SceneData.FromImage(_job.Image, _job.UseSources, _job.DampingEdge);- _job.Image.Dispose();- _job.Image = null;- }- else- {- scene = SceneData.Empty(_job.Width, _job.Height, _job.DampingEdge, _job.BackgroundRefractiveIndex);- }- int width = scene.Width;- int height = scene.Height;-- // the probes- ProbeSampler sampler = null;- if (_job.Probes != null && _job.Probes.Count > 0)- {- sampler = ProbeSampler.Build(_job.Probes, width, height);- collector = new ProbeCollector(sampler);- if (sampler.NeedsIntensity)- {- needIntensity = true;- }- }- string engineNote = "";- engine = WaveEngineFactory.Create(scene, settings, _job.SourceAmplitude, needIntensity, ref engineNote, _job.ObjectSources);- _sim = engine;- _collector = collector;- result.Engine = engine.Description;- result.EngineNote = engineNote;- EngineReady?.Invoke(engine.Description, engineNote);- if (sampler != null)- {- engine.SetProbes(sampler);- }-- // videos- if (writeField)- {- fieldSink = SimulationRunner.OpenSink(_job.FieldVideoPath, width, height, settings.VideoFps, settings.VideoQuality, result);- result.Files.Add(fieldSink.FilePath);- result.FieldFile = fieldSink.FilePath;- }- if (writeIntensity)- {- intensitySink = SimulationRunner.OpenSink(_job.IntensityVideoPath, width, height, settings.VideoFps, settings.VideoQuality, result);- result.Files.Add(intensitySink.FilePath);- result.IntensityFile = intensitySink.FilePath;- }- int[] fullPixels = null;- if (writeField || writeIntensity)- {- fullPixels = new int[width * height];- }- // the "glowing edges" overlay for the videos (FrameRenderer.AddOverlay): converted to a plain RGB- // byte array and gain-prescaled (FrameRenderer.ScaleOverlayRgb) once, up front, rather than redoing- // either on every single exported frame; this was the actual cost of the overlay on a video export- byte[] fieldOverlayScaled = null;- byte[] intensityOverlayScaled = null;- if (_job.GlowOverlay != null && (writeField || writeIntensity))- {- byte[] overlayRgb = FrameRenderer.ToRgbBytes(_job.GlowOverlay, width, height);- if (writeField)- {- fieldOverlayScaled = FrameRenderer.ScaleOverlayRgb(overlayRgb, _job.FieldOverlayGain);- }- if (writeIntensity)- {- intensityOverlayScaled = FrameRenderer.ScaleOverlayRgb(overlayRgb, _job.IntensityOverlayGain);- }- }- if (_job.GlowOverlay != null)- {- _job.GlowOverlay.Dispose();- _job.GlowOverlay = null;- }- // previews are made small enough to fit the preview area: shrunk (never enlarged), keeping the aspect ratio- int previewWidth = width;- int previewHeight = height;- double previewScale = Math.Min((double)_job.PreviewWidth / width, (double)_job.PreviewHeight / height);- if (previewScale < 1.0)- {- previewWidth = Math.Max(1, (int)Math.Floor(width * previewScale));- previewHeight = Math.Max(1, (int)Math.Floor(height * previewScale));- }- int[] previewPixels = null;- if (settings.PreviewField || settings.PreviewIntensity)- {- previewPixels = new int[previewWidth * previewHeight];- }- float fieldBrightness = (float)settings.FieldBrightness;- float intensityBrightness = (float)settings.IntensityBrightness;- int visualizeEvery = Math.Max(1, settings.VisualizeEvery);- totalSteps = settings.Steps;- long lastProgressMs = 0L;- long lastProbeMs = 0L;- long lastPreviewMs = 0L;- result.Status = SimulationStatus.Completed;- for (int i = 0; i < totalSteps; i++)- {- if (!_gate.IsSet)- {- // paused: report the exact step count; the time of the pause does not count- stopwatch.Stop();- ProgressChanged?.Invoke(result.StepsDone, totalSteps);- _gate.Wait();- stopwatch.Start();- }- if (Thread.VolatileRead(ref _cancel) != 0)- {- result.Status = SimulationStatus.Cancelled;- break;- }- engine.AdvanceOneStep();- if (sampler != null)- {- engine.SampleProbes();- }- result.StepsDone = i + 1;- if (i % visualizeEvery == 0)- {- // the probe values up to this step (the graphs in the videos need them)- if (collector != null)- {- collector.Collect(engine, result.StepsDone);- if (writeField || writeIntensity)- {- collector.CollectProfiles(engine, result.StepsDone);- }- }- // previews are only made when the pictures of the last preview have all been shown, and not- // more often than roughly PreviewIntervalMs. The second condition is the fix for a real bug:- // without it, this was gated purely by _previewPending (whether the UI thread has finished- // showing the last one, via ShowPreview/PreviewShown) - and on a GPU engine, PrepareFrame- // below is where the actual cost is (a full-resolution GPU->host readback, not just the small- // preview picture), so the GPU run's speed ended up riding on how fast the UI happened to be.- // With the "display overlay" checkboxes off, SetPreviewFrame is cheap and _previewPending- // clears almost immediately, so a readback fired on nearly every eligible step; with them on,- // ComposeGlowOverlay's per-pixel blend made the UI side slow enough to skip most of those- // readbacks "by accident", which is why turning the overlay on made the run go faster rather- // than slower. Pacing previews by elapsed time keeps the readback rate steady and no longer- // dependent on a checkbox that was never meant to affect simulation throughput. Exporting a- // video already forces a readback every eligible step regardless (see writeField/- // writeIntensity below), which is why the slowdown was never visible with video export on.- bool previewDue = stopwatch.ElapsedMilliseconds - lastPreviewMs >= PreviewIntervalMs;- bool doPreview = previewPixels != null && previewDue && Thread.VolatileRead(ref _previewPending) <= 0;- if (doPreview)- {- lastPreviewMs = stopwatch.ElapsedMilliseconds;- }- // a GPU engine copies only the data that is going to be drawn- engine.PrepareFrame(writeField || (doPreview && settings.PreviewField), writeIntensity || (doPreview && settings.PreviewIntensity));- if (writeField)- {- FrameRenderer.RenderField(engine, _job.FieldLut, fieldBrightness, fullPixels, width, height);- FrameRenderer.AddOverlay(fullPixels, fieldOverlayScaled, width, height);- if (collector != null)- {- ProbeOverlay.Burn(fullPixels, width, height, _job.Probes, collector.Traces, ProbePlaceOn.Field, totalSteps);- }- fieldSink.AddPixels(fullPixels);- }- if (writeIntensity)- {- FrameRenderer.RenderIntensity(engine, _job.IntensityLut, intensityBrightness, fullPixels, width, height);- FrameRenderer.AddOverlay(fullPixels, intensityOverlayScaled, width, height);- if (collector != null)- {- ProbeOverlay.Burn(fullPixels, width, height, _job.Probes, collector.Traces, ProbePlaceOn.Intensity, totalSteps);- }- intensitySink.AddPixels(fullPixels);- }- if (doPreview)- {- // Set the outstanding count before raising, so PreviewShown() cannot race it to 0.- int previewCount = (settings.PreviewField ? 1 : 0) + (settings.PreviewIntensity ? 1 : 0);- Interlocked.Exchange(ref _previewPending, previewCount);- if (settings.PreviewField)- {- FrameRenderer.RenderField(engine, _job.FieldLut, fieldBrightness, previewPixels, previewWidth, previewHeight);- PreviewReady?.Invoke(true, FrameRenderer.ToBitmap(previewPixels, previewWidth, previewHeight));- }- if (settings.PreviewIntensity)- {- FrameRenderer.RenderIntensity(engine, _job.IntensityLut, intensityBrightness, previewPixels, previewWidth, previewHeight);- PreviewReady?.Invoke(false, FrameRenderer.ToBitmap(previewPixels, previewWidth, previewHeight));- }- }- }- // the probe values go to the user interface about 20 times a second- if (collector != null && stopwatch.ElapsedMilliseconds - lastProbeMs >= 50L)- {- lastProbeMs = stopwatch.ElapsedMilliseconds;- collector.Collect(engine, result.StepsDone);- collector.CollectProfiles(engine, result.StepsDone);- ProbesUpdated?.Invoke(collector.TakeForUi());- }- if (stopwatch.ElapsedMilliseconds - lastProgressMs >= 100L)- {- lastProgressMs = stopwatch.ElapsedMilliseconds;- ProgressChanged?.Invoke(i + 1, totalSteps);- }- }-- // the last probe values- if (collector != null)- {- collector.Collect(engine, result.StepsDone);- collector.CollectProfiles(engine, result.StepsDone);- ProbesUpdated?.Invoke(collector.TakeForUi());- }- }- catch (OutOfMemoryException)- {- result.Status = SimulationStatus.Failed;- result.Message = "There is not enough memory for a simulation of this size. Use a smaller canvas.";- }- catch (Exception ex)- {- result.Status = SimulationStatus.Failed;- result.Message = ex.Message;- }- finally- {- // close the videos, also after a stop or an error, so that the files can be played- try- {- if (fieldSink != null)- {- fieldSink.Close();- }- }- catch (Exception)- {- // nothing more can be done- }- try- {- if (intensitySink != null)- {- intensitySink.Close();- }- }- catch (Exception)- {- // nothing more can be done- }- if (engine != null)- {- try- {- // one last full-resolution snapshot, so a still export still has something to save once the run- // has fully stopped and the engine itself is gone (see SimulationResult.LastFieldFrame/LastIntensityFrame)- int[] lastPixels = new int[engine.Width * engine.Height];- bool hasIntensity = engine.IntensityData != null;- engine.PrepareFrame(true, hasIntensity);- FrameRenderer.RenderField(engine, _job.FieldLut, (float)_job.Settings.FieldBrightness, lastPixels, engine.Width, engine.Height);- if (collector != null)- {- ProbeOverlay.Burn(lastPixels, engine.Width, engine.Height, _job.Probes, collector.Traces, ProbePlaceOn.Field, totalSteps);- }- result.LastFieldFrame = FrameRenderer.ToBitmap(lastPixels, engine.Width, engine.Height);- if (hasIntensity)- {- FrameRenderer.RenderIntensity(engine, _job.IntensityLut, (float)_job.Settings.IntensityBrightness, lastPixels, engine.Width, engine.Height);- if (collector != null)- {- ProbeOverlay.Burn(lastPixels, engine.Width, engine.Height, _job.Probes, collector.Traces, ProbePlaceOn.Intensity, totalSteps);- }- result.LastIntensityFrame = FrameRenderer.ToBitmap(lastPixels, engine.Width, engine.Height);- }- }- catch (Exception)- {- // no still frame this time - not fatal, the export buttons just won't have anything to save- }- try- {- (engine as IDisposable)?.Dispose();- }- catch (Exception)- {- // nothing more can be done- }- _sim = null;- _collector = null;- }- if (_job.Image != null)- {- _job.Image.Dispose();- }- }- stopwatch.Stop();- result.Elapsed = stopwatch.Elapsed;- ProgressChanged?.Invoke(result.StepsDone, _job.Settings.Steps);- Finished?.Invoke(result);- }-- /// <summary>- /// Opens a video file. An .mp4 path is written as H.264 with the encoder of Windows (Media Foundation),- /// falling back to a Motion JPEG .avi (same name, .avi extension) when that is not possible (no Media- /// Foundation, size not supported); any partial .mp4 is deleted and the reason is stored in- /// <see cref="SimulationResult.Message"/>. Other extensions always get AVI.- /// </summary>- /// <param name="filePath">Requested output path; the extension decides the container.</param>- /// <param name="w">Frame width in pixels.</param>- /// <param name="h">Frame height in pixels.</param>- /// <param name="fps">Playback frame rate.</param>- /// <param name="quality">1..100; bitrate for MP4, JPEG quality for AVI.</param>- /// <param name="result">Receives the fallback message; its file lists are filled by the caller.</param>- /// <returns>An open sink; its <see cref="IFrameSink.FilePath"/> is the path actually used.</returns>- private static IFrameSink OpenSink(string filePath, int w, int h, int fps, int quality, SimulationResult result)- {- if (string.Equals(Path.GetExtension(filePath), ".mp4", StringComparison.OrdinalIgnoreCase))- {- try- {- return new MfVideoWriter(filePath, w, h, fps, quality);- }- catch (Exception ex)- {- if (File.Exists(filePath))- {- try- {- File.Delete(filePath);- }- catch (Exception)- {- // an empty leftover file does no harm- }- }- result.Message = "MP4 (H.264) video could not be made on this computer (" + ex.Message.Trim() + "). The videos were written as Motion JPEG .avi files instead; play them with VLC.";- filePath = Path.ChangeExtension(filePath, ".avi");- }- }- return new AviFrameSink(filePath, w, h, fps, quality);- }-- /// <summary>Unused leftover; the JPEG quality actually comes from <see cref="SimulationSettings.VideoQuality"/>.</summary>- private const long JpegQuality = 90L;-- /// <summary>- /// Minimum time between two preview frames, in stopwatch milliseconds (about 30 fps). See its use in- /// <see cref="Run"/> for why this exists: it keeps a GPU engine's readback rate steady and independent of- /// how fast the UI thread happens to be at displaying the previous one (e.g. with/without the "display- /// overlay" checkboxes), rather than implicitly riding on <see cref="_previewPending"/> alone. ~30 fps is- /// already faster than a picture box is usefully watchable at.- /// </summary>- private const long PreviewIntervalMs = 33L;-- /// <summary>The job to run; its bitmaps are consumed and disposed by the worker.</summary>- private readonly SimulationJob _job;-- /// <summary>The worker thread; null until <see cref="Start"/>.</summary>- private Thread _thread;-- /// <summary>Cancel flag (0/1), written by the UI thread via <see cref="Interlocked"/>, read volatile by the worker.</summary>- private int _cancel;-- /// <summary>Number of preview bitmaps handed to the UI that have not been acknowledged by <see cref="PreviewShown"/> yet.</summary>- private int _previewPending;-- /// <summary>Pause gate: set = running, reset = paused. The worker waits on it at the top of each step.</summary>- private readonly ManualResetEventSlim _gate;-- /// <summary>- /// The live engine, set once at the start of <see cref="Run"/> and cleared just before it is disposed at the- /// end; read from the UI thread (<see cref="RenderCurrentFrame"/>) only while paused, when the worker thread- /// is parked at <c>_gate.Wait()</c> and is not touching it.- /// </summary>- private IWaveEngine _sim;-- /// <summary>- /// The probe collector for this run (null when there are no probes, or after the run ends), set alongside- /// <see cref="_sim"/> so <see cref="RenderCurrentFrame"/> can also burn the probe markers/graphs onto a still- /// export: the video export loop in <see cref="Run"/> already did this (<see cref="ProbeOverlay.Burn"/>) but- /// <see cref="RenderCurrentFrame"/> did not, which left probe data out of exported still frames.- /// </summary>- private ProbeCollector _collector;-- /// <summary>Handler for <see cref="ProgressChanged"/>: steps completed so far and the total step count.</summary>- public delegate void ProgressChangedEventHandler(int stepsDone, int totalSteps);-- /// <summary>Handler for <see cref="EngineReady"/>: engine description and an optional note (empty when none).</summary>- public delegate void EngineReadyEventHandler(string description, string note);-- /// <summary>Handler for <see cref="ProbesUpdated"/>: the samples drained since the previous update.</summary>- public delegate void ProbesUpdatedEventHandler(ProbeUpdate update);-- /// <summary>Handler for <see cref="PreviewReady"/>: <paramref name="isField"/> tells which picture box the (caller-owned) bitmap is for.</summary>- public delegate void PreviewReadyEventHandler(bool isField, Bitmap frame);-- /// <summary>Handler for <see cref="Finished"/>: the completed result, including status, files and last frames.</summary>- public delegate void FinishedEventHandler(SimulationResult result);- }-}diff --git a/Wave_Dude_2D/SimulationSettings.cs b/Wave_Dude_2D/SimulationSettings.csdeleted file mode 100644index 13db241..0000000--- a/Wave_Dude_2D/SimulationSettings.cs+++ /dev/null@@ -1,346 +0,0 @@-using System;-using System.Collections.Generic;-using System.Globalization;--namespace _2D_wave_sim_V01-{- /// <summary>- /// The "simulation" section of a project (Configuration tab): step count, visualisation and export options,- /// and solver parameters. Edited by <c>Form1</c> on the UI thread, persisted through <see cref="ProjectConfig"/>- /// and handed to the runner as a <see cref="Clone"/> inside the <see cref="SimulationJob"/>.- /// A few keys have no control on the screen yet but can be edited in the file: <c>field_brightness</c>,- /// <c>intensity_brightness</c>, <c>field_black_level</c>, <c>intensity_black_level</c>,- /// <c>source_frequency_scale</c>, <c>video_fps</c>. The defaults are those of the Python example- /// (<c>main_curr.py</c>).- /// </summary>- public sealed class SimulationSettings- {- /// <summary>- /// Creates settings with the defaults for a new project (preview on, export off, 4th-order stencil, CPU- /// engine). <see cref="Steps"/> and <see cref="TimeDecayFactor"/> deliberately have no software-chosen- /// default and stay 0: a new project starts at whatever the Designer value of <c>numSimulationSteps</c> /- /// <c>numTimeDecayFactor</c> is, which <c>StartNewProject</c> (Form1) reads right after creating this- /// instance. <see cref="DefaultSteps"/> is only the <see cref="FromConfig"/> fallback for a project saved- /// before the key existed.- /// </summary>- public SimulationSettings()- {- VisualizeEvery = 2;- ExportField = false;- ExportIntensity = false;- PreviewField = true;- PreviewIntensity = true;- FieldColorScheme = "Default_Field";- IntensityColorScheme = "Default_intensity";- FieldBrightness = 30.0;- IntensityBrightness = 30.0;- FieldBlackLevel = -0.05;- IntensityBlackLevel = 0.0;- SourceFrequencyScale = 2.0;- VideoFps = 60;- VideoQuality = DefaultVideoQuality;- UseGpu = false;- Use4thOrderLaplacian = true;- WaveSpeedC = 1.0;- IntensityScale = 1.0;- }-- /// <summary>- /// Total number of simulation steps to run. No software-chosen default of its own, the same as- /// <see cref="TimeDecayFactor"/>: a new project starts at whatever <c>numSimulationSteps</c>' own Designer- /// value is (see <c>StartNewProject</c>'s <c>new SimulationSettings()</c>); <see cref="DefaultSteps"/> is- /// only the fallback for an existing project saved before "steps" existed (<see cref="FromConfig"/>).- /// </summary>- public int Steps { get; set; }-- /// <summary>Render, export and collect probe data every this many steps.</summary>- public int VisualizeEvery { get; set; }-- /// <summary>Whether to write the field frames to a video file.</summary>- public bool ExportField { get; set; }-- /// <summary>Whether to write the intensity frames to a video file.</summary>- public bool ExportIntensity { get; set; }-- /// <summary>Whether to show the field in the live preview.</summary>- public bool PreviewField { get; set; }-- /// <summary>Whether to show the intensity in the live preview.</summary>- public bool PreviewIntensity { get; set; }-- /// <summary>- /// Name of the <see cref="ColorScheme"/> used for field frames (empty: grey levels). The name a new project- /// starts with is selected by <c>FillSchemeCombo</c> (Form1) only when a scheme with that exact name- /// (case-insensitive) and matching <see cref="ColorScheme.SchemeType"/> exists; otherwise the combo just- /// shows nothing selected, the same as for any other scheme name that is not found.- /// </summary>- public string FieldColorScheme { get; set; }-- /// <summary>Name of the <see cref="ColorScheme"/> used for intensity frames (empty: grey levels); see <see cref="FieldColorScheme"/> for how the name is matched.</summary>- public string IntensityColorScheme { get; set; }-- /// <summary>- /// Display gain for field frames (multiplies the field value before the colour lookup). This is- /// <c>render_field(7)</c> in the Python example; 30.0 here is high enough to see a single source in the- /// simulation, which is what <c>numFieldScaling</c>'s own Designer default also shows for a new source.- /// </summary>- public double FieldBrightness { get; set; }-- /// <summary>Display gain for intensity frames (multiplies the square root of the intensity before the colour lookup); <c>render_intensity(7)</c> in the Python example, see <see cref="FieldBrightness"/>.</summary>- public double IntensityBrightness { get; set; }-- /// <summary>Offset baked into the field colour LUT (the "offset" spinner in the UI); see <see cref="ColorLut.Build"/>.</summary>- public double FieldBlackLevel { get; set; }-- /// <summary>Offset baked into the intensity colour LUT (the "offset" spinner in the UI); see <see cref="ColorLut.Build"/>.</summary>- public double IntensityBlackLevel { get; set; }-- /// <summary>Multiplies the frequency of the sources that come from the green channel of the scene image (and of the object sources, which use the same level scale): angular frequency = level/255 × 0.5 × this, in radians per step.</summary>- public double SourceFrequencyScale { get; set; }-- /// <summary>Frame rate of the exported videos.</summary>- public int VideoFps { get; set; }-- /// <summary>Encoder quality of the exported videos, 1 (small files) to 100 (best picture, large files).</summary>- public int VideoQuality { get; set; }-- /// <summary>Run the simulation on the graphics card (OpenCL); falls back to the processor when that is not possible.</summary>- public bool UseGpu { get; set; }-- /// <summary>- /// Use a 4th-order accurate discrete Laplacian (a 5-point "cross" in each of x and y, reaching 2 cells away)- /// instead of the standard 3x3 kernel, everywhere it is safe to (see <c>WaveSimulator.UpdateField</c> /- /// <c>GpuWaveSimulator.KernelSource</c>; the outermost ring of the domain still falls back to the 3x3 kernel,- /// since it does not have 2 cells of margin). This reduces numerical dispersion (short wavelengths,- /// under-resolved by the grid, are otherwise slowed down relative to long ones; see <see cref="WaveSpeedC"/>,- /// whose legacy fallback is itself a symptom of this) at the cost of roughly twice the memory reads per step.- /// On by default for a new project (the constructor). An existing project saved before this property existed- /// still loads as Off (<see cref="FromConfig"/>'s own separate, hardcoded fallback), so it keeps its exact- /// previous behaviour instead of silently picking up the new project default.- /// </summary>- public bool Use4thOrderLaplacian { get; set; }-- /// <summary>- /// The propagation speed of waves through the medium, in canvas pixels per step (λ = c / frequency). Set- /// from the "Set c-value" entry on the File menu. This is only used to estimate and display a source's- /// wavelength (<c>lblLambdaIs</c> on the Sources tab); it does not affect the simulation itself, which- /// derives the real, per-pixel wave speed from the scene's refractive index (the red channel of the scene- /// image; see <c>SceneData.C2</c>) instead, and can vary from pixel to pixel while this single value cannot.- /// A new project starts at 1.0, the solver's own default speed for a uniform medium (the constructor). An- /// existing project saved before this field existed still loads at 0.563 instead (<see cref="FromConfig"/>'s- /// own separate, hardcoded fallback): that value was found experimentally to be the correct one at around- /// a source frequency of 100, and is kept only so such a project's displayed wavelength estimate does not- /// change out from under it. Like every other property here, this belongs to one project's settings and is- /// saved/loaded with it (<c>wave_speed_c</c>); it is not a global setting, so different projects can each- /// keep their own value.- /// </summary>- public double WaveSpeedC { get; set; }-- /// <summary>- /// "Intensity decay factor" (Configuration tab, <c>numTimeDecayFactor</c>): the intensity shown/exported is- /// not the raw field², it is an exponential running average of it (see <c>WaveSimulator.UpdateField</c> /- /// <c>GpuWaveSimulator.KernelSource</c>), because a source oscillates every step and the raw squared- /// amplitude would flicker at twice the source frequency instead of showing a steady intensity. The- /// averaging needs a time constant of at least a few periods of the slowest active source, or that flicker- /// "prints through"; a fixed time constant long enough for a low-frequency source is unnecessarily long for- /// a high-frequency one and shows as a visible trail behind anything that moves. Both engines therefore- /// scale the time constant inversely with the frequency of the slowest active source (image or object)- /// instead of using one fixed value, and this property is the number of steps that time constant works out- /// to at a nominal medium source (green level <c>WaveSimulator.NominalDecayLevel</c>, 100). Raising it- /// lengthens the trail on every source (helps a low-frequency source avoid print-through); lowering it- /// shortens the trail (helps a high-frequency source look crisp) at the cost of print-through if a- /// low-frequency source is also present in the same scene.- /// This class does not itself pick a number for a new project; that would just be a second, competing- /// default fighting the one already set on <c>numTimeDecayFactor</c> in the Designer. <c>StartNewProject</c>- /// (Form1) instead reads the control's own value right after creating a new instance, and that is the only- /// place a new project's starting value is decided; changing it means changing <c>numTimeDecayFactor</c>'s- /// Value in the Designer. The 10.0 in <see cref="FromConfig"/> is only the fallback for a project saved- /// before the key existed.- /// </summary>- public double TimeDecayFactor { get; set; }-- /// <summary>- /// A plain multiplier on the tracked intensity itself (not just how it is displayed): both engines apply it- /// to every intensity value they compute, so it changes the actual numbers in the preview, the exported- /// videos, the probe data and any exported files, unlike <see cref="FieldBrightness"/> /- /// <see cref="IntensityBrightness"/>, which only scale how an image is drawn from the numbers and leave- /// the numbers themselves alone. It exists because, with the filtering <see cref="TimeDecayFactor"/>- /// controls, the raw intensity ends up landing around 1e-5 for typical scenes (an inconvenient scale for an- /// axis or a data file), and the right multiplier to bring that into a convenient range depends on the- /// source amplitudes and pulse shapes actually used, which this class has no way to predict. The default- /// of 1.0 leaves the raw numbers exactly as computed; <c>numIntensityScale</c> (Configuration tab) lets the- /// value be tuned by eye once the actual scale in use is visible.- /// </summary>- public double IntensityScale { get; set; }-- /// <summary>Shallow copy that a running simulation can keep while the user goes on editing; all members are value types or immutable strings, so the copy is independent.</summary>- public SimulationSettings Clone()- {- return (SimulationSettings)base.MemberwiseClone();- }-- /// <summary>- /// Reads the "simulation" section of <paramref name="config"/>. Missing keys and out-of-range values fall- /// back to per-key defaults; a missing section yields a default instance.- /// </summary>- /// <remarks>- /// The per-key fallbacks are deliberately separate from the constructor defaults and differ for four keys- /// (steps 2500 vs 0, use_4th_order_laplacian false vs true, wave_speed_c 0.563 vs 1.0, time_decay_factor- /// 10 vs 0): an existing project saved before a key existed keeps its exact previous behaviour, while a new- /// project takes the constructor / Designer values via <c>StartNewProject</c> (Form1). See- /// <see cref="Steps"/>, <see cref="Use4thOrderLaplacian"/>, <see cref="WaveSpeedC"/> and- /// <see cref="TimeDecayFactor"/> for the reasoning behind each.- /// </remarks>- public static SimulationSettings FromConfig(ProjectConfig config)- {- SimulationSettings settings = new SimulationSettings();- if (!config.ContainsKey(SectionName))- {- return settings;- }- Dictionary<string, object> section = config.GetSection(SectionName);- settings.Steps = SimulationSettings.ReadInt(section, "steps", DefaultSteps, 1, MaxSteps);- settings.VisualizeEvery = SimulationSettings.ReadInt(section, "visualize_every", 2, 1, MaxVisualizeEvery);- settings.ExportField = SimulationSettings.ReadBool(section, "export_field", false);- settings.ExportIntensity = SimulationSettings.ReadBool(section, "export_intensity", false);- settings.PreviewField = SimulationSettings.ReadBool(section, "preview_field", true);- settings.PreviewIntensity = SimulationSettings.ReadBool(section, "preview_intensity", true);- settings.FieldColorScheme = SimulationSettings.ReadText(section, "field_color_scheme", "Default_Field");- settings.IntensityColorScheme = SimulationSettings.ReadText(section, "intensity_color_scheme", "Default_intensity");- settings.FieldBrightness = SimulationSettings.ReadDouble(section, "field_brightness", 30.0, 0.0001, 100000.0);- settings.IntensityBrightness = SimulationSettings.ReadDouble(section, "intensity_brightness", 30.0, 0.0001, 100000.0);- settings.FieldBlackLevel = SimulationSettings.ReadDouble(section, "field_black_level", -0.05, -10.0, 1.0);- settings.IntensityBlackLevel = SimulationSettings.ReadDouble(section, "intensity_black_level", 0.0, -10.0, 1.0);- settings.SourceFrequencyScale = SimulationSettings.ReadDouble(section, "source_frequency_scale", 2.0, 0.0, 1000.0);- settings.VideoFps = SimulationSettings.ReadInt(section, "video_fps", 60, 1, MaxVideoFps);- settings.VideoQuality = SimulationSettings.ReadInt(section, "video_quality", DefaultVideoQuality, 1, 100);- settings.UseGpu = SimulationSettings.ReadBool(section, "use_gpu", false);- settings.Use4thOrderLaplacian = SimulationSettings.ReadBool(section, "use_4th_order_laplacian", false);- settings.WaveSpeedC = SimulationSettings.ReadDouble(section, "wave_speed_c", 0.563, 1E-06, 1000000.0);- settings.TimeDecayFactor = SimulationSettings.ReadDouble(section, "time_decay_factor", 10.0, 1.0, 100.0);- settings.IntensityScale = SimulationSettings.ReadDouble(section, "intensity_scale", 1.0, 1E-07, 1000000.0);- return settings;- }-- /// <summary>Writes every value into the "simulation" section of <paramref name="config"/>, creating the section if needed.</summary>- public void ToConfig(ProjectConfig config)- {- Dictionary<string, object> section = config.GetSection(SectionName);- section["steps"] = Steps;- section["visualize_every"] = VisualizeEvery;- section["export_field"] = ExportField;- section["export_intensity"] = ExportIntensity;- section["preview_field"] = PreviewField;- section["preview_intensity"] = PreviewIntensity;- section["field_color_scheme"] = FieldColorScheme;- section["intensity_color_scheme"] = IntensityColorScheme;- section["field_brightness"] = FieldBrightness;- section["intensity_brightness"] = IntensityBrightness;- section["field_black_level"] = FieldBlackLevel;- section["intensity_black_level"] = IntensityBlackLevel;- section["source_frequency_scale"] = SourceFrequencyScale;- section["video_fps"] = VideoFps;- section["video_quality"] = VideoQuality;- section["use_gpu"] = UseGpu;- section["use_4th_order_laplacian"] = Use4thOrderLaplacian;- section["wave_speed_c"] = WaveSpeedC;- section["time_decay_factor"] = TimeDecayFactor;- section["intensity_scale"] = IntensityScale;- }-- /// <summary>The value under <paramref name="key"/> converted to text (invariant culture), or the fallback when absent or null.</summary>- private static string ReadText(Dictionary<string, object> section, string key, string fallback)- {- object value;- if (section.TryGetValue(key, out value) && value != null)- {- return Convert.ToString(value, CultureInfo.InvariantCulture);- }- return fallback;- }-- /// <summary>The value under <paramref name="key"/> if it is an actual <see cref="bool"/>; anything else yields the fallback.</summary>- private static bool ReadBool(Dictionary<string, object> section, string key, bool fallback)- {- object value;- if (section.TryGetValue(key, out value) && value is bool)- {- return Convert.ToBoolean(value);- }- return fallback;- }-- /// <summary>- /// The value under <paramref name="key"/> converted to an int (invariant culture) when it converts and- /// lies within [<paramref name="minValue"/>, <paramref name="maxValue"/>]; otherwise the fallback.- /// </summary>- private static int ReadInt(Dictionary<string, object> section, string key, int fallback, int minValue, int maxValue)- {- object value;- if (section.TryGetValue(key, out value) && value != null)- {- try- {- int parsed = Convert.ToInt32(value, CultureInfo.InvariantCulture);- if (parsed >= minValue && parsed <= maxValue)- {- return parsed;- }- }- catch (Exception ex) when (ex is FormatException || ex is InvalidCastException || ex is OverflowException)- {- // use the fallback- }- }- return fallback;- }-- /// <summary>- /// The value under <paramref name="key"/> converted to a double (invariant culture) when it converts and- /// lies within [<paramref name="minValue"/>, <paramref name="maxValue"/>]; otherwise the fallback.- /// </summary>- private static double ReadDouble(Dictionary<string, object> section, string key, double fallback, double minValue, double maxValue)- {- object value;- if (section.TryGetValue(key, out value) && value != null)- {- try- {- double parsed = Convert.ToDouble(value, CultureInfo.InvariantCulture);- if (parsed >= minValue && parsed <= maxValue)- {- return parsed;- }- }- catch (Exception ex) when (ex is FormatException || ex is InvalidCastException || ex is OverflowException)- {- // use the fallback- }- }- return fallback;- }-- /// <summary>Name of this section in the project file.</summary>- public const string SectionName = "simulation";-- /// <summary>- /// Only the <see cref="FromConfig"/> fallback for an existing project saved before "steps" existed.- /// <see cref="Steps"/> itself has no software-chosen default of its own, the same as- /// <see cref="TimeDecayFactor"/>: a new project starts at whatever <c>numSimulationSteps</c>' own Designer- /// value is (see <c>StartNewProject</c>'s <c>new SimulationSettings()</c>).- /// </summary>- public const int DefaultSteps = 2500;-- /// <summary>Largest accepted <see cref="Steps"/>.</summary>- public const int MaxSteps = 10000000;-- /// <summary>Largest accepted <see cref="VisualizeEvery"/>.</summary>- public const int MaxVisualizeEvery = 1000;-- /// <summary>Largest accepted <see cref="VideoFps"/>.</summary>- public const int MaxVideoFps = 240;-- /// <summary>Default <see cref="VideoQuality"/>.</summary>- public const int DefaultVideoQuality = 70;- }-}diff --git a/Wave_Dude_2D/SimulationStatus.cs b/Wave_Dude_2D/SimulationStatus.csdeleted file mode 100644index 5783469..0000000--- a/Wave_Dude_2D/SimulationStatus.cs+++ /dev/null@@ -1,16 +0,0 @@-namespace _2D_wave_sim_V01-{- /// <summary>- /// How a simulation run ended. Set by <see cref="SimulationRunner"/> on its worker thread in- /// <see cref="SimulationResult.Status"/> and read by <c>Form1.OnSimulationFinished</c> on the UI thread.- /// </summary>- internal enum SimulationStatus- {- /// <summary>All requested steps were computed.</summary>- Completed,- /// <summary>The user stopped the run (or closed the program) before the last step.</summary>- Cancelled,- /// <summary>An exception ended the run early; the reason is in <see cref="SimulationResult.Message"/>.</summary>- Failed- }-}diff --git a/Wave_Dude_2D/SourceCompositeMode.cs b/Wave_Dude_2D/SourceCompositeMode.csdeleted file mode 100644index 2a17493..0000000--- a/Wave_Dude_2D/SourceCompositeMode.cs+++ /dev/null@@ -1,17 +0,0 @@-using System;--namespace _2D_wave_sim_V01-{- /// <summary>- /// How the elements of a <see cref="SourceMainType.Composite"/> array get their- /// frequency/phase/off-width/position: all the same as the single source, or randomised around it.- /// Ignored for simple sources. Stored in the project as <c>"inherit"</c> / <c>"randomize"</c>.- /// </summary>- public enum SourceCompositeMode- {- /// <summary>Every element is an exact copy of the single-source settings; only its position differs.</summary>- InheritFromSingle = 0,- /// <summary>Elements inherit the settings, and each enabled "randomize" option (frequency, phase, off-width, position) adds an independent random offset per element when the elements are generated.</summary>- InheritAndRandomize = 1- }-}diff --git a/Wave_Dude_2D/SourceElement.cs b/Wave_Dude_2D/SourceElement.csdeleted file mode 100644index 873fb43..0000000--- a/Wave_Dude_2D/SourceElement.cs+++ /dev/null@@ -1,99 +0,0 @@-using System;--namespace _2D_wave_sim_V01-{- /// <summary>- /// One point source as the wave engines consume it: a resolved, per-element copy of the- /// user's <see cref="SourceSettings"/> with all units already converted (phase in radians,- /// amplitude 0..1). Produced by <see cref="SourceSettings.GenerateElements"/> on the UI- /// thread, stored in the project file, and handed by reference to- /// <c>SimulationJob.ObjectSources</c>, where <c>WaveSimulator</c> / <c>GpuWaveSimulator</c>- /// read it from the <c>SimulationRunner</c> worker thread. The engines never write to it- /// (they keep their own per-element off-width state), so it must simply not be mutated- /// while a run is in progress. Generating rolls the randomisation once, so a run is- /// reproducible: the engine never re-randomises the elements themselves.- /// </summary>- public sealed class SourceElement- {- /// <summary>Creates an element at (0, 0) with the fallback values: level 100, amplitude 0.5, no phase, continuous, 10-cycle on/off widths, never detached.</summary>- public SourceElement()- {- Level = 100;- Amplitude = 0.5;- PhaseRad = 0.0;- Mode = SourceMode.Continuous;- PulseShape = SourcePulseShape.Gaussian;- OnWidthCycles = 10;- OffWidthCycles = 10;- OffWidthBase = 10;- RandomizeOffWidthAmount = 0;- DetachAfterStep = -1;- }-- /// <summary>X position in canvas pixels (0 = left edge). Elements outside the canvas are dropped by the engines.</summary>- public int PosX { get; set; }-- /// <summary>Y position in canvas pixels (0 = top edge). Elements outside the canvas are dropped by the engines.</summary>- public int PosY { get; set; }-- /// <summary>- /// Frequency as a source level 1..255, the same scale as the brightness of image-based- /// sources. The engines map it to an angular frequency of- /// <c>Level / 255 * 0.5 * SimulationSettings.SourceFrequencyScale</c> radians per step.- /// </summary>- public int Level { get; set; }-- /// <summary>Peak field amplitude 0..1 (the settings' 0..100 % divided by 100).</summary>- public double Amplitude { get; set; }-- /// <summary>Phase offset in radians added to the sine argument (<c>sin(PhaseRad + omega * t)</c>); positive values lead.</summary>- public double PhaseRad { get; set; }-- /// <summary>Continuous or pulsed emission.</summary>- public SourceMode Mode { get; set; }-- /// <summary>Envelope shape of each burst; only used when <see cref="Mode"/> is <see cref="SourceMode.Pulsed"/>.</summary>- public SourcePulseShape PulseShape { get; set; }-- /// <summary>Length of the "on" burst in cycles of this element's own frequency (pulsed mode only).</summary>- public int OnWidthCycles { get; set; }-- /// <summary>- /// Length of the "off" gap in cycles (pulsed mode only). With a fixed gap- /// (<see cref="RandomizeOffWidthAmount"/> is 0) the engines shift the period so the first- /// burst starts at step 0 and the gap follows each burst. With a randomised gap the first- /// period begins with a gap of this length before the first burst, and every later gap is- /// re-drawn by the engine around <see cref="OffWidthBase"/>.- /// </summary>- public int OffWidthCycles { get; set; }-- /// <summary>Nominal off gap in cycles that the engine randomises around for every new period when <see cref="RandomizeOffWidthAmount"/> is positive.</summary>- public int OffWidthBase { get; set; }-- /// <summary>Half-range in cycles of the per-period random off-width offset (gap = max(1, OffWidthBase +/- amount)); 0 keeps <see cref="OffWidthCycles"/> fixed.</summary>- public int RandomizeOffWidthAmount { get; set; }-- /// <summary>- /// Simulation step at which this element stops driving the field (releasing its hold on it, so it no- /// longer diffracts waves passing through its position), fading out linearly over- /// <see cref="DetachRampSteps"/> steps; -1 means it stays on for the whole run. Copied from the parent- /// <see cref="SourceSettings.DetachSource"/> / <see cref="SourceSettings.DetachAfterSteps"/> at generate time.- /// </summary>- public int DetachAfterStep { get; set; }-- /// <summary>Shallow copy; sufficient because every property is a value type.</summary>- public SourceElement Clone()- {- return (SourceElement)base.MemberwiseClone();- }-- /// <summary>- /// Number of simulation steps over which a detaching element's drive is faded out (linearly, down to 0)- /// rather than cut instantly at <see cref="DetachAfterStep"/>: an abrupt cutoff otherwise leaves a small- /// kink in the forcing at that point, which can ring. Shared by both engines- /// (<c>WaveSimulator.ApplySources</c> and the <c>apply_object_sources</c> kernel in- /// <c>GpuWaveSimulator</c>, which splices it into the kernel text), so the two stay in exact agreement.- /// </summary>- public const int DetachRampSteps = 30;- }-}diff --git a/Wave_Dude_2D/SourceMainType.cs b/Wave_Dude_2D/SourceMainType.csdeleted file mode 100644index 941609f..0000000--- a/Wave_Dude_2D/SourceMainType.cs+++ /dev/null@@ -1,18 +0,0 @@-using System;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Whether a <see cref="SourceSettings"/> entry describes one point source (or line, in a future version)- /// or a rectangular array of identical point sources. Selected with the "main type" combo box on the source- /// tab (the numeric values are the combo-box indices) and stored in the project as <c>"single"</c> /- /// <c>"composite"</c>.- /// </summary>- public enum SourceMainType- {- /// <summary>A single point source at (PosX, PosY); generates exactly one <see cref="SourceElement"/>. Named Simple (not Single) because Single is a reserved VB keyword (the floating-point type) in the original source.</summary>- Simple = 0,- /// <summary>An ArraySizeX x ArraySizeY grid of point sources centred on (PosX, PosY), optionally randomised per element.</summary>- Composite = 1- }-}diff --git a/Wave_Dude_2D/SourceMode.cs b/Wave_Dude_2D/SourceMode.csdeleted file mode 100644index 52b351c..0000000--- a/Wave_Dude_2D/SourceMode.cs+++ /dev/null@@ -1,18 +0,0 @@-using System;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Time behaviour of a point source (or of an element of a composite source): always on, or switching on- /// and off in cycles of its own frequency. Chosen with the mode radio buttons on the source tab,- /// copied into every generated <see cref="SourceElement"/> and evaluated by the wave engines- /// on each simulation step.- /// </summary>- public enum SourceMode- {- /// <summary>The source emits a steady sine wave for the whole run (envelope is always 1).</summary>- Continuous = 0,- /// <summary>The sine wave is gated by a repeating on/off envelope whose shape is a <see cref="SourcePulseShape"/> and whose on and off lengths are given in cycles.</summary>- Pulsed = 1- }-}diff --git a/Wave_Dude_2D/SourcePulseShape.cs b/Wave_Dude_2D/SourcePulseShape.csdeleted file mode 100644index 2f6ed30..0000000--- a/Wave_Dude_2D/SourcePulseShape.cs+++ /dev/null@@ -1,16 +0,0 @@-using System;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Envelope shape of one "on" burst of a <see cref="SourceMode.Pulsed"/> source. Only used- /// when the mode is pulsed; stored in the project as <c>"gaussian"</c> / <c>"smoothed_square"</c>.- /// </summary>- public enum SourcePulseShape- {- /// <summary>Gaussian bell centred in the on-window; its sigma is one sixth of the on-width, so the burst is essentially zero at both edges.</summary>- Gaussian = 0,- /// <summary>Flat-topped burst with smoothed rising and falling edges that spans the whole on-width.</summary>- SmoothedSquare = 1- }-}diff --git a/Wave_Dude_2D/SourceSettings.cs b/Wave_Dude_2D/SourceSettings.csdeleted file mode 100644index d3d42f3..0000000--- a/Wave_Dude_2D/SourceSettings.cs+++ /dev/null@@ -1,566 +0,0 @@-using System;-using System.Collections;-using System.Collections.Generic;-using System.Globalization;--namespace _2D_wave_sim_V01-{- /// <summary>- /// User-editable description of one wave source (single point source or composite array of point sources- /// built from the same base parameters, optionally randomised) plus the generated- /// <see cref="SourceElement"/> list that the simulation actually consumes.- /// Edited on the source tab of <c>Form1</c> (UI thread only) and persisted in the- /// <see cref="SectionName"/> section of the project config. "Generate composite source" resolves the- /// current parameters (and, for a composite source, a fresh random draw) into a fixed list of elements via- /// <see cref="GenerateElements"/>, which is what the simulation runs; "Save source" keeps both the- /// authoring parameters (so the source can be reopened and edited or regenerated) and that generated list- /// (so a saved project runs exactly what was generated, even before it is regenerated again). Units are the- /// ones shown in the UI: positions in canvas pixels, frequency as a 1..255 level, amplitude in- /// percent, phase in degrees, pulse widths in cycles, detach time in simulation steps.- /// </summary>- public sealed class SourceSettings- {- /// <summary>Creates a source with the editor defaults: "Source 1", simple, continuous Gaussian at (100, 100) but not yet positioned, frequency level 100, 100 % amplitude, 10-cycle widths, 1x1 array with 10 px spacing, nothing randomised, no elements.</summary>- public SourceSettings()- {- Name = "Source 1";- MainType = SourceMainType.Simple;- PosX = 100;- PosY = 100;- HasPosition = false;- SourceOn = true;- DetachSource = false;- DetachAfterSteps = 1000;- Frequency = 100;- Amplitude = 100;- PhaseDeg = 0;- Mode = SourceMode.Continuous;- PulseShape = SourcePulseShape.Gaussian;- PulseWidthCycles = 10;- OffStateCycles = 10;- ArraySizeX = 1;- ArraySizeY = 1;- SpacingX = 10;- SpacingY = 10;- CompositeMode = SourceCompositeMode.InheritFromSingle;- RandomizeFrequency = false;- RandomizeFrequencyAmount = 0;- RandomizePhase = false;- RandomizePhaseAmount = 0;- RandomizeOffWidth = false;- RandomizeOffWidthAmount = 0;- RandomizePosition = false;- RandomizePositionAmount = 0;- Elements = new List<SourceElement>();- }-- /// <summary>Display name shown in the source list and next to the marker on the scene picture; must be non-blank to save.</summary>- public string Name { get; set; }-- /// <summary>Single point source or composite array.</summary>- public SourceMainType MainType { get; set; }-- /// <summary>X position in canvas pixels of the source, or of the array centre for a composite source. Only meaningful once <see cref="HasPosition"/> is true; until then it is just the unset default and the Sources tab must not draw a marker for it.</summary>- public int PosX { get; set; }-- /// <summary>Y position in canvas pixels of the source, or of the array centre for a composite source; see <see cref="PosX"/>.</summary>- public int PosY { get; set; }-- /// <summary>- /// True once the user has placed the source (by picking on the picture or editing the- /// position inputs) rather than still holding the default; only sources with a position get- /// a marker drawn on the scene picture. Defaults to false for a new source but to true when- /// loaded from a project saved before this flag existed (see <see cref="FromDictionary"/>),- /// since its sources were positioned under the old rules.- /// </summary>- public bool HasPosition { get; set; }-- /// <summary>- /// Whether the source interacts with the simulation at all; a new source starts on. Switching it off- /// keeps every parameter (it can still be edited, and switched back on) but the source takes no part- /// in a run: it is listed in grey and <c>SourcesForRun</c> leaves it out entirely, so it neither drives- /// the field nor gets in the way of waves passing through its position.- /// </summary>- public bool SourceOn { get; set; }-- /// <summary>- /// When true, the source stops driving the field after <see cref="DetachAfterSteps"/> simulation steps- /// (it runs normally up to that point). A source that keeps driving the field also holds it at a fixed- /// value there, which diffracts waves that later pass through that point; detaching releases that hold- /// once the source has done its job, so the field becomes free of it again for the rest of the run.- /// </summary>- public bool DetachSource { get; set; }-- /// <summary>Simulation step (0-based) at which the source detaches and starts fading out (over <see cref="SourceElement.DetachRampSteps"/> steps) when <see cref="DetachSource"/> is set; 0 or greater.</summary>- public int DetachAfterSteps { get; set; }-- /// <summary>- /// Frequency as a source level 1..255, the same scale as the brightness of image-based- /// sources (angular frequency = level / 255 * 0.5 * <c>SimulationSettings.SourceFrequencyScale</c>- /// radians per step). Copied to <see cref="SourceElement.Level"/>.- /// </summary>- public int Frequency { get; set; }-- /// <summary>Amplitude in percent of the source amplitude, 0..100; becomes 0..1 on the element. 100 matches <c>numAmplitude</c>'s own Designer default for a new source.</summary>- public int Amplitude { get; set; }-- /// <summary>Phase offset in degrees, -180..180; converted to radians on the element.</summary>- public int PhaseDeg { get; set; }-- /// <summary>Continuous or pulsed emission.</summary>- public SourceMode Mode { get; set; }-- /// <summary>Burst envelope shape; only used in pulsed mode.</summary>- public SourcePulseShape PulseShape { get; set; }-- /// <summary>Length of each "on" burst in cycles of the source frequency, at least 1 (pulsed mode only).</summary>- public int PulseWidthCycles { get; set; }-- /// <summary>Length of the "off" gap between bursts in cycles, at least 1 (pulsed mode only).</summary>- public int OffStateCycles { get; set; }-- /// <summary>Number of array columns for a composite source, at least 1; the UI enforces odd values so the centre element sits on (PosX, PosY).</summary>- public int ArraySizeX { get; set; }-- /// <summary>Number of array rows for a composite source, at least 1; the UI enforces odd values.</summary>- public int ArraySizeY { get; set; }-- /// <summary>Horizontal distance between neighbouring array elements in canvas pixels.</summary>- public int SpacingX { get; set; }-- /// <summary>Vertical distance between neighbouring array elements in canvas pixels.</summary>- public int SpacingY { get; set; }-- /// <summary>Whether composite elements are exact copies or get per-element random offsets.</summary>- public SourceCompositeMode CompositeMode { get; set; }-- /// <summary>Enables the per-element frequency offset (composite + randomize mode only).</summary>- public bool RandomizeFrequency { get; set; }-- /// <summary>Half-range of the random frequency offset in levels: each element gets Frequency +/- up to this, clamped to 1..255.</summary>- public int RandomizeFrequencyAmount { get; set; }-- /// <summary>Enables the per-element phase offset (composite + randomize mode only).</summary>- public bool RandomizePhase { get; set; }-- /// <summary>Half-range of the random phase offset in degrees: each element gets PhaseDeg +/- up to this, clamped to -180..180.</summary>- public int RandomizePhaseAmount { get; set; }-- /// <summary>Enables the per-element and per-period off-width randomisation (composite + randomize mode only).</summary>- public bool RandomizeOffWidth { get; set; }-- /// <summary>Half-range of the random off-gap offset in cycles; also passed on to the elements so the engine re-draws the gap every period.</summary>- public int RandomizeOffWidthAmount { get; set; }-- /// <summary>Enables the per-element position jitter (composite + randomize mode only).</summary>- public bool RandomizePosition { get; set; }-- /// <summary>Half-range of the position jitter in canvas pixels, drawn independently for X and Y of each element; the UI caps it at half the smallest spacing.</summary>- public int RandomizePositionAmount { get; set; }-- /// <summary>- /// The point sources generated from these settings by <see cref="GenerateElements"/>;- /// empty until the source has been saved at least once. Persisted with the project so a- /// randomised layout survives reloads. Handed to the simulation by reference.- /// </summary>- public List<SourceElement> Elements { get; set; }-- /// <summary>Deep copy: the element list and every element are cloned as well.</summary>- public SourceSettings Clone()- {- SourceSettings copy = (SourceSettings)base.MemberwiseClone();- copy.Elements = new List<SourceElement>();- foreach (SourceElement element in Elements)- {- copy.Elements.Add(element.Clone());- }- return copy;- }-- /// <summary>- /// Clamps every setting into its valid range (frequency 1..255, amplitude 0..100, phase- /// -180..180, widths and array sizes at least 1, detach steps at least 0). Positions,- /// spacings and randomise amounts are not touched.- /// </summary>- public void Normalize()- {- if (Frequency < 1)- {- Frequency = 1;- }- if (Frequency > 255)- {- Frequency = 255;- }- if (Amplitude < 0)- {- Amplitude = 0;- }- if (Amplitude > 100)- {- Amplitude = 100;- }- if (PhaseDeg < -180)- {- PhaseDeg = -180;- }- if (PhaseDeg > 180)- {- PhaseDeg = 180;- }- if (PulseWidthCycles < 1)- {- PulseWidthCycles = 1;- }- if (OffStateCycles < 1)- {- OffStateCycles = 1;- }- if (ArraySizeX < 1)- {- ArraySizeX = 1;- }- if (ArraySizeY < 1)- {- ArraySizeY = 1;- }- if (DetachAfterSteps < 0)- {- DetachAfterSteps = 0;- }- }-- /// <summary>- /// Rebuilds <see cref="Elements"/> from the settings: one element for a simple source,- /// or an ArraySizeX x ArraySizeY grid centred on (PosX, PosY) for a composite source,- /// optionally randomised per element. Calls <see cref="Normalize"/> first. Random offsets- /// are only applied when <see cref="CompositeMode"/> is- /// <see cref="SourceCompositeMode.InheritAndRandomize"/>, the matching Randomize flag is- /// set and its amount is positive; frequency and phase offsets are clamped back into- /// their valid ranges, the off gap is kept at least 1 cycle. Element positions are not- /// clamped to the canvas. Every call replaces the list, so a randomised layout changes- /// each time the source is saved.- /// </summary>- /// <param name="rng">Random generator for the per-element offsets; may be any instance when nothing is randomised.</param>- public void GenerateElements(Random rng)- {- Normalize();- List<SourceElement> elements = new List<SourceElement>();- if (MainType == SourceMainType.Simple)- {- elements.Add(MakeBaseElement(PosX, PosY));- }- else- {- int cols = ArraySizeX;- int rows = ArraySizeY;- bool randomize = CompositeMode == SourceCompositeMode.InheritAndRandomize;- for (int row = 0; row < rows; row++)- {- for (int col = 0; col < cols; col++)- {- // The array is centred on (PosX, PosY), not anchored at a corner; with an even size the centre falls between two elements.- int x = PosX + (int)Math.Round((col - (cols - 1) / 2.0) * SpacingX);- int y = PosY + (int)Math.Round((row - (rows - 1) / 2.0) * SpacingY);- if (randomize && RandomizePosition && RandomizePositionAmount > 0)- {- x += SourceSettings.RandomInt(rng, RandomizePositionAmount);- y += SourceSettings.RandomInt(rng, RandomizePositionAmount);- }- SourceElement element = MakeBaseElement(x, y);- if (randomize && RandomizeFrequency && RandomizeFrequencyAmount > 0)- {- element.Level = SourceSettings.Clamp(Frequency + SourceSettings.RandomInt(rng, RandomizeFrequencyAmount), 1, 255);- }- if (randomize && RandomizePhase && RandomizePhaseAmount > 0)- {- int phaseDeg = SourceSettings.Clamp(PhaseDeg + SourceSettings.RandomInt(rng, RandomizePhaseAmount), -180, 180);- element.PhaseRad = phaseDeg * Math.PI / 180.0;- }- if (randomize && RandomizeOffWidth && RandomizeOffWidthAmount > 0)- {- element.OffWidthCycles = Math.Max(1, OffStateCycles + SourceSettings.RandomInt(rng, RandomizeOffWidthAmount));- element.RandomizeOffWidthAmount = RandomizeOffWidthAmount;- }- elements.Add(element);- }- }- }- Elements = elements;- }-- /// <summary>- /// Creates an element at the given canvas position with the non-randomised settings,- /// converting amplitude to 0..1 and phase to radians; <c>DetachAfterStep</c> is -1 when- /// <see cref="DetachSource"/> is off.- /// </summary>- private SourceElement MakeBaseElement(int x, int y)- {- return new SourceElement- {- PosX = x,- PosY = y,- Level = Frequency,- Amplitude = Amplitude / 100.0,- PhaseRad = PhaseDeg * Math.PI / 180.0,- Mode = Mode,- PulseShape = PulseShape,- OnWidthCycles = PulseWidthCycles,- OffWidthCycles = OffStateCycles,- OffWidthBase = OffStateCycles,- RandomizeOffWidthAmount = 0,- DetachAfterStep = DetachSource ? DetachAfterSteps : -1- };- }-- /// <summary>Uniform random integer in [-amount, +amount]; 0 when amount is not positive. Also used by <c>WaveSimulator</c> for the per-period off-width.</summary>- internal static int RandomInt(Random rng, int amount)- {- return amount <= 0 ? 0 : rng.Next(-amount, amount + 1);- }-- /// <summary>Clamps <paramref name="value"/> into [minValue, maxValue].</summary>- private static int Clamp(int value, int minValue, int maxValue)- {- return Math.Max(minValue, Math.Min(maxValue, value));- }-- /// <summary>- /// Reads all sources from the <see cref="SectionName"/> section of a project config.- /// Returns an empty list when the section or its <c>"items"</c> list is missing; entries- /// that are not dictionaries are skipped. Each source is clamped via <see cref="Normalize"/>.- /// </summary>- public static List<SourceSettings> ListFromConfig(ProjectConfig config)- {- List<SourceSettings> sources = new List<SourceSettings>();- if (!config.ContainsKey(SourceSettings.SectionName))- {- return sources;- }- Dictionary<string, object> section = config.GetSection(SourceSettings.SectionName);- if (!section.TryGetValue("items", out object itemsValue))- {- return sources;- }- IEnumerable items = itemsValue as IEnumerable;- // A string is IEnumerable too; it is not a list of sources.- if (items == null || itemsValue is string)- {- return sources;- }- foreach (object item in items)- {- Dictionary<string, object> itemDict = item as Dictionary<string, object>;- if (itemDict != null)- {- sources.Add(SourceSettings.FromDictionary(itemDict));- }- }- return sources;- }-- /// <summary>Writes all sources (settings and generated elements) into the <see cref="SectionName"/> section of a project config, replacing its <c>"count"</c> and <c>"items"</c> entries.</summary>- public static void ListToConfig(List<SourceSettings> sources, ProjectConfig config)- {- Dictionary<string, object> section = config.GetSection(SourceSettings.SectionName);- List<object> items = new List<object>();- foreach (SourceSettings source in sources)- {- items.Add(source.ToDictionary());- }- section["count"] = items.Count;- section["items"] = items;- }-- /// <summary>Serialises the settings and the generated elements into the key/value form stored in the project file (enums as lower-case strings, phase of elements in radians).</summary>- private Dictionary<string, object> ToDictionary()- {- Dictionary<string, object> data = new Dictionary<string, object>();- data["name"] = Name;- data["main_type"] = ((MainType == SourceMainType.Composite) ? "composite" : "single");- data["x"] = PosX;- data["y"] = PosY;- data["has_position"] = HasPosition;- data["source_on"] = SourceOn;- data["detach_source"] = DetachSource;- data["detach_after_steps"] = DetachAfterSteps;- data["frequency"] = Frequency;- data["amplitude"] = Amplitude;- data["phase_deg"] = PhaseDeg;- data["mode"] = ((Mode == SourceMode.Pulsed) ? "pulsed" : "continuous");- data["pulse_shape"] = ((PulseShape == SourcePulseShape.SmoothedSquare) ? "smoothed_square" : "gaussian");- data["pulse_width_cycles"] = PulseWidthCycles;- data["off_state_cycles"] = OffStateCycles;- data["array_size_x"] = ArraySizeX;- data["array_size_y"] = ArraySizeY;- data["spacing_x"] = SpacingX;- data["spacing_y"] = SpacingY;- data["composite_mode"] = ((CompositeMode == SourceCompositeMode.InheritAndRandomize) ? "randomize" : "inherit");- data["randomize_frequency"] = RandomizeFrequency;- data["randomize_frequency_amount"] = RandomizeFrequencyAmount;- data["randomize_phase"] = RandomizePhase;- data["randomize_phase_amount"] = RandomizePhaseAmount;- data["randomize_off_width"] = RandomizeOffWidth;- data["randomize_off_width_amount"] = RandomizeOffWidthAmount;- data["randomize_position"] = RandomizePosition;- data["randomize_position_amount"] = RandomizePositionAmount;- List<object> elements = new List<object>();- foreach (SourceElement element in Elements)- {- Dictionary<string, object> elementData = new Dictionary<string, object>();- elementData["x"] = element.PosX;- elementData["y"] = element.PosY;- elementData["level"] = element.Level;- elementData["amplitude"] = element.Amplitude;- elementData["phase_rad"] = element.PhaseRad;- elementData["mode"] = ((element.Mode == SourceMode.Pulsed) ? "pulsed" : "continuous");- elementData["pulse_shape"] = ((element.PulseShape == SourcePulseShape.SmoothedSquare) ? "smoothed_square" : "gaussian");- elementData["on_width_cycles"] = element.OnWidthCycles;- elementData["off_width_cycles"] = element.OffWidthCycles;- elementData["off_width_base"] = element.OffWidthBase;- elementData["randomize_off_width_amount"] = element.RandomizeOffWidthAmount;- elementData["detach_after_step"] = element.DetachAfterStep;- elements.Add(elementData);- }- data["elements"] = elements;- return data;- }-- /// <summary>- /// Inverse of <see cref="ToDictionary"/>. Missing or out-of-range values fall back to the- /// constructor defaults, except <c>has_position</c> which defaults to true (see the comments in the- /// body for the keys that were added after the first projects were saved); unknown enum- /// strings map to the first enum value. Stored elements are restored as they are (they are- /// not regenerated), with a 0.5 amplitude fallback and the phase range left wide open.- /// </summary>- private static SourceSettings FromDictionary(Dictionary<string, object> d)- {- SourceSettings s = new SourceSettings();- s.Name = SourceSettings.ReadText(d, "name", s.Name);- s.MainType = ((SourceSettings.ReadText(d, "main_type", "single") == "composite") ? SourceMainType.Composite : SourceMainType.Simple);- s.PosX = SourceSettings.ReadInt(d, "x", s.PosX, -1000000, 1000000);- s.PosY = SourceSettings.ReadInt(d, "y", s.PosY, -1000000, 1000000);- // a project saved before HasPosition existed has no "has_position" entry - default to true, since its- // sources were positioned under the old rules (there was no "unset" state back then)- s.HasPosition = SourceSettings.ReadBool(d, "has_position", true);- // a project saved before SourceOn/DetachSource existed has no entries for them either - default to the- // same behaviour it always had: on, and never detaching- s.SourceOn = SourceSettings.ReadBool(d, "source_on", true);- s.DetachSource = SourceSettings.ReadBool(d, "detach_source", false);- s.DetachAfterSteps = SourceSettings.ReadInt(d, "detach_after_steps", s.DetachAfterSteps, 0, 1000000000);- s.Frequency = SourceSettings.ReadInt(d, "frequency", s.Frequency, 1, 255);- s.Amplitude = SourceSettings.ReadInt(d, "amplitude", s.Amplitude, 0, 100);- s.PhaseDeg = SourceSettings.ReadInt(d, "phase_deg", s.PhaseDeg, -180, 180);- s.Mode = ((SourceSettings.ReadText(d, "mode", "continuous") == "pulsed") ? SourceMode.Pulsed : SourceMode.Continuous);- s.PulseShape = ((SourceSettings.ReadText(d, "pulse_shape", "gaussian") == "smoothed_square") ? SourcePulseShape.SmoothedSquare : SourcePulseShape.Gaussian);- s.PulseWidthCycles = SourceSettings.ReadInt(d, "pulse_width_cycles", s.PulseWidthCycles, 1, 1000000);- s.OffStateCycles = SourceSettings.ReadInt(d, "off_state_cycles", s.OffStateCycles, 1, 1000000);- s.ArraySizeX = SourceSettings.ReadInt(d, "array_size_x", s.ArraySizeX, 1, 100000);- s.ArraySizeY = SourceSettings.ReadInt(d, "array_size_y", s.ArraySizeY, 1, 100000);- s.SpacingX = SourceSettings.ReadInt(d, "spacing_x", s.SpacingX, -1000000, 1000000);- s.SpacingY = SourceSettings.ReadInt(d, "spacing_y", s.SpacingY, -1000000, 1000000);- s.CompositeMode = ((SourceSettings.ReadText(d, "composite_mode", "inherit") == "randomize") ? SourceCompositeMode.InheritAndRandomize : SourceCompositeMode.InheritFromSingle);- s.RandomizeFrequency = SourceSettings.ReadBool(d, "randomize_frequency", false);- s.RandomizeFrequencyAmount = SourceSettings.ReadInt(d, "randomize_frequency_amount", 0, 0, 1000000);- s.RandomizePhase = SourceSettings.ReadBool(d, "randomize_phase", false);- s.RandomizePhaseAmount = SourceSettings.ReadInt(d, "randomize_phase_amount", 0, 0, 1000000);- s.RandomizeOffWidth = SourceSettings.ReadBool(d, "randomize_off_width", false);- s.RandomizeOffWidthAmount = SourceSettings.ReadInt(d, "randomize_off_width_amount", 0, 0, 1000000);- s.RandomizePosition = SourceSettings.ReadBool(d, "randomize_position", false);- s.RandomizePositionAmount = SourceSettings.ReadInt(d, "randomize_position_amount", 0, 0, 1000000);- List<SourceElement> elements = new List<SourceElement>();- if (d.TryGetValue("elements", out object elementsValue))- {- IEnumerable items = elementsValue as IEnumerable;- if (items != null && !(elementsValue is string))- {- foreach (object item in items)- {- Dictionary<string, object> elementDict = item as Dictionary<string, object>;- if (elementDict == null)- {- continue;- }- SourceElement element = new SourceElement();- element.PosX = SourceSettings.ReadInt(elementDict, "x", 0, -1000000, 1000000);- element.PosY = SourceSettings.ReadInt(elementDict, "y", 0, -1000000, 1000000);- element.Level = SourceSettings.ReadInt(elementDict, "level", 100, 1, 255);- element.Amplitude = SourceSettings.ReadDouble(elementDict, "amplitude", 0.5, 0.0, 1.0);- element.PhaseRad = SourceSettings.ReadDouble(elementDict, "phase_rad", 0.0, -1000.0, 1000.0);- element.Mode = ((SourceSettings.ReadText(elementDict, "mode", "continuous") == "pulsed") ? SourceMode.Pulsed : SourceMode.Continuous);- element.PulseShape = ((SourceSettings.ReadText(elementDict, "pulse_shape", "gaussian") == "smoothed_square") ? SourcePulseShape.SmoothedSquare : SourcePulseShape.Gaussian);- element.OnWidthCycles = SourceSettings.ReadInt(elementDict, "on_width_cycles", 10, 1, 1000000);- element.OffWidthCycles = SourceSettings.ReadInt(elementDict, "off_width_cycles", 10, 1, 1000000);- // a project saved before off-width re-randomisation existed has no "off_width_base" entry -- // default to this element's own off_width_cycles (already read above), which is exactly its- // anchor under the old, always-static behaviour- element.OffWidthBase = SourceSettings.ReadInt(elementDict, "off_width_base", element.OffWidthCycles, 1, 1000000);- element.RandomizeOffWidthAmount = SourceSettings.ReadInt(elementDict, "randomize_off_width_amount", 0, 0, 1000000);- element.DetachAfterStep = SourceSettings.ReadInt(elementDict, "detach_after_step", -1, -1, 1000000000);- elements.Add(element);- }- }- }- s.Elements = elements;- s.Normalize();- return s;- }-- /// <summary>Reads a value as text (invariant culture); <paramref name="fallback"/> when the key is missing or null.</summary>- private static string ReadText(Dictionary<string, object> d, string key, string fallback)- {- return (d.TryGetValue(key, out object value) && value != null) ? Convert.ToString(value, CultureInfo.InvariantCulture) : fallback;- }-- /// <summary>Reads a bool; <paramref name="fallback"/> unless the stored value is an actual <see cref="bool"/> (no string parsing).</summary>- private static bool ReadBool(Dictionary<string, object> d, string key, bool fallback)- {- return (d.TryGetValue(key, out object value) && value is bool) ? (bool)value : fallback;- }-- /// <summary>Reads an int (invariant culture); <paramref name="fallback"/> when the key is missing, not convertible or outside [minValue, maxValue].</summary>- private static int ReadInt(Dictionary<string, object> d, string key, int fallback, int minValue, int maxValue)- {- if (d.TryGetValue(key, out object value) && value != null)- {- try- {- int parsed = Convert.ToInt32(value, CultureInfo.InvariantCulture);- if (parsed >= minValue && parsed <= maxValue)- {- return parsed;- }- }- catch (Exception ex) when (ex is FormatException || ex is InvalidCastException || ex is OverflowException)- {- // use the fallback- }- }- return fallback;- }-- /// <summary>Reads a double (invariant culture); <paramref name="fallback"/> when the key is missing, not convertible or outside [minValue, maxValue].</summary>- private static double ReadDouble(Dictionary<string, object> d, string key, double fallback, double minValue, double maxValue)- {- if (d.TryGetValue(key, out object value) && value != null)- {- try- {- double parsed = Convert.ToDouble(value, CultureInfo.InvariantCulture);- if (parsed >= minValue && parsed <= maxValue)- {- return parsed;- }- }- catch (Exception ex) when (ex is FormatException || ex is InvalidCastException || ex is OverflowException)- {- // use the fallback- }- }- return fallback;- }-- /// <summary>Name of the project config section that holds the source list.</summary>- public const string SectionName = "object_sources";- }-}diff --git a/Wave_Dude_2D/WaveEngineFactory.cs b/Wave_Dude_2D/WaveEngineFactory.csdeleted file mode 100644index 818a113..0000000--- a/Wave_Dude_2D/WaveEngineFactory.cs+++ /dev/null@@ -1,76 +0,0 @@-using System;-using System.Collections.Generic;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Picks the wave engine for a run: the GPU (OpenCL) engine when requested and available, otherwise the CPU engine.- /// Static-only; called by <see cref="SimulationRunner"/> on its worker thread once per run.- /// </summary>- internal sealed class WaveEngineFactory- {- /// <summary>Not instantiable.</summary>- private WaveEngineFactory()- {- }-- /// <summary>- /// Creates the engine for <paramref name="scene"/>. With <see cref="SimulationSettings.UseGpu"/> set it first tries- /// <see cref="GpuWaveSimulator.TryCreate"/>, translating the usual OpenCL loader failures (missing, wrong-bitness or- /// incomplete OpenCL.dll) into a readable reason; any failure falls back to the CPU <see cref="WaveSimulator"/>.- /// Never throws for GPU problems, but CPU engine construction may still throw (e.g. out of memory).- /// Object sources (the Sources tab) run on either engine, the same as the image sources.- /// </summary>- /// <param name="scene">Per-pixel speed, damping and image sources of the canvas; the engine copies it into its padded grid.</param>- /// <param name="settings">Supplies <see cref="SimulationSettings.UseGpu"/> and the physics options passed to the engine (frequency scale, Laplacian order, time decay, intensity scale).</param>- /// <param name="sourceAmplitude">Amplitude multiplier for the image-defined sources.</param>- /// <param name="trackIntensity">Whether the engine must accumulate the intensity buffer (needed for intensity video, preview or probes).</param>- /// <param name="note">- /// Receives an empty string when the GPU was not requested or the GPU engine was created; "GPU not used: reason" when the GPU- /// was requested but could not be used (the loader message above, or the per-device errors from <c>TryCreate</c>).- /// The "the first choice failed - ..." form is only produced if <c>TryCreate</c> ever returns an engine together with a- /// message, which it does not at present.- /// </param>- /// <param name="objectSources">The generated elements of the object sources (Sources tab) to drive in addition to the image sources; may be null.</param>- /// <returns>A ready engine; the caller owns and must dispose it.</returns>- public static IWaveEngine Create(SceneData scene, SimulationSettings settings, double sourceAmplitude, bool trackIntensity, ref string note, List<SourceElement> objectSources = null)- {- note = "";- if (settings.UseGpu)- {- string gpuMessage = "";- GpuWaveSimulator gpu = null;- try- {- gpu = GpuWaveSimulator.TryCreate(scene, settings.SourceFrequencyScale, sourceAmplitude, trackIntensity, settings.Use4thOrderLaplacian, settings.TimeDecayFactor, settings.IntensityScale, ref gpuMessage, objectSources);- }- catch (DllNotFoundException)- {- gpuMessage = "no OpenCL driver (OpenCL.dll) found; install the driver of the graphics card";- }- catch (BadImageFormatException)- {- gpuMessage = "the OpenCL driver does not match this 32/64-bit program";- }- catch (EntryPointNotFoundException)- {- gpuMessage = "the OpenCL driver is incomplete";- }- catch (Exception ex)- {- gpuMessage = ex.Message;- }- if (gpu != null)- {- if (gpuMessage.Length > 0)- {- note = "the first choice failed - " + gpuMessage;- }- return gpu;- }- note = "GPU not used: " + gpuMessage;- }- return new WaveSimulator(scene, settings.SourceFrequencyScale, sourceAmplitude, trackIntensity, settings.Use4thOrderLaplacian, settings.TimeDecayFactor, settings.IntensityScale, objectSources);- }- }-}diff --git a/Wave_Dude_2D/WaveSimulator.cs b/Wave_Dude_2D/WaveSimulator.csdeleted file mode 100644index d1692fb..0000000--- a/Wave_Dude_2D/WaveSimulator.cs+++ /dev/null@@ -1,887 +0,0 @@-using System;-using System.Collections.Generic;-using System.Globalization;-using System.Threading.Tasks;--namespace _2D_wave_sim_V01-{- /// <summary>- /// CPU implementation of <see cref="IWaveEngine"/>: an explicit leapfrog finite-difference solver for the- /// scalar 2D wave equation on a grid padded by one cell on each side, a port of the Python class- /// WaveSimulator2D (which runs on the GPU with CuPy). Created by- /// <see cref="WaveEngineFactory"/> on the <see cref="SimulationRunner"/> worker thread, which is the only- /// thread that advances it; the UI thread reads <see cref="FieldData"/> / <see cref="IntensityData"/> only- /// while the run is paused. The engine has no thread affinity of its own: any single thread may drive it.- /// </summary>- /// <remarks>- /// <para>- /// Units: grid spacing and time step are both 1, so the wave speed c is in cells (canvas pixels) per step,- /// the per-cell <c>c2</c> is c² = 1/n² for refractive index n, and <see cref="Time"/> counts steps. Source- /// frequencies are angular frequencies in radians per step (<see cref="_levelFrequency"/>).- /// </para>- /// <para>- /// The scheme: laplacian = 3x3 convolution with [[0.066, 0.184, 0.066], [0.184, -1, 0.184], [0.066, 0.184, 0.066]],- /// new u = u + (u - previous u) * d + laplacian * c², with the field outside the domain fixed at 0. The sources- /// are applied before each step as in update_scene / StaticImageScene.update_field:- /// u = u * 0.9 + sin(frequency * t) * 0.1 (<see cref="ApplySources"/>). The field is then advanced by- /// <see cref="_subSteps"/> leapfrog sub-steps (<see cref="UpdateField"/>), the last of which also updates the- /// running intensity. The arrays have a border of one cell (which always stays 0) so that the step needs no edge- /// tests. The rows are divided over all processor cores.- /// </para>- /// <para>- /// The intensity is no longer a single exponential average of WaveVisualizer.update (I = I * 0.98 + u² * 0.02):- /// a single-pole filter like that only rolls off at 6 dB/octave, so it never fully removes the ripple at the- /// source's own oscillation frequency, just delays it - lengthening its time constant mostly adds trail without- /// buying much extra ripple suppression. Instead the same one-pole filter (I = I * alpha + x * (1 - alpha)) is run- /// twice in a row (<see cref="_intensityStage1"/>, then <see cref="_intensity"/>), a critically-damped 2-pole- /// low-pass that rolls off at 12 dB/octave, so for the same responsiveness it suppresses the ripple far more- /// without needing to know the local frequency at every pixel. Two full stages turned out to add more delay than- /// wanted at low frequencies (a short pulse can come and go before the second stage has caught up, understating- /// its peak) for not that much extra benefit over one, so what is actually shown/exported- /// (<see cref="_intensityOut"/>) is a blend of the one-stage and two-stage outputs (<see cref="IntensityBlend"/>) -- /// roughly the middle ground between the two (about 9, not 6 or 12, dB/octave), still well ahead of a single- /// stage at rejecting the ripple but reacting closer to as fast. alpha (<see cref="_intensityAlpha"/>) is derived- /// once per simulation so the time constant of each stage scales inversely with the frequency of the slowest- /// active source, times the user's <see cref="SimulationSettings.TimeDecayFactor"/> - see that property's doc- /// for why.- /// </para>- /// <para>- /// Optionally (<see cref="SimulationSettings.Use4thOrderLaplacian"/>), the Laplacian is instead computed with a- /// 4th order accurate, 5-point "cross" stencil (reaching 2 cells away along x and along y) wherever there is- /// room for it - see <see cref="UpdateField"/>. This reduces numerical dispersion (short, under-resolved- /// wavelengths otherwise travel slower than long ones - see the <see cref="SimulationSettings.WaveSpeedC"/> doc)- /// at roughly twice the memory reads per step. The outermost ring of the domain still uses the original 3x3- /// kernel, since it only has the usual one cell of border to read from, not the two the wider stencil needs.- /// </para>- /// <para>- /// The 4th order stencil's coefficients (-1/12, 4/3, -5) reach much further from zero than the 3x3 kernel's- /// (0.066, 0.184, -1) - about 7 times further at the highest spatial frequency the grid can represent - so the- /// same c² that is safely stable with the 3x3 kernel can be wildly unstable with the 4th order one (the field- /// blows up: everywhere saturates except at object edges, which is what an invalid/unstable Laplacian looks- /// like). To stay stable without changing the physical wave speed, <see cref="AdvanceOneStep"/> instead takes- /// <see cref="_subSteps"/> smaller time steps per call when the 4th order stencil is used: c² is scaled by- /// 1 / _subSteps² (matching a time step _subSteps times smaller) and the damping factor d by its _subSteps-th- /// root (so _subSteps applications of it compound back to the original d), so the net effect after _subSteps- /// steps is exactly the same physical propagation and damping as one ordinary step - just spread over more,- /// individually stable, time steps. _subSteps is computed once per scene from its highest c²- /// (<see cref="ComputeSubSteps"/>) and is 1 (no sub-stepping, and a multiply by the exact literal 1.0F)- /// whenever the 3x3 kernel is used or the scene's c² does not need it.- /// </para>- /// </remarks>- internal sealed class WaveSimulator : IWaveEngine, IDisposable- {- /// <summary>- /// Copies the scene's c² and damping maps into the padded grid, derives the sub-step count (4th order- /// only, and only when the scene's highest c² needs it) and the matching per-sub-step damping and c²- /// corrections, indexes the image and object sources, and sets the intensity averaging constant from the- /// slowest source level in use.- /// </summary>- /// <param name="scene">Per-cell c² and damping maps plus the image (green-channel) sources; its arrays are copied.</param>- /// <param name="sourceFrequencyScale">Frequency of a source = green value / 255 × 0.5 × this value; see <see cref="_levelFrequency"/>.</param>- /// <param name="sourceAmplitude">Peak amplitude of the image sources (1 = the value of the Python code; object sources carry their own).</param>- /// <param name="trackIntensity">Whether to allocate and update the intensity buffers (it costs extra time in every step); when false <see cref="IntensityData"/> stays null.</param>- /// <param name="use4thOrderLaplacian">Use the 4th-order 5-point-per-axis stencil (with sub-stepping) instead of the 9-point one; see the class remarks.</param>- /// <param name="timeDecayFactor"><see cref="SimulationSettings.TimeDecayFactor"/>: intensity averaging time in units of <see cref="NominalDecayLevel"/>/level steps; see that property's doc and <see cref="_intensityAlpha"/>.</param>- /// <param name="intensityScale"><see cref="SimulationSettings.IntensityScale"/>, the multiplier applied to the intensity output; see that property's doc.</param>- /// <param name="objectSources">The generated elements of the object sources (Sources tab), or null/empty for none; those positioned outside the canvas are dropped.</param>- public WaveSimulator(SceneData scene, double sourceFrequencyScale, double sourceAmplitude, bool trackIntensity, bool use4thOrderLaplacian, double timeDecayFactor, double intensityScale, List<SourceElement> objectSources = null)- {- _sourceAmplitude = sourceAmplitude;- _use4thOrderLaplacian = use4thOrderLaplacian;- _intensityScale = (float)intensityScale;- _width = scene.Width;- _height = scene.Height;- _stride = _width + 2;- int cellCount = _stride * (_height + 2);- _u = new float[cellCount];- _uPrev = new float[cellCount];- _c2 = new float[cellCount];- float[] damping = new float[cellCount];- if (trackIntensity)- {- _intensity = new float[cellCount];- _intensityStage1 = new float[cellCount];- _intensityOut = new float[cellCount];- }- for (int y = 0; y < _height; y++)- {- Array.Copy(scene.C2, y * _width, _c2, (y + 1) * _stride + 1, _width);- Array.Copy(scene.D, y * _width, damping, (y + 1) * _stride + 1, _width);- }-- // see the class remarks: sub-stepping keeps the 4th order stencil stable without changing the physical- // wave speed or damping - _subSteps stays 1 (no sub-stepping) unless the 4th order stencil is in use and- // this scene's highest c² actually needs it- _subSteps = use4thOrderLaplacian ? ComputeSubSteps(MaxOf(_c2)) : 1;- if (_subSteps > 1)- {- // Damping is applied once per sub-step, so take the sub-step root to keep the per-step decay unchanged- // (_subSteps applications of it compound back to the original d).- _damping = new float[cellCount];- double exponent = 1.0 / _subSteps;- for (int i = 0; i < cellCount; i++)- {- _damping[i] = (float)Math.Pow(damping[i], exponent);- }- // A sub-step is 1/subSteps long, so c²·dt² shrinks by 1/subSteps².- _c2Mult = 1f / (_subSteps * _subSteps);- }- else- {- _damping = damping;- _c2Mult = 1f;- }-- int sourceCount = scene.SourceCount;- _sourceIndex = new int[sourceCount];- _sourceLevel = new byte[sourceCount];- for (int i = 0; i < sourceCount; i++)- {- _sourceIndex[i] = (scene.SourceY[i] + 1) * _stride + scene.SourceX[i] + 1;- _sourceLevel[i] = scene.SourceLevel[i];- _levelUsed[scene.SourceLevel[i]] = true;- }- for (int level = 0; level <= 255; level++)- {- _levelFrequency[level] = level / 255.0 * 0.5 * sourceFrequencyScale;- }-- // object sources: keep only the elements whose position is inside the canvas (a randomized composite- // element can fall outside)- List<SourceElement> insideSources = new List<SourceElement>();- List<int> insideIndices = new List<int>();- if (objectSources != null)- {- foreach (SourceElement source in objectSources)- {- if (source.PosX >= 0 && source.PosX < _width && source.PosY >= 0 && source.PosY < _height)- {- insideSources.Add(source);- insideIndices.Add((source.PosY + 1) * _stride + source.PosX + 1);- }- }- }- _objSources = insideSources.ToArray();- _objIndex = insideIndices.ToArray();- _objCycleAnchor = new double[_objSources.Length];- _objCurrentOffWidth = new int[_objSources.Length];- for (int i = 0; i < _objSources.Length; i++)- {- // the very first cycle uses the off-width already rolled once at "Generate composite source" time;- // later cycles (for elements that opt into it) redraw from OffWidthBase - see ComputePulsePosition- _objCurrentOffWidth[i] = _objSources[i].OffWidthCycles;- }-- // the intensity's averaging time constant scales inversely with the frequency of the slowest active- // source (image or object) - see TimeDecayFactor's doc (SimulationSettings) for why, and- // NominalDecayLevel's doc for the calibration this reproduces- _intensityAlpha = IntensityRetention(timeDecayFactor, LowestSourceLevel(_levelUsed, _objSources));- }-- /// <summary>Scene width in cells (canvas pixels), excluding the padding.</summary>- public int Width => _width;-- /// <summary>Scene height in cells (canvas pixels), excluding the padding.</summary>- public int Height => _height;-- /// <summary>Row pitch of the padded buffers: <see cref="Width"/> + 2. Pixel (x, y) is at (y + 1) * Stride + x + 1.</summary>- public int Stride => _stride;-- /// <summary>- /// The current field u of the last completed step (padded layout). The array instance changes every sub-step- /// because the two field buffers are swapped, so callers must re-read this property per frame rather than- /// cache the array. Do not change.- /// </summary>- public float[] FieldData => _u;-- /// <summary>Scaled running intensity (padded layout), or null when the engine was created without intensity tracking. Do not change.</summary>- public float[] IntensityData => _intensityOut;-- /// <summary>Engine label for the UI/result: "CPU (n threads)" with the logical processor count.</summary>- public string Description => "CPU (" + Environment.ProcessorCount.ToString(CultureInfo.InvariantCulture) + " threads)";-- /// <summary>Elapsed simulation time in steps (one per <see cref="AdvanceOneStep"/>).</summary>- public double Time => _time;-- /// <summary>No-op: the CPU buffers are always host-resident and up to date.</summary>- public void PrepareFrame(bool needField, bool needIntensity)- {- }-- /// <summary>No-op: the engine owns only managed arrays.</summary>- public void Dispose()- {- }-- /// <summary>- /// Advances the simulation by one step: blends the sources in once, runs <see cref="_subSteps"/> leapfrog- /// sub-steps (the intensity is updated on the last one only) and increments <see cref="Time"/>.- /// </summary>- public void AdvanceOneStep()- {- ApplySources();- for (int subStep = 1; subStep <= _subSteps; subStep++)- {- UpdateField(subStep == _subSteps);- }- _time += 1.0;- }-- /// <summary>- /// Installs the probe layout (or clears it when <paramref name="sampler"/> is null or empty), discarding any- /// pending samples and integrated totals, and allocates the per-pixel totals for integrated line probes.- /// </summary>- /// <exception cref="InvalidOperationException">The sampler needs intensity but this engine does not track it.</exception>- public void SetProbes(ProbeSampler sampler)- {- _probeValues.Clear();- _profileTotals = null;- if (sampler == null || sampler.Count == 0)- {- _sampler = null;- return;- }- if (sampler.NeedsIntensity && _intensityOut == null)- {- throw new InvalidOperationException("the intensity is not tracked");- }- _sampler = sampler;- _profileTotals = new double[sampler.Count][];- for (int i = 0; i < sampler.Count; i++)- {- _probeValues.Add(new List<float>());- if (sampler.Integrate[i])- {- _profileTotals[i] = new double[sampler.Pixels[i].Length];- }- }- }-- /// <summary>- /// Called by the runner after every step: appends one field or intensity value per point probe, and adds- /// the current intensity to the per-pixel totals of integrated line probes (once <see cref="Time"/> has- /// reached their start step). Non-integrated line probes are read live by <see cref="ReadProbeProfiles"/>.- /// </summary>- public void SampleProbes()- {- if (_sampler == null)- {- return;- }- int step = (int)Math.Round(_time);- for (int p = 0; p < _sampler.Count; p++)- {- if (!_sampler.IsProfile[p])- {- float[] data = _sampler.UseIntensity[p] ? _intensityOut : _u;- _probeValues[p].Add(_sampler.Compute(p, data));- }- else if (_sampler.Integrate[p])- {- // before "start after step" the totals are simply never added to, so they stay at zero: any- // intensity that arrived earlier is purged rather than being baked into the total once recording starts- if (_sampler.UseStartAfterStep[p] && step < _sampler.StartAfterStep[p])- {- continue;- }- // the intensity that has passed every point of the line, added up over the steps- int[] pixels = _sampler.Pixels[p];- double[] totals = _profileTotals[p];- for (int k = 0; k < pixels.Length; k++)- {- totals[k] += _intensityOut[pixels[k]];- }- }- }- }-- /// <summary>Returns and clears the point-probe values collected since the previous call.</summary>- /// <returns>One array per probe, one value per step (empty for line probes); an empty outer array when no sampler is set.</returns>- public float[][] TakeProbeSamples()- {- if (_sampler == null)- {- return new float[0][];- }- float[][] samples = new float[_sampler.Count][];- for (int p = 0; p < _sampler.Count; p++)- {- samples[p] = _probeValues[p].ToArray();- _probeValues[p].Clear();- }- return samples;- }-- /// <summary>Reads the current values along every line probe; nothing is cleared.</summary>- /// <returns>- /// One array per probe in pixel order along the line, holding the integrated intensity totals or the live- /// field/intensity values; null entries for point probes; an empty outer array when no sampler is set.- /// </returns>- public float[][] ReadProbeProfiles()- {- if (_sampler == null)- {- return new float[0][];- }- float[][] profiles = new float[_sampler.Count][];- for (int p = 0; p < _sampler.Count; p++)- {- if (!_sampler.IsProfile[p])- {- continue;- }- int[] pixels = _sampler.Pixels[p];- float[] profile = new float[pixels.Length];- if (_sampler.Integrate[p])- {- double[] totals = _profileTotals[p];- for (int k = 0; k < pixels.Length; k++)- {- profile[k] = (float)totals[k];- }- }- else- {- float[] data = _sampler.UseIntensity[p] ? _intensityOut : _u;- for (int k = 0; k < pixels.Length; k++)- {- profile[k] = data[pixels[k]];- }- }- profiles[p] = profile;- }- return profiles;- }-- /// <summary>- /// Number of sub-steps per time step needed to keep the 4th-order stencil stable for the largest c² in the- /// scene: the smallest n with c²·λmax/n² ≤ <see cref="SubStepTargetLimit"/>, at least 1. Shared with- /// <see cref="GpuWaveSimulator"/>.- /// </summary>- internal static int ComputeSubSteps(float maxC2)- {- if (maxC2 <= 0f)- {- return 1;- }- double subSteps = Math.Ceiling(Math.Sqrt((double)maxC2 * FourthOrderLambdaMax / SubStepTargetLimit));- return Math.Max(1, (int)Math.Round(subSteps));- }-- /// <summary>Largest value in <paramref name="values"/>, or 0 for an empty or all-negative array.</summary>- internal static float MaxOf(float[] values)- {- float max = 0f;- foreach (float value in values)- {- if (value > max)- {- max = value;- }- }- return max;- }-- /// <summary>- /// The lowest (slowest) source level in use, image or object (a level of 0 means "no source" and is- /// excluded), or <see cref="NominalDecayLevel"/> when no source has a level above 0. Shared with- /// <see cref="GpuWaveSimulator"/>.- /// </summary>- /// <param name="levelUsed">Per level 0..255: whether an image source uses it.</param>- /// <param name="objectSources">Object sources to consider as well.</param>- internal static int LowestSourceLevel(bool[] levelUsed, IEnumerable<SourceElement> objectSources)- {- int minActiveLevel = 0;- for (int level = 1; level <= 255; level++)- {- if (levelUsed[level])- {- minActiveLevel = level;- break;- }- }- foreach (SourceElement source in objectSources)- {- if (source.Level > 0 && (minActiveLevel == 0 || source.Level < minActiveLevel))- {- minActiveLevel = source.Level;- }- }- return minActiveLevel == 0 ? NominalDecayLevel : minActiveLevel;- }-- /// <summary>- /// Per-step retention factor of the intensity averages: exp(-1/tauSteps) with- /// tauSteps = <paramref name="timeDecayFactor"/>·<see cref="NominalDecayLevel"/>/<paramref name="lowestLevel"/>,- /// at least 1 step, so the time constant scales inversely with the slowest source's frequency and- /// <see cref="SimulationSettings.TimeDecayFactor"/> counts steps at a nominal source level of- /// <see cref="NominalDecayLevel"/>. Shared with <see cref="GpuWaveSimulator"/>.- /// </summary>- internal static float IntensityRetention(double timeDecayFactor, int lowestLevel)- {- double tauSteps = Math.Max(1.0, timeDecayFactor * NominalDecayLevel / lowestLevel);- return (float)Math.Exp(-1.0 / tauSteps);- }-- /// <summary>- /// Soft-blends the current source values into the field (<c>u = 0.9·u + 0.1·value</c>, see- /// <see cref="SourceOpacity"/>): image sources driven by their level's frequency, then object sources- /// with their own phase, amplitude, pulse envelope and detach fade. Object sources that have been- /// detached for <see cref="SourceElement.DetachRampSteps"/> steps or longer are skipped.- /// </summary>- private void ApplySources()- {- float[] u = _u;- if (_sourceIndex.Length > 0)- {- // sin(phase + frequency * t) * amplitude is the same for all sources with the same green value:- // one sine per level in use, not per source pixel- for (int level = 1; level <= 255; level++)- {- if (_levelUsed[level])- {- _levelValue[level] = (float)(Math.Sin(_levelFrequency[level] * _time) * _sourceAmplitude);- }- }- for (int i = 0; i < _sourceIndex.Length; i++)- {- int idx = _sourceIndex[i];- u[idx] = u[idx] * SourceOpacity + _levelValue[_sourceLevel[i]] * (1f - SourceOpacity);- }- }- for (int i = 0; i < _objSources.Length; i++)- {- SourceElement source = _objSources[i];- // "detach source": once the run reaches the source's detach step, its drive is faded out linearly over- // the next DetachRampSteps steps (rather than cut instantly), then it stops driving the field entirely- // (not even towards 0) so it releases its hold and stops diffracting waves through that point. A hard- // cutoff would otherwise leave a small kink in the forcing right at the detach step, which can ring.- float detachFade = 1f;- if (source.DetachAfterStep >= 0)- {- double stepsSinceDetach = _time - source.DetachAfterStep;- if (stepsSinceDetach >= SourceElement.DetachRampSteps)- {- continue;- }- if (stepsSinceDetach > 0.0)- {- detachFade = (float)(1.0 - stepsSinceDetach / SourceElement.DetachRampSteps);- }- }- double freq = _levelFrequency[source.Level];- double envelope = 1.0;- if (source.Mode != SourceMode.Continuous)- {- double pulsePos = ComputePulsePosition(i, source, freq, out int offWidth, out bool isFirstCycle);- envelope = PulseEnvelope(source, pulsePos, offWidth, isFirstCycle);- }- float value = (float)(Math.Sin(source.PhaseRad + freq * _time) * source.Amplitude * envelope) * detachFade;- int idx = _objIndex[i];- u[idx] = u[idx] * SourceOpacity + value * (1f - SourceOpacity);- }- }-- /// <summary>- /// Returns the element's position within its current off+on cycle (0 = the very start of the "off" span, up- /// to but not including its current period, in cycles of the source frequency), and reports the off-width- /// in effect for that cycle via <paramref name="offWidth"/>. For most elements- /// (<see cref="SourceElement.RandomizeOffWidthAmount"/> <= 0) the off-width never changes, so this is a- /// pure, stateless function of <see cref="_time"/> - except that the cycle clock is shifted by the- /// off-width, so the run starts already at the beginning of the "on" span (pos = offWidth) instead of at the- /// start of an off span: a single/non-randomized source sitting silent for its off-width at the very start of- /// a run was never the intent, only ever a side effect of the cycle position formula happening to start at 0.- /// An element with RandomizeOffWidthAmount > 0 (only ever a composite source with "Randomize off-width"- /// ticked) keeps the original start-in-off-state behavior instead, since there the elements are meant to- /// desynchronize from a common starting point rather than all begin already mid-pulse. For such an element- /// this also owns its runtime state (<see cref="_objCycleAnchor"/>, <see cref="_objCurrentOffWidth"/>): each- /// time <see cref="_time"/> has advanced far enough to complete the current cycle, it advances the element's- /// cycle anchor and redraws a fresh off-width (uniformly within ± RandomizeOffWidthAmount of- /// <see cref="SourceElement.OffWidthBase"/>, at least 1, at most <see cref="CycleAdvanceGuard"/> cycles at a- /// time) before computing the position - so every source keeps its own, independently-drifting rhythm- /// instead of staying locked to whatever it rolled once at generate time.- /// <paramref name="isFirstCycle"/> reports whether pos falls within the element's very first off+on cycle- /// since the run began - see <see cref="PulseEnvelope"/> for why that matters for the SmoothedSquare shape.- /// </summary>- /// <param name="i">Index of the source in <see cref="_objSources"/> (selects its anchor/off-width slot).</param>- /// <param name="el">The source whose pulse timing is evaluated.</param>- /// <param name="freq">Angular frequency of the source in radians per step.</param>- /// <param name="offWidth">Receives the off-width (cycles) in effect for the current period.</param>- /// <param name="isFirstCycle">Receives whether the source is still in its first period.</param>- private double ComputePulsePosition(int i, SourceElement el, double freq, out int offWidth, out bool isFirstCycle)- {- // cycles of the source's own frequency elapsed since t = 0 (not folding in the phase, so the on/off timing- // does not shift when only the phase of the wave itself is changed)- double cycleClock = freq * _time / (2.0 * Math.PI);- if (el.RandomizeOffWidthAmount <= 0)- {- offWidth = el.OffWidthCycles;- int period = el.OnWidthCycles + offWidth;- if (period <= 0)- {- isFirstCycle = true;- return 0.0;- }- // shifted so cycleClock = 0 lands at pos = offWidth (the start of the "on" span), not pos = 0 (the start- // of an "off" span) - see the summary above- double adjustedClock = cycleClock + offWidth;- isFirstCycle = Math.Floor(adjustedClock / period) == 0.0;- return adjustedClock - period * Math.Floor(adjustedClock / period); // 0 .. period- }- else- {- offWidth = _objCurrentOffWidth[i];- int dynPeriod = el.OnWidthCycles + offWidth;- if (dynPeriod <= 0)- {- isFirstCycle = true;- return 0.0;- }- double sinceAnchor = cycleClock - _objCycleAnchor[i];- int guard = 0;- while (sinceAnchor >= dynPeriod && guard < CycleAdvanceGuard)- {- _objCycleAnchor[i] += dynPeriod;- sinceAnchor -= dynPeriod;- offWidth = Math.Max(1, el.OffWidthBase + SourceSettings.RandomInt(_objRandom, el.RandomizeOffWidthAmount));- _objCurrentOffWidth[i] = offWidth;- dynPeriod = el.OnWidthCycles + offWidth;- guard++;- }- if (sinceAnchor < 0.0)- {- sinceAnchor = 0.0; // should not happen (_time only increases), guarded for safety- }- // the anchor only ever advances (above) once a cycle has actually completed, so it still reading its- // initial 0 means no cycle has completed yet - we are still in the element's very first (off-first) cycle- isFirstCycle = _objCycleAnchor[i] == 0.0;- return sinceAnchor;- }- }-- /// <summary>- /// Amplitude envelope (0..1) of a pulsed source: the source is "off" for <paramref name="offWidth"/> cycles- /// of its own frequency, then "on" for <see cref="SourceElement.OnWidthCycles"/> cycles, repeating (off- /// precedes on so that, at the start of a run, every source is silent for its own off-width before its first- /// pulse, rather than every source firing simultaneously at t = 0; a non-positive period yields 1). Within- /// the "on" span the amplitude is shaped by the pulse shape: Gaussian tapers smoothly to (about) 0 at both- /// ends of the "on" span (a bell centred in the on-window with σ = on-width/6), and SmoothedSquare rises and- /// falls quickly (an atan-smoothed square wave, avoiding a hard on/off step that would ring the field).- /// <paramref name="pos"/> and <paramref name="offWidth"/> come from <see cref="ComputePulsePosition"/>, as- /// does <paramref name="isFirstCycle"/> - see the SmoothedSquare branch for why that one matters.- /// </summary>- /// <param name="el">The source; supplies the pulse shape and on-width.</param>- /// <param name="pos">Position within the period in cycles, as returned by <see cref="ComputePulsePosition"/>.</param>- /// <param name="offWidth">Off-width (cycles) in effect for this period.</param>- /// <param name="isFirstCycle">Whether this is the first period (suppresses the tail wrapping of the smoothed square).</param>- private static double PulseEnvelope(SourceElement el, double pos, int offWidth, bool isFirstCycle)- {- int onWidthCycles = el.OnWidthCycles;- int period = onWidthCycles + offWidth;- if (period <= 0)- {- return 1.0;- }- double onPos = pos - offWidth; // 0 .. onWidth, position within the "on" span- if (el.PulseShape == SourcePulseShape.Gaussian)- {- if (onPos < 0.0)- {- return 0.0;- }- double center = onWidthCycles / 2.0;- double sigma = Math.Max(onWidthCycles / 6.0, 1E-06);- double z = (onPos - center) / sigma;- return Math.Exp(-0.5 * z * z);- }- // a flat-topped pulse (envelope 1 while "on", 0 while "off") with a short, FIXED-width (in cycles, not a- // fraction of the on/off span) smoothed edge at the rise and the fall, evaluated on a coordinate shifted- // so the "on" span starts at 0 (folding around the period).- if (onPos < 0.0 && !isFirstCycle)- {- // wrapping onPos forward by a full period makes it continue the falling tail of the on-span that- // JUST ended - correct from the second off-span onward, where that on-span really happened. A- // source's very first off-span (isFirstCycle) has no real preceding on-emission to continue from, so- // wrapping there would fabricate one: pos = 0 would land exactly on that phantom falling edge and- // start the run at envelope ~0.5 instead of ~0, emitting a spurious one-cycle "blip" before the- // source actually goes quiet. Left un-wrapped (deeply negative) instead, riseArg/fallArg below- // correctly place it far from both edges, so the envelope is (very close to) 0 until the real rising edge.- onPos += period;- }- const double EdgeWidth = 0.35;- double fallArg = onPos - onWidthCycles; // 0 at the falling edge, grows past it- double riseArg = onPos; // 0 at the rising edge- if (riseArg > period / 2.0)- {- riseArg -= period; // signed distance to the *nearest* rising edge- }- double rise = 0.5 + Math.Atan(riseArg / EdgeWidth) / Math.PI;- double fall = 0.5 - Math.Atan(fallArg / EdgeWidth) / Math.PI;- return rise * fall;- }-- /// <summary>- /// One leapfrog sub-step over all interior cells, parallelised over row bands:- /// <c>next = u + (u - uPrev)·d + lap·c2·c2Mult</c>, where d is the per-cell damping (1 = lossless, applied- /// to the velocity term) and lap is the Laplacian: the 9-point stencil (corners <see cref="KernelCorner"/>,- /// edges <see cref="KernelEdge"/>, centre -1), or for cells at least two cells away from the border and- /// when enabled, the 4th-order 5-point-per-axis stencil (<see cref="FourthOrderFar"/>,- /// <see cref="FourthOrderNear"/>, <see cref="FourthOrderCenter"/>). Each cell reads only <see cref="_u"/>- /// and overwrites its own slot in <see cref="_uPrev"/>, so the bands do not race; afterwards the two- /// buffers are swapped. Border cells are never written and stay 0.- /// When tracking, the intensity is a cascade of two exponential moving averages of u² (retention- /// <see cref="_intensityAlpha"/>); the output mixes both stages (<see cref="IntensityBlend"/>) times- /// <see cref="_intensityScale"/>. The damping array is <see cref="_damping"/> (the scene's d itself when- /// <see cref="_subSteps"/> = 1, otherwise its 1/_subSteps-th root) and c² is scaled by- /// <see cref="_c2Mult"/> (1.0F, an exact no-op, when _subSteps = 1).- /// </summary>- /// <param name="updateIntensity">- /// Whether to update the intensity buffers in this sub-step: only on the last one, so that its own exponential- /// averaging still runs once per <see cref="AdvanceOneStep"/> call, from the field after all of its sub-steps,- /// matching its calibration (<see cref="_intensityAlpha"/>) regardless of how many sub-steps that call takes.- /// </param>- private void UpdateField(bool updateIntensity)- {- // Local copies for the parallel loop: the lambda should not touch fields.- float[] u = _u;- float[] uPrev = _uPrev;- float[] c2 = _c2;- float[] d = _damping;- float[] intensity = _intensity;- float[] stage1 = _intensityStage1;- float[] intensityOut = _intensityOut;- bool track = intensity != null && updateIntensity;- int stride = _stride;- int w = _width;- int h = _height;- bool use4th = _use4thOrderLaplacian;- float mult = _c2Mult;- float alpha = _intensityAlpha;- float scale = _intensityScale;- int bands = Math.Min(h, Environment.ProcessorCount * 4);-- Parallel.For(0, bands, band =>- {- int rowStart = (int)((long)h * band / bands);- int rowEnd = (int)((long)h * (band + 1) / bands) - 1;- for (int y = rowStart; y <= rowEnd; y++)- {- int idx = (y + 1) * stride + 1;- // the 4th order stencil reaches 2 cells away, so it is only safe for domain rows/columns that- // have that much room before the (1 cell wide) border - the outermost ring of the domain (y = 0,- // y = h - 1, and, per column below, x = 0, x = w - 1) falls back to the original 3x3 kernel- bool rowAllows4th = use4th && y >= 1 && y <= h - 2;- for (int x = 0; x < w; x++)- {- float center = u[idx];- float laplacian;- if (rowAllows4th && x >= 1 && x <= w - 2)- {- laplacian = FourthOrderFar * (u[idx - 2] + u[idx + 2] + u[idx - 2 * stride] + u[idx + 2 * stride])- + FourthOrderNear * (u[idx - 1] + u[idx + 1] + u[idx - stride] + u[idx + stride])- + FourthOrderCenter * center;- }- else- {- laplacian = KernelCorner * (u[idx - stride - 1] + u[idx - stride + 1] + u[idx + stride - 1] + u[idx + stride + 1])- + KernelEdge * (u[idx - 1] + u[idx + 1] + u[idx - stride] + u[idx + stride])- - center;- }- // the new value replaces the previous one (each cell only reads its own previous value)- float next = center + (center - uPrev[idx]) * d[idx] + laplacian * c2[idx] * mult;- uPrev[idx] = next;- if (track)- {- // two cascaded one-pole stages (see the class remarks), blended with the 1-stage- // result (IntensityBlend) for the shown/exported intensity rather than using the full- // 2-stage cascade outright- float s1 = stage1[idx] * alpha + next * next * (1f - alpha);- stage1[idx] = s1;- float s2 = intensity[idx] * alpha + s1 * (1f - alpha);- intensity[idx] = s2;- intensityOut[idx] = (s1 * (1f - IntensityBlend) + s2 * IntensityBlend) * scale;- }- idx++;- }- }- });-- // the array that received the new values is now the current field- _uPrev = u;- _u = uPrev;- }-- /// <summary>Weight of the four diagonal neighbours in the 9-point Laplacian.</summary>- private const float KernelCorner = 0.066f;-- /// <summary>Weight of the four edge neighbours in the 9-point Laplacian (4·corner + 4·edge = 1 balances the centre weight of -1).</summary>- private const float KernelEdge = 0.184f;-- /// <summary>Fraction of the old field value kept when a source value is blended in (soft source injection).</summary>- private const float SourceOpacity = 0.9f;-- /// <summary>- /// Nominal source level (of 255) that <see cref="SimulationSettings.TimeDecayFactor"/>'s steps count is- /// calibrated against - see that property's doc and <see cref="IntensityRetention"/>; also the level assumed- /// when no source has a level above 0 (<see cref="LowestSourceLevel"/>).- /// </summary>- internal const int NominalDecayLevel = 100;-- /// <summary>- /// How much of the fully cascaded (2-stage, 12 dB/octave) intensity is blended into the shown/exported value- /// versus the 1-stage (6 dB/octave) intensity (0 = first stage only, 1 = second stage only) - see the class- /// remarks; 0.5 is the middle ground, about 9 dB/octave.- /// </summary>- private const float IntensityBlend = 0.5f;-- // the 4th order "cross" stencil's coefficients: (-f(-2) + 16f(-1) - 30f(0) + 16f(+1) - f(+2)) / 12 per axis,- // the two axes' center terms combined into one (-60/12 = -5) since both apply to the same center pixel-- /// <summary>4th-order stencil weight of the nearest neighbours (16 / 12).</summary>- private const float FourthOrderNear = 4.0f / 3.0f;-- /// <summary>4th-order stencil weight of the second-nearest neighbours (-1 / 12).</summary>- private const float FourthOrderFar = -1.0f / 12.0f;-- /// <summary>4th-order stencil centre weight (-60 / 12, the two axes' centre terms combined).</summary>- private const float FourthOrderCenter = -5f;-- /// <summary>- /// The 4th order stencil's largest |eigenvalue| (at the grid's highest spatial frequency, kx = ky = π):- /// 2 * (-1/12 * cos(2k) + 4/3 * cos(k) - 5/2)|k=π per axis, summed over x and y = -32/3. Used by the- /// stability estimate in <see cref="ComputeSubSteps"/>.- /// </summary>- private const float FourthOrderLambdaMax = 32.0f / 3.0f;-- /// <summary>- /// How far below the hard stability limit (c² * |λmax| <= 4) sub-stepping aims to stay - chosen to give- /// roughly the same safety margin the 3x3 kernel already has in practice (its own c² * |λmax| is about 1.8- /// at the highest c² the app allows, i.e. about 2.2 times under the limit of 4).- /// </summary>- private const float SubStepTargetLimit = 2f;-- /// <summary>Upper bound on the periods <see cref="ComputePulsePosition"/> advances at once (guards against a tiny period).</summary>- private const int CycleAdvanceGuard = 1000;-- /// <summary>Scene width in cells.</summary>- private readonly int _width;-- /// <summary>Scene height in cells.</summary>- private readonly int _height;-- /// <summary>Padded row pitch (<see cref="_width"/> + 2).</summary>- private readonly int _stride;-- /// <summary>Whether interior cells use the 4th-order stencil.</summary>- private readonly bool _use4thOrderLaplacian;-- /// <summary>- /// Leapfrog sub-steps per simulation step (see the class remarks); 1 (no sub-stepping) unless the 4th-order- /// stencil is on and this scene's highest c² needs it.- /// </summary>- private readonly int _subSteps;-- /// <summary>- /// Per-cell damping applied per sub-step (padded), 1 = lossless: the scene's map itself when- /// <see cref="_subSteps"/> = 1 (same array, so multiplying by it is bit-for-bit identical to before),- /// otherwise a separate array of it raised to the power 1/<see cref="_subSteps"/>.- /// </summary>- private readonly float[] _damping;-- /// <summary>1/<see cref="_subSteps"/>², scaling c² for the shorter sub-step (or exactly 1.0F when _subSteps = 1, a bit-for-bit no-op multiply).</summary>- private readonly float _c2Mult;-- /// <summary>- /// The intensity's exponential-average decay factor for this simulation (replaces the old fixed 0.98F) - see- /// <see cref="SimulationSettings.TimeDecayFactor"/>'s doc and <see cref="IntensityRetention"/>.- /// </summary>- private readonly float _intensityAlpha;-- /// <summary><see cref="SimulationSettings.IntensityScale"/>, the multiplier on the intensity output - see that property's doc.</summary>- private readonly float _intensityScale;-- /// <summary>Current field (padded); exchanged with <see cref="_uPrev"/> after every sub-step.</summary>- private float[] _u;-- /// <summary>Previous field (padded); receives the new field during a sub-step and then becomes <see cref="_u"/>.</summary>- private float[] _uPrev;-- /// <summary>Per-cell c² = 1/n² (padded; border cells 0).</summary>- private readonly float[] _c2;-- /// <summary>- /// Second-stage running average of u² (padded): the 2-stage cascade's internal recursive state (12 dB/octave),- /// no longer what is shown/exported - see <see cref="_intensityOut"/> and the class remarks. Null when- /// intensity is not tracked.- /// </summary>- private readonly float[] _intensity;-- /// <summary>- /// The first of the two cascaded exponential-filter stages that make up the intensity (padded; see the class- /// remarks), or null when intensity is not tracked, same as <see cref="_intensity"/>.- /// </summary>- private readonly float[] _intensityStage1;-- /// <summary>- /// The blend of <see cref="_intensityStage1"/> and <see cref="_intensity"/> (<see cref="IntensityBlend"/>)- /// times <see cref="_intensityScale"/> that is actually shown/exported as <see cref="IntensityData"/>, or null- /// when not tracked.- /// </summary>- private readonly float[] _intensityOut;-- /// <summary>Padded cell index of every image source.</summary>- private readonly int[] _sourceIndex;-- /// <summary>Green level (1..255) of every image source, indexing <see cref="_levelFrequency"/>.</summary>- private readonly byte[] _sourceLevel;-- /// <summary>Angular frequency in radians per step for each level 0..255: level/255 × 0.5 × sourceFrequencyScale.</summary>- private readonly double[] _levelFrequency = new double[256];-- /// <summary>Which levels have at least one image source; only those get a value computed per step.</summary>- private readonly bool[] _levelUsed = new bool[256];-- /// <summary>- /// Scratch for <see cref="ApplySources"/>: the source value of each level in use for the current step,- /// computed once per level and shared by every image source of that level. Kept as a field so it is not- /// re-allocated every step; written and read only by the driving thread.- /// </summary>- private readonly float[] _levelValue = new float[256];-- /// <summary>Peak amplitude of the image sources.</summary>- private readonly double _sourceAmplitude;-- /// <summary>Object sources that lie inside the canvas.</summary>- private readonly SourceElement[] _objSources;-- /// <summary>Padded cell index of every entry in <see cref="_objSources"/>.</summary>- private readonly int[] _objIndex;-- /// <summary>Random generator for randomized off-widths; used by the driving thread only.</summary>- private readonly Random _objRandom = new Random();-- /// <summary>- /// Per object source (parallel to <see cref="_objSources"/>): the cycle-clock value (in cycles of the- /// element's own frequency) at which its current off+on cycle started. Runtime state for pulsed sources- /// whose off-width is re-randomized at runtime (<see cref="SourceElement.RandomizeOffWidthAmount"/>);- /// elements that never re-randomize (the common case) never touch it: their position within the cycle is- /// a pure function of <see cref="_time"/>, exactly as before.- /// </summary>- private readonly double[] _objCycleAnchor;-- /// <summary>Per object source (parallel to <see cref="_objSources"/>): off-width (cycles) in effect for its current period; see <see cref="_objCycleAnchor"/>.</summary>- private readonly int[] _objCurrentOffWidth;-- /// <summary>Elapsed time in steps.</summary>- private double _time;-- /// <summary>Probe layout in use, or null when no probes are set.</summary>- private ProbeSampler _sampler;-- /// <summary>Point-probe samples gathered since the last <see cref="TakeProbeSamples"/>, one list per probe.</summary>- private readonly List<List<float>> _probeValues = new List<List<float>>();-- /// <summary>Running per-pixel intensity sums for integrated line probes (null entries for other probes); null without a sampler.</summary>- private double[][] _profileTotals;- }-}diff --git a/Wave_Dude_2D/Wave_Dude_2D.csproj b/Wave_Dude_2D/Wave_Dude_2D.csprojdeleted file mode 100644index 2361b8a..0000000--- a/Wave_Dude_2D/Wave_Dude_2D.csproj+++ /dev/null@@ -1,192 +0,0 @@-<?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>{C3F63FB8-2009-4631-AB8D-4E176E131C5F}</ProjectGuid>- <OutputType>WinExe</OutputType>- <RootNamespace>_2D_wave_sim_V01</RootNamespace>- <AssemblyName>Wave_Dude_2D</AssemblyName>- <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>- <FileAlignment>512</FileAlignment>- <ApplicationIcon>Wave_Dude_2D.ico</ApplicationIcon>- <StartupObject>_2D_wave_sim_V01.My.MyApplication</StartupObject>- </PropertyGroup>- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">- <PlatformTarget>AnyCPU</PlatformTarget>- <DebugSymbols>true</DebugSymbols>- <DebugType>full</DebugType>- <Optimize>false</Optimize>- <OutputPath>bin\Debug\</OutputPath>- <DocumentationFile>bin\Debug\Wave_Dude_2D.xml</DocumentationFile>- <DefineConstants>DEBUG;TRACE</DefineConstants>- <ErrorReport>prompt</ErrorReport>- <WarningLevel>4</WarningLevel>- </PropertyGroup>- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">- <PlatformTarget>AnyCPU</PlatformTarget>- <DebugType>pdbonly</DebugType>- <Optimize>true</Optimize>- <OutputPath>bin\Release\</OutputPath>- <DocumentationFile>bin\Release\Wave_Dude_2D.xml</DocumentationFile>- <DefineConstants>TRACE</DefineConstants>- <ErrorReport>prompt</ErrorReport>- <WarningLevel>4</WarningLevel>- </PropertyGroup>- <ItemGroup>- <Reference Include="Microsoft.VisualBasic" />- <Reference Include="System" />- <Reference Include="System.Core" />- <Reference Include="System.Drawing" />- <Reference Include="System.Web.Extensions" />- <Reference Include="System.Windows.Forms" />- </ItemGroup>- <ItemGroup>- <AppDesigner Include="Properties\" />- </ItemGroup>- <ItemGroup>- <Compile Include="AboutForm.cs">- <SubType>Form</SubType>- </Compile>- <Compile Include="AboutForm.Designer.cs">- <DependentUpon>AboutForm.cs</DependentUpon>- </Compile>- <Compile Include="AppSettings.cs" />- <Compile Include="AviFrameSink.cs" />- <Compile Include="AviMjpegWriter.cs" />- <Compile Include="ColorLut.cs" />- <Compile Include="ColorPickerControl.cs" />- <Compile Include="ColorScheme.cs" />- <Compile Include="ColorSchemeStore.cs" />- <Compile Include="Form1.cs">- <SubType>Form</SubType>- </Compile>- <Compile Include="Form1.Designer.cs">- <DependentUpon>Form1.cs</DependentUpon>- </Compile>- <Compile Include="Form1.Projects.cs">- <DependentUpon>Form1.cs</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="Form1.Output.cs">- <DependentUpon>Form1.cs</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="Form1.Scene.cs">- <DependentUpon>Form1.cs</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="Form1.Colors.cs">- <DependentUpon>Form1.cs</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="Form1.Simulation.cs">- <DependentUpon>Form1.cs</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="Form1.Probes.cs">- <DependentUpon>Form1.cs</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="Form1.Sources.cs">- <DependentUpon>Form1.cs</DependentUpon>- <SubType>Form</SubType>- </Compile>- <Compile Include="FrameRenderer.cs" />- <Compile Include="frmDescription.cs">- <SubType>Form</SubType>- </Compile>- <Compile Include="frmDescription.Designer.cs">- <DependentUpon>frmDescription.cs</DependentUpon>- </Compile>- <Compile Include="GpuDeviceInfo.cs" />- <Compile Include="GpuWaveSimulator.cs" />- <Compile Include="HelpForm.cs">- <SubType>Form</SubType>- </Compile>- <Compile Include="HelpForm.Designer.cs">- <DependentUpon>HelpForm.cs</DependentUpon>- </Compile>- <Compile Include="IFrameSink.cs" />- <Compile Include="IMFAttributesNative.cs" />- <Compile Include="IMFMediaBufferNative.cs" />- <Compile Include="IMFSampleNative.cs" />- <Compile Include="IMFSinkWriterNative.cs" />- <Compile Include="IWaveEngine.cs" />- <Compile Include="MfVideoWriter.cs" />- <Compile Include="My\MyApplication.cs" />- <Compile Include="My\MyComputer.cs" />- <Compile Include="My\MyProject.cs" />- <Compile Include="My\MySettings.Designer.cs">- <DependentUpon>MySettings.settings</DependentUpon>- <AutoGen>True</AutoGen>- <DesignTimeSharedInput>True</DesignTimeSharedInput>- </Compile>- <Compile Include="My\MySettingsProperty.cs" />- <Compile Include="My\Resources\_2D_wave_sim_V01.Resources.Designer.cs">- <DependentUpon>_2D_wave_sim_V01.Resources.resx</DependentUpon>- <AutoGen>True</AutoGen>- <DesignTime>True</DesignTime>- </Compile>- <Compile Include="OpenClApi.cs" />- <Compile Include="ProbeBoxSize.cs" />- <Compile Include="ProbeCollector.cs" />- <Compile Include="ProbeGraphPainter.cs" />- <Compile Include="ProbeKind.cs" />- <Compile Include="ProbeMeasurement.cs" />- <Compile Include="ProbeOverlay.cs" />- <Compile Include="ProbePlaceOn.cs" />- <Compile Include="ProbeSampler.cs" />- <Compile Include="ProbeScaleMode.cs" />- <Compile Include="ProbeSeries.cs" />- <Compile Include="ProbeSettings.cs" />- <Compile Include="ProbeTrace.cs" />- <Compile Include="ProbeUpdate.cs" />- <Compile Include="Project.cs" />- <Compile Include="ProjectConfig.cs" />- <Compile Include="ProjectStore.cs" />- <Compile Include="Properties\AssemblyInfo.cs" />- <Compile Include="SceneData.cs" />- <Compile Include="SceneSettings.cs" />- <Compile Include="SimulationJob.cs" />- <Compile Include="SimulationResult.cs" />- <Compile Include="SimulationRunner.cs" />- <Compile Include="SimulationSettings.cs" />- <Compile Include="SimulationStatus.cs" />- <Compile Include="SourceCompositeMode.cs" />- <Compile Include="SourceElement.cs" />- <Compile Include="SourceMainType.cs" />- <Compile Include="SourceMode.cs" />- <Compile Include="SourcePulseShape.cs" />- <Compile Include="SourceSettings.cs" />- <Compile Include="WaveEngineFactory.cs" />- <Compile Include="WaveSimulator.cs" />- </ItemGroup>- <ItemGroup>- <EmbeddedResource Include="AboutForm.resx">- <DependentUpon>AboutForm.cs</DependentUpon>- </EmbeddedResource>- <EmbeddedResource Include="Form1.resx">- <DependentUpon>Form1.cs</DependentUpon>- </EmbeddedResource>- <EmbeddedResource Include="frmDescription.resx">- <DependentUpon>frmDescription.cs</DependentUpon>- </EmbeddedResource>- <EmbeddedResource Include="HelpForm.resx">- <DependentUpon>HelpForm.cs</DependentUpon>- </EmbeddedResource>- <EmbeddedResource Include="My\Resources\_2D_wave_sim_V01.Resources.resx">- <Generator>ResXFileCodeGenerator</Generator>- <LastGenOutput>_2D_wave_sim_V01.Resources.Designer.cs</LastGenOutput>- </EmbeddedResource>- </ItemGroup>- <ItemGroup>- <None Include="app.config" />- <None Include="My\MySettings.settings">- <Generator>SettingsSingleFileGenerator</Generator>- <LastGenOutput>MySettings.Designer.cs</LastGenOutput>- </None>- </ItemGroup>- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />-</Project>\ No newline at end of filediff --git a/Wave_Dude_2D/Wave_Dude_2D.ico b/Wave_Dude_2D/Wave_Dude_2D.icodeleted file mode 100644index daf72c8..0000000Binary files a/Wave_Dude_2D/Wave_Dude_2D.ico and /dev/null differdiff --git a/Wave_Dude_2D/app.config b/Wave_Dude_2D/app.configdeleted file mode 100644index b22f757..0000000--- a/Wave_Dude_2D/app.config+++ /dev/null@@ -1,6 +0,0 @@-<?xml version="1.0" encoding="utf-8" ?>-<configuration>- <startup>- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />- </startup>-</configuration>\ No newline at end of filediff --git a/Wave_Dude_2D/frmDescription.Designer.cs b/Wave_Dude_2D/frmDescription.Designer.csdeleted file mode 100644index cd4cee5..0000000--- a/Wave_Dude_2D/frmDescription.Designer.cs+++ /dev/null@@ -1,76 +0,0 @@-using System;-using System.ComponentModel;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- public partial class frmDescription : global::System.Windows.Forms.Form- {- /// <summary>Releases the designer-managed components when <paramref name="disposing"/> is true, then the form itself.</summary>- /// <param name="disposing">True when called from <see cref="System.ComponentModel.Component.Dispose()"/>; false from the finalizer.</param>- [global::System.Diagnostics.DebuggerNonUserCode]- protected override void Dispose(bool disposing)- {- try- {- bool flag = disposing && this.components != null;- if (flag)- {- this.components.Dispose();- }- }- finally- {- base.Dispose(disposing);- }- }-- [global::System.Diagnostics.DebuggerStepThrough]- private void InitializeComponent()- {- this.TextBox1 = new global::System.Windows.Forms.TextBox();- this.btnSaveDescription = new global::System.Windows.Forms.Button();- this.btnCancelDescription = new global::System.Windows.Forms.Button();- base.SuspendLayout();- this.TextBox1.BorderStyle = global::System.Windows.Forms.BorderStyle.FixedSingle;- this.TextBox1.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.TextBox1.Location = new global::System.Drawing.Point(22, 23);- this.TextBox1.Multiline = true;- this.TextBox1.Name = "TextBox1";- this.TextBox1.Size = new global::System.Drawing.Size(662, 267);- this.TextBox1.TabIndex = 0;- this.btnSaveDescription.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnSaveDescription.Location = new global::System.Drawing.Point(575, 305);- this.btnSaveDescription.Name = "btnSaveDescription";- this.btnSaveDescription.Size = new global::System.Drawing.Size(109, 32);- this.btnSaveDescription.TabIndex = 1;- this.btnSaveDescription.Text = "OK";- this.btnSaveDescription.UseVisualStyleBackColor = true;- this.btnCancelDescription.Font = new global::System.Drawing.Font("Microsoft Sans Serif", 11.25f, global::System.Drawing.FontStyle.Regular, global::System.Drawing.GraphicsUnit.Point, 0);- this.btnCancelDescription.Location = new global::System.Drawing.Point(460, 305);- this.btnCancelDescription.Name = "btnCancelDescription";- this.btnCancelDescription.Size = new global::System.Drawing.Size(109, 32);- this.btnCancelDescription.TabIndex = 1;- this.btnCancelDescription.Text = "Cancel";- this.btnCancelDescription.UseVisualStyleBackColor = true;- // event wiring (was VB WithEvents/Handles)- this.btnSaveDescription.Click += new EventHandler(this.btnSaveDescription_Click);- this.btnCancelDescription.Click += new EventHandler(this.btnCancelDescription_Click);- base.AutoScaleDimensions = new global::System.Drawing.SizeF(6f, 13f);- base.AutoScaleMode = global::System.Windows.Forms.AutoScaleMode.Font;- base.ClientSize = new global::System.Drawing.Size(705, 349);- base.Controls.Add(this.btnCancelDescription);- base.Controls.Add(this.btnSaveDescription);- base.Controls.Add(this.TextBox1);- base.Name = "frmDescription";- this.Text = "Edit project description";- base.ResumeLayout(false);- base.PerformLayout();- }-- private TextBox TextBox1;- private Button btnSaveDescription;- private Button btnCancelDescription;- private global::System.ComponentModel.IContainer components;- }-}diff --git a/Wave_Dude_2D/frmDescription.cs b/Wave_Dude_2D/frmDescription.csdeleted file mode 100644index 29dc615..0000000--- a/Wave_Dude_2D/frmDescription.cs+++ /dev/null@@ -1,43 +0,0 @@-using System;-using System.Windows.Forms;--namespace _2D_wave_sim_V01-{- /// <summary>- /// Small modal dialog that lets the user type or edit a free-form description of the current- /// project. Opened modally from <see cref="Form1.btnDescription_Click"/>, which sets- /// <see cref="DescriptionText"/> before <c>ShowDialog</c> and reads it back (and saves it to the- /// project) only when the dialog returns <see cref="DialogResult.OK"/>- /// (<see cref="btnSaveDescription_Click"/>); <see cref="btnCancelDescription_Click"/> discards- /// any typing.- /// </summary>- public partial class frmDescription : Form- {- /// <summary>Creates the dialog with an empty description.</summary>- public frmDescription()- {- InitializeComponent();- }-- /// <summary>The text being edited (the text box contents). <see cref="Form1"/> sets this before showing the dialog and reads it back after a <see cref="DialogResult.OK"/>.</summary>- public string DescriptionText- {- get => TextBox1.Text;- set => TextBox1.Text = value;- }-- /// <summary>Closes the dialog with <see cref="DialogResult.OK"/>; the edited text stays in <see cref="DescriptionText"/>.</summary>- private void btnSaveDescription_Click(object sender, EventArgs e)- {- base.DialogResult = DialogResult.OK;- base.Close();- }-- /// <summary>Closes the dialog with <see cref="DialogResult.Cancel"/>; the caller discards the edit.</summary>- private void btnCancelDescription_Click(object sender, EventArgs e)- {- base.DialogResult = DialogResult.Cancel;- base.Close();- }- }-}diff --git a/Wave_Dude_2D/frmDescription.resx b/Wave_Dude_2D/frmDescription.resxdeleted file mode 100644index 7c72981..0000000--- a/Wave_Dude_2D/frmDescription.resx+++ /dev/null@@ -1,61 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<root>- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />- <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" use="required" type="xsd:string" />- <xsd:attribute name="type" type="xsd:string" />- <xsd:attribute name="mimetype" type="xsd:string" />- <xsd:attribute ref="xml:space" />- </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" use="required" msdata:Ordinal="1" />- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />- <xsd:attribute ref="xml:space" />- </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>- <resheader name="writer">- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>- </resheader>-</root>\ No newline at end of filediff --git a/_tools/CLEANUP_GUIDE.md b/_tools/CLEANUP_GUIDE.mddeleted file mode 100644index 9b73e78..0000000--- a/_tools/CLEANUP_GUIDE.md+++ /dev/null@@ -1,85 +0,0 @@-# Decompiled-code cleanup guide (phase 2)--The C# in `Wave_Dude_2D/` is ILSpy output from a VB.NET binary. Your job is to make the-files assigned to you read like hand-written C# **without changing behaviour**. The project-compiles right now; it must still compile when you are done.--## Hard rules--1. **Behaviour-preserving only.** No feature changes, no "improvements" to logic, no reordering- of side effects. If you are unsure whether a rewrite is equivalent, leave the original.-2. **Do not change the signature, name, accessibility or type of any member** (method, property,- field, event, constant, nested type). Other agents are editing other files in parallel and- call into yours. This includes `ref` parameters — leave them `ref` for now.-3. **Only edit the files assigned to you.** Never touch `*.Designer.cs`, `My/*`, `*.resx`,- `*.csproj`, or any other file.-4. Keep the file format: **tab indentation, Allman braces**,- `this.` prefixes as they are. Do not reflow or reformat code you are not otherwise changing.-5. Keep `using` directives that are still needed; drop ones that become unused- (`Microsoft.VisualBasic.CompilerServices`, `System.Runtime.CompilerServices` usually do).--## What to fix--### Names-Decompiler placeholders → descriptive names based on what the value *is*:-`num`, `num2`, … `flag`, `flag3`, … `text`, `text2`, … `array`, `list`, `list2`, `obj`,-`item`, `ex2`, `dictionary`, `bitmap2`, `graphics`, `stringBuilder`, `result`, `enumerator`…-- A loop bound `int num = x.Length - 1; for (int i = 0; i <= num; i++)` becomes- `for (int i = 0; i < x.Length; i++)` (drop the temp).-- A hoisted `bool flag = <cond>;` used once in an `if` is inlined (see control flow).-- Unused catch variables: `catch (Exception ex) { }` → `catch (Exception) { }`- (or `catch { }` when the type is `Exception`). Keep the variable if it is used.-- Keep names already meaningful (`stride`, `width`, `probe`, `scheme`...).-- Naming style: camelCase locals, no Hungarian, no `_` prefix for locals.--### Control flow-- `bool flag = cond; if (flag) {…}` → `if (cond) {…}`; `if (!flag)` → `if (!cond)`.-- `if (!cond) { <whole rest of method> }` → `if (cond) return;` + flat body (guard clauses),- when it removes a nesting level and the method has no other tail code.-- `T result; if (c) { result = a; } else { result = b; } return result;` →- `return c ? a : b;` for simple expressions, otherwise two `return`s.-- `do { … num++; } while (num <= 255);` counting loops → `for`.-- `for (;;) { … if (x) break; … }` → `while (!x)` when it reads naturally; otherwise leave.-- `foreach (object obj in coll) { T t = (T)obj; … }` → `foreach (T t in coll) { … }`.-- `checked { … }` blocks and `checked(...)`/`unchecked(...)` expression wrappers: remove.- Keep `unchecked` only where it is needed to compile a constant/cast- (e.g. `unchecked((int)0xFF000000)`).-- `RuntimeHelpers.GetObjectValue(x)` → `x`.-- VB runtime helpers → C#, preserving semantics:- - `Conversions.ToString(x)` → `x.ToString()` (for numbers use the same culture the original- would have used: VB uses the current culture → `x.ToString(CultureInfo.CurrentCulture)`,- or keep `CultureInfo.InvariantCulture` when the surrounding code already uses it).- - `Conversions.ToInteger(s)` / `ToDouble(s)` → `int.Parse` / `double.Parse` with- `CultureInfo.CurrentCulture`; if the original was wrapped in try/catch keep it.- - `Conversions.ToBoolean`, `ToInteger(bool)` etc. → plain C# casts/expressions.- - `Operators.CompareString(a, b, false) == 0` → `string.CompareOrdinal(a, b) == 0`- (or `a == b` when neither side can be null-vs-empty sensitive — if unsure use `CompareOrdinal`).- - `Strings.Len(s)` → `s.Length`; `Strings.Trim` → `.Trim()`; `Interaction.MsgBox` → `MessageBox.Show`.-- Redundant casts the decompiler added (`(int)c.R`, `(double)intValue * 1.0`, `(long)` widening- in index arithmetic) → remove where the result type is unchanged.-- Empty `try { } finally { }` leftovers, dead `if (true)`, duplicated null checks → remove.--### Comments / attributes-- Delete every `// Token: …`, `// (get) Token…`, `// (set) Token…`, `// RVA…` comment.-- Delete decompiler attributes `[CompilerGenerated]`, `[DebuggerStepThrough]`,- `[MethodImpl(MethodImplOptions.Synchronized)]`, `[DesignerGenerated]`, `[GeneratedCode(...)]`- when they sit on ordinary members. Keep `[DllImport]`, `[StructLayout]`, `[STAThread]`,- `[DesignerCategory]`, `[Serializable]` and anything with runtime meaning.-- You may add a short `///` summary on a class and on methods whose purpose is not obvious from- the name. Keep it sparse — the surrounding code has few comments; do not comment every line.--## Verify before you finish--Run the standalone compiler check (does not touch `bin/obj`, safe in parallel):--```-cd /c/Work/WaveDude/Wave_Dude_2D && "/c/Program Files/Microsoft Visual Studio/18/Community/MSBuild/Current/Bin/Roslyn/csc.exe" -nologo -target:winexe -out:"$(cygpath -w /tmp/check_<yourname>.exe)" -langversion:7.3 -r:System.dll -r:System.Core.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:Microsoft.VisualBasic.dll -r:System.Web.Extensions.dll -nowarn:0168,0649,0414,0675 *.cs My/*.cs My/Resources/*.cs Properties/*.cs-```--- Errors in **your** files: fix them.-- Errors in other files: another agent is mid-edit; wait ~30 s and re-run. Ignore if they persist- and your files are clean (report it).---Finish with a 5-line report: files touched, approximate number of renames, anything you left-alone because you were unsure, and the csc result.diff --git a/_tools/DOC_GUIDE.md b/_tools/DOC_GUIDE.mddeleted file mode 100644index 8bca643..0000000--- a/_tools/DOC_GUIDE.md+++ /dev/null@@ -1,64 +0,0 @@-# Documentation + final cleanup guide (phase 3)--The code in `Wave_Dude_2D/` has been cleaned from decompiler output into readable C#. This pass-adds proper XML documentation and finishes any cleanup still left. All the **hard rules** of-`CLEANUP_GUIDE.md` still apply (behaviour-preserving, no signature/name/accessibility changes,-only your assigned files, tabs + Allman, verify with `csc`). Read that file first. Do not touch, check or mention file encodings or line endings; `.editorconfig` handles that.--## XML documentation — what is required--Every **type** (class, struct, interface, enum, delegate, nested type) gets a `/// <summary>` that-says what it is *for* and how it fits in (who creates it, who consumes it, which thread it lives-on if that matters).--Every **member** gets a `/// <summary>`:-- public/internal methods, properties, fields, events, constants: always, with `<param>` for every- parameter whose meaning is not obvious from its name and type, `<returns>` when the return value- needs explanation (what null/empty/-1 means, units, ranges), `<exception>` when the method throws- deliberately.-- enum members: always, one line each.-- private fields: one line each (what it holds, units, when it is null, which thread touches it).-- private methods: a summary; `<param>`/`<returns>` only where they add information.-- WinForms event handlers (`btnX_Click`, `numY_ValueChanged`, …): one line saying what the user- action results in — not "handles the click event".-- Constructors: only if they do more than assign parameters.--Quality bar:-- Write from the *code*, not from the name. Read the body before writing the summary. If the code- does something surprising (side effects, re-entrancy guards like `_loadingScene`, swapping buffers,- clamping, culture-specific parsing, COM late binding), say so.-- State units and coordinate systems: canvas pixels vs. picture-box pixels vs. screen; steps vs.- seconds; refractive index vs. speed; 0..1 vs 0..255; radians vs degrees.-- State threading: anything called from `SimulationRunner`'s worker thread, anything that must- run on the UI thread, anything marshalled through `PostToUi`.-- State ownership/disposal for `Bitmap`, `Graphics`, OpenCL and Media Foundation handles.-- Do not pad. "Gets or sets the width." is fine for a trivial property. Do not write a paragraph- for a one-line getter. Do not restate parameter names as prose.-- Keep summaries that already exist if they are accurate; sharpen them if not.-- Use `<see cref="..."/>` for references to other members/types; `<paramref name="..."/>` for- parameters. Standard XML doc syntax only (`<summary>`, `<param>`, `<returns>`, `<remarks>`,- `<exception>`, `<see>`, `<paramref>`, `<c>`, `<list>`). Escape `<`, `>` and `&` in prose as- `<`, `>`, `&`.-- Inline `//` comments: add them where a non-obvious line needs one (magic numbers, why a- workaround exists); do not comment every line.--## Final cleanup — whatever is still left--While you are reading each method anyway, finish the cleanup from `CLEANUP_GUIDE.md` where the-previous pass missed something: leftover placeholder names, `bool x = cond; if (x)` temps used-once, redundant casts, `string.Concat(new string[] {...})` → `+`, dead code, duplicated-null-checks, empty handlers that are never wired, unused `using`s, `catch (Exception ex)` with-unused `ex`. Still no signature or behaviour changes.--Also fix obvious typos in **identifiers you own privately** is NOT allowed (names are frozen);-typos in **comments** and in **existing string literals** are also off-limits (strings are UI-behaviour). Just document.--## Verify--Run the csc check from `CLEANUP_GUIDE.md` (use your own check exe name), **adding `-doc:"$(cygpath -w /tmp/check_<yourname>.xml)" -warnaserror+:1570,1572,1573,1574,1580,1584,1587,1589,1590,1591,1710`** so malformed-XML or wrong `<param>` names fail the build. Fix every such error in your files.--Finish with a 5-line report: files touched, number of members documented, anything you could not-understand well enough to document confidently (list them — a wrong comment is worse than none),-cleanup done beyond docs, csc result.diff --git a/_tools/VB_SOURCE_AUDIT.md b/_tools/VB_SOURCE_AUDIT.mddeleted file mode 100644index 84a7f99..0000000--- a/_tools/VB_SOURCE_AUDIT.md+++ /dev/null@@ -1,253 +0,0 @@-# Audit: original VB source (`2D_wave_sim_V01/`) vs the C# port (`Wave_Dude_2D/`)--Date: 2026-10-08. **Status: acted upon the same day.** The reasoning comments, doc corrections,-constant unfolds, local renames and the behaviour restorations in "Semantic differences (accidental)"-have been applied to the C# (see CLAUDE.md, "Fixed on 2026-10-08"). Deliberately not applied: the-GPL/attribution headers and `AssemblyCopyright` (the C# tree is temporary), and the decompiler-artefacts listed under "cosmetic". The line numbers below are from before those edits.--Read-only comparison of every VB file against its C# counterpart(s), looking for-what decompilation strips (comments, XML docs, local names, folded constants, `Debug.Assert`,-conditional code) and for behavioural drift. Line numbers refer to the files as they were on that date.--## Headline findings--1. **The VB source is newer than the binary that was decompiled.** The source has a GPL-3.0-or-later- header on 31 of 38 files, `AssemblyCopyright("Copyright © 2026 JJM Vleggaar (Huygens Optics)")`,- and a Help-tab disclaimer that says "free software, released under the GNU General Public License,- version 3 or later". The decompiled Help text (`HelpForm.cs:32`) still says "educational use only.- Redistribution for commercial purposes is not allowed", and `Properties/AssemblyInfo.cs:13` has- `"Copyright © 2026"` with no author. Every other Help paragraph is string-identical, so the author- relicensed and added headers after that build. The header text refers to "the LICENSE file that- comes with the source code"; no LICENSE/COPYING file is in `2D_wave_sim_V01/`.-2. **Provenance lost.** Five files (`WaveSimulator`, `GpuWaveSimulator`, `FrameRenderer`, `SceneData`,- `ColorLut`) carry "Portions of this file are based on WaveSimulator2D by 0x23- <https://github.com/0x23/WaveSimulator2D>". That repository is Python/CuPy and has no licence file- (checked 2026-10-08), so the note is the author's attribution, not an inherited obligation. The C#- docs also dropped every reference to the Python original (`main_curr.py`, `WaveVisualizer.render_field`- / `render_intensity`, `get_colormap_lut`, `StaticImageScene` / `StaticRefractiveIndex` /- `StaticDampening`, matplotlib `_r` maps), which is where several magic numbers come from.-3. **Code is faithful.** No logic bug was introduced by decompilation. The divergences found are listed- under "Semantic differences"; all are small, and most are deliberate post-decompile fixes.-4. **Two CLAUDE.md "known issues" are wrong.** The differing `FromConfig` fallbacks and the- `Use4thOrderLaplacian`/`WaveSpeedC` defaults are documented by the author as deliberate- old-project compatibility (see `SimulationSettings.vb:47-49, 92-103, 106-119`). The GpuWaveSimulator- `TryCreate` doc in the VB overstates its own code, which is the root of the "dead branch in- `WaveEngineFactory.Create`" entry.-5. **What was stripped**: 1,409 lines of `'''` XML docs and 1,242 `'` comments in the VB. The C# docs- were written fresh and are often more complete on threading and layout, but the author's *rationale*- (why a formula, why a workaround, why a default is absent) is largely gone. Roughly 150 comment sites- are listed below with the C# location they belong at. Nothing else was stripped: the VB has no- `#If` blocks, one `Debug.Assert` (kept), no `Obsolete`, no `Static` locals, and all `Optional`- defaults survived.--## Semantic differences (code)--Accidental, original behaviour is the VB:--| C# location | VB location | Difference |-|---|---|---|-| `AviMjpegWriter.cs:82` | `AviMjpegWriter.vb:108` | strh `dwQuality` written as `0U`; VB writes `&HFFFFFFFF` ("default"). C# comment says "(default)" which is wrong for 0. Readers ignore it for MJPG. `avi_check` does not test offset 148. |-| `WaveSimulator.cs:372` | `WaveSimulator.vb:135, 433` | `new float[256]` allocated on every `ApplySources` call; VB reuses a `Private ReadOnly _levelValue(255)` field. 1 KB per step. Side effect of the field-to-local cleanup. |-| `ColorSchemeStore.cs:46` | `ColorSchemeStore.vb:62` | `FindDefaultFolder` probes for `*.vbproj`. The only `.vbproj` is a sibling of `Wave_Dude_2D/`, so the C# exe never finds the repo's tracked `ColorSchemeList/` and creates an empty `bin\Debug\ColorSchemeList`. The vbproj also had `<Content Include="ColorSchemeList\*.json" CopyToOutputDirectory=PreserveNewest>`; the csproj has no such item. |-| `ProbeGraphPainter.cs:138, 196`; `ProbeSettings.cs:143` | `ProbeGraphPainter.vb:123, 159`; `ProbeSettings.vb:142` | `If Not (yMax > yMin)` became `if (yMax <= yMin)`. NaN limits no longer reset to -1..1. Reachable from UI-entered values. |-| `ProbeSampler.cs:87` | `ProbeSampling.vb:214` | `Measurement > Amplitude` instead of `<> Amplitude`; `ProbeGraphPainter.cs:222` still uses `!=`, and `ProbeMeasurement.cs:5-6` documents the `>` as a contract. |-| `Form1.Colors.cs:708` | `Form1.vb:3131` | `StopRole` centre case is `case 4:`; VB is `If StopCount Mod 2 = 1 AndAlso k = StopCount \ 2`. Same today, diverges if `StopCount` becomes even. |-| `Form1.cs:85` | `Form1.vb:109` | `Debug.Assert(_stopButtons.Length == 9, ...)`; VB compares with `ColorScheme.StopCount`, so the assert no longer guards what its message says. |-| `GpuWaveSimulator.cs:634-644` | `GpuWaveSimulator.vb:791` | `_sinceFinish = 0` only inside `ReadBack`; VB resets it on every `PrepareFrame`. Harmless. |-| `Form1.Simulation.cs:1366` | `Form1.Designer.vb:4130` | `colCreatedOn2` is `protected internal virtual` property in the Simulation part; VB declares it `Protected Friend WithEvents` in the Designer (accidental accessibility in the original). Belongs in `Form1.Designer.cs` as a private field like `colCreatedOn`. |-| `Form1.cs:1170` | `Form1.vb:1835` | `NativeSize` lost `[StructLayout(LayoutKind.Sequential)]` (default is the same, intent lost). |--Deliberate post-decompile fixes, original is the VB (keep, but feed back to the author):--| C# location | VB location | Difference |-|---|---|---|-| `AviMjpegWriter.cs:174` | `AviMjpegWriter.vb:182` | movi LIST size: VB writes `end - 216` (includes the size DWORD, off by 4); C# writes `end - 220`. Proven by `avi_check`. The current C# header is otherwise byte-identical to the VB's 224-byte layout. |-| `GpuWaveSimulator.cs:719-731` | `GpuWaveSimulator.vb:848-873` | `SetProbes(null)` releases the old set (VB returned early and leaked). On failure the C# leaves no probes installed and throws "the intensity is not tracked" bare; VB kept the previous probes working and prefixed "the probes could not be set up on the GPU: ...". |-| `GpuWaveSimulator.cs:734, 489-506` | `GpuWaveSimulator.vb:859, 665-681` | Probe program and failed buffers are released; VB leaked them. |-| `IWaveEngine.cs:12` | `IWaveEngine.vb:31` | Interface no longer extends `IDisposable` (project convention). |-| `Form1.Output.cs:418` | `Form1.vb:1560-1563` | `btnDeleteScene_Click` uses `SelectedFilePaths` (skips null tags) instead of `DirectCast(item.Tag, String)`. |-| `SimulationRunner.cs:534`, `Form1.Probes.cs:809` | `SimulationRunner.vb:161`, `Form1.Probes.vb:699-700` | `_collector` kept for still exports (VB comment explains it); redundant status-label clear dropped. |--Decompiler artefacts with identical behaviour (cosmetic, fix when touching the file):--- `MessageBoxIcon.Information/Warning/Error` → `Asterisk/Exclamation/Hand`; `Keys.Enter` → `Keys.Return` (all Form1 parts).-- `OpenClApi.cs:42, 50`: `[MarshalAs(UnmanagedType.VBByRefStr)] ref string` for `options`/`kernelName` is what the VB compiler emits for by-value `String`; idiomatic C# is plain `string`, which removes the `ref string name` dance at `GpuWaveSimulator.cs:486-488, 530`.-- `OpenClApi.cs:14`: VB `Module` became `internal sealed class` with a public constructor; should be `static class`.-- `SimulationRunner.cs:538-550`: nested `*EventHandler` delegates are the VB compiler's expansion of `Public Event X(args)`; `Action<...>` is the hand-written form.-- `SimulationJob.cs:13-19`, `SimulationResult.cs:15-23`, `ProbeSeries.cs:11-14`, `ProbeSettings.cs:18-39`, `GpuDeviceInfo.cs:13-17`, `ColorPickerControl.cs:43-45`, `Form1.cs:33-69`: constructors that are expanded VB field/property initialisers.-- Expanded `Optional` arguments at call sites: `ColorLut.Build(scheme, false, blackLevel, false, false)` (`Form1.Simulation.cs:738, 749`), `InputBox(..., -1, -1)` (`Form1.Colors.cs:351`), `RefreshOutputProjectList("")` (`Form1.Output.cs:33, 65`), `SetOutputPreviewImage(null, false)` (`:401`).-- `MfVideoWriter.cs` qualifies every static call as `MfVideoWriter.X(...)`.-- `My/*.cs` carry ILSpy `// Token: ...` lines; `Properties/AssemblyInfo.cs:2,4,6` has unused usings.-- `ProbeControlSet` constructed with 22 positional arguments (`Form1.Probes.cs:67-68`); VB used named arguments (`Form1.Probes.vb:169-180`).--## C# docs that are wrong or stale--| C# location | Problem | VB authority |-|---|---|---|-| `SimulationJob.cs:48, 51` | `FieldLut/IntensityLut` "null when neither export nor preview is wanted". Null means grey levels; `FrameRenderer.Colorize` renders grey when the LUT is null. | `SimulationRunner.vb:53` |-| `SimulationJob.cs:72-75` | `GlowOverlay` "null when not exporting or both gains are 0". VB: null when there is no scene image or both gains are 0; frozen at run start. | `SimulationRunner.vb:71-74` |-| `SimulationSettings.cs:110-113` and CLAUDE.md | Per-key fallbacks presented as an anomaly. They are deliberate: old projects keep their exact behaviour; new projects take the Designer values via `StartNewProject`. | `SimulationSettings.vb:47-49, 92-103, 106-119, 122-139` |-| `SceneSettings.cs:16-26` | Constructor silently omits `DampingEdgeEnabled`/`UseObjectSources` with no explanation (same deliberate no-default design). | `SceneSettings.vb:72-75, 85-87` |-| `SourceElement.cs:84-88` | Says both engines "hard-code 30 rather than referencing this constant". Stale: both use `DetachRampSteps` now. `GpuWaveSimulator.cs:388` comment still says "30 steps". | — |-| `WaveSimulator.cs:644` | `_subSteps` "1 unless the 4th-order stencil is on". Also 1 when the scene's c² does not need it. | `WaveSimulator.vb:65-71, 197-199` |-| `WaveSimulator.cs:608` | `NominalDecayLevel` described only as a fallback; it is the calibration constant in the τ formula, and `IntensityRetention` (`:356`) hard-codes `100.0` instead of using it. | `WaveSimulator.vb:79-80` |-| `GpuWaveSimulator.cs:19-20` | "Kernel launches and uploads are asynchronous". Uploads are blocking (`blocking = 1U` at `:513, 522`; `:508` says so). | — |-| `ColorLut.cs:44, 39-40` | `blackLevel` documented as 0..1 and lifting only; VB: "Lifts (positive) or lowers (negative)". | `ColorLut.vb:67` |-| `ColorScheme.cs:29-32` | `SchemeType` "decides which combo box offers the scheme"; VB adds "only a label saved in the file; any scheme can technically be used for either". | `ColorScheme.vb:59-62` |-| `ProbeSettings.cs:92` | `UseStartAfterStep` "sampling/accumulation and the graph are gated". Sampling is not gated; the collector keeps sampling and zeroes the cumulative total. "(0 = from the start)" dropped. | `ProbeSettings.vb:111`, `ProbeSampling.vb:303-307` |-| `ProbeMeasurement.cs:5-6` | Documents the `>` comparison as an engine rule (see semantic table). | `ProbeSampling.vb:214` |-| `FrameRenderer.cs:106-113` | `ToRgbBytes` "any size; clipped or padded". VB: a format normalisation, not a resize; the one caller already passes the right size. | `FrameRenderer.vb:90-93` |-| `Form1.Scene.cs:24`, `Form1.Probes.cs:57-58` | "Called once from the constructor". Both are called from `Form1_Load` (`Form1.cs:123, 125`). | `Form1.vb:161, 163` |-| `Form1.Scene.cs:329` | "0.25 keeps a full-contrast step edge (gradient 4 * 255) just within the byte range". VB: a hard edge reaches ~1442 raw; `GlowScale` brings that into range "without every ordinary edge saturating", and a diagonal full-contrast edge does saturate. | `Form1.vb:2109-2121` |-| `Form1.Simulation.cs:15` | The only Form1 part with no class-level summary. | `Form1.vb:3156-3161` |-| `AboutForm.cs:45` | `DisplayVersion` doc dropped the link to the Form1 title bar it is kept in sync with. (VB comment itself is stale: "V0.25", "Wave Maker".) | `AboutForm.vb:33-34` |-| `Form1.Output.cs:745` vs `Form1.vb:1865` | C# documents `COMException`; VB says "never throws". The C# is right (PreserveSig=false). Do not "fix" back. | — |-| `GpuWaveSimulator.cs:39-40` vs `GpuWaveSimulator.vb:176-177` | VB claims `problems` also explains earlier failures when a later GPU worked; its code does not. C# documents the actual behaviour. | — |--## Folded constants (name exists, literal used)--| C# location(s) | Literal | VB expression |-|---|---|---|-| `ColorLut.cs:157` | `255` | `ColorScheme.EntryCount` |-| `ColorScheme.cs:160, 197, 199-201` | `254`, `8.0`, `7` | `EntryCount - 1`, `StopCount - 1`, `StopCount - 2` |-| `Form1.cs:85`; `Form1.Colors.cs:635, 696, 706, 708` | `9`, `8.0`, `8`, `4` | `ColorScheme.StopCount` and derived |-| `Form1.Colors.cs:653, 654, 659, 676, 696, 734` | `127`, `254` | `EntryCount \ 2`, `EntryCount - 1` |-| `Form1.Simulation.cs:108, 109, 140, 141, 731, 742` | `"field"`, `"intensity"` | `ColorScheme.SchemeTypeField/Intensity` (Form1.Colors.cs still uses the constants) |-| `Form1.cs:93`; `Form1.Colors.cs:729, 732, 734, 737, 740` | `120`, `16`, `119`, `15` | `ThumbWidth`, `ThumbHeight` (declared at `Form1.cs:959-962`, unused) |-| `Form1.Output.cs:562, 697`; `Form1.Simulation.cs:1195, 1214` | `1`, `4` | `FVM_ICON`, `FVM_DETAILS` (declared at `Form1.cs:1084-1087`, unused; VB `:4223-4225` comments "Windows Explorer's own view-mode numbers (the classic Shell FOLDERVIEWMODE enum)") |-| `Form1.Scene.cs:38, 625, 754, 773` | `1000m`, `8192`, `8`, `16384` | `SceneSettings.MaxImageSourceScale`, `MaxDampingEdgeSize`, `MinCanvasSize`, `MaxCanvasSize` |-| `Form1.Probes.cs:87, 227, 228`; `Form1.Sources.cs:34, 37, 48, 51, 673` | `16383`, `16384` | `SceneSettings.MaxCanvasSize - 1`, `MaxCanvasSize` |-| `Form1.Scene.cs:330` | `0.25` | local `Const GlowScale` |-| `Form1.Simulation.cs:1259, 1261, 1264, 1270, 1286` | `BindingFlags.InvokeMethod \| BindingFlags.GetProperty` | local `Const memberFlags` |-| `Form1.Sources.cs:979, 994` | `0.7f`, `3f`/`6f` | local `Const marginFraction = 0.15F` (`1 - 2*margin`), `Const dotRadius = 3.0F` |-| `ProbeGraphPainter.cs:787-790` | `7f` (x8) | local `Const arm = 7.0F` in `DrawCross` |-| `WaveSimulator.cs:515, 516` | `0.35` | local `Const EdgeWidth` in `PulseEnvelope` |-| `WaveSimulator.cs:356` | `100.0` | `NominalDecayLevel` |-| `WaveSimulator.cs:615, 618, 624` | `1.3333334f`, `-0.083333336f`, `10.666667f` | `4.0F / 3.0F`, `-1.0F / 12.0F`, `32.0F / 3.0F` |-| `MfVideoWriter.cs:66, 301, 141, 59-60` | `9437184L`, `131184`, `4294967297UL`, `& -2` | `4096L * 2304L`, `&H20070`, `(1UL << 32) Or 1UL`, `And Not 1` |-| `OpenClApi.cs:292-319` | decimal | `&H1084, &H902, &H1002, &H100C, &H1010, &H101F, &H102B, &H102C, &H1035, &H1183` (cl.h spelling) |-| `Project.cs:42, 45, 48, 51, 54` | `"configuration.json"`, `"assets"`, `"output_frames"`, `"output_video"`, `"scene_images"` | `ProjectConfig.FileName`, `ProjectStore.*FolderName` |-| `ProjectStore.cs:111, 115` | in messages | `ProjectConfig.FileName`, `LegacyFileName` |--Doc-text folds that will go stale: `ColorScheme.cs:8, 135, 151-152, 185, 196`; `ColorSchemeStore.cs:17`; `Form1.Sources.cs:23-24, 660`; `Form1.Probes.cs:220`; `Form1.Scene.cs:617, 742`; `GpuWaveSimulator.cs:388` ("30 steps"); `WaveSimulator.cs:36` ("100/level").--## Local names where the VB is better--| C# | VB | Where |-|---|---|---|-| `source` (probed buffer) | `data` | `WaveSimulator.cs:216, 282` ("source" means wave source in that class) |-| `cycles`, `shifted`, `period`, `i`, `fade`/`sinceDetach`, `i`/`j`, `lowest` | `cycleClock`, `adjustedClock`, `dynPeriod`, `subStep`, `detachFade`/`stepsSinceDetach`, `p`/`k`, `minActiveLevel` | `WaveSimulator.cs:431, 441, 448, 163, 389-392, 212-275, 330` |-| `i`, `random` | `subStep`, `seedRng` | `GpuWaveSimulator.cs:611, 255` |-| `framePixels`, `fieldOverlay`/`intensityOverlay`, `canvas` | `fullPixels`, `fieldOverlayScaled`/`intensityOverlayScaled`, `normalized` | `SimulationRunner.cs:250, 255-256`; `FrameRenderer.cs:117` |-| `lastStepsDone`, `series`, `t`, `i`/`j`+`y`/`x`, `tickCount` | `batchStartStep`, `samples`, `fraction`, `y`/`x`+`fy`/`fx`, `guard` | `ProbeCollector.cs:48, 123`; `ProbeGraphPainter.cs:600, 287`; `ProbeOverlay.cs:75-85` |-| `i`, `overlayBrush`, `dir`, `name` | `y`, `veil`, `probe`, `schemeName` | `ColorPickerControl.cs:365, 299`; `ColorSchemeStore.cs:44, 89` |-| `arraySizeX/Y`, `i`/`j` | `cols`/`rows`, `row`/`col` | `SourceSettings.cs:239-244` |-| `frequency` (it is the 1-255 level) | `level` | `Form1.Sources.cs:616` |-| `width`/`height`, `source`, `spacings`, `bitmap`, `box` | `boxW`/`boxH`, `shown`, `relevantSpacing`, `placeholder`, `rect` | `Form1.Sources.cs:962-963, 885, 677, 784`; `Form1.Probes.cs:697, 934` |-| `location`, `size`+`canvas` (bitmap), `bytesPerPixel`, `center`, `loadingSim`, `path`/`folder`, `fileName`, `target`, `projectName` | `rootButtonSpot`, `canvas`+`fresh`/`placeholder`, `bytesPerDstPixel`, `cMid`, `wasLoading`, `imagePath`/`videoPath`/`projectFolder`, `oldName`, `targetPath`, `projectLabel` | `Form1.cs:130, 789`; `Form1.Scene.cs:542-592, 395, 314`; `Form1.Simulation.cs:136, 250, 268, 1248`; `Form1.Output.cs:327-689, 653` |--Everywhere else the C# names are equal or better than the VB.--## Lost documentation, by file (VB line → C# line)--Quote the VB text at the given C# location. Items marked **why** carry rationale that is nowhere else.--### WaveSimulator.vb → WaveSimulator.cs-- Class summary `:30-71` → `:8-23`: Python lineage ("port of the Python class WaveSimulator2D (CuPy)", sources applied "as in update_scene / StaticImageScene.update_field"); **why** two-stage intensity (single pole 6 dB/octave never removes the ripple at the source frequency; two stages 12 dB/octave but over-delay short pulses; blend ≈ 9 dB/octave); alpha scales inversely with the slowest source frequency × TimeDecayFactor; border "so that the step needs no edge tests"; 4th-order **why** (dispersion: under-resolved wavelengths travel slower; ~2× memory reads; coefficients reach ~7× further at the highest spatial frequency; instability symptom "everywhere saturates except at object edges"); sub-step scaling (c² by 1/n², d by its n-th root, so n sub-steps equal one ordinary step exactly; n is 1 whenever 3×3 is used *or the scene's c² does not need it*).-- Ctor params `:165-169` → `:33-37`: sourceAmplitude "(1 = the value of the Python code)"; trackIntensity "(costs extra time in every step)"; timeDecayFactor/intensityScale "see that property's comment" in SimulationSettings.-- `Stride` `:290` → `:128`: "Pixel (x, y) is at (y + 1) * Stride + x + 1". `FieldData`/`IntensityData` `:297, 304` and `IWaveEngine.vb:42, 45` → `:131-138`, `IWaveEngine.cs:26-34`: "Do not change."-- Constants `:79-97` → `:608-626`: `NominalDecayLevel` "nominal source level (of 255) that TimeDecayFactor's steps count is calibrated against"; `IntensityBlend` "0.5 is the middle ground, about 9 dB/octave"; 4th-order derivation "(-f(-2) + 16f(-1) - 30f(0) + 16f(+1) - f(+2)) / 12 per axis, -60/12 = -5" (and `' 16 / 12`, `' -60 / 12` tags); `FourthOrderLambdaMax` "2 * (-1/12 cos 2k + 4/3 cos k - 5/2)|k=π per axis, summed = -32/3"; `SubStepTargetLimit` **why** "the 3x3 kernel's own c² |λmax| is about 1.8 at the highest c² the app allows, i.e. about 2.2 times under the limit of 4".-- Fields `:106-111, 146-147` → `:647-653, 701-705`: `_dEffective`/`_c2Mult` are "the original _d itself / exactly 1.0F, a bit-for-bit no-op"; `_intensityAlpha` "(replaces the old fixed 0.98F)"; non-randomising elements "never touch this state: pure function of _time, exactly as before".-- `ComputePulsePosition` `:474-493` → `:415-431`: return range "(0 = the very start of the 'off' span, up to but not including its current period)"; **why** "a single/non-randomized source sitting silent for its off-width at the very start of a run was never the intent, only a side effect of the cycle position formula"; randomized elements keep the off-first start "since there the elements are meant to desynchronize from a common starting point"; "every source keeps its own, independently-drifting rhythm"; "cycles of the source's own frequency since t = 0 (not folding in the phase, so the on/off timing does not shift when only the phase is changed)".-- `PulseEnvelope` `:535-575` → `:474-516`: off precedes on "so every source is silent for its own off-width before its first pulse, rather than every source firing simultaneously at t = 0"; Gaussian "tapers smoothly to (about) 0 at both ends"; SmoothedSquare "atan-smoothed square wave, avoiding a hard on/off step that would ring the field"; "FIXED-width (in cycles, not a fraction of the on/off span) smoothed edge"; **why** the first-cycle guard (wrapping in the very first off-span "would fabricate a phantom falling edge: pos = 0 would land exactly on it and start the run at envelope ~0.5 instead of ~0, emitting a spurious one-cycle blip; left un-wrapped (deeply negative), dRise/dFall correctly place it far from both edges"); "0 at the falling edge, grows past it" / "0 at the rising edge" / "signed distance to the *nearest* rising edge".-- `UpdateField` `:586-588, 615-617` → `:533, 561`: intensity on the last sub-step only "so its own exponential averaging still runs once per AdvanceOneStep call, from the field after all sub-steps, matching its calibration regardless of how many sub-steps"; the fallback ring "(y = 0, y = h - 1, x = 0, x = w - 1) falls back to the original 3x3 kernel".-- Inline `:197-199, 235, 252-254, 272-273, 351-352, 445-448, 527-529` → `:64, 97, 119, 116, 221, 389, 465-469`: sub-steps stay 1 unless 4th-order *and* the scene's highest c² needs it; "a randomized composite element can fall outside" the canvas; the slowest-source rule "(a level of 0 means 'no source' and is excluded)"; "the very first cycle uses the off-width rolled at Generate time; later cycles redraw from OffWidthBase"; "before 'start after step' the totals are simply never added to: earlier intensity is purged rather than baked in"; **why** detach fades "then stops driving the field entirely (not even towards 0) so it releases its hold and stops diffracting waves through that point. A hard cutoff would leave a small kink in the forcing, which can ring"; "should not happen (_time only increases)"; "the anchor only advances once a cycle has completed, so it still reading 0 means no cycle has completed yet".-- `IWaveEngine.vb:52-53, 71, 86` → `IWaveEngine.cs:39-42, 61-63`, `WaveEngineFactory.cs:17-34`: PrepareFrame "so only ask for what is going to be drawn"; ReadProbeProfiles "On the GPU this waits for the card, so do not call it every step"; "Object sources run on either engine, the same as the image sources".--### GpuWaveSimulator.vb / OpenClApi.vb → GpuWaveSimulator.cs, GpuDeviceInfo.cs, OpenClApi.cs-Kernel text is token-identical; the only kernel-internal comments (`:633-636`) survived.-- Class summary `:30-55` → `:7-15, 309, 592-593, 157-168`: the scheme as formulas, "(why two stages and the blend, not the single, fixed-0.98 filter)", pointers to `SimulationSettings.TimeDecayFactor`/`IntensityScale`; the `#define` "so there is no extra cost when it is off"; "matching the CPU engine and its own earlier calibration"; "c2Scale exactly 1.0F, an exact no-op multiply".-- `KernelSource` `:486-489` → `:306-310`: **why** c2Scale and intensityAlpha "are runtime kernel arguments rather than a #define, so they need no text formatting/locale handling" (the C# does splice `DetachRampSteps` as an integer, which is safe; floats are deliberately not spliced).-- `TryCreate` `:178` → `:28-42`: "Throws DllNotFoundException when there is no OpenCL driver."-- `OpenClApi.vb:28-31` → `OpenClApi.cs:8-13`: "OpenCL 1.2", "NVIDIA, Intel and AMD all install it", type mapping "size_t is an IntPtr, cl_bitfield a ULong, cl_uint a UInteger and cl_bool a UInteger".-- Inline `:227-228, 318, 327-329, 449-450, 525-526, 545-548, 557-563, 574-577, 594-596, 618-619, 638-644, 775, 818-820, 123-126, 75-76` → `:92-103, 181, 200, 274, 323, 374, 383-394, 388, 422, 443, 461, 595, 679-681, 391-392, 200`: canvas filter "(a randomized composite element can fall outside)"; the level-to-frequency table "shared by the image sources and the object sources"; the slowest-source rule; **why** args 13-16 "appended rather than renumbering 0-12, so every SetMem/SetInt call keeps its existing index"; the kernel's `0.5f` is `WaveSimulator.IntensityBlend`; **why** xorshift ("OpenCL has no built-in RNG ... matches WaveSimulator's RandomInt only in spirit, not bit-for-bit: the two engines are not expected to reproduce each other"); off-first ordering; detach "releases its hold and stops diffracting"; the t=0 clock shift; the anchor-reads-0 meaning; the seven-line phantom-falling-edge explanation (same as the CPU one above); clFinish "so errors show up in time"; purge "rather than baked into the total"; rngState "only the entropy bits matter, not signedness"; "(replaces the old fixed 0.98f in the kernel)".-- `GpuDeviceInfo.Discrete` `OpenClApi.vb:190` → `GpuDeviceInfo.cs:106`: examples "(the NVIDIA GeForce) ... (Intel UHD)".--### SimulationRunner.vb → SimulationRunner.cs, SimulationJob.cs, SimulationResult.cs-- `:118-122` → `:9-14`: "as the loop in main_curr.py".-- `:77-82` → `SimulationJob.cs:78-82`: overlay gains "frozen at the start of the run from numBrightnessFieldOverlay/... and chkDiplayOverlayInField/...; **only affects the exported videos**: the live preview blends its own copy on the UI thread, which can track the checkbox live; a running export cannot".-- `:105, 109-113, 131, 142-145, 183, 479-480` → `SimulationResult.cs:49, 55-59`; `SimulationRunner.cs:51-55, 513, 98-101, 471-474`: Engine examples `"CPU (8 threads)"`, `"GPU: NVIDIA GeForce MX130 (OpenCL)"`; last frames "rendered right before the engine was closed down, so a still export has something to save once the live engine no longer exists"; ProbesUpdated "The receiver owns the arrays"; **why** `PreviewIntervalMs` ("keeps a GPU engine's readback rate steady and independent of how fast the UI thread displays the previous one, rather than riding on _previewPending alone; ~30 fps is already faster than a picture box is usefully watchable at"); PauseRun "The videos stay open"; OpenSink fallback reasons "(no Media Foundation, size not supported)".-- Inline `:161-163, 294-296, 349, 355-368, 373, 404, 418, 432, 436-491` → `:534, 255, 319, 327, 333, 371, 384, 403, 410-501`: `_collector` kept "so RenderCurrentFrame can also burn the probe markers/graphs onto a still export (the video loop already did, stills did not)"; overlay "gain-prescaled once, up front; this was the actual cost of the overlay on a video export"; "the probe values up to this step (the graphs in the videos need them)"; the 14-line `previewDue` **why** (GPU readback cost riding on UI speed; the overlay checkboxes made the run *faster*; a video export forces a readback anyway so it was never visible there); "a GPU engine copies only the data that is going to be drawn"; "about 20 times a second"; "close the videos, also after a stop or an error, so that the files can be played"; the empty-catch reasons ("nothing more can be done", "no still frame this time - not fatal", "an empty leftover file does no harm").--### FrameRenderer.vb, FrameSink.vb, SceneData.vb → FrameRenderer.cs, IFrameSink.cs, AviFrameSink.cs, SceneData.cs-- `FrameRenderer.vb:31-37, 61` → `:9-14, 54-58`: "like WaveVisualizer.render_field and render_intensity"; "(exponent 0.5, as in the Python code)".-- `:90-93, 125-131, 143-151` → `:106-113, 153-158, 173-176`: ToRgbBytes is "just a format normalization, not a real resize"; **why** ScaleOverlayRgb ("so AddOverlay's per-frame, per-pixel work is a plain add instead of a float multiply and CInt per byte per frame; gain is fixed for the whole run"); AddOverlay "never darkens ... parallelized by row since this runs once per exported frame at full resolution and was the actual cost of the glow-edges overlay; the live preview's ComposeGlowOverlay is kept separate since it runs on the UI thread against a Bitmap".-- `FrameSink.vb:41-44` → `AviFrameSink.cs:8-12`: "Windows' own players do not play it; VLC does."-- `SceneData.vb:31-42, 87, 117-118, 158` → `:9-18, 63-66, 97-101, 162-167`: "(the time step is 1)"; "the rules are those of the Python classes StaticImageScene, StaticRefractiveIndex and StaticDampening"; "Format32bppArgb is stored as B, G, R, A"; Empty uses "the same rule as a scene image's red channel: index = red / 100"; ApplyBorder "as in StaticDampening".--### MfVideoWriter.vb, AviMjpegWriter.vb → MfVideoWriter.cs, IMF*Native.cs, AviMjpegWriter.cs-- `MfVideoWriter.vb:25-29` → `IMFSampleNative.cs:6-11`, `IMFAttributesNative.cs:6-11`: **why** "Every interface repeats the methods of IMFAttributes because .NET does not inherit them in COM interfaces."-- `:137-142, 146, 216-217, 231` → `:6-12, 300, 80-83, 94`: "the encoder that is built into Windows, so no codec is needed and every Windows player opens the file"; "(MF_VERSION of the Windows 7 and later SDK)"; bitrate examples "0.01 at quality 1, 0.15 at 70 and 0.5 at 100 (1920 x 1080 at 60 frames/s: 1 to 62 Mbit/s)"; "the pictures are given as 32 bit pixels; the sink writer converts them for the encoder".-- `AviMjpegWriter.vb:27-31, 40, 70, 92` → `:8-13, 194, 45, 66`: "VLC and most video editors play the file; ffmpeg can convert it to MP4"; "(unsigned 32 bit sizes)"; `192` = "'hdrl' + avih chunk (64) + strl list chunk (124)"; `116` = "'strl' + strh chunk (64) + strf chunk (48)".--### ProbeSampling.vb, ProbeGraphPainter.vb, ProbeSettings.vb → Probe*.cs-- `ProbeSampling.vb:25, 38, 132-139, 153-156` → `ProbeSeries.cs:5-8, 19-22`; `ProbeSampler.cs:6-12, 186-190`: "(value i belongs to step i + 1)"; "Do not change."; the four-case table (point / point integrated → collector sums / line → profile on demand / line integrated → engine sums per pixel); **why** UseStartAfterStep purges "so the total shown once recording starts is not inflated by intensity that arrived before it - see ProbeCollector.Collect, WaveSimulator.SampleProbes and the profile_accumulate kernel".-- `ProbeSampling.vb:291-292, 304-305` → `ProbeCollector.cs:48, 67-71`: `batchStartStep` meaning; "keep the running total at zero ... so the total does not jump the moment recording starts".-- `ProbeGraphPainter.vb:96-100, 174, 260-261, 266-267, 276-277, 322, 330, 561` → `ProbeGraphPainter.cs:95-100, 222, 353-354, 359, 369-372, 453, 459`; `ProbeOverlay.cs:30-36`: **why** point probes are trimmed (xMin never below the start step, "more room for the data that follows, especially with the full scale") while line probes stay blank ("a profile of the current instant has nothing meaningful to show before the start step"); "a point probe's own range/autoscale must see the real trace; only a line probe uses shownTrace"; "an intensity starts at zero"; axis labels "value axis" / "step axis (point) or position on the line (line)"; Burn "the frame is the whole scene, so the box is where the probe says (in scene pixels)".-- `ProbeSettings.vb:93-97, 162` → `ProbeSettings.cs:71-72, 176-177`: Active "Off by default for both probes of a new project; a probe loaded from a project saved before 'active' was written still comes back On, so that project keeps its exact previous behavior"; Title "The number is also drawn at the probe in the picture."-- VB enums give explicit numeric values (`ProbeSettings.vb:29-62`); the C# enum files rely on implicit numbering (values identical; they drive the combo-box index).--### SimulationSettings.vb, SourceSettings.vb, SceneSettings.vb, Projects/*.vb → *.cs-- `SimulationSettings.vb:26-42, 47-49, 64-66, 70-75, 81, 86, 92-103, 106-119, 122-139, 142-153` → `:7-11, 244-245 (replace remarks 110-113), 55-59, 61-65, 73, 79, 85, 88-92, 94, 97`: keys "with no control on the screen yet but editable in the file: field_brightness, intensity_brightness, field_black_level, intensity_black_level, source_frequency_scale, video_fps"; "defaults are those of the Python example (main_curr.py)"; **why** Steps/TimeDecayFactor have no software default ("a new project starts at whatever the Designer value is; DefaultSteps is only the fallback for a project saved before 'steps' existed"); scheme name match "exact name (case-insensitive) and matching SchemeType, otherwise nothing selected"; FieldBrightness "render_field(7) in Python; 30 is high enough to see a single source"; SourceFrequencyScale "multiplies the frequency of the sources that come from the green channel"; VideoQuality "1 (small files) to 100 (best picture, large files)"; Use4thOrderLaplacian full description + **why** old projects load Off; WaveSpeedC **why** 0.563 ("found experimentally to be correct at around a source frequency of 100, kept only so such a project's displayed wavelength estimate does not change; not a global setting"); TimeDecayFactor **why** an EMA ("raw Sqr(field) would flicker at twice the source frequency"), the print-through vs trail trade-off, "the number of steps that time constant works out to at a nominal medium source (green level 100)"; IntensityScale "changes the actual numbers in the preview, the videos, the probe data and exported files, unlike the brightness settings; exists because the raw intensity lands around 1e-5".-- `SourceSettings.vb:29, 27, 92-97, 131-134, 137-140, 143, 151, 371-375, 418-420` → `SourceMainType.cs:12, 5-9`; `SourceElement.cs:84-88`; `SourceSettings.cs:72, 75, 78, 88, 426-428, 473`: "Named Simple (not Single) because Single is a reserved VB keyword"; "(or line, in a future version)"; DetachRampSteps **why** ("an abrupt cutoff leaves a small kink in the forcing, which can ring; shared by both engines so the two stay in exact agreement"); a skipped source "neither drives the field nor gets in the way of waves passing through its position"; detach **why** ("a source that keeps driving the field holds it at a fixed value there, which diffracts waves that later pass through"); DetachAfterSteps "(0-based)"; Amplitude "100 matches numAmplitude's Designer default"; the three legacy-key comments (`has_position` defaults True "since its sources were positioned under the old rules"; SourceOn/DetachSource "default to the behavior it always had: on, and never detaching"; `off_width_base` "defaults to this element's own off_width_cycles (already read above), exactly its anchor under the old always-static behavior").-- `SceneSettings.vb:27-38, 46, 58, 72-75, 82, 85-87` → `:8-12, 220-227, 55/245-251, 40-41, 49, 52-53`: "the size of a scene image is not stored: it is read from the image"; "no scene-level 'use probes' switch: each probe has its own On"; image path "relative to the project folder when inside it (forward slashes)"; "defaults are those of the Python example (1920 x 1080 canvas, 64 px damping edge)"; refractive index "1.0 to 2.55 (a red channel value of 100 to 255, as in a scene image)"; DampingEdgeEnabled/UseObjectSources **why** no default and the False fallback; ImageSourceScale "source_amplitude of StaticImageScene".-- `ProjectStore.vb:27-33, 55-58, 218`; `Project.vb:78-79` → `ProjectStore.cs:269, 22-28, 245-247`; `Project.cs:44`: assets "where the user keeps third-party files, such as the original Photoshop file of a scene image; not read or written by the simulator"; ValidateName "The name is never changed silently"; "a folder that cannot be created is reported when it is needed".-- `ProjectConfig.vb:30-40, 49, 58, 108, 144-147` → `:11-21, 406, 424-425, 61, 103`: the worked example of adding a section; **the forward-compatibility contract** "Keys that this version does not know are kept and written back unchanged, so a file written by a newer version is not damaged by an older one (refused when format_version is newer)"; "Increase it when a change makes old files incompatible"; `_values` "insertion ordered in practice, so the file keeps a stable, readable order"; "(Form1's btnDescription/frmDescription)"; SetValue accepted types "String, Boolean, numbers, Nothing, a Dictionary(Of String, Object) or a list or array of these".-- `AppSettings.vb:42-44, 81` → `:38-43, 97-99`: ProjectRoot vs LastRootFolder/LastProjectName distinction; "the settings are a convenience only".--### ColorSchemes/*.vb → ColorLut.cs, ColorScheme.cs, ColorSchemeStore.cs, ColorPickerControl.cs-- `ColorLut.vb:28-35, 61-69, 117-132, 97-98` → `:6-13, 33-46, 104-134, 75-79`: "get_colormap_lut" options; **why** options are not saved in the scheme file ("they belong to how a scheme is used, field or intensity, not to the scheme itself"); order of operations "as in Python; reverse is new, optional"; "converted to 8 bit by truncation, like the Python code"; blackLevel may be negative; reverse "like matplotlib's _r maps"; "like render_field / render_intensity; the Python default exponent is 0.5"; symmetric origin "Python: entries 0..127 = src[0::2] and 127..254 the same list mirrored, i.e. entry i = src(2 * min(i, 254 - i))".-- `ColorScheme.vb:26-36, 42-43, 59-62, 121-124, 155-158, 187-188` → `:7-17, 267, 29-32, 97-100, 150-154, 196`: "the same table size the Python simulator uses"; **why** 255 entries and 9 stops ("with an odd number of stops the middle stop is exactly the centre entry 127, the zero-field color; with 9 stops that is Color 5"; "entry 127 is exactly 4.0, the middle stop"); StopCount "one Color button each; 9 since the Color 8/9 buttons were added to the Designer (previously upgraded from 5 to 7 the same way)"; imported schemes "(matplotlib, seaborn, Python tables) have no stops"; "only a label saved in the file"; FromStops stop order; ToStopScheme "This is lossy".-- `ColorSchemeStore.vb:31-39, 48-53, 72, 179` → `:12-21, 29-37, 63-65, 224`: "the same format as the files exported from Python ... (e.g. in the color_schemes folder)"; FindDefaultFolder "while developing this is the ColorSchemeList folder of the project itself, so edits end up in the project"; "the caller checks whether the folder exists"; "write to a temporary file first so a failed save never leaves a half-written scheme behind".-- `ColorPickerControl.vb:31-35, 224-252` → `:12-19, 267-285`: "built completely in code, so it has no designer file" (explains `[DesignerCategory("Code")]`); OnPaint section labels.--### Form1.vb → Form1.cs, Form1.Projects.cs, Form1.Output.cs, Form1.Scene.cs, Form1.Colors.cs, Form1.Simulation.cs-- `:142-144, 157, 181-183, 199-202, 189-190` → `Form1.cs:113, 121, 138, 158, 141`: tabMainFunctions owner-drawn "only so a disabled tab's label can be shown in a lighter gray (a disabled TabPage still draws its label at full strength)"; lblInfo "a clickable 'hyperlink' style label"; Enter in a NumericUpDown "beeps and leaves the value uncommitted"; SuppressKeyPress **why** ("Enter is not a character its edit box accepts, which is what Windows was beeping about ... a NumericUpDown parses/clamps its text on losing focus regardless of how focus was lost"); "a plain loop over Controls rather than a fixed list, so it also covers any NumericUpDown added later".-- `:268-276, 284-287, 302-303, 315-317, 329-330, 337-338, 343-344` → `Form1.cs:219-223, 230, 245, 254, 265, 275, 280`: UpdateProjectAccess rules ("the Configuration tab and the color scheme tab manage the application's own settings, so they are never restricted"; "Disabling a TabPage is not enough by itself, see tabMainFunctions_Selecting"); btnPickRoot blinks "for a fresh install on another computer"; "grpNavigateTabs stays enabled: btnGotoConfiguration jumps to the always-available tab"; **why** `tabMainFunctions.Invalidate()` ("Changing a TabPage's Enabled does not by itself repaint the tab strip"); "WinForms' TabControl has no built-in notion of a locked tab"; "the selected tab a shade lighter, so which one is open is still visible without the native visual style".-- `:237, 250-256, 392-398, 443-448, 710-715, 758-760, 812-828, 843-859, 868-877, 903-905` → `Form1.cs:207, 964, 328, 394-398, 620-627, 688, 700-715, 728-748, 793-801, 831`: "the runner closes the video files before it ends"; the project-folder model; SaveAs "not a file dialog ... SaveProjectTo itself asks to overwrite"; "txtRootFolder just displays it, AppSettings.ProjectRoot is the real value"; PrepareSceneImageFor "catches an image picked before the new project was ever saved"; "there is no such thing as an 'unsaved new project' to ask about any more"; StartNewProject Enabled contract and the no-default controls; SetCurrentProject "the preview-clearing must only run when the project is actually changing, or every 'Save configuration' would blank the Sources/Probes picture"; "(AutoLoadSceneImageIfEmpty only fills an empty picture, so a stale one would never be replaced)"; BrowseForFolder **why** hand-built ("plain FolderBrowserDialog shows no address bar to type a path into and makes other drives awkward"; rooted at This PC "so every drive is one click away").-- `:1072-1081, 1230-1235, 1272-1273, 1304-1309` → `Form1.Projects.cs:9-17, 202-206, 288, 334-343`: list-sort conventions and the Tag/ProjectListEntry reason; **why** `btnNewProject2_Click` saves before `SetCurrentProject` ("a freshly created project has no 'steps' or 'time_decay_factor' key yet, so FromConfig would fall back to its legacy defaults, silently discarding the Designer values StartNewProject just set"); delete warning names the assets folder "since deleting the project deletes those too, and they have no other copy here"; "a project's name is always just its folder name".-- `:1337-1350, 1457-1460, 1501-1504, 1827-1833` → `Form1.Output.cs:12-19, 264-268, 343-348, 726`: **why** shell thumbnails ("there is no dependency-free way to decode/play a frame with just System.Drawing/System.Windows.Forms"); "the Projects list is not one of these three and keeps its own selection"; **the warning** "genuine COM interop which could not be exercised on an actual Windows machine while writing it. GetShellThumbnail is written so a wrong detail surfaces as 'no thumbnail' rather than a crash; if the preview comes out consistently missing for videos, this is the place to revisit".-- `:1917-1925, 1941, 1984, 2004, 2067-2070, 2109-2121, 2129-2147, 2206-2215, 2223, 2244, 2301-2304, 2378, 2422-2427, 2473-2474` → `Form1.Scene.cs:37-39, 63-65, 113, 137, 227, 269-275, 285-305, 378-385, 396, 421, 495-501, 590, 646-650, 718-722`: **why** no `ShowSceneInControls()` at init ("would overwrite the Designer defaults before StartNewProject reads them"); "the image label tells that the image could not be loaded"; "a scene image has its own refractive index per pixel"; ClearGlowEdgesImage callers and **why** `_sceneImage` is kept; glow edges **why** per channel ("a hard red-to-black edge lights up mostly in red, the way Photoshop's 'Glowing Edges' does") and the GlowScale calibration (~1442 raw max; "ask if this should be stronger/weaker"); "24bppRgb stores each pixel as three bytes, B,G,R"; ComposeGlowOverlay **why** multiplicative ("keeps a still-black background black at any gain; a brightness slider that lifted the black background would defeat its own purpose"; "the frame itself is never modified"); overlay-gain semantics "1 is the Designer default, higher brightens faint edges, 0 is the same as unchecking"; the stale-overlay hazard on scene-mode switch ("would also be baked into any picture shared into the Sources/Probes tabs"); "an image from outside the project folder is copied in, so the project does not depend on a file elsewhere".-- `:2756, 2775, 2781, 2984-2985, 3047, 3071-3114` → `Form1.Colors.cs:230, 259, 267, 503-507, 589, 621-678`: "ends the preview; also refreshes the display"; "clicking a Color button while a list item is only previewed loads that scheme first"; "an imported scheme is a full table without stops: editing it means making a stop-based approximation"; scheme_type persistence; "radio buttons can only be changed for the current scheme"; gradient layout ("top = entry 0 (Color 1), bottom = entry 254, middle = entry 127 (centre Color)"; "tick marks dark and light so they show on any color").-- `:3156-3161, 3183-3185, 3217-3282, 3300, 3339, 3392-3408, 3414-3417, 3430-3450, 3578, 3603-3620, 3649, 3697-3708, 3718-3721, 3764-3893, 3933-4015, 4163-4167, 4185-4250, 4313, 4322-4325` → `Form1.Simulation.cs:15, 24-63, 88, 123, 206-218, 224, 244-263, 455, 484-504, 536, 594-598, 609-612, 659-809, 857-1015, 1161, 1184-1238, 1328, 1341-1354`: the class summary ("'Start simulation' hands a copy of everything to a SimulationRunner ... PostToUi passes events on to this thread"); "(render_field / render_intensity in the Python code)"; **why** the numFieldScaling2 mirror pair matches range/precision; "2 decimals, otherwise the default of -0.05 would be rounded"; lblWarningField/Intensity history; **why** no `ShowSimulationInControls()` at init ("would clamp numSimulationSteps/numTimeDecayFactor from their Designer defaults (3000 and 10) to their Minimum"); "the quality only matters for exported videos"; **why** the scheme folder and project list are re-read from disk on tab entry; numSimulationSteps "replaces the old cmbSimulationSteps combo, so no separate parsing/validation here"; `_loadingSim` as the reentrancy guard for the linked controls; "the button is also a stop button"; CopyPreviewToTabs "overlay baked in when 'Display overlay' is checked"; "btnShareSceneImage is not gated, matching 'Import scene image' which always works"; "back to the Preview tab, so the user follows the simulation"; **why** `UpdateRunButtons` only recolours ("with its custom Azure BackColor, Windows' disabled-button rendering draws the text with a strange two-tone etched effect; btnPauzeResume_Click already ignores clicks while nothing runs"); the ten `Validate()` calls "so a value typed in but not confirmed yet is used"; "the runner works on copies, so the settings can be edited while it runs"; the glow overlay "frozen at the start of the run" note; "a full-resolution snapshot for a still export once nothing is running"; NextNumericSuffix "instead of the previous date/time stamp, which made file names too long; grows past 4 digits rather than wrapping"; **the Explorer view-mode hack** ("Explorer has no command-line switch for view mode ... Shell.Application COM via reflection since Option Strict is on and a COM reference for this alone is more trouble than it is worth ... not fully reliable: if a window for the folder is already open Explorer reuses it, and Explorer remembers per folder whatever view the user leaves it in, so this only matters the first time ... every failure swallowed"); "so the folder can be opened even before any video has been exported"; "a new run is starting, drop the cached snapshots from the previous run"; the Button1 pointer to Form1.Source.vb.--### Form1.Probes.vb, Form1.Source.vb → Form1.Probes.cs, Form1.Sources.cs-- `Form1.Probes.vb:28-45, 72-78, 92-93, 207, 460-463, 496-499, 559, 614-619` → `Form1.Probes.cs:10-24, 27, 44, 93, 439-445, 489, 596, 689`: the contract that a switched-off probe "keeps being sampled, so switching it back on shows its recorded history" while "marker, graph box and burned-in overlay are all skipped"; the picture is "a copy of a simulation picture, shared by both probes"; **why** `ProbeUi` guards early events ("InitializeComponent sets numRunningWindow's 500, and that alone fires the change event before _probeUi exists"); padding "from before Probe 2 existed"; "the graphs and markers are drawn over the pictures (the pictures stay clean)"; "the number of clicks depends on the type; only cancel a pick that belongs to this probe"; "a line probe shows nothing before the start step: nothing to freeze"; canvas size source and placeholder replacement.-- `Form1.Source.vb:27-48, 73-75, 91-93, 123-124, 133-136, 177-181, 213-214, 331-338, 347-348, 371, 406-408, 430-437, 550-551, 556-565, 581, 596-624, 637-638, 650-660, 681-685, 758-772, 800-807, 831-848, 876-888` → `Form1.Sources.cs:10-18, (Form1.cs:1150), 38, 70, 77-80, 147-151, 193, 355-360, 370, 398, 436, 455, 598, 604-608, 628, 650-661, 677, 698, 723, 828-836, 885-891, 925-929, 975-984`: the object-source model (HasPosition "so an unpositioned source is never mistaken for one at (0, 0)"; Save resolves parameters "including a fresh random draw when 'Inherit + randomize' is chosen, into a fixed list of elements; the engine always runs the already-generated list, never re-randomizing, so a run is reproducible"; "there is no separate Edit step"); `_sourceSaveButtonDefaultBackColor` "captured once so ClearSourceDirty restores exactly that"; **why** array-size Min/Max are odd with Increment 2; owner-drawn list "stays fully selectable, only the text color changes"; first-source selection rationale; "a source saved before it was ever generated (should not normally happen)"; CommitSourceEdits' second caller (position pick) and **why**; "always (re)generate the elements, so a changed position is never left stale"; "the editor keeps editing the source just saved, so Save again updates it in place"; **the ValueChanged gotcha** ("a value that happens to equal what a control already shows does not raise that event", twice); position deliberately excluded from dirty tracking; "not guarded by _loadingSource" reasons (three places); UpdateLambdaLabel output format and **caveat** ("only an estimate: the real per-pixel wave speed comes from the scene's refractive index and is not necessarily uniform"); "the current culture's own decimal separator (a comma in nl-NL)"; **why** the randomize limits ("so GenerateElements' inherited ± amount can never clip against a hard limit and end up biased instead of a true symmetric spread"; position "can never overshoot as far as a neighboring grid position"; phase not limited "since ±180° is the same angle either way"); the hand-written min loop "without relying on System.Linq (not imported by this file)"; **why** even array sizes are rejected ("centre between two pixels places the whole array off-grid in an irregular way"; the spinner cannot produce one but typing can; Validating "only fires from an actual focus change, never from a Value assignment in code"); SyncSourceListSelectionToEditor **why**; the explicit `_editing.PosX = ...` after setting the spinners **why**; position pick commits an existing source but not a new one "since adding it here could silently add an incomplete/unnamed source"; live position display "but only once it actually has one, never at the unset default"; the preview box purpose ("a composite source's elements can be too small or too close together to make out at canvas scale"; "blank until generated by Save source"; the Invalidate contract); "a single element has no span to scale to, fall back to a fixed half-extent instead of dividing by zero"; "keeps outer dots from touching the edge"; "true size: one simulation pixel is one screen pixel".--### AboutForm.vb, HelpForm.vb, frmDescription.vb → *.cs-- `AboutForm.vb:25-34, 48` → `AboutForm.cs:8-11, 45, 35-37`: "Designer-editable; this file only fills in the copyright string and loads the icon; opened from AboutToolStripMenuItem_Click"; DisplayVersion "kept in sync by hand with Form1's title bar, since AssemblyVersion is left at 1.0.0.0"; "no icon available (e.g. running outside a normal exe)".-- `HelpForm.vb:26-33, 171-172` → `HelpForm.cs:7-11, 111-114`: "a dedicated section on the propagation speed c, since its correct value depends on both the Laplacian order and the source frequency and is easy to get wrong"; "opened from HelpToolStripMenuItem_Click"; AppendBullet "used for the per-control breakdowns".-- `frmDescription.vb:23-32` → `frmDescription.cs:6-10, 19`: "saved to the project only when the dialog returns OK (btnSaveDescription); btnCancelDescription discards any typing"; "Form1 sets this before showing the dialog and reads it back after OK".--## Project-level differences (vbproj vs csproj)--- `ColorSchemeList\*.json` was `Content` with `CopyToOutputDirectory=PreserveNewest`; the csproj has no Content item (see semantic table, `FindDefaultFolder`).-- ClickOnce publishing (`PublishUrl ...\2D_wave_sim_install_V0.29\`, `ApplicationRevision 18`), manifest signing (`2D_wave_sim_V01_TemporaryKey.pfx`, thumbprint) and bootstrapper packages dropped; the `.pfx` was not copied. The PublishUrl confirms the author's own label for this build was V0.29.-- `Debug|x64` / `Release|x64` configurations (`Prefer32Bit=true`, `MinimumRecommendedRules.ruleset`) dropped; AnyCPU only.-- `AutoGenerateBindingRedirects`, `Deterministic` not set in the csproj. Project-level `OptionStrict Off` (every file opts in individually). Unused VB references `System.Data`, `System.Deployment`, `System.Xml`, `System.Xml.Linq`, `System.Data.DataSetExtensions`, `System.Net.Http`.-- Resources: VB references `Resources\QR-code.png` through `ResXFileRef`; the C# resx embeds a BinaryFormatter-serialised `Bitmap` (pixel-identical, 128×128) that will not load on .NET 10. `Form1.resx` stores a serialised `Icon` object instead of the raw `.ico` bytes. `AppIcon.ico` and `Wave_Dude_2D.ico` are byte-identical.-- `Application.myapp` values (`MySubMain`, `MainForm Form1`, `SingleInstance false`, `ShutdownMode 0`, `EnableVisualStyles`, `SaveMySettingsOnExit`) are hard-coded in `My\MyApplication.cs:35-49` and match. `Settings.settings` lost `UseMySettingsClassName` and the `(Default)` profile.-- Designer: 318/318 controls, all 229 `.Text` strings and all 209 `Handles`/`+=` wirings match. VB fields are `Friend WithEvents`; C# makes them `private`. The 950-odd VB designer separator comments are boilerplate, not author text.-- `ColorSchemeList/` (repo root) and `2D_wave_sim_V01/ColorSchemeList/`: 23 files, byte-identical.--## Verified intact (no action)--- All JSON keys, string enum encodings, defaults and per-key fallbacks in `SimulationSettings`, `SourceSettings`/`SourceElement`, `SceneSettings`, `ProbeSettings`, `AppSettings`, `ProjectConfig`, `ColorSchemeStore`.-- All six OpenCL kernels and `xorshift32`, token for token; every kernel argument index; all 23 P/Invoke signatures.-- All COM interfaces (`IMFAttributes` 30 slots, `IMFSample` 30+14, `IMFMediaBuffer` 5, `IMFSinkWriter` 11), GUIDs, marshalling, MF call sequence.-- Every `CInt`/`CByte`/`CLng` on a floating value became `Math.Round` (banker's), never a truncating cast; every `CInt(Math.Truncate(...))` became a cast; every `\` became integer `/`.-- `Optional` parameter defaults everywhere (`ColorLut.Build`, `IntensityIndex`, `SceneData.Empty`, `GpuWaveSimulator.TryCreate`, `RefreshOutputProjectList`, `SetOutputPreviewImage`).-- The single `Debug.Assert` (`Form1.vb:109`) survives at `Form1.cs:85`.-- `ColorLut.IntensityIndex` is uncalled in the VB too, so the C# "not currently called" note is accurate.diff --git a/_tools/_edit_snap.py b/_tools/_edit_snap.pydeleted file mode 100644index faca4b3..0000000--- a/_tools/_edit_snap.py+++ /dev/null@@ -1,200 +0,0 @@-import re--def edit(path, pairs):- s = open(path, encoding='utf-8').read()- for old, new in pairs:- if old not in s:- raise SystemExit('not found in ' + path + ': ' + old[:70])- s = s.replace(old, new, 1)- open(path, 'w', encoding='utf-8', newline='').write(s)--edit('WaveDude/Model/Probe.cs', [-(''' /// <summary>- /// X of the probe pixel, or of the start of the line, in canvas pixels. While the graph box sits at the- /// same x (<see cref="BoxX"/> equal), the box moves along; a box dragged elsewhere stays put- /// (the user's rule, 2026-10-14).- /// </summary>''', ''' /// <summary>- /// X of the probe pixel, or of the start of the line, in canvas pixels. While the graph box is attached- /// (<see cref="IsBoxAttached"/>: its anchor on this point) the box moves along; a box dragged away stays- /// put (the user's rule, 2026-10-14: one attachment, not one per axis).- /// </summary>'''),-(''' set- {- bool boxFollows = _boxX == _aX;- if (SetProperty(ref _aX, value) && boxFollows)- {- BoxX = value;- }- }- }-- /// <summary>Y of the probe pixel, or of the start of the line, in canvas pixels. The graph box follows it like <see cref="AX"/>.</summary>''', ''' set- {- bool attached = IsBoxAttached;- if (SetProperty(ref _aX, value) && attached)- {- BoxX = value;- }- }- }-- /// <summary>Y of the probe pixel, or of the start of the line, in canvas pixels. An attached graph box follows it like <see cref="AX"/>.</summary>'''),-(''' set- {- bool boxFollows = _boxY == _aY;- if (SetProperty(ref _aY, value) && boxFollows)- {- BoxY = value;- }- }- }''', ''' set- {- bool attached = IsBoxAttached;- if (SetProperty(ref _aY, value) && attached)- {- BoxY = value;- }- }- }-- /// <summary>- /// Whether the graph box is attached to the probe: its anchor (<see cref="BoxX"/>, <see cref="BoxY"/>) sits on- /// point A, so the box moves with the probe. The preview snaps a box dragged close to the probe onto it and- /// detaches it when it is dragged away (2026-10-14).- /// </summary>- [XmlIgnore]- [Browsable(false)]- public bool IsBoxAttached => _boxX == _aX && _boxY == _aY;'''),-(''' /// <summary>Left edge of the graph box in canvas pixels; while it equals <see cref="AX"/>, the box moves with the probe.</summary>- [XmlAttribute]- [DefaultValue(0)]- [Category("Graph")]- [DisplayName("Box x")]- [Description("Left edge of the graph box in canvas pixels; while it equals A x, the box moves with the probe.")]''',- ''' /// <summary>Left edge of the graph box in canvas pixels; with the box on point A (<see cref="IsBoxAttached"/>) it moves with the probe.</summary>- [XmlAttribute]- [DefaultValue(0)]- [Category("Graph")]- [DisplayName("Box x")]- [Description("Left edge of the graph box in canvas pixels. A box placed on the probe's point A moves with the probe; dragging it close snaps it on.")]'''),-(''' /// <summary>Top edge of the graph box in canvas pixels; while it equals <see cref="AY"/>, the box moves with the probe.</summary>- [XmlAttribute]- [DefaultValue(0)]- [Category("Graph")]- [DisplayName("Box y")]- [Description("Top edge of the graph box in canvas pixels; while it equals A y, the box moves with the probe.")]''',- ''' /// <summary>Top edge of the graph box in canvas pixels; with the box on point A (<see cref="IsBoxAttached"/>) it moves with the probe.</summary>- [XmlAttribute]- [DefaultValue(0)]- [Category("Graph")]- [DisplayName("Box y")]- [Description("Top edge of the graph box in canvas pixels. A box placed on the probe's point A moves with the probe; dragging it close snaps it on.")]'''),-])--edit('WaveDude.WPF/Controls/ProbeGraphOverlay.cs', [-(''' /// <summary>Pixels a focused box moves or grows per arrow key, and with Shift.</summary>- private const int KeyStep = 1;- private const int KeyStepFast = 10;''', ''' /// <summary>Pixels a focused box moves or grows per arrow key, and with Shift.</summary>- private const int KeyStep = 1;- private const int KeyStepFast = 10;-- /// <summary>Screen distance within which a dragged box snaps onto its probe's point A and attaches to it.</summary>- private const double SnapRadius = 14.0;'''),-(''' else- {- SetBoxPosition(probe, x, y);- }- }-- /// <summary>Moves the box, kept inside the canvas.</summary>- private void SetBoxPosition(Probe probe, int x, int y)- {- BoxRect box = ProbeGraph.BoxInCanvas(probe, CanvasWidth, CanvasHeight);- probe.BoxX = Math.Clamp(x, 0, Math.Max(0, CanvasWidth - box.Width));- probe.BoxY = Math.Clamp(y, 0, Math.Max(0, CanvasHeight - box.Height));- }''', ''' else- {- SetBoxPosition(probe, x, y, snap: true);- }- }-- /// <summary>- /// Moves the box, kept inside the canvas. With <paramref name="snap"/> (a drag, not a keyboard nudge) a box- /// whose anchor comes within <see cref="SnapRadius"/> screen pixels of the probe's point A lands on it and is- /// attached from then on (<see cref="Probe.IsBoxAttached"/>); dragging it further away detaches it. One radius,- /// not a snap per axis (the user's rule, 2026-10-14).- /// </summary>- private void SetBoxPosition(Probe probe, int x, int y, bool snap)- {- if (snap)- {- double scale = ScaleFor(RenderSize);- double dx = (x - probe.AX) * scale;- double dy = (y - probe.AY) * scale;- if (dx * dx + dy * dy <= SnapRadius * SnapRadius)- {- x = probe.AX;- y = probe.AY;- }- }- BoxRect box = ProbeGraph.BoxInCanvas(probe, CanvasWidth, CanvasHeight);- probe.BoxX = Math.Clamp(x, 0, Math.Max(0, CanvasWidth - box.Width));- probe.BoxY = Math.Clamp(y, 0, Math.Max(0, CanvasHeight - box.Height));- }'''),-(''' SetBoxPosition(probe, probe.BoxX + dx, probe.BoxY + dy);''', ''' SetBoxPosition(probe, probe.BoxX + dx, probe.BoxY + dy, snap: false);'''),-])--hints = {- 'EN': ('Left edge of the graph box in canvas pixels. A box placed on the probe\'s point A moves with the probe; dragging it close snaps it on.',- 'Top edge of the graph box in canvas pixels. A box placed on the probe\'s point A moves with the probe; dragging it close snaps it on.'),- 'DE': ('Linker Rand des Diagrammkastens in Leinwandpixeln. Ein Kasten auf Punkt A der Sonde wandert mit ihr; in die Nähe gezogen rastet er dort ein.',- 'Oberer Rand des Diagrammkastens in Leinwandpixeln. Ein Kasten auf Punkt A der Sonde wandert mit ihr; in die Nähe gezogen rastet er dort ein.'),- 'FR': ('Bord gauche du cadre du graphique en pixels de toile. Un cadre posé sur le point A de la sonde la suit ; approché en le glissant, il s\'y accroche.',- 'Bord supérieur du cadre du graphique en pixels de toile. Un cadre posé sur le point A de la sonde la suit ; approché en le glissant, il s\'y accroche.'),- 'NL': ('Linkerrand van het grafiekkader in canvaspixels. Een kader op punt A van de sonde beweegt met haar mee; dichtbij gesleept klikt het daar vast.',- 'Bovenrand van het grafiekkader in canvaspixels. Een kader op punt A van de sonde beweegt met haar mee; dichtbij gesleept klikt het daar vast.'),-}-for lang, (x, y) in hints.items():- path = 'WaveDude.WPF/Strings/Strings.%s.xaml' % lang- s = open(path, encoding='utf-8').read()- s, n1 = re.subn(r'(<s:String x:Key="Hint.Probe.BoxX">)[^<]*(</s:String>)', lambda m: m.group(1) + x + m.group(2), s)- s, n2 = re.subn(r'(<s:String x:Key="Hint.Probe.BoxY">)[^<]*(</s:String>)', lambda m: m.group(1) + y + m.group(2), s)- if n1 != 1 or n2 != 1:- raise SystemExit('hint not found in ' + path)- open(path, 'w', encoding='utf-8', newline='').write(s)--edit('_tools/library_check/Program.cs', [-(''' var follower = new Probe { Name = "F" };- follower.AX = 50;- follower.AY = 60;- Check(follower.BoxX == 50 && follower.BoxY == 60, "the graph box moves with the probe while they share its position");- follower.BoxX = 10;- follower.AX = 70;- follower.AY = 61;- Check(follower.BoxX == 10 && follower.BoxY == 61, "a box moved away stays put on that axis; the other axis still follows");''',- ''' var follower = new Probe { Name = "F" };- follower.AX = 50;- follower.AY = 60;- Check(follower.IsBoxAttached && follower.BoxX == 50 && follower.BoxY == 60, "an attached graph box moves with the probe");- follower.BoxX = 10;- follower.AX = 70;- follower.AY = 61;- Check(!follower.IsBoxAttached && follower.BoxX == 10 && follower.BoxY == 60, "a box moved away is detached on both axes and stays put");- follower.BoxX = 70;- follower.BoxY = 61;- follower.AX = 75;- Check(follower.IsBoxAttached && follower.BoxX == 75 && follower.BoxY == 61, "a box put back on the probe is attached again");'''),-])--edit('CLAUDE.md', [-('''**The box follows the- probe while they share a position** (the user's rule): `Probe.AX`/`AY` move `BoxX`/`BoxY` along when they- were equal (in the model, so every editor does it), and a box dragged elsewhere stays put per axis.''',- '''**The box follows the- probe while it is attached** (the user's rule, one attachment, not one per axis, 2026-10-14):- `Probe.IsBoxAttached` is the box anchor sitting on point A; `Probe.AX`/`AY` then move `BoxX`/`BoxY` along- (in the model, so every editor does it). Dragging the box within 14 screen pixels of point A snaps it on- (`ProbeGraphOverlay.SetBoxPosition`, drags only; keyboard nudges stay exact), dragging it further away- detaches it.'''),-])-print('ok')diff --git a/_tools/avi_check/Program.cs b/_tools/avi_check/Program.csdeleted file mode 100644index ae42518..0000000--- a/_tools/avi_check/Program.cs+++ /dev/null@@ -1,94 +0,0 @@-using System;-using System.IO;-using System.Text;-using _2D_wave_sim_V01;--// Writes a 3-frame MJPEG AVI with dummy payloads, then walks the RIFF tree and checks every-// size/offset against what the AVI spec expects. Exit code 0 = structure is valid.-internal static class Program-{- private static int _checks;- private static int _failures;-- private static void Check(bool ok, string what)- {- Console.WriteLine((ok ? " ok " : " FAIL ") + what);- _checks++;- if (!ok) _failures++;- }-- private static int Main()- {- string path = Path.Combine(Path.GetTempPath(), "avi_check.avi");- int[] frameSizes = { 1001, 2000, 777 }; // odd sizes exercise the pad byte- using (var w = new AviMjpegWriter(path, 320, 240, 25))- {- foreach (int n in frameSizes)- {- var payload = new byte[n];- for (int i = 0; i < n; i++) payload[i] = (byte)i;- w.AddFrame(payload, n);- }- }- byte[] f = File.ReadAllBytes(path);- Func<int, string> fourcc = o => Encoding.ASCII.GetString(f, o, 4);- Func<int, uint> u32 = o => BitConverter.ToUInt32(f, o);- Func<int, ushort> u16 = o => BitConverter.ToUInt16(f, o);-- Console.WriteLine("file length " + f.Length);- Check(fourcc(0) == "RIFF" && fourcc(8) == "AVI ", "RIFF/AVI signature");- Check(u32(4) == f.Length - 8, "RIFF size = file length - 8");- Check(fourcc(12) == "LIST" && u32(16) == 192 && fourcc(20) == "hdrl", "LIST hdrl 192");- Check(fourcc(24) == "avih" && u32(28) == 56, "avih 56");- Check(u32(32) == 1000000 / 25, "avih.dwMicroSecPerFrame");- Check(u32(44) == 0x10, "avih.dwFlags = AVIF_HASINDEX");- Check(u32(48) == 3, "avih.dwTotalFrames = 3");- Check(u32(56) == 1, "avih.dwStreams = 1");- Check(u32(60) == 2000, "avih.dwSuggestedBufferSize = largest frame");- Check(u32(64) == 320 && u32(68) == 240, "avih width/height");- Check(fourcc(88) == "LIST" && u32(92) == 116 && fourcc(96) == "strl", "LIST strl 116");- Check(fourcc(100) == "strh" && u32(104) == 56, "strh 56");- Check(fourcc(108) == "vids" && fourcc(112) == "MJPG", "strh fccType/fccHandler");- Check(u32(128) == 1 && u32(132) == 25, "strh dwScale=1 dwRate=25");- Check(u32(140) == 3, "strh.dwLength = 3");- Check(u32(144) == 2000, "strh.dwSuggestedBufferSize = largest frame");- // AVISTREAMHEADER: dwQuality follows dwSuggestedBufferSize, i.e. PosStreamBufferSize (144) + 4- Check(u32(148) == 0xFFFFFFFFU, "strh.dwQuality = 0xFFFFFFFF (-1, default)");- Check(u16(156) == 0 && u16(158) == 0 && u16(160) == 320 && u16(162) == 240, "strh.rcFrame");- Check(fourcc(164) == "strf" && u32(168) == 40, "strf 40");- Check(u32(172) == 40 && u32(176) == 320 && u32(180) == 240, "bih size/width/height");- Check(u16(184) == 1 && u16(186) == 24 && fourcc(188) == "MJPG", "bih planes/bitcount/compression");- Check(fourcc(212) == "LIST" && fourcc(220) == "movi", "LIST movi at 212/220");-- // walk the movi chunks- int pos = 224;- int moviEnd = 220 + (int)u32(216);- int frame = 0;- var offsets = new int[frameSizes.Length];- while (pos < moviEnd)- {- Check(fourcc(pos) == "00dc", "frame " + frame + " chunk id at " + pos);- uint size = u32(pos + 4);- Check(size == frameSizes[frame], "frame " + frame + " size " + size);- Check(f[pos + 8] == 0 && f[pos + 8 + (int)size - 1] == (byte)(size - 1), "frame " + frame + " payload intact");- offsets[frame] = pos - 220;- pos += 8 + (int)size + (int)(size & 1);- frame++;- }- Check(frame == frameSizes.Length, "movi LIST size covers exactly " + frameSizes.Length + " frames");- Check(pos == moviEnd, "movi LIST size ends on chunk boundary");-- Check(fourcc(pos) == "idx1" && u32(pos + 4) == 16 * frameSizes.Length, "idx1 header");- for (int i = 0; i < frameSizes.Length; i++)- {- int e = pos + 8 + 16 * i;- Check(fourcc(e) == "00dc" && u32(e + 4) == 0x10, "idx1[" + i + "] id/flags");- Check(u32(e + 8) == offsets[i], "idx1[" + i + "] offset " + u32(e + 8) + " == " + offsets[i]);- Check(u32(e + 12) == frameSizes[i], "idx1[" + i + "] size");- }- Check(pos + 8 + 16 * frameSizes.Length == f.Length, "idx1 ends at EOF");-- Console.WriteLine(_checks + " checks: " + (_failures == 0 ? "AVI structure OK" : _failures + " failed"));- return _failures == 0 ? 0 : 1;- }-}diff --git a/_tools/engine_check/Program.cs b/_tools/engine_check/Program.csdeleted file mode 100644index 3dedd95..0000000--- a/_tools/engine_check/Program.cs+++ /dev/null@@ -1,146 +0,0 @@-using System;-using System.Collections.Generic;-using System.Drawing;-using _2D_wave_sim_V01;--namespace EngineCheck-{- // Drives the CPU and (if available) GPU engines over the same scene and compares their fields, so a- // refactor of either engine is checked against the other. Exit code 0 = all checks passed.- internal static class Program- {- private static int _failures;-- private static void Check(bool ok, string what)- {- Console.WriteLine((ok ? " ok " : " FAIL ") + what);- if (!ok) _failures++;- }-- private static List<SourceElement> Sources()- {- return new List<SourceElement>- {- new SourceElement { PosX = 20, PosY = 24, Level = 120, Amplitude = 1.0, Mode = SourceMode.Continuous },- new SourceElement { PosX = 44, PosY = 12, Level = 200, Amplitude = 0.7, PhaseRad = 0.5, Mode = SourceMode.Pulsed, PulseShape = SourcePulseShape.Gaussian, OnWidthCycles = 4, OffWidthCycles = 6 },- new SourceElement { PosX = 44, PosY = 36, Level = 90, Amplitude = 0.5, Mode = SourceMode.Pulsed, PulseShape = SourcePulseShape.SmoothedSquare, OnWidthCycles = 5, OffWidthCycles = 3, DetachAfterStep = 120 },- new SourceElement { PosX = 99, PosY = 99, Level = 50, Amplitude = 9.0, Mode = SourceMode.Continuous }, // outside: must be dropped- };- }-- private static float MaxAbs(float[] a)- {- float m = 0f;- foreach (float v in a) m = Math.Max(m, Math.Abs(v));- return m;- }-- private static float MaxDiff(float[] a, float[] b)- {- float m = 0f;- for (int i = 0; i < a.Length; i++) m = Math.Max(m, Math.Abs(a[i] - b[i]));- return m;- }-- private static ProbeSampler Probes(int w, int h)- {- var probes = new List<ProbeSettings>- {- new ProbeSettings { Kind = ProbeKind.Point, Measurement = ProbeMeasurement.Amplitude, PosAX = 20, PosAY = 24, Active = true },- new ProbeSettings { Kind = ProbeKind.Line, Measurement = ProbeMeasurement.IntegratedIntensity, PosAX = 5, PosAY = 5, PosBX = 40, PosBY = 30, Active = true, UseStartAfterStep = true, StartAfterStep = 50 },- new ProbeSettings { Kind = ProbeKind.Point, Measurement = ProbeMeasurement.Intensity, PosAX = 30, PosAY = 20, Active = true },- };- return ProbeSampler.Build(probes, w, h);- }-- private static float MaxDiff(float[][] a, float[][] b)- {- float m = 0f;- for (int i = 0; i < a.Length; i++)- {- if (a[i] == null || b[i] == null) { if (a[i] != b[i]) return float.PositiveInfinity; continue; }- if (a[i].Length != b[i].Length) return float.PositiveInfinity;- m = Math.Max(m, MaxDiff(a[i], b[i]));- }- return m;- }-- private static void Run(IWaveEngine engine, int steps)- {- for (int i = 0; i < steps; i++)- {- engine.AdvanceOneStep();- engine.SampleProbes();- }- engine.PrepareFrame(true, true);- }-- private static int Main()- {- const int W = 64, H = 48, Steps = 200;- // Scene with an image source (green level 160) so both source kernels run.- Bitmap image = new Bitmap(W, H);- using (Graphics g = Graphics.FromImage(image)) g.Clear(Color.FromArgb(100, 0, 0)); // refractive index 1.00- image.SetPixel(10, 10, Color.FromArgb(100, 160, 0));- SceneData scene = SceneData.FromImage(image, true, 6);- Check(scene.SourceCount == 1, "scene has 1 image source");-- foreach (bool fourth in new[] { false, true })- {- Console.WriteLine("--- 4th order: " + fourth);- WaveSimulator cpu = new WaveSimulator(scene, 1.0, 1.0, true, fourth, 10.0, 1.0, Sources());- cpu.SetProbes(Probes(W, H));- Run(cpu, Steps);- float[] cpuField = (float[])cpu.FieldData.Clone();- float[] cpuInten = (float[])cpu.IntensityData.Clone();- float[][] cpuSamples = cpu.TakeProbeSamples();- float[][] cpuProfiles = cpu.ReadProbeProfiles();- Check(cpuSamples[0].Length == Steps && cpuSamples[2].Length == Steps && cpuSamples[1].Length == 0, "CPU point probes have one sample per step");- Check(cpuProfiles[1] != null && cpuProfiles[1].Length > 30 && MaxAbs(cpuProfiles[1]) > 0f, "CPU integrated line profile populated");- Check(cpu.TakeProbeSamples()[0].Length == 0, "CPU TakeProbeSamples clears");- Check(MaxAbs(cpuField) > 0.01f, "CPU field is non-trivial (max |u| = " + MaxAbs(cpuField) + ")");- Check(MaxAbs(cpuInten) > 0f, "CPU intensity accumulated");- Check(Math.Abs(cpu.Time - Steps) < 1e-9, "CPU time counts steps");- // Border stays zero (never written).- bool borderZero = true;- for (int x = 0; x < cpu.Stride; x++) borderZero &= cpuField[x] == 0f && cpuField[(H + 1) * cpu.Stride + x] == 0f;- Check(borderZero, "CPU padding rows untouched");-- string problems = "";- GpuWaveSimulator gpu = GpuWaveSimulator.TryCreate(scene, 1.0, 1.0, true, fourth, 10.0, 1.0, ref problems, Sources());- if (gpu == null)- {- Console.WriteLine(" skip GPU: " + problems);- continue;- }- using (gpu)- {- Console.WriteLine(" " + gpu.Description);- gpu.SetProbes(Probes(W, H));- Run(gpu, Steps);- float diffField = MaxDiff(cpuField, gpu.FieldData);- float diffInten = MaxDiff(cpuInten, gpu.IntensityData);- Check(diffField < 1e-3f * Math.Max(1f, MaxAbs(cpuField)), "GPU field matches CPU (max diff " + diffField + ")");- Check(diffInten < 1e-3f * Math.Max(1f, MaxAbs(cpuInten)), "GPU intensity matches CPU (max diff " + diffInten + ")");- float[][] gpuSamples = gpu.TakeProbeSamples();- float[][] gpuProfiles = gpu.ReadProbeProfiles();- float diffSamples = MaxDiff(cpuSamples, gpuSamples);- float diffProfiles = MaxDiff(cpuProfiles, gpuProfiles);- Check(diffSamples < 1e-3f, "GPU point-probe samples match CPU (max diff " + diffSamples + ")");- Check(diffProfiles < 1e-3f * Math.Max(1f, MaxAbs(cpuProfiles[1])), "GPU line profile matches CPU (max diff " + diffProfiles + ")");- // Re-installing probes replaces the previous set (no leak, no stale state); clearing empties results.- gpu.SetProbes(Probes(W, H));- Run(gpu, 10);- Check(gpu.TakeProbeSamples()[0].Length == 10, "GPU probes re-installed and sampling again");- gpu.SetProbes(null);- Check(gpu.TakeProbeSamples().Length == 0 && gpu.ReadProbeProfiles().Length == 0, "GPU: probes cleared -> empty results");- gpu.Dispose();- gpu.Dispose();- Check(true, "GPU double dispose is harmless");- }- }- Console.WriteLine(_failures == 0 ? "ENGINES OK" : _failures + " check(s) failed");- return _failures == 0 ? 0 : 1;- }- }-}diff --git a/_tools/field_usage.py b/_tools/field_usage.pyindex d1a29bc..378069f 100644--- a/_tools/field_usage.py+++ b/_tools/field_usage.py@@ -1,4 +1,4 @@-"""List every private field/const of the given classes with usage counts, grouped by method."""+"""List every private field/const of the classes in the given .cs files with usage counts, grouped by method."""import re, sysSTRING = re.compile(r'"(?:[^"\\]|\\.)*"')@@ -6,7 +6,7 @@ FIELD = re.compile(r'^\t\tprivate (?:readonly |static |const )*([A-Za-z0-9_<>\[\METHOD = re.compile(r'^\t\t(?:public|private|internal|protected)[^\r\n=;]*? ([A-Za-z0-9_]+)\([^)]*\)\s*(?:=>|\r?\n\t\t\{)', re.M)for f in sys.argv[1:]:- src = open('Wave_Dude_2D/%s.cs' % f, encoding='utf-8').read()+ src = open(f, encoding='utf-8').read()code = '\n'.join(l for l in src.split('\n') if not l.strip().startswith('///'))code = STRING.sub('""', code)fields = FIELD.findall(code)diff --git a/_tools/fix_designer_generated.py b/_tools/fix_designer_generated.pydeleted file mode 100644index c1da0a7..0000000--- a/_tools/fix_designer_generated.py+++ /dev/null@@ -1,31 +0,0 @@-"""Remove VB [DesignerGenerated] attributes and replace the _rootBlinkTimer WithEvents property with a field."""-import glob, re--def rw(path, fn):- raw = open(path, 'rb').read()- bom = raw.startswith(b'\xef\xbb\xbf')- text = raw.decode('utf-8-sig')- new = fn(text)- if new != text:- open(path, 'wb').write((b'\xef\xbb\xbf' if bom else b'') + new.encode('utf-8'))- print('patched', path)--for p in glob.glob('Wave_Dude_2D/*.cs'):- rw(p, lambda t: re.sub(r'^\t\[(global::Microsoft\.VisualBasic\.CompilerServices\.)?DesignerGenerated\]\r\n', '', t, flags=re.M))--def fix_timer(t):- # property -> field- t, n = re.subn(- r'(\t\t// Token:[^\r\n]*\r\n)*\t\tprivate virtual global::System\.Windows\.Forms\.Timer _rootBlinkTimer\r\n\t\t\{.*?\r\n\t\t\}\r\n',- '\t\tprivate readonly global::System.Windows.Forms.Timer _rootBlinkTimer;\r\n', t, count=1, flags=re.S)- assert n == 1, 'timer property not found'- # drop backing field- t, n = re.subn(r'(\t\t// Token:[^\r\n]*\r\n)*\t\tprivate global::System\.Windows\.Forms\.Timer __rootBlinkTimer;\r\n\r\n?', '', t, count=1)- # (the decompiler never emitted the backing field, so n may be 0)- # wire the Tick handler where the timer is created- t, n = re.subn(r'(\t\t\tthis\._rootBlinkTimer = new global::System\.Windows\.Forms\.Timer\r\n\t\t\t\{\r\n\t\t\t\tInterval = 700\r\n\t\t\t\};\r\n)',- r'\1\t\t\tthis._rootBlinkTimer.Tick += this.RootBlinkTimer_Tick;\r\n', t, count=1)- assert n == 1, 'timer construction not found'- return t--rw('Wave_Dude_2D/Form1.cs', fix_timer)diff --git a/_tools/fix_semantic.py b/_tools/fix_semantic.pydeleted file mode 100644index 2d32b55..0000000--- a/_tools/fix_semantic.py+++ /dev/null@@ -1,191 +0,0 @@-"""Second-pass fixes for decompiled-VB residue that is syntactically valid but does not compile.--Order matters: step 1 uses line numbers from the current build log (/tmp/build.log),-so it runs before anything that shifts lines.-- 1. CS0165 ByRef locals : `double num;` passed as `ref num` -> `double num = default(double);`- 2. bogus try/finally : `finally { List<T>.Enumerator enumerator; ((IDisposable)enumerator).Dispose(); }`- -> drop the finally, unwrap the try- 3. VB event backing refs: `this.FooEvent` -> `this.Foo`- 4. AviMjpegWriter : two mis-decompiled unsigned constants- 5. WithEvents properties: `internal virtual T name { get{return this._name;} set{...hook events...} }`- -> `private T name;` in the Designer + `this.name.Event += handler;` in InitializeComponent-"""-import re, sys, os--SRC = 'Wave_Dude_2D'--def read(path):- raw = open(path, 'rb').read()- return raw.startswith(b'\xef\xbb\xbf'), raw.decode('utf-8-sig').split('\r\n')--def write(path, bom, lines):- open(path, 'wb').write((b'\xef\xbb\xbf' if bom else b'') + '\r\n'.join(lines).encode('utf-8'))--def indent_of(line):- return len(line) - len(line.lstrip('\t'))--# ---------------------------------------------------------------- 1. ByRef locals-def fix_byref_locals(log_path):- sites = {}- for m in re.finditer(r'\\([A-Za-z0-9_.]+\.cs)\((\d+),\d+\): error CS0165: Use of unassigned local variable \'(\w+)\'', open(log_path, encoding='utf-8', errors='replace').read()):- f, line, var = m.group(1), int(m.group(2)), m.group(3)- if var.startswith('enumerator'):- continue- sites.setdefault(f, set()).add((line, var))- for f, items in sites.items():- path = os.path.join(SRC, f)- bom, lines = read(path)- for line, var in sorted(items):- i = line - 1- decl = re.compile(r'^(\t+)([A-Za-z0-9_<>\[\].]+) ' + re.escape(var) + r';$')- while i >= 0 and not decl.match(lines[i]):- i -= 1- if i < 0:- sys.exit('decl of %s not found near %s:%d' % (var, f, line))- m = decl.match(lines[i])- lines[i] = '%s%s %s = default(%s);' % (m.group(1), m.group(2), var, m.group(2))- write(path, bom, lines)- print('byref locals: %s (%d)' % (f, len(items)))--# ---------------------------------------------------------------- 2. bogus try/finally-BOGUS = [re.compile(p) for p in (- r'^\t+[A-Za-z0-9_<>.\[\]]*Enumerator enumerator\d*;$',- r'^\t+\(\(IDisposable\)enumerator\d*\)\.Dispose\(\);$',- r'^\t+if \(enumerator\d* is IDisposable\)$',- r'^\t+\(enumerator\d* as IDisposable\)\.Dispose\(\);$',- r'^\t+[{}]$',-)]--def fix_bogus_finally(path):- bom, lines = read(path)- changed = 0- i = 0- while i < len(lines):- if lines[i].lstrip('\t') == 'finally' and lines[i].startswith('\t'):- k = indent_of(lines[i])- close = i + 2- while close < len(lines) and lines[close] != '\t' * k + '}':- close += 1- body = lines[i + 2:close]- if body and all(any(p.match(l) for p in BOGUS) for l in body) and any('numerator' in l for l in body):- # block directly before `finally` is `{ ... }` at indent k; find its opening brace- j = i - 1- assert lines[j] == '\t' * k + '}', (path, i)- depth = 0- while True:- s = lines[j].strip()- if s == '}':- depth += 1- elif s == '{':- depth -= 1- if depth == 0:- break- j -= 1- head = lines[j - 1].strip()- del lines[i:close + 1] # drop finally block- if head == 'try':- inner = [l[1:] if l.startswith('\t') else l for l in lines[j + 1:i - 1]]- lines[j - 1:i] = inner # unwrap try { ... }- i = j - 1 + len(inner)- else:- # try/catch/finally: keep try/catch, finally alone is dropped- i = i- changed += 1- continue- i += 1- if changed:- write(path, bom, lines)- print('bogus finally: %s (%d)' % (path, changed))--# ---------------------------------------------------------------- 3. event backing refs-def fix_event_refs(path):- bom, lines = read(path)- new = [re.sub(r'this\.(ColorChanged|EngineReady|ProgressChanged|PreviewReady|ProbesUpdated|Finished)Event\b', r'this.\1', l) for l in lines]- if new != lines:- write(path, bom, new)- print('event refs:', path)--# ---------------------------------------------------------------- 4. AVI constants-def fix_avi():- path = os.path.join(SRC, 'AviMjpegWriter.cs')- bom, lines = read(path)- text = '\r\n'.join(lines)- a = text.replace('this._writer.Write((uint)((unchecked((long)width) * unchecked((long)height) * 3L) & (long)(unchecked((ulong)(-1)))));',- 'this._writer.Write((uint)(((long)width * height * 3L) & 0xFFFFFFFFL));')- b = a.replace('+ 64L > (long)(unchecked((ulong)(-394967296)))', '+ 64L > MaxAviBytes')- assert a != text and b != a, 'AVI constants not found'- b = b.replace('\t\tpublic void AddFrame(byte[] data, int length)',- '\t\t// stay safely below the 4 GB RIFF limit\r\n\t\tprivate const long MaxAviBytes = 3900000000L;\r\n\r\n\t\tpublic void AddFrame(byte[] data, int length)', 1)- write(path, bom, b.split('\r\n'))- print('avi constants fixed')--# ---------------------------------------------------------------- 5. WithEvents properties-PROP = re.compile(r'^\t\tinternal virtual ([A-Za-z0-9_<>.:]+) ([A-Za-z0-9_]+)$')-HANDLER = re.compile(r'^\t{4}([A-Za-z0-9_.]+) ([A-Za-z0-9_]+) = new ([A-Za-z0-9_.]+)\(this\.([A-Za-z0-9_]+)\);$')-HOOK = re.compile(r'^\t{5}([A-Za-z0-9_]+)\.([A-Za-z0-9_]+) \+= ([A-Za-z0-9_]+);$')--def fix_withevents(code_path, designer_path):- bom, lines = read(code_path)- fields = [] # (type, name)- wiring = [] # (control, event, delegateType, handlerMethod)- i = 0- out = []- while i < len(lines):- m = PROP.match(lines[i])- if not m:- out.append(lines[i]); i += 1; continue- typ, name = m.group(1), m.group(2)- # strip preceding decompiler comments already emitted to out- while out and out[-1].strip().startswith('// '):- out.pop()- end = i + 1- while lines[end] != '\t\t}':- end += 1- block = lines[i:end + 1]- delegates = {}- for l in block:- h = HANDLER.match(l)- if h:- delegates[h.group(2)] = (h.group(3), h.group(4))- k = HOOK.match(l)- if k:- dt, method = delegates[k.group(3)]- wiring.append((name, k.group(2), dt, method))- fields.append((typ, name))- i = end + 1- # drop one trailing blank line- if i < len(lines) and lines[i] == '' and out and out[-1] == '':- i += 1- # sanity: no stray references to the backing fields remain- leftover = [n for _, n in fields if re.search(r'\b_' + re.escape(n) + r'\b', '\r\n'.join(out))]- assert not leftover, ('backing field refs remain', code_path, leftover[:5])- write(code_path, bom, out)-- dbom, dlines = read(designer_path)- comp = next(j for j, l in enumerate(dlines) if l.strip().startswith('private global::System.ComponentModel.IContainer components;'))- # drop the Token comment above `components`- if dlines[comp - 1].strip().startswith('// Token'):- del dlines[comp - 1]; comp -= 1- decls = ['\t\tprivate %s %s;' % (t.replace('global::', ''), n) for t, n in fields]- dlines[comp:comp] = decls- if wiring:- created = set(re.findall(r'this\.([A-Za-z0-9_]+) = new ', '\r\n'.join(dlines)))- missing = sorted({c for c, _, _, _ in wiring if c not in created})- assert not missing, ('wired controls not created in InitializeComponent', designer_path, missing)- anchor = next(j for j, l in enumerate(dlines) if re.match(r'^\t\t\t(base|this)\.(AutoScaleDimensions|ResumeLayout)', l))- hooks = ['\t\t\tthis.%s.%s += new %s(this.%s);' % w for w in wiring]- dlines[anchor:anchor] = ['\t\t\t// event wiring (was VB WithEvents/Handles)'] + hooks- write(designer_path, dbom, dlines)- print('withevents: %s -> %d fields, %d event hooks' % (code_path, len(fields), len(wiring)))--if __name__ == '__main__':- fix_byref_locals('/tmp/build.log' if os.path.exists('/tmp/build.log') else sys.argv[1])- for f in sorted(os.listdir(SRC)):- if f.endswith('.cs'):- fix_bogus_finally(os.path.join(SRC, f))- fix_event_refs(os.path.join(SRC, 'ColorPickerControl.cs'))- fix_event_refs(os.path.join(SRC, 'SimulationRunner.cs'))- fix_avi()- for form in ('Form1', 'frmDescription', 'AboutForm', 'HelpForm'):- fix_withevents(os.path.join(SRC, form + '.cs'), os.path.join(SRC, form + '.Designer.cs'))diff --git a/_tools/fix_static_lambdas.py b/_tools/fix_static_lambdas.pydeleted file mode 100644index 7dfc527..0000000--- a/_tools/fix_static_lambdas.py+++ /dev/null@@ -1,27 +0,0 @@-"""Replace the two decompiled cached-static-lambda Sort calls with plain lambdas."""-import re--def patch(path, pattern, replacement):- raw = open(path, 'rb').read()- text = raw.decode('utf-8-sig')- new, n = re.subn(pattern, replacement, text, flags=re.S)- if n != 1:- raise SystemExit('%s: expected 1 match, got %d' % (path, n))- open(path, 'wb').write(b'\xef\xbb\xbf' + new.encode('utf-8'))- print(path, 'patched')--patch('Wave_Dude_2D/GpuDeviceInfo.cs',- r'list\.Sort\(\(GpuDeviceInfo\._Closure\$__\.\$I9-0 == null\) \? \(GpuDeviceInfo\._Closure\$__\.\$I9-0 = delegate\(GpuDeviceInfo a, GpuDeviceInfo b\)\r\n(\t+)\{.*?\}\) : GpuDeviceInfo\._Closure\$__\.\$I9-0\);',- lambda m: ('list.Sort((a, b) =>\r\n'- + m.group(1) + '{\r\n'- + m.group(1) + '\t// discrete GPUs first, then by score descending\r\n'- + m.group(1) + '\tif (a.Discrete != b.Discrete)\r\n'- + m.group(1) + '\t{\r\n'- + m.group(1) + '\t\treturn a.Discrete ? -1 : 1;\r\n'- + m.group(1) + '\t}\r\n'- + m.group(1) + '\treturn b.Score.CompareTo(a.Score);\r\n'- + m.group(1) + '});'))--patch('Wave_Dude_2D/ProjectStore.cs',- r'list\.Sort\(\(ProjectStore\._Closure\$__\.\$I14-0 == null\) \? \(ProjectStore\._Closure\$__\.\$I14-0 = \(string a, string b\) => string\.Compare\(a, b, StringComparison\.OrdinalIgnoreCase\)\) : ProjectStore\._Closure\$__\.\$I14-0\);',- 'list.Sort((a, b) => string.Compare(a, b, StringComparison.OrdinalIgnoreCase));')diff --git a/_tools/library_check/Program.cs b/_tools/library_check/Program.csindex 64fffff..aacc86c 100644--- a/_tools/library_check/Program.cs+++ b/_tools/library_check/Program.cs@@ -1239,10 +1239,6 @@ internal static class ProgramCheck(p.Sources[0] is { Array: null, DetachAfter: 670, PulseWidth: 70, OffWidth: 100, Frequency: 200 } && p.Simulation.TimeDecay == 8 && p.Display.Intensity.ColorScheme == "Copper", "a single detaching source (its unused array settings ignored), decay 8, Copper");Check(p.Scene.Mode == SceneMode.Image && p.Scene.ImageData == null && notes.Count == 1, "image mode with the image missing: one note");- // a source the author never placed- notes.Clear();- p = LegacyProject.Import(Path.Combine(root, "Project", "Test", "configuration.json"), notes, out _);- Check(p.Sources.Count == 1 && !p.Sources[0].Enabled && notes.Any(n => n.Contains("no position")) && p.Simulation.TimeDecay == 5, "Test: a source without a position comes in disabled and noted");bool refused = false;string newer = Path.Combine(Path.GetTempPath(), "library_check-newer.json");File.WriteAllText(newer, "{ \"format_version\": 2 }");diff --git a/_tools/modernize.py b/_tools/modernize.pydeleted file mode 100644index 09f5c99..0000000--- a/_tools/modernize.py+++ /dev/null@@ -1,52 +0,0 @@-"""Mechanical C# modernisation of the hand-maintained files (not *.Designer.cs, not My/):-- 1. block-bodied single-return getters -> expression-bodied (`=> expr;` / `get => expr;`)- 2. single-statement setters -> `set => stmt;`- 3. single-return / single-statement methods of trivial shape stay as they are (readability)- 4. `this.member` qualification removed (the project style; a following build with- CS1717 (self-assignment) as a tripwire catches any parameter/field shadowing)-"""-import glob, re, sys--SRC = 'Wave_Dude_2D'-NL = r'\r?\n'--# { get { return X; } } with no setter -> => X;-GETTER_ONLY = re.compile(- r'(?P<head>^(?P<ind>\t+)(?P<decl>(?:public|internal|protected|private)(?: static| override| virtual| new| readonly)* [^\r\n=;{]+?[A-Za-z0-9_]+))' + NL +- r'(?P=ind)\{' + NL +- r'(?P=ind)\tget' + NL +- r'(?P=ind)\t\{' + NL +- r'(?P=ind)\t\treturn (?P<expr>[^\r\n]+);' + NL +- r'(?P=ind)\t\}' + NL +- r'(?P=ind)\}', re.M)--# get { return X; } (inside a property that also has a setter) -> get => X;-GETTER_IN = re.compile(- r'^(?P<ind>\t+)get' + NL + r'(?P=ind)\{' + NL + r'(?P=ind)\treturn (?P<expr>[^\r\n]+);' + NL + r'(?P=ind)\}', re.M)--# set { one statement; } -> set => one statement;-SETTER_IN = re.compile(- r'^(?P<ind>\t+)set' + NL + r'(?P=ind)\{' + NL + r'(?P=ind)\t(?P<stmt>[^\r\n{}]+;)' + NL + r'(?P=ind)\}', re.M)--THIS = re.compile(r'\bthis\.(?=[A-Za-z_])')--def modernize(text):- before = text- text = GETTER_ONLY.sub(lambda m: '%s%s => %s;' % (m.group('ind'), m.group('decl'), m.group('expr')), text)- text = GETTER_IN.sub(lambda m: '%sget => %s;' % (m.group('ind'), m.group('expr')), text)- text = SETTER_IN.sub(lambda m: '%sset => %s' % (m.group('ind'), m.group('stmt')), text)- text = THIS.sub('', text)- return text--total = 0-for path in sorted(glob.glob(SRC + '/*.cs')):- if path.endswith('.Designer.cs'):- continue- raw = open(path, 'rb').read().decode('utf-8')- new = modernize(raw)- if new != raw:- open(path, 'wb').write(new.encode('utf-8'))- total += 1- print('modernized', path)-print(total, 'files changed')diff --git a/_tools/replace_method.py b/_tools/replace_method.pydeleted file mode 100644index 4d4c8c0..0000000--- a/_tools/replace_method.py+++ /dev/null@@ -1,32 +0,0 @@-"""Replace one method body in a decompiled .cs file, preserving BOM + CRLF.--usage: replace_method.py <file.cs> <signature-substring> <replacement.txt>--The method is located by the first line containing <signature-substring>;-the replaced range runs from any directly preceding '// Token:' comment lines-to the closing brace at the same indentation as the signature line.-"""-import sys--path, sig, repl_path = sys.argv[1:4]-raw = open(path, 'rb').read()-bom = raw.startswith(b'\xef\xbb\xbf')-text = raw.decode('utf-8-sig')-lines = text.split('\r\n')--start = next(i for i, l in enumerate(lines) if sig in l)-indent = lines[start][:len(lines[start]) - len(lines[start].lstrip('\t'))]-# swallow preceding decompiler comment lines-while start > 0 and lines[start - 1].strip().startswith('//'):- start -= 1-end = start-while end < len(lines) and lines[end] != indent + '}':- end += 1-if end == len(lines):- sys.exit('closing brace not found for ' + sig)--repl = open(repl_path, 'rb').read().decode('utf-8-sig').replace('\r\n', '\n').rstrip('\n').split('\n')-lines[start:end + 1] = repl-out = '\r\n'.join(lines).encode('utf-8')-open(path, 'wb').write((b'\xef\xbb\xbf' if bom else b'') + out)-print('%s: replaced lines %d-%d with %d lines' % (path, start + 1, end + 1, len(repl)))diff --git a/_tools/split_form1.py b/_tools/split_form1.pydeleted file mode 100644index 4024530..0000000--- a/_tools/split_form1.py+++ /dev/null@@ -1,64 +0,0 @@-"""Split Form1.cs into partial-class files along its feature seams (no code changes).--Each section starts at the named method (including the decompiler comment lines-directly above it) and runs to the line before the next section. The Sources-section ends before the first field token comment (`// Token: 0x04...`).-Fields and nested types stay in Form1.cs. Adds the new files to the csproj.-"""-import re--SRC = 'Wave_Dude_2D/'-SECTIONS = [- ('Form1.Projects.cs', 'BuildProjectEntries'),- ('Form1.Output.cs', 'InitializeOutputsTab'),- ('Form1.Scene.cs', 'InitializeSceneControls'),- ('Form1.Colors.cs', 'btbChooseFFolder_Click'),- ('Form1.Simulation.cs', 'InitializeSimulationControls'),- ('Form1.Probes.cs', 'ProbeUi'),- ('Form1.Sources.cs', 'InitializeSourceControls'),-]--raw = open(SRC + 'Form1.cs', 'rb').read()-lines = raw.decode('utf-8-sig').split('\r\n')--def method_start(name):- sig = re.compile(r'^\t\t(private|public|internal|protected)[^=]*\b' + re.escape(name) + r'\(')- i = next(i for i, l in enumerate(lines) if sig.match(l))- while lines[i - 1].strip().startswith('//'):- i -= 1- return i--starts = [method_start(m) for _, m in SECTIONS]-last_method = starts[-1]-fields_start = next(i for i in range(last_method, len(lines)) if re.match(r'^\t\t// Token: 0x04', lines[i]))-bounds = starts + [fields_start]--header_end = next(i for i, l in enumerate(lines) if l.startswith('namespace '))-usings = lines[:header_end]--def wrap(body):- out = list(usings) + ['namespace _2D_wave_sim_V01', '{', '\tpublic partial class Form1', '\t{']- # trim leading/trailing blank lines of the body- while body and body[0] == '':- body.pop(0)- while body and body[-1] == '':- body.pop()- out += body + ['\t}', '}', '']- return out--for (fname, _), a, b in zip(SECTIONS, bounds, bounds[1:]):- open(SRC + fname, 'wb').write(b'\xef\xbb\xbf' + '\r\n'.join(wrap(lines[a:b])).encode('utf-8'))- print('%-22s lines %5d-%5d (%d)' % (fname, a + 1, b, b - a))--core = lines[:starts[0]] + lines[fields_start:]-open(SRC + 'Form1.cs', 'wb').write(b'\xef\xbb\xbf' + '\r\n'.join(core).encode('utf-8'))-print('Form1.cs now %d lines' % len(core))--proj = SRC + 'Wave_Dude_2D.csproj'-p = open(proj, 'rb').read().decode('utf-8-sig')-items = ''.join(' <Compile Include="%s">\r\n <DependentUpon>Form1.cs</DependentUpon>\r\n </Compile>\r\n' % f for f, _ in SECTIONS)-anchor = ' <Compile Include="Form1.Designer.cs">\r\n <DependentUpon>Form1.cs</DependentUpon>\r\n </Compile>\r\n'-assert anchor in p-p = p.replace(anchor, anchor + items, 1)-open(proj, 'wb').write(b'\xef\xbb\xbf' + p.encode('utf-8'))-print('csproj updated')