Skip to content

Commit

Permalink
Merged PR 703: Add Implicit H&C Heirarchy
Browse files Browse the repository at this point in the history
# Thank you for your contribution to the Chem4Word project.

## Please enter description of what these changes are for
**Describe the changes being made to the code and why**

## Before submitting this PR for code review, please make sure:
- [X] "Describe the changes being made to the code and why" above has been replaced
- [X] All new files have the standard license headers
- [X] CodeMaid has been run against all new or updated files
- [X] The code builds clean (please check Debug and Setup configurations) without any errors or new warnings
- [ ] All NuGet packages have been updated and /README.md updated
- [X] All Unit Tests pass
- [X] You have followed the [Chem4Word Coding Standards](https://chem4word.visualstudio.com/C4W-VNext/_wiki/wikis/C4W-VNext.wiki/2/Coding-Standards)
- [X] You have updated the change history (/src/Chem4Word.V3/Data/Chem4Word-Versions.xml)
- [X] If appropriate you have updated the manual (/docs/Chem4Word-Version3-3-User-Manual.docx)
- [X] The build pipeline is green

Related work items: #969
  • Loading branch information
MikeWilliams-UK committed Feb 19, 2025
1 parent 7cb989f commit cd03b87
Show file tree
Hide file tree
Showing 298 changed files with 6,388 additions and 8,355 deletions.
Binary file modified docs/Chem4Word-Version3-3-User-Manual.docx
Binary file not shown.
28 changes: 0 additions & 28 deletions src/Chem4Word.V3-3.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chem4Word.V3", "Chem4Word.V
{061F7B7B-89AE-4095-B3BB-B297F015A038} = {061F7B7B-89AE-4095-B3BB-B297F015A038}
{0EB3EFF1-FA71-4E65-8B4F-4C6FC632817B} = {0EB3EFF1-FA71-4E65-8B4F-4C6FC632817B}
{1049E49F-753E-4C98-ACAF-BE4250C2DC3D} = {1049E49F-753E-4C98-ACAF-BE4250C2DC3D}
{666B7E5E-D48A-42CF-91A6-8E58E90B830D} = {666B7E5E-D48A-42CF-91A6-8E58E90B830D}
{7A4F7024-DFBF-416F-A7E3-E2D04F971ABE} = {7A4F7024-DFBF-416F-A7E3-E2D04F971ABE}
{A73732B0-FF0A-488E-B353-C238A9085C63} = {A73732B0-FF0A-488E-B353-C238A9085C63}
{BB7BD7A5-B266-402C-9C53-A42B5A07D101} = {BB7BD7A5-B266-402C-9C53-A42B5A07D101}
Expand Down Expand Up @@ -83,8 +82,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{1B81DF60
Notes\Solution Notes.txt = Notes\Solution Notes.txt
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chem4Word.Editor.ChemDoodleWeb800", "PlugIns\Editors\ChemDoodleWeb.800\Chem4Word.Editor.ChemDoodleWeb800.csproj", "{666B7E5E-D48A-42CF-91A6-8E58E90B830D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chem4Word.ACME", "Chemistry\Chem4Word.ACME\Chem4Word.ACME.csproj", "{1E3FC1F1-06CC-44BD-8004-3EF0CE7EEAA7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chem4Word.Editor.ACME", "PlugIns\Editors\Chem4Word.Editor.ACME\Chem4Word.Editor.ACME.csproj", "{D81EFA27-A4EF-4F75-B5D8-9BB06AB76091}"
Expand Down Expand Up @@ -501,30 +498,6 @@ Global
{D8A20813-2BAC-4094-9586-927121C10D06}.Vso-Ci|x64.Build.0 = Release|x86
{D8A20813-2BAC-4094-9586-927121C10D06}.Vso-Ci|x86.ActiveCfg = Release|x86
{D8A20813-2BAC-4094-9586-927121C10D06}.Vso-Ci|x86.Build.0 = Release|x86
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Debug|x64.ActiveCfg = Debug|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Debug|x64.Build.0 = Debug|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Debug|x86.ActiveCfg = Debug|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Debug|x86.Build.0 = Debug|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Release|Any CPU.Build.0 = Release|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Release|x64.ActiveCfg = Release|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Release|x64.Build.0 = Release|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Release|x86.ActiveCfg = Release|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Release|x86.Build.0 = Release|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Setup|Any CPU.ActiveCfg = Setup|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Setup|Any CPU.Build.0 = Setup|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Setup|x64.ActiveCfg = Setup|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Setup|x64.Build.0 = Setup|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Setup|x86.ActiveCfg = Setup|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Setup|x86.Build.0 = Setup|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Vso-Ci|Any CPU.ActiveCfg = Vso-Ci|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Vso-Ci|Any CPU.Build.0 = Vso-Ci|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Vso-Ci|x64.ActiveCfg = Vso-Ci|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Vso-Ci|x64.Build.0 = Vso-Ci|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Vso-Ci|x86.ActiveCfg = Vso-Ci|Any CPU
{666B7E5E-D48A-42CF-91A6-8E58E90B830D}.Vso-Ci|x86.Build.0 = Vso-Ci|Any CPU
{1E3FC1F1-06CC-44BD-8004-3EF0CE7EEAA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E3FC1F1-06CC-44BD-8004-3EF0CE7EEAA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E3FC1F1-06CC-44BD-8004-3EF0CE7EEAA7}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -738,7 +711,6 @@ Global
{3F2A5C9A-1776-4252-B370-5965362A94E6} = {738340DC-D00E-4A6F-A715-552CA5C5C6C6}
{EB6953E3-E0C3-468D-BD7E-2811CB275C75} = {738340DC-D00E-4A6F-A715-552CA5C5C6C6}
{D8A20813-2BAC-4094-9586-927121C10D06} = {738340DC-D00E-4A6F-A715-552CA5C5C6C6}
{666B7E5E-D48A-42CF-91A6-8E58E90B830D} = {C14AF02F-B11C-4479-8E8F-4F520FCB8D50}
{1E3FC1F1-06CC-44BD-8004-3EF0CE7EEAA7} = {0A7C66AA-7788-4EA5-AC94-8CBB354010CD}
{D81EFA27-A4EF-4F75-B5D8-9BB06AB76091} = {C14AF02F-B11C-4479-8E8F-4F520FCB8D50}
{C69BAB8F-4881-4D5F-9929-FC8470DF1E48} = {0A7C66AA-7788-4EA5-AC94-8CBB354010CD}
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Chem4Word.V3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@
<Compile Include="Helpers\ApiHelper.cs" />
<Compile Include="Helpers\ChemistryHelper.cs" />
<Compile Include="Helpers\ChemistryObjectComparer.cs" />
<Compile Include="Helpers\ConfigWatcher.cs" />
<Compile Include="Helpers\DtoHelper.cs" />
<Compile Include="Helpers\LibraryFileHelper.cs" />
<Compile Include="Helpers\ReferenceKeeper.cs" />
Expand Down Expand Up @@ -531,6 +530,7 @@
<Content Include="Resources\Button Images\Office-2016\Navigator-Toggle.png" />
<Content Include="Resources\Button Images\Office-2016\Seperate-Molecules.png" />
<Content Include="Resources\Button Images\Office-2016\WebSearch.png" />
<Content Include="Resources\Button Images\Pound.png" />
<Content Include="Resources\Button Images\Settings.png" />
<Content Include="Resources\Button Images\Shield-Danger.png" />
<Content Include="Resources\Button Images\Shield-Good.png" />
Expand Down
65 changes: 60 additions & 5 deletions src/Chem4Word.V3/Chem4WordOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

using Chem4Word.Core.Helpers;
using Chem4Word.Helpers;
using Chem4Word.Model2.Enums;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
Expand All @@ -21,7 +22,6 @@ namespace Chem4Word
[JsonObject(MemberSerialization.OptIn)]
public class Chem4WordOptions
{
private const int DefaultCheckInterval = 7;
private const bool DefaultCheckingEnabled = true;

private static string _product = Assembly.GetExecutingAssembly().FullName.Split(',')[0];
Expand Down Expand Up @@ -77,6 +77,22 @@ public class Chem4WordOptions

#endregion General

#region Rendering Options

[JsonProperty]
public HydrogenLabels ExplicitH { get; set; } = HydrogenLabels.HeteroAndTerminal;

[JsonProperty]
public bool ExplicitC { get; set; }

[JsonProperty]
public bool ShowColouredAtoms { get; set; } = true;

[JsonProperty]
public bool ShowMoleculeGrouping { get; set; } = true;

#endregion Rendering Options

// Not serialised
public Point WordTopLeft { get; set; }

Expand Down Expand Up @@ -121,9 +137,14 @@ public void RestoreDefaults()
RemoveExplicitHydrogensOnImportFromSearch = false;
RemoveExplicitHydrogensOnImportFromLibrary = false;

ShowColouredAtoms = true;
ExplicitC = false;
ExplicitH = HydrogenLabels.HeteroAndTerminal;
ShowMoleculeGrouping = true;

// Non serialised settings
AutoUpdateEnabled = DefaultCheckingEnabled;
AutoUpdateFrequency = DefaultCheckInterval;
AutoUpdateFrequency = Constants.DefaultCheckInterval;
}

public Chem4WordOptions Clone()
Expand Down Expand Up @@ -170,16 +191,17 @@ public void Load()
if (string.IsNullOrEmpty(fileContents))
{
RegistryHelper.StoreMessage(module, $"Setting {optionsFileForLogs} to defaults because it's empty");
Debugger.Break();

RestoreDefaults();
PersistOptions(optionsFile);
}
else
{
var settings = new JsonSerializerSettings
{
CheckAdditionalContent = false
};
{
CheckAdditionalContent = false
};
var options = JsonConvert.DeserializeObject<Chem4WordOptions>(fileContents, settings);
SetValuesFromCopy(options);

Expand Down Expand Up @@ -245,6 +267,11 @@ private void SetValuesFromCopy(Chem4WordOptions copy)
RemoveExplicitHydrogensOnImportFromSearch = copy.RemoveExplicitHydrogensOnImportFromSearch;
RemoveExplicitHydrogensOnImportFromLibrary = copy.RemoveExplicitHydrogensOnImportFromLibrary;

ShowColouredAtoms = copy.ShowColouredAtoms;
ExplicitC = copy.ExplicitC;
ExplicitH = copy.ExplicitH;
ShowMoleculeGrouping = copy.ShowMoleculeGrouping;

// Non serialised settings
AutoUpdateEnabled = copy.AutoUpdateEnabled;
AutoUpdateFrequency = copy.AutoUpdateFrequency;
Expand Down Expand Up @@ -313,5 +340,33 @@ private void PersistOptions(string filename)
Errors.Add(exception.StackTrace);
}
}

public bool AreDefault()
{
var result = TelemetryEnabled

&& SelectedEditorPlugIn == Constants.DefaultEditorPlugIn
&& SelectedRendererPlugIn == Constants.DefaultRendererPlugIn

&& BondLength == (int)Constants.StandardBondLength

&& SetBondLengthOnImportFromFile
&& SetBondLengthOnImportFromSearch
&& SetBondLengthOnImportFromLibrary

&& !RemoveExplicitHydrogensOnImportFromFile
&& !RemoveExplicitHydrogensOnImportFromSearch
&& !RemoveExplicitHydrogensOnImportFromLibrary

&& ShowColouredAtoms
&& !ExplicitC
&& ExplicitH == HydrogenLabels.HeteroAndTerminal
&& ShowMoleculeGrouping

&& AutoUpdateEnabled
&& AutoUpdateFrequency == 7;

return result;
}
}
}
Loading

0 comments on commit cd03b87

Please sign in to comment.