Skip to content

Commit

Permalink
Merged PR 663: Restore lost delete button from library
Browse files Browse the repository at this point in the history
Related work items: #1124
  • Loading branch information
MikeWilliams-UK committed Feb 7, 2024
1 parent 5359112 commit d7e00ed
Show file tree
Hide file tree
Showing 30 changed files with 98 additions and 71 deletions.
4 changes: 2 additions & 2 deletions src/Chem4Word.V3/Data/Chem4Word-Versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<Version>
<Number>3.2.17 Release 12</Number>
<IsBeta>false</IsBeta>
<Released>31-Jan-2024</Released>
<Released>07-Feb-2024</Released>
<Changes>
<Change>...</Change>
<Change>...</Change>
<Change>BugFix: Restore missing delete button from library</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>
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.17 Release 12</Number>
<IsBeta>false</IsBeta>
<Released>31-Jan-2024</Released>
<Released>07-Feb-2024</Released>
</Version>
10 changes: 5 additions & 5 deletions src/Chem4Word.V3/Library/LibraryController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public LibraryController(TelemetryWriter telemetry, LibraryOptions libraryOption
_telemetry = telemetry;
_libraryOptions = libraryOptions;

ChemistryItems = new ObservableCollection<ACME.Models.ChemistryObject>();
ChemistryItems = new ObservableCollection<ChemistryObject>();
ChemistryItems.CollectionChanged += ChemistryItems_CollectionChanged;

LoadChemistryItems();
}

private void LoadChemistryItems()
public void LoadChemistryItems()
{
string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";
try
Expand All @@ -57,7 +57,7 @@ private void LoadChemistryItems()

foreach (var chemistryDto in dto)
{
var obj = new ACME.Models.ChemistryObject
var obj = new ChemistryObject
{
Id = chemistryDto.Id,
Cml = chemistryDto.Cml,
Expand Down Expand Up @@ -118,7 +118,7 @@ private void DeleteChemistry(IList eOldItems)
if (!_initializing)
{
var lib = new Libraries.Database.Library(_telemetry, _libraryOptions);
foreach (ACME.Models.ChemistryObject chemistry in eOldItems)
foreach (ChemistryObject chemistry in eOldItems)
{
lib.DeleteChemistry(chemistry.Id);
}
Expand All @@ -141,7 +141,7 @@ private void AddNewChemistry(IList eNewItems)
if (!_initializing)
{
var lib = new Libraries.Database.Library(_telemetry, _libraryOptions);
foreach (ACME.Models.ChemistryObject chemistry in eNewItems)
foreach (ChemistryObject chemistry in eNewItems)
{
var cmlConverter = new CMLConverter();
chemistry.Id = lib.AddChemistry(cmlConverter.Import(chemistry.Cml), chemistry.Name, chemistry.Formula);
Expand Down
10 changes: 2 additions & 8 deletions src/Chem4Word.V3/Library/LibraryViewControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,11 @@
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid>
<ComboBox FontSize="16" SelectedIndex="0">
<ComboBoxItem>Library.db</ComboBoxItem>
</ComboBox>
</Grid>
<GroupBox
Grid.Row="1"
Grid.Row="0"
Background="White"
BorderBrush="{StaticResource Chem4WordBlue}"
BorderThickness="2"
Expand Down Expand Up @@ -149,7 +143,7 @@
</Button>
</Grid>
</GroupBox>
<Grid Grid.Row="2">
<Grid Grid.Row="1">
<ListBox
x:Name="LibraryList"
HorizontalAlignment="Stretch"
Expand Down
18 changes: 18 additions & 0 deletions src/Chem4Word.V3/Library/LibraryViewControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@

using Chem4Word.ACME;
using Chem4Word.ACME.Models;
using Chem4Word.Core;
using Chem4Word.Core.UI.Forms;
using Chem4Word.Core.UI.Wpf;
using Chem4Word.Helpers;
using System;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
using UserControl = System.Windows.Controls.UserControl;

namespace Chem4Word.Library
{
Expand Down Expand Up @@ -76,6 +81,19 @@ private void OnItemButtonClick(object sender, RoutedEventArgs e)
case "Library|InsertCopy":
TaskPaneHelper.InsertChemistry(true, Globals.Chem4WordV3.Application, clicked.Cml, true);
break;

case "Library|DeleteStructure":
StringBuilder sb = new StringBuilder();
sb.AppendLine("Do you wish to delete the chemistry?");
sb.AppendLine($" {clicked.Name}");
DialogResult dr = UserInteractions.AskUserYesNo(sb.ToString());
if (dr == DialogResult.Yes)
{
var lib = new Libraries.Database.Library(Globals.Chem4WordV3.Telemetry, Globals.Chem4WordV3.LibraryOptions);
lib.DeleteChemistry(clicked.Id);
controller.LoadChemistryItems();
}
break;
}
}

Expand Down
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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
33 changes: 24 additions & 9 deletions src/Chemistry/Chem4Word.ACME/Controls/ChemistryItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,31 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ItemsControl
<Button
Grid.Column="0"
MinHeight="15"
Foreground="{StaticResource Chem4WordBlue}"
ItemsSource="{Binding Path=Tags}"
Style="{StaticResource TagListStyle}">
<i:Interaction.Behaviors>
<behaviors:IgnoreMouseWheelBehavior />
</i:Interaction.Behaviors>
</ItemsControl>
Width="32"
Height="32"
Click="OnItemButtonClick"
HorizontalAlignment="Left"
Style="{StaticResource NavButtonStyle}"
Tag="Library|DeleteStructure">
<Button.ToolTip>Delete the chemistry from your library</Button.ToolTip>
<Viewbox Stretch="Uniform">
<Canvas
Width="32"
Height="32"
ClipToBounds="True">
<Path
Canvas.Left="4"
Canvas.Top="4"
Width="24"
Height="24"
Fill="{StaticResource Chem4WordBlue}"
Stretch="Fill"
Style="{StaticResource DelButtonPath}" />
</Canvas>
</Viewbox>
</Button>
<Button
Grid.Column="1"
Width="32"
Expand Down
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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
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 12" Manufacturer="Chem4Word" Version="3.2.17.8796" UpgradeCode="865226e7-d29d-49aa-a390-dda49979b102" Language="1033">
<Product Id="*" Name="Chemistry Add-In for Microsoft Word 2022 Release 12" Manufacturer="Chem4Word" Version="3.2.17.8803" 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.17 -name "Release 12" -released "31-Jan-2024" -path ..
.\Set-Assembly-Version.ps1 -version 3.2.17 -name "Release 12" -released "07-Feb-2024" -path ..

.\Set-Assembly-Version.ps1 -version 3.2.16 -name "Release 11" -released "17-Jan-2024" -path ..
.\Set-Assembly-Version.ps1 -version 3.2.15 -name "Release 10" -released "22-Dec-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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
4 changes: 2 additions & 2 deletions src/TestHarness/Wpf.UI.Sandbox/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.2.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]
4 changes: 2 additions & 2 deletions src/UnitTests/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.17.8796")]
[assembly: AssemblyFileVersion("3.2.17.8796")]
[assembly: AssemblyVersion("3.2.17.8803")]
[assembly: AssemblyFileVersion("3.2.17.8803")]

0 comments on commit d7e00ed

Please sign in to comment.