Skip to content

Commit

Permalink
Merged PR 602: Fix infinite loop and reduce form sizes to suit screen…
Browse files Browse the repository at this point in the history
… of 1366x768

# Thank you for your contribution to the Chem4Word project.

## Please enter description of what these changes are for
Fix infinite loop and reduce form sizes to suit screen of 1366x768

## 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
- [ ] CodeMaid has been run against all new or updated files
- [X] The code builds clean 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)
- [ ] If appropriate you have updated the manual (/docs/Chem4Word-Version3-2-User-Manual.docx)
- [X] The build pipeline is green

Fix infinate loop and reduce form sizes

Related work items: #1070
  • Loading branch information
MikeWilliams-UK committed Mar 20, 2023
1 parent be6fea8 commit be54e7e
Show file tree
Hide file tree
Showing 30 changed files with 89 additions and 119 deletions.
27 changes: 12 additions & 15 deletions src/Chem4Word.V3/Data/Chem4Word-Versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@
<!-- This file must be uploaded to https://www.chem4word.co.uk/files3-2/ folder as Chem4Word-Versions.xml -->
<ChangeLog>
<Id>f3c4f4db-2fff-46db-b14a-feb8e09f7742</Id>
<Version>
<Number>3.2.10 Release 6</Number>
<IsBeta>false</IsBeta>
<Released>31-Mar-2023</Released>
<Changes>
<Change>...</Change>
<Change>...</Change>
<Change>...</Change>
<Change>...</Change>
<Change>Please note any previous beta versions V3.2.4 and below will cease to allow insertion or editing of chemistry</Change>
<Change>If you like our product, please consider buying us a coffee at https://www.buymeacoffee.com/chem4word</Change>
<Change>Please download Chem4Word-Setup.exe via https://www.chem4word.co.uk/download/ if you encounter any difficulties updating</Change>
</Changes>
<Url>https://www.chem4word.co.uk/files3-2/Chem4Word-Setup.3.2.10.Release.6.msi</Url>
</Version>
<Version>
<Number>3.2.10 Release 6</Number>
<IsBeta>false</IsBeta>
<Released>22-Mar-2023</Released>
<Changes>
<Change>Fix infinite loop and reduce form sizes to suit screen of 1366x768</Change>
<Change>Please note any previous beta versions V3.2.4 and below will cease to allow insertion or editing of chemistry</Change>
<Change>If you like our product, please consider buying us a coffee at https://www.buymeacoffee.com/chem4word</Change>
<Change>Please download Chem4Word-Setup.exe via https://www.chem4word.co.uk/download/ if you encounter any difficulties updating</Change>
</Changes>
<Url>https://www.chem4word.co.uk/files3-2/Chem4Word-Setup.3.2.10.Release.6.msi</Url>
</Version>
<Version>
<Number>3.2.9 Release 5</Number>
<IsBeta>false</IsBeta>
Expand Down
2 changes: 1 addition & 1 deletion src/Chem4Word.V3/Data/This-Version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<Version>
<Number>3.2.10 Release 6</Number>
<IsBeta>false</IsBeta>
<Released>31-Mar-2023</Released>
<Released>22-Mar-2023</Released>
</Version>
4 changes: 2 additions & 2 deletions src/Chem4Word.V3/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
18 changes: 9 additions & 9 deletions src/Chem4Word.V3/UI/WPF/EditLabelsHost.Designer.cs

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

4 changes: 2 additions & 2 deletions src/Chemistry/Chem4Word.ACME/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
4 changes: 2 additions & 2 deletions src/Chemistry/Chem4Word.Libraries/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
4 changes: 2 additions & 2 deletions src/Chemistry/Chem4Word.Model2/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
47 changes: 10 additions & 37 deletions src/Common/Chem4Word.Core/Helpers/PointHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,65 +19,38 @@ public static bool PointIsEmpty(Point point)
/// <summary>
/// Returns a point which can be used as the top left hand corner of a form without hiding any part of it off bottom right of current screen
/// </summary>
/// <param name="point"></param>
/// <param name="screen"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="point">Starting point</param>
/// <param name="screen">Screen object</param>
/// <param name="width">Desired width</param>
/// <param name="height">Desired Height</param>
/// <returns></returns>
public static Point SensibleTopLeft(Point point, Screen screen, int width, int height)
{
var left = Clamp((int)point.X, width, screen.WorkingArea.Left, screen.WorkingArea.Left + screen.WorkingArea.Width);
var top = Clamp((int)point.Y, height, screen.WorkingArea.Top, screen.WorkingArea.Top + screen.WorkingArea.Height);

//var maximumRight = screen.WorkingArea.Left + screen.WorkingArea.Width;
//var maximumBottom = screen.WorkingArea.Top + screen.WorkingArea.Height;

//while (left + width > maximumRight)
//{
// left -= 24;
// if (left < screen.WorkingArea.Left)
// {
// left = screen.WorkingArea.Left;
// }
//}

//while (left < screen.WorkingArea.Left)
//{
// left += 24;
//}

//while (top + height > maximumBottom)
//{
// top -= 24;
// if (top < screen.WorkingArea.Top)
// {
// top = screen.WorkingArea.Top;
// }
//}

//while (top < screen.WorkingArea.Top)
//{
// top += 24;
//}

return new Point(left, top);
}

private static int Clamp(int leftOrTop, int widthOrHeight, int workingAreaLeftOrTop, int workingAreaWidthOrHeight)
{
var result = leftOrTop;

while (result + widthOrHeight > workingAreaWidthOrHeight)
var loops = 0;
while (loops < 16 && result + widthOrHeight > workingAreaWidthOrHeight)
{
loops++;
result -= 24;
if (result < workingAreaLeftOrTop)
{
result = workingAreaLeftOrTop;
}
}

while (result < workingAreaLeftOrTop)
loops = 0;
while (loops < 16 && result < workingAreaLeftOrTop)
{
loops++;
result += 24;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Common/Chem4Word.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
4 changes: 2 additions & 2 deletions src/Common/Chem4Word.Telemetry/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
4 changes: 2 additions & 2 deletions src/Installer/Chem4WordSetup/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
4 changes: 2 additions & 2 deletions src/Installer/Chem4WordUpdater/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
4 changes: 2 additions & 2 deletions src/Installer/WiX.CustomAction/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
2 changes: 1 addition & 1 deletion src/Installer/WiXInstaller/Product.wxs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- For automatic upgrade to work only first three parts of version number are used -->
<Product Id="*" Name="Chemistry Add-In for Microsoft Word 2022 Release 6" Manufacturer="Chem4Word" Version="3.2.10.8490" UpgradeCode="865226e7-d29d-49aa-a390-dda49979b102" Language="1033">
<Product Id="*" Name="Chemistry Add-In for Microsoft Word 2022 Release 6" Manufacturer="Chem4Word" Version="3.2.10.8481" UpgradeCode="865226e7-d29d-49aa-a390-dda49979b102" Language="1033">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of Chem4Word is already installed." />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" CompressionLevel="high" />
Expand Down
2 changes: 1 addition & 1 deletion src/Notes/Releases.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Set Build Numbers

.\Set-Assembly-Version.ps1 -version 3.2.10 -name "Release 6" -released "31-Mar-2023" -path ..
.\Set-Assembly-Version.ps1 -version 3.2.10 -name "Release 6" -released "22-Mar-2023" -path ..

.\Set-Assembly-Version.ps1 -version 3.2.9 -name "Release 5" -released "17-Mar-2023" -path ..
.\Set-Assembly-Version.ps1 -version 3.2.8 -name "Release 4" -released "15-Feb-2023" -path ..
Expand Down
4 changes: 2 additions & 2 deletions src/PlugIns/Contracts/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
18 changes: 9 additions & 9 deletions src/PlugIns/Editors/Chem4Word.Editor.ACME/EditorHost.Designer.cs

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

Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
4 changes: 2 additions & 2 deletions src/PlugIns/Renderers/OoXmlV4/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.10.8490")]
[assembly: AssemblyFileVersion("3.2.10.8490")]
[assembly: AssemblyVersion("3.2.10.8481")]
[assembly: AssemblyFileVersion("3.2.10.8481")]
Loading

0 comments on commit be54e7e

Please sign in to comment.