From e3f8d8da748bed3a436f3c095b6d86d9dd52f526 Mon Sep 17 00:00:00 2001 From: josephmyers <43733878+josephmyers@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:30:30 +0700 Subject: [PATCH] .NET8 Windows for SIL.Windows.Forms (#1358) --- .github/workflows/build.yml | 2 +- Palaso.sln | 7 - .../i18n/StringCatalogTests.cs | 4 + SIL.Core.Desktop/i18n/StringCatalog.cs | 3 + SIL.Core.Tests/IO/PathHelperTests.cs | 4 +- SIL.Core.Tests/IO/TempFileTests.cs | 2 +- SIL.Core.Tests/Xml/XmlUtilsTests.cs | 11 - .../LexEntryRepositoryCachingTests.cs | 6 +- SIL.Lift.Tests/Parsing/ExtensibleMatcher.cs | 14 +- .../Parsing/LiftMultiTextAnnotationMatcher.cs | 15 + SIL.Lift.Tests/Parsing/TraitMatcher.cs | 12 + .../SIL.Windows.Forms.Archiving.csproj | 1 - .../SIL.Windows.Forms.DblBundle.csproj | 1 - .../App.config | 8 - ...SIL.Windows.Forms.Keyboarding.Tests.csproj | 2 +- .../SIL.Windows.Forms.Keyboarding.csproj | 2 +- SIL.Windows.Forms.Tests/App.config | 8 - .../ClearShare/CreativeCommonsLicenseTests.cs | 2 + .../ImageToolbox/ImageToolboxTests.cs | 188 ------ .../Progress/LogBox/LogBoxTests.cs | 2 - .../SIL.Windows.Forms.Tests.csproj | 5 +- .../SettingsProviderTests.cs | 103 ++- .../App.config | 8 - .../LanguageLookupControlTests.cs | 2 + .../LanguageLookupModelTests.cs | 7 + .../SIL.Windows.Forms.WritingSystems.csproj | 1 - .../WritingSystemSetupModel.cs | 2 + .../LinuxClipboard.NativeMethods.cs | 2 +- .../FolderBrowserControl.cs | 12 +- SIL.Windows.Forms/HotSpot/HotSpotProvider.cs | 1 - SIL.Windows.Forms/HtmlBrowser/XWebBrowser.cs | 2 +- .../AcquireImageControl.Designer.cs | 226 ------- .../ImageToolbox/AcquireImageControl.cs | 585 ------------------ .../ImageToolbox/AcquireImageControl.resx | 356 ----------- .../ImageToolbox/Cropping/Grip.cs | 169 ----- .../ImageToolbox/Cropping/ImageCropper.cs | 511 --------------- .../Cropping/ImageCropper.designer.cs | 39 -- .../ImageToolbox/Cropping/ImageCropper.resx | 120 ---- .../ImageGalleryControl.Designer.cs | 258 -------- .../ImageGallery/ImageGalleryControl.cs | 498 --------------- .../ImageGallery/ImageGalleryControl.resx | 126 ---- .../ImageGallery/ThumbnailViewer.cs | 2 +- .../ImageToolboxButtons.Designer.cs | 143 ----- .../ImageToolbox/ImageToolboxButtons.resx | 146 ----- .../ImageToolboxControl.Designer.cs | 243 -------- .../ImageToolbox/ImageToolboxControl.cs | 461 -------------- .../ImageToolbox/ImageToolboxControl.resx | 126 ---- .../ImageToolboxDialog.Designer.cs | 136 ---- .../ImageToolbox/ImageToolboxDialog.cs | 74 --- .../ImageToolbox/ImageToolboxDialog.resx | 123 ---- .../ImageToolboxSettings.Designer.cs | 49 -- .../ImageToolboxSettings.settings | 12 - .../ImageToolbox/OpenFileDialogWithViews.cs | 281 --------- .../Miscellaneous/PortableClipboard.cs | 2 +- .../Miscellaneous/SILAboutBox.cs | 4 +- SIL.Windows.Forms/SIL.Windows.Forms.csproj | 11 +- SIL.Windows.Forms/Widgets/Prompt.cs | 2 +- SIL.Windows.Forms/Widgets/TextInputBox.cs | 2 +- .../ArchivingTestApp/ArchivingTestApp.csproj | 4 - .../ClipboardTestApp/ClipboardTestApp.csproj | 15 - TestApps/ClipboardTestApp/Form1.Designer.cs | 212 ------- TestApps/ClipboardTestApp/Form1.cs | 83 --- TestApps/ClipboardTestApp/Form1.resx | 120 ---- TestApps/ClipboardTestApp/Program.cs | 22 - .../SIL.Windows.Forms.TestApp.csproj | 1 - .../TestAppForm.Designer.cs | 106 ++-- .../SIL.Windows.Forms.TestApp/TestAppForm.cs | 10 - TestApps/SIL.Windows.Forms.TestApp/app.config | 8 - 68 files changed, 214 insertions(+), 5511 deletions(-) delete mode 100644 SIL.Windows.Forms.Tests/ImageToolbox/ImageToolboxTests.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/AcquireImageControl.Designer.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/AcquireImageControl.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/AcquireImageControl.resx delete mode 100644 SIL.Windows.Forms/ImageToolbox/Cropping/Grip.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.designer.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.resx delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.Designer.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.resx delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageToolboxButtons.Designer.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageToolboxButtons.resx delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.Designer.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.resx delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.Designer.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.resx delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageToolboxSettings.Designer.cs delete mode 100644 SIL.Windows.Forms/ImageToolbox/ImageToolboxSettings.settings delete mode 100644 SIL.Windows.Forms/ImageToolbox/OpenFileDialogWithViews.cs delete mode 100644 TestApps/ClipboardTestApp/ClipboardTestApp.csproj delete mode 100644 TestApps/ClipboardTestApp/Form1.Designer.cs delete mode 100644 TestApps/ClipboardTestApp/Form1.cs delete mode 100644 TestApps/ClipboardTestApp/Form1.resx delete mode 100644 TestApps/ClipboardTestApp/Program.cs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a6dbc4ddd..72c54b4b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - framework: [net462, net48, net8.0] + framework: [net462, net48, net8.0, net8.0-windows] concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.framework }} cancel-in-progress: true diff --git a/Palaso.sln b/Palaso.sln index e7e313c7c..b34e7b6d0 100755 --- a/Palaso.sln +++ b/Palaso.sln @@ -114,8 +114,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SIL.TestUtilities.Tests", "SIL.TestUtilities.Tests\SIL.TestUtilities.Tests.csproj", "{CCB5E6CC-8CC1-4248-924E-D4F36CBEF37D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClipboardTestApp", "TestApps\ClipboardTestApp\ClipboardTestApp.csproj", "{B1E0B522-FEDF-497E-BFCD-A572F67C03C1}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommandLineRunnerTestApp", "TestApps\CommandLineRunnerTestApp\CommandLineRunnerTestApp.csproj", "{6407C2F9-F62D-4568-B694-7A79C72582C9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SIL.Archiving", "SIL.Archiving\SIL.Archiving.csproj", "{01B31D97-63A4-4FC6-940F-D7278F4D0F65}" @@ -294,10 +292,6 @@ Global {CCB5E6CC-8CC1-4248-924E-D4F36CBEF37D}.Debug|Any CPU.Build.0 = Debug|Any CPU {CCB5E6CC-8CC1-4248-924E-D4F36CBEF37D}.Release|Any CPU.ActiveCfg = Release|Any CPU {CCB5E6CC-8CC1-4248-924E-D4F36CBEF37D}.Release|Any CPU.Build.0 = Release|Any CPU - {B1E0B522-FEDF-497E-BFCD-A572F67C03C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B1E0B522-FEDF-497E-BFCD-A572F67C03C1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B1E0B522-FEDF-497E-BFCD-A572F67C03C1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B1E0B522-FEDF-497E-BFCD-A572F67C03C1}.Release|Any CPU.Build.0 = Release|Any CPU {6407C2F9-F62D-4568-B694-7A79C72582C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6407C2F9-F62D-4568-B694-7A79C72582C9}.Debug|Any CPU.Build.0 = Debug|Any CPU {6407C2F9-F62D-4568-B694-7A79C72582C9}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -324,7 +318,6 @@ Global {2A206833-C713-4ACB-ACD3-EB971415119E} = {3C695301-9C39-4715-8EDD-817C63EF81E7} {24FAE6A1-3B6E-4E5A-BAB2-78DCAA1566C4} = {3C695301-9C39-4715-8EDD-817C63EF81E7} {CA8F3657-3D85-4C97-81A6-5C212627B2F6} = {3C695301-9C39-4715-8EDD-817C63EF81E7} - {B1E0B522-FEDF-497E-BFCD-A572F67C03C1} = {3C695301-9C39-4715-8EDD-817C63EF81E7} {6407C2F9-F62D-4568-B694-7A79C72582C9} = {3C695301-9C39-4715-8EDD-817C63EF81E7} {321BB622-8185-4173-8770-742CD620BC18} = {3C695301-9C39-4715-8EDD-817C63EF81E7} EndGlobalSection diff --git a/SIL.Core.Desktop.Tests/i18n/StringCatalogTests.cs b/SIL.Core.Desktop.Tests/i18n/StringCatalogTests.cs index 4b5e9f541..e592f4640 100644 --- a/SIL.Core.Desktop.Tests/i18n/StringCatalogTests.cs +++ b/SIL.Core.Desktop.Tests/i18n/StringCatalogTests.cs @@ -10,6 +10,10 @@ namespace SIL.Tests.i18n { [TestFixture] +#if NET + [System.Runtime.Versioning.SupportedOSPlatform("windows")] +#endif + [Platform(Include = "Win")] public class StringCatalogTests { private string _poFile = Path.GetTempFileName(); diff --git a/SIL.Core.Desktop/i18n/StringCatalog.cs b/SIL.Core.Desktop/i18n/StringCatalog.cs index 6c38de9fc..29b7daf74 100644 --- a/SIL.Core.Desktop/i18n/StringCatalog.cs +++ b/SIL.Core.Desktop/i18n/StringCatalog.cs @@ -6,6 +6,9 @@ namespace SIL.i18n { +#if NET + [System.Runtime.Versioning.SupportedOSPlatform("windows")] +#endif public class StringCatalog { private Dictionary _catalog; diff --git a/SIL.Core.Tests/IO/PathHelperTests.cs b/SIL.Core.Tests/IO/PathHelperTests.cs index cbb2a781c..252d5dac3 100644 --- a/SIL.Core.Tests/IO/PathHelperTests.cs +++ b/SIL.Core.Tests/IO/PathHelperTests.cs @@ -322,7 +322,7 @@ public void NormalizePath_WindowsStylePathConvertsToSlashes() public void StripFilePrefix_EnsureFilePrefixIsRemoved_Windows() { var prefix = Uri.UriSchemeFile + ":"; - var fullPathname = Assembly.GetExecutingAssembly().CodeBase; + const string fullPathname = "file:///C:/Users/source/"; Assert.IsTrue(fullPathname.StartsWith(prefix)); var reducedPathname = PathHelper.StripFilePrefix(fullPathname); @@ -335,7 +335,7 @@ public void StripFilePrefix_EnsureFilePrefixIsRemoved_Windows() public void StripFilePrefix_EnsureFilePrefixIsRemoved_Linux() { var prefix = Uri.UriSchemeFile + ":"; - var fullPathname = Assembly.GetExecutingAssembly().CodeBase; + const string fullPathname = "file:///usr/local/bin/"; Assert.IsTrue(fullPathname.StartsWith(prefix)); var reducedPathname = PathHelper.StripFilePrefix(fullPathname); diff --git a/SIL.Core.Tests/IO/TempFileTests.cs b/SIL.Core.Tests/IO/TempFileTests.cs index 08dab610f..17f980fce 100644 --- a/SIL.Core.Tests/IO/TempFileTests.cs +++ b/SIL.Core.Tests/IO/TempFileTests.cs @@ -80,7 +80,7 @@ public void CreateAndGetPathButDontMakeTheFile_ReturnsUniqueFilenames() [Test] public void InFolderOf_WorksProperly() { - string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase; + string codeBase = System.Reflection.Assembly.GetExecutingAssembly().Location; UriBuilder uri = new UriBuilder(codeBase); string originalPath = Uri.UnescapeDataString(uri.Path); string filePath, filePath2; diff --git a/SIL.Core.Tests/Xml/XmlUtilsTests.cs b/SIL.Core.Tests/Xml/XmlUtilsTests.cs index 1ee82f04e..8ce3edbcc 100644 --- a/SIL.Core.Tests/Xml/XmlUtilsTests.cs +++ b/SIL.Core.Tests/Xml/XmlUtilsTests.cs @@ -208,17 +208,6 @@ public void WriteNode_PreserveNamespacesArePreserved() public void WriteNode_ProtectsAgainstXmlnsFormatThrashing() { string input = @" "; - string expectedOutput = - "\r\n" - + "\r\n" - + " \r\n" - + " \r\n" - + " \r\n" - + ""; var output = new StringBuilder(); var preserveNamespace = new HashSet(); preserveNamespace.Add("xml"); diff --git a/SIL.DictionaryServices.Tests/LexEntryRepositoryCachingTests.cs b/SIL.DictionaryServices.Tests/LexEntryRepositoryCachingTests.cs index 302783b72..474ec6658 100644 --- a/SIL.DictionaryServices.Tests/LexEntryRepositoryCachingTests.cs +++ b/SIL.DictionaryServices.Tests/LexEntryRepositoryCachingTests.cs @@ -11,7 +11,11 @@ namespace SIL.DictionaryServices.Tests { [TestFixture] + [Platform(Include = "Win")] [OfflineSldr] +#if NET + [System.Runtime.Versioning.SupportedOSPlatform("windows")] +#endif public class LiftLexEntryRepositoryCachingTests { private TemporaryFolder _tempfolder; @@ -371,4 +375,4 @@ public void GetAllEntriesSortedByDefinition_DeleteAllItemsAfterFirstCall_EntryIs } -} \ No newline at end of file +} diff --git a/SIL.Lift.Tests/Parsing/ExtensibleMatcher.cs b/SIL.Lift.Tests/Parsing/ExtensibleMatcher.cs index 3e378a81d..3952165e7 100644 --- a/SIL.Lift.Tests/Parsing/ExtensibleMatcher.cs +++ b/SIL.Lift.Tests/Parsing/ExtensibleMatcher.cs @@ -77,5 +77,17 @@ public override bool Equals(object o) } return true; } - } + + public override int GetHashCode() + { + unchecked + { + var hashCode = (_expectedId != null ? _expectedId.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ _expectedGuid.GetHashCode(); + hashCode = (hashCode * 397) ^ _expectedCreationTime.GetHashCode(); + hashCode = (hashCode * 397) ^ _expectedModificationTime.GetHashCode(); + return hashCode; + } + } + } } diff --git a/SIL.Lift.Tests/Parsing/LiftMultiTextAnnotationMatcher.cs b/SIL.Lift.Tests/Parsing/LiftMultiTextAnnotationMatcher.cs index 37ffecade..4880020f4 100644 --- a/SIL.Lift.Tests/Parsing/LiftMultiTextAnnotationMatcher.cs +++ b/SIL.Lift.Tests/Parsing/LiftMultiTextAnnotationMatcher.cs @@ -47,5 +47,20 @@ public override bool Equals(object o) && t.Who == _expectedWhoOfFirstAnnotation && t.When == _expectedWhenOfFirstAnnotation); } + + public override int GetHashCode() + { + unchecked + { + int hashCode = base.GetHashCode(); + hashCode = (hashCode * 397) ^ (_expectedLanguageOfFirstAnnotation != null ? _expectedLanguageOfFirstAnnotation.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (_expectedNameOfFirstAnnotation != null ? _expectedNameOfFirstAnnotation.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (_expectedValueOfFirstAnnotation != null ? _expectedValueOfFirstAnnotation.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (_expectedWhoOfFirstAnnotation != null ? _expectedWhoOfFirstAnnotation.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ _expectedWhenOfFirstAnnotation.GetHashCode(); + hashCode = (hashCode * 397) ^ _expectedCount; + return hashCode; + } + } } } \ No newline at end of file diff --git a/SIL.Lift.Tests/Parsing/TraitMatcher.cs b/SIL.Lift.Tests/Parsing/TraitMatcher.cs index 529b921ec..fb610881c 100644 --- a/SIL.Lift.Tests/Parsing/TraitMatcher.cs +++ b/SIL.Lift.Tests/Parsing/TraitMatcher.cs @@ -28,5 +28,17 @@ public override bool Equals(object o) &&(trait.Name == _expectedName) && (trait.Value == _expectedValue); } + + public override int GetHashCode() + { + unchecked + { + int hashCode = base.GetHashCode(); + hashCode = (hashCode * 397) ^ (_expectedName != null ? _expectedName.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (_expectedValue != null ? _expectedValue.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ _expectedNumberofAnnotations; + return hashCode; + } + } } } \ No newline at end of file diff --git a/SIL.Windows.Forms.Archiving/SIL.Windows.Forms.Archiving.csproj b/SIL.Windows.Forms.Archiving/SIL.Windows.Forms.Archiving.csproj index 168baac41..8997cc8b6 100644 --- a/SIL.Windows.Forms.Archiving/SIL.Windows.Forms.Archiving.csproj +++ b/SIL.Windows.Forms.Archiving/SIL.Windows.Forms.Archiving.csproj @@ -18,7 +18,6 @@ All - diff --git a/SIL.Windows.Forms.DblBundle/SIL.Windows.Forms.DblBundle.csproj b/SIL.Windows.Forms.DblBundle/SIL.Windows.Forms.DblBundle.csproj index 25fec9550..05ca7c39c 100644 --- a/SIL.Windows.Forms.DblBundle/SIL.Windows.Forms.DblBundle.csproj +++ b/SIL.Windows.Forms.DblBundle/SIL.Windows.Forms.DblBundle.csproj @@ -14,7 +14,6 @@ All - diff --git a/SIL.Windows.Forms.Keyboarding.Tests/App.config b/SIL.Windows.Forms.Keyboarding.Tests/App.config index d62eeb6b2..6fac838c4 100644 --- a/SIL.Windows.Forms.Keyboarding.Tests/App.config +++ b/SIL.Windows.Forms.Keyboarding.Tests/App.config @@ -2,12 +2,4 @@ - - - - - - - - \ No newline at end of file diff --git a/SIL.Windows.Forms.Keyboarding.Tests/SIL.Windows.Forms.Keyboarding.Tests.csproj b/SIL.Windows.Forms.Keyboarding.Tests/SIL.Windows.Forms.Keyboarding.Tests.csproj index 27f239d32..0cf57183e 100644 --- a/SIL.Windows.Forms.Keyboarding.Tests/SIL.Windows.Forms.Keyboarding.Tests.csproj +++ b/SIL.Windows.Forms.Keyboarding.Tests/SIL.Windows.Forms.Keyboarding.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/SIL.Windows.Forms.Keyboarding/SIL.Windows.Forms.Keyboarding.csproj b/SIL.Windows.Forms.Keyboarding/SIL.Windows.Forms.Keyboarding.csproj index feb45067b..c4e519ad0 100644 --- a/SIL.Windows.Forms.Keyboarding/SIL.Windows.Forms.Keyboarding.csproj +++ b/SIL.Windows.Forms.Keyboarding/SIL.Windows.Forms.Keyboarding.csproj @@ -13,7 +13,7 @@ All - + diff --git a/SIL.Windows.Forms.Tests/App.config b/SIL.Windows.Forms.Tests/App.config index 398f8c9b4..f3cdc8c7b 100644 --- a/SIL.Windows.Forms.Tests/App.config +++ b/SIL.Windows.Forms.Tests/App.config @@ -26,12 +26,4 @@ - - - - - - - - \ No newline at end of file diff --git a/SIL.Windows.Forms.Tests/ClearShare/CreativeCommonsLicenseTests.cs b/SIL.Windows.Forms.Tests/ClearShare/CreativeCommonsLicenseTests.cs index 201c928cd..58c1a4856 100644 --- a/SIL.Windows.Forms.Tests/ClearShare/CreativeCommonsLicenseTests.cs +++ b/SIL.Windows.Forms.Tests/ClearShare/CreativeCommonsLicenseTests.cs @@ -1,6 +1,7 @@ using System; using System.Globalization; using System.Threading; +using L10NSharp; using NUnit.Framework; using SIL.Windows.Forms.ClearShare; @@ -13,6 +14,7 @@ public class CreativeCommonsLicenseTests public void Setup() { Thread.CurrentThread.CurrentCulture = new CultureInfo("sv-SE"); //sweden, which uses commas for decimal point (regression test) + LocalizationManager.StrictInitializationMode = false; } [Test] diff --git a/SIL.Windows.Forms.Tests/ImageToolbox/ImageToolboxTests.cs b/SIL.Windows.Forms.Tests/ImageToolbox/ImageToolboxTests.cs deleted file mode 100644 index 5b0ad7e6e..000000000 --- a/SIL.Windows.Forms.Tests/ImageToolbox/ImageToolboxTests.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System; -using System.Diagnostics; -using System.Drawing.Imaging; -using System.IO; -using System.Reflection; -using System.Windows.Forms; -using NUnit.Framework; -using SIL.Windows.Forms.ClearShare; -using SIL.Windows.Forms.ImageToolbox; -using SIL.Windows.Forms.ImageToolbox.ImageGallery; - -namespace SIL.Windows.Forms.Tests.ImageToolbox -{ - class ImageToolboxTests - { - [Test] - [Explicit("By hand only")] - [STAThread] - public void ShowToolbox() - { - Application.EnableVisualStyles(); - using (var dlg = new ImageToolboxDialog(new PalasoImage(),null))// "arrow")) - { - if (DialogResult.OK == dlg.ShowDialog()) - { - // File name ending in .tmp will confuse TagLib#...doesn't know what kind of metadata to write. - var ext = ".png"; - if (Path.GetExtension(dlg.ImageInfo.OriginalFilePath) == ".jpg") - ext = ".jpg"; - string path = Path.ChangeExtension(Path.GetTempFileName(), ext); - dlg.ImageInfo.Save(path); - Process.Start("explorer.exe", "/select, \"" + path + "\""); - } - } - } - - [Test] - [Explicit("By hand only")] - [STAThread] - public void ShowGeckoToolbox() - { - Application.EnableVisualStyles(); - ThumbnailViewer.UseWebViewer = true; - using (var dlg = new ImageToolboxDialog(new PalasoImage(), null))// "arrow")) - { - if (DialogResult.OK == dlg.ShowDialog()) - { - // File name ending in .tmp will confuse TagLib#...doesn't know what kind of metadata to write. - string path = Path.ChangeExtension(Path.GetTempFileName(), ".png"); - dlg.ImageInfo.Save(path); - Process.Start("explorer.exe", "/select, \"" + path + "\""); - } - - } - } - - [Test] - [Explicit("By hand only")] - [STAThread] - public void ShowToolboxWith_PreExisting_Image_WithMetadata() - { - Application.EnableVisualStyles(); - PalasoImage i = PalasoImage.FromImage(LicenseLogos.by_nd); - i.Metadata.License = new CreativeCommonsLicense(true,true, CreativeCommonsLicense.DerivativeRules.DerivativesWithShareAndShareAlike); - i.Metadata.CopyrightNotice = "Copyright 1992 Papua New Guinea Department of Education and Other Good Things"; - i.Metadata.CollectionName = "International Illustrations: The Art Of Reading"; - i.Metadata.Creator = "Various Talented Illustrators"; - //using (var f = TempFile.WithExtension(".png")) - { - //i.Save(f.Path); - using (var dlg = new ImageToolboxDialog(i, "arrow")) - { - dlg.ShowDialog(); - } - } - } - - [Test] - [Explicit("By hand only")] - [STAThread] - public void ShowToolboxWith_PreExisting_EnsureRawFormatUnchanged() - { - Application.EnableVisualStyles(); - PalasoImage i = PalasoImage.FromImage(TestImages.logo); - - using (var dlg = new ImageToolboxDialog(i, "")) - { - dlg.ShowDialog(); - Assert.AreEqual(ImageFormat.Jpeg.Guid, dlg.ImageInfo.Image.RawFormat.Guid); - } - } - - [Test] - [Platform(Exclude="Win", Reason="applies only to Mono")] - public void CheckMonoForSelectLargeIconView() - { - using (var dlg = new OpenFileDialog ()) - { - Assert.IsTrue(dlg is FileDialog, "OpenFileDialog no longer inherits from FileDialog"); - Type dlgType = typeof(FileDialog); - var dlgViewField = dlgType.GetField("mwfFileView", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); - Assert.IsNotNull(dlgViewField, "FileDialog no longer has an mwfFileView field"); - var fileView = dlgViewField.GetValue(dlg); - Assert.IsNotNull(fileView, "FileDialog has not yet set the mwfFileView value"); - var viewType = fileView.GetType(); - var viewItemField = viewType.GetField("largeIconMenutItem", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); - Assert.IsNotNull(viewItemField, "MWFFileView no longer has a largeIconMenutItem field"); - var largeIcon = viewItemField.GetValue(fileView) as MenuItem; - Assert.IsNotNull(largeIcon, "MWFFileView has not yet set the largeIconMenutItem value"); - var viewOnClickMethod = viewType.GetMethod("OnClickViewMenuSubItem", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public, - null, new Type[] { typeof(Object), typeof(EventArgs) }, null); - Assert.IsNotNull(viewOnClickMethod, "MWFFileView no longer has an OnClickViewMenuSubItem(object, EventArgs) method"); - } - } - - [Test] - public void DoubleCheckFileFilterWorks() - { - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(null, "foo.txt")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(null, "foo.doc")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(null, "foo")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(null, "foo.")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(null, "foo.bar")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(null, "foo.bar.baz")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter("", "foo.txt")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter("", "foo.doc")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter("", "foo")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter("", "foo.")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter("", "foo.bar")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter("", "foo.bar.baz")); - - var filterAll = "All files|*.*"; - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterAll, "foo.txt")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterAll, "foo.doc")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterAll, "foo")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterAll, "foo.")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterAll, "foo.bar")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterAll, "foo.bar.baz")); - - var filterTxtOnly = "Text files|*.txt"; - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterTxtOnly, "foo.txt")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterTxtOnly, "foo.doc")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterTxtOnly, "foo")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterTxtOnly, "foo.")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterTxtOnly, "foo.bar")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterTxtOnly, "foo.txt.baz")); - - var filterTxtAndDoc = "Text files|*.txt|Word files|*.doc"; - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDoc, "foo.txt")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDoc, "foo.doc")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDoc, "foo")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDoc, "foo.")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDoc, "foo.bar")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDoc, "foo.txt.baz")); - - var filterTxtAndDocWithAll = "Text files|*.txt|Word files|*.doc|All files|*.*"; - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDocWithAll, "foo.txt")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDocWithAll, "foo.doc")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDocWithAll, "foo")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDocWithAll, "foo.")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDocWithAll, "foo.bar")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterTxtAndDocWithAll, "foo.txt.baz")); - - var filterCodeSourceFiles = "Image files|*.png;*.jpg;*.jpeg;*.tiff"; - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterCodeSourceFiles, "foo.png")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterCodeSourceFiles, "foo.jpg")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterCodeSourceFiles, "foo.jpeg")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterCodeSourceFiles, "foo.tiff")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterCodeSourceFiles, "foo")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterCodeSourceFiles, "foo.")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterCodeSourceFiles, "foo.bar")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterCodeSourceFiles, "foo.png.baz")); - - var filterCsCppSourceFiles = "Bitmap files|*.bmp;*.png;*.tiff|JPEG files|*.jpg;*.jpeg"; - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo.bmp")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo.png")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo.tiff")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo.jpg")); - Assert.IsTrue(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo.jpeg")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo.h")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo.cs")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo.")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo.bar")); - Assert.IsFalse(AcquireImageControl.DoubleCheckFileFilter(filterCsCppSourceFiles, "foo.png.baz")); - } - } -} diff --git a/SIL.Windows.Forms.Tests/Progress/LogBox/LogBoxTests.cs b/SIL.Windows.Forms.Tests/Progress/LogBox/LogBoxTests.cs index 9b392717a..f780e1ab5 100644 --- a/SIL.Windows.Forms.Tests/Progress/LogBox/LogBoxTests.cs +++ b/SIL.Windows.Forms.Tests/Progress/LogBox/LogBoxTests.cs @@ -25,8 +25,6 @@ public void ShowLogBox() progress.WriteMessage("done"); - Console.WriteLine(progress.Text); - Console.WriteLine(progress.Rtf); Console.WriteLine("Finished"); } } diff --git a/SIL.Windows.Forms.Tests/SIL.Windows.Forms.Tests.csproj b/SIL.Windows.Forms.Tests/SIL.Windows.Forms.Tests.csproj index a272acdea..fcb8a8760 100644 --- a/SIL.Windows.Forms.Tests/SIL.Windows.Forms.Tests.csproj +++ b/SIL.Windows.Forms.Tests/SIL.Windows.Forms.Tests.csproj @@ -4,6 +4,7 @@ SIL.Windows.Forms.Tests SIL.Windows.Forms.Tests Unit tests for SIL.Windows.Forms + $(TargetFrameworks);net8.0-windows true true true @@ -18,12 +19,12 @@ - + - + diff --git a/SIL.Windows.Forms.Tests/SettingsProviderTests.cs b/SIL.Windows.Forms.Tests/SettingsProviderTests.cs index 047b40096..6a2fa8826 100644 --- a/SIL.Windows.Forms.Tests/SettingsProviderTests.cs +++ b/SIL.Windows.Forms.Tests/SettingsProviderTests.cs @@ -90,16 +90,15 @@ public void SettingsFolderWithNewerConfig_SortsBeforeOneWithOlderConfig() [Test] public void CanOverrideDefaultLocation() { - string settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SIL", "SettingsProviderTests"); - Directory.CreateDirectory(settingsPath); - using (TemporaryFolder.TrackExisting(settingsPath)) + RegistrationSettingsProvider.SetProductName("SettingsProviderTests"); + var settingsProvider = new TestCrossPlatformSettingsProvider(); + settingsProvider.Initialize(null, null); // Seems to be what .NET does, despite warnings + + string dirPath = settingsProvider.UserConfigLocation; + Directory.CreateDirectory(dirPath); + using (TemporaryFolder.TrackExisting(dirPath)) { - RegistrationSettingsProvider.SetProductName("SettingsProviderTests"); - var settingsProvider = new TestCrossPlatformSettingsProvider(); - settingsProvider.Initialize(null, null); // Seems to be what .NET does, despite warnings - string dirPath = settingsProvider.UserConfigLocation; Assert.That(dirPath, Does.Contain("SettingsProviderTests")); - Directory.CreateDirectory(dirPath); string filePath = Path.Combine(dirPath, TestCrossPlatformSettingsProvider.UserConfigFileName); using (new TempFile(filePath, true)) { @@ -160,15 +159,15 @@ public void CanSaveBothRegularAndRegistrationSettings() [Category("KnownMonoIssue")] public void Upgrade_SectionsRenamed_SettingsMigrated() { - string settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SIL", "SettingsProviderTests"); - Directory.CreateDirectory(settingsPath); - using (TemporaryFolder.TrackExisting(settingsPath)) + RegistrationSettingsProvider.SetProductName("SettingsProviderTests"); + var settingsProvider = new TestCrossPlatformSettingsProvider(); + settingsProvider.Initialize(null, null); // Seems to be what .NET does, despite warnings + + string appSettingsRoot = Path.Combine(settingsProvider.UserConfigLocation, ".."); + string dirPath = Path.Combine(appSettingsRoot, "0.0.0.0"); + Directory.CreateDirectory(dirPath); + using (TemporaryFolder.TrackExisting(dirPath)) { - RegistrationSettingsProvider.SetProductName("SettingsProviderTests"); - var settingsProvider = new TestCrossPlatformSettingsProvider(); - settingsProvider.Initialize(null, null); // Seems to be what .NET does, despite warnings - string dirPath = Path.Combine(settingsPath, "0.0.0.0"); - Directory.CreateDirectory(dirPath); string filePath = Path.Combine(dirPath, TestCrossPlatformSettingsProvider.UserConfigFileName); using (new TempFile(filePath, true)) { @@ -180,6 +179,48 @@ public void Upgrade_SectionsRenamed_SettingsMigrated() someone@somewhere.org + + +"); + + Registration.Registration regSettings = Registration.Registration.Default; + regSettings.Upgrade(); + Assert.That(regSettings.Email, Is.EqualTo("someone@somewhere.org")); + } + } + } + + /// + /// This test is ignored on Mono, because of known issues in the ApplicationSettingsBase class (Xamarin-15818 + /// and Xamarin-2315). This issue is fixed in Mono-SIL. + /// + /// This test adds and changes values from the earlier tests. This is necessary to confirm + /// we're reading the temp file for this test, as opposed to a temp file from a previous. + /// + [Test] + [Category("KnownMonoIssue")] + public void Upgrade_ExtraFields_SettingsMigrated() + { + RegistrationSettingsProvider.SetProductName("SettingsProviderTests"); + var settingsProvider = new TestCrossPlatformSettingsProvider(); + settingsProvider.Initialize(null, null); // Seems to be what .NET does, despite warnings + + string appSettingsRoot = Path.Combine(settingsProvider.UserConfigLocation, ".."); + string dirPath = Path.Combine(appSettingsRoot, "0.0.0.0"); + Directory.CreateDirectory(dirPath); + using (TemporaryFolder.TrackExisting(dirPath)) + { + string filePath = Path.Combine(dirPath, TestCrossPlatformSettingsProvider.UserConfigFileName); + using (new TempFile(filePath, true)) + { + File.WriteAllText(filePath, + @" + + + + + someone2@somewhere.org + 10 @@ -189,7 +230,7 @@ public void Upgrade_SectionsRenamed_SettingsMigrated() Registration.Registration regSettings = Registration.Registration.Default; regSettings.Upgrade(); - Assert.That(regSettings.Email, Is.EqualTo("someone@somewhere.org")); + Assert.That(regSettings.Email, Is.EqualTo("someone2@somewhere.org")); Assert.That(regSettings.LaunchCount, Is.EqualTo(10)); } } @@ -198,14 +239,14 @@ public void Upgrade_SectionsRenamed_SettingsMigrated() [Test, Ignore("Probably due to statics on CrossPlatformSettingsProvider, this test is corrupted by other tests. Works fine in isolation")] public void LoadSettings_FileCorrupt_ShowsErrorAndSelfHeals() { - var settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SIL", "SettingsProviderTests"); - Directory.CreateDirectory(settingsPath); - using (TemporaryFolder.TrackExisting(settingsPath)) + RegistrationSettingsProvider.SetProductName("SettingsProviderTests"); + var settingsProvider = new TestCrossPlatformSettingsProvider(); + settingsProvider.Initialize(null, null); // Seems to be what .NET does, despite warnings + + string dirPath = settingsProvider.UserConfigLocation; + Directory.CreateDirectory(dirPath); + using (TemporaryFolder.TrackExisting(dirPath)) { - var settingsProvider = new TestCrossPlatformSettingsProvider(); - settingsProvider.Initialize(null, null); // Seems to be what .NET does, despite warnings - var dirPath = settingsProvider.UserConfigLocation; - Directory.CreateDirectory(dirPath); var filePath = Path.Combine(dirPath, TestCrossPlatformSettingsProvider.UserConfigFileName); File.Delete(filePath); using (new TempFile(filePath, true)) @@ -232,14 +273,14 @@ public void LoadSettings_FileCorrupt_ShowsErrorAndSelfHeals() [Test] public void CheckForErrorsInFile_FileCorrupt_ReturnsMessage() { - var settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "SIL", "SettingsProviderTests"); - Directory.CreateDirectory(settingsPath); - using (TemporaryFolder.TrackExisting(settingsPath)) + RegistrationSettingsProvider.SetProductName("SettingsProviderTests"); + var settingsProvider = new TestCrossPlatformSettingsProvider(); + settingsProvider.Initialize(null, null); // Seems to be what .NET does, despite warnings + + string dirPath = settingsProvider.UserConfigLocation; + Directory.CreateDirectory(dirPath); + using (TemporaryFolder.TrackExisting(dirPath)) { - var settingsProvider = new TestCrossPlatformSettingsProvider(); - settingsProvider.Initialize(null, null); // Seems to be what .NET does, despite warnings - var dirPath = settingsProvider.UserConfigLocation; - Directory.CreateDirectory(dirPath); var filePath = Path.Combine(dirPath, TestCrossPlatformSettingsProvider.UserConfigFileName); using (new TempFile(filePath, true)) { diff --git a/SIL.Windows.Forms.WritingSystems.Tests/App.config b/SIL.Windows.Forms.WritingSystems.Tests/App.config index afd79568d..6fac838c4 100644 --- a/SIL.Windows.Forms.WritingSystems.Tests/App.config +++ b/SIL.Windows.Forms.WritingSystems.Tests/App.config @@ -2,12 +2,4 @@ - - - - - - - - \ No newline at end of file diff --git a/SIL.Windows.Forms.WritingSystems.Tests/LanguageLookupControlTests.cs b/SIL.Windows.Forms.WritingSystems.Tests/LanguageLookupControlTests.cs index 3a0ec498b..b28b23511 100644 --- a/SIL.Windows.Forms.WritingSystems.Tests/LanguageLookupControlTests.cs +++ b/SIL.Windows.Forms.WritingSystems.Tests/LanguageLookupControlTests.cs @@ -1,6 +1,7 @@ using System; using System.Drawing; using System.Windows.Forms; +using L10NSharp; using NUnit.Framework; using SIL.TestUtilities; using SIL.WritingSystems; @@ -18,6 +19,7 @@ public class LanguageLookupControlTests [SetUp] public void Setup() { + LocalizationManager.StrictInitializationMode = false; _ready = false; _control = new LanguageLookupControl(); _control.ReadinessChanged += _control_ReadinessChanged; diff --git a/SIL.Windows.Forms.WritingSystems.Tests/LanguageLookupModelTests.cs b/SIL.Windows.Forms.WritingSystems.Tests/LanguageLookupModelTests.cs index 108e9294e..e6bd0c8d1 100644 --- a/SIL.Windows.Forms.WritingSystems.Tests/LanguageLookupModelTests.cs +++ b/SIL.Windows.Forms.WritingSystems.Tests/LanguageLookupModelTests.cs @@ -1,4 +1,5 @@ using System.Linq; +using L10NSharp; using NUnit.Framework; using SIL.TestUtilities; using SIL.WritingSystems; @@ -9,6 +10,12 @@ namespace SIL.Windows.Forms.WritingSystems.Tests [OfflineSldr] public class LanguageLookupModelTests { + [SetUp] + public void SetUp() + { + LocalizationManager.StrictInitializationMode = false; + } + [Test] public void IncludeRegionCodes_SetToFalse_DialectsNotReturned() { diff --git a/SIL.Windows.Forms.WritingSystems/SIL.Windows.Forms.WritingSystems.csproj b/SIL.Windows.Forms.WritingSystems/SIL.Windows.Forms.WritingSystems.csproj index e6250be03..bb7abe38c 100644 --- a/SIL.Windows.Forms.WritingSystems/SIL.Windows.Forms.WritingSystems.csproj +++ b/SIL.Windows.Forms.WritingSystems/SIL.Windows.Forms.WritingSystems.csproj @@ -13,7 +13,6 @@ all - diff --git a/SIL.Windows.Forms.WritingSystems/WritingSystemSetupModel.cs b/SIL.Windows.Forms.WritingSystems/WritingSystemSetupModel.cs index fd7b6ea68..1f1dbcb42 100644 --- a/SIL.Windows.Forms.WritingSystems/WritingSystemSetupModel.cs +++ b/SIL.Windows.Forms.WritingSystems/WritingSystemSetupModel.cs @@ -1075,6 +1075,7 @@ public string CurrentSpellCheckingId } } + [Obsolete] public SpellCheckInfo CurrentSpellChecker { get @@ -1089,6 +1090,7 @@ public SpellCheckInfo CurrentSpellChecker } } + [Obsolete] public List GetSpellCheckComboBoxItems() { _spellCheckerItems.Clear(); diff --git a/SIL.Windows.Forms/Clipboarding/LinuxClipboard.NativeMethods.cs b/SIL.Windows.Forms/Clipboarding/LinuxClipboard.NativeMethods.cs index aced7fab0..c758d4ba1 100644 --- a/SIL.Windows.Forms/Clipboarding/LinuxClipboard.NativeMethods.cs +++ b/SIL.Windows.Forms/Clipboarding/LinuxClipboard.NativeMethods.cs @@ -1,10 +1,10 @@ // // Copyright (c) 2024 SIL Global // // This software is licensed under the MIT License (http://opensource.org/licenses/MIT) -using SIL.Windows.Forms.Miscellaneous; using System; using System.Diagnostics; using System.Runtime.InteropServices; +using SIL.Windows.Forms.Miscellaneous; namespace SIL.Windows.Forms.Clipboarding { diff --git a/SIL.Windows.Forms/FolderBrowserControl/FolderBrowserControl.cs b/SIL.Windows.Forms/FolderBrowserControl/FolderBrowserControl.cs index a8ce33368..4352a615e 100644 --- a/SIL.Windows.Forms/FolderBrowserControl/FolderBrowserControl.cs +++ b/SIL.Windows.Forms/FolderBrowserControl/FolderBrowserControl.cs @@ -145,8 +145,8 @@ public class FolderBrowserControl : UserControl private ToolTip _toolTip; // magic container for all tooltips - private ContextMenu _shortcutContextMenu; // a context menu that works on user's shortcut folders - private MenuItem _shortCutRemovalMenuItem; // context menu item to remove a user's shortcut folder + private ContextMenuStrip _shortcutContextMenu; // a context menu that works on user's shortcut folders + private ToolStripMenuItem _shortCutRemovalMenuItem; // context menu item to remove a user's shortcut folder private IContainer components; // silly thing that .NET seems to like @@ -328,8 +328,8 @@ private void InitializeComponent() this._toolTip = new System.Windows.Forms.ToolTip(this.components); this._addShortcutButton = new System.Windows.Forms.Button(); this._infoButton = new System.Windows.Forms.Button(); - this._shortcutContextMenu = new System.Windows.Forms.ContextMenu(); - this._shortCutRemovalMenuItem = new System.Windows.Forms.MenuItem(); + this._shortcutContextMenu = new System.Windows.Forms.ContextMenuStrip(); + this._shortCutRemovalMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this._toolBarGroupBox = new System.Windows.Forms.GroupBox(); this._toolBarGroupBox.SuspendLayout(); this.SuspendLayout(); @@ -513,12 +513,10 @@ private void InitializeComponent() // // _shortcutContextMenu // - this._shortcutContextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this._shortCutRemovalMenuItem}); + this._shortcutContextMenu.Items.Insert(0, this._shortCutRemovalMenuItem); // // _shortCutRemovalMenuItem // - this._shortCutRemovalMenuItem.Index = 0; this._shortCutRemovalMenuItem.Text = "Remove Shortcut"; this._shortCutRemovalMenuItem.Click += new System.EventHandler(this.OnShortCutRemovalMenuItemClick); // diff --git a/SIL.Windows.Forms/HotSpot/HotSpotProvider.cs b/SIL.Windows.Forms/HotSpot/HotSpotProvider.cs index 9557d1a76..263805a9d 100644 --- a/SIL.Windows.Forms/HotSpot/HotSpotProvider.cs +++ b/SIL.Windows.Forms/HotSpot/HotSpotProvider.cs @@ -180,7 +180,6 @@ public HotSpotInternal(HotSpot hotspot, Color underlineColor) #region Nested type: HotSpotPainter - [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] private class HotSpotPainter: NativeWindow, IDisposable { private readonly TextBoxBase _control; diff --git a/SIL.Windows.Forms/HtmlBrowser/XWebBrowser.cs b/SIL.Windows.Forms/HtmlBrowser/XWebBrowser.cs index 4df9eb7d3..14b511752 100644 --- a/SIL.Windows.Forms/HtmlBrowser/XWebBrowser.cs +++ b/SIL.Windows.Forms/HtmlBrowser/XWebBrowser.cs @@ -80,7 +80,7 @@ private IWebBrowser CreateBrowser(BrowserType type) if (browser == null) { var path = Path.Combine(Path.GetDirectoryName( - new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), + new Uri(Assembly.GetExecutingAssembly().Location).LocalPath), "SIL.Windows.Forms.GeckoBrowserAdapter.dll"); if (File.Exists(path)) { diff --git a/SIL.Windows.Forms/ImageToolbox/AcquireImageControl.Designer.cs b/SIL.Windows.Forms/ImageToolbox/AcquireImageControl.Designer.cs deleted file mode 100644 index 74d8447ad..000000000 --- a/SIL.Windows.Forms/ImageToolbox/AcquireImageControl.Designer.cs +++ /dev/null @@ -1,226 +0,0 @@ -using SIL.Windows.Forms.ImageToolbox.ImageGallery; -using SIL.Windows.Forms.Widgets; - -namespace SIL.Windows.Forms.ImageToolbox -{ - partial class AcquireImageControl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - _galleryControl?.Dispose(); // Can be null if error when initializing. - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AcquireImageControl)); - this.toolStrip1 = new System.Windows.Forms.ToolStrip(); - this._galleryButton = new System.Windows.Forms.ToolStripButton(); - this._scannerButton = new System.Windows.Forms.ToolStripButton(); - this._cameraButton = new System.Windows.Forms.ToolStripButton(); - this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); - this._pictureBox = new System.Windows.Forms.PictureBox(); - this._galleryControl = new ImageGalleryControl(); - this._messageLabel = new BetterLabel(); - this._focusTimer = new System.Windows.Forms.Timer(this.components); - this._L10NSharpExtender = new L10NSharp.UI.L10NSharpExtender(this.components); - this.toolStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._pictureBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._L10NSharpExtender)).BeginInit(); - this.SuspendLayout(); - // - // toolStrip1 - // - this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this.toolStrip1.ImageScalingSize = new System.Drawing.Size(32, 32); - this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._galleryButton, - this._scannerButton, - this._cameraButton, - this.toolStripButton1}); - this._L10NSharpExtender.SetLocalizableToolTip(this.toolStrip1, null); - this._L10NSharpExtender.SetLocalizationComment(this.toolStrip1, null); - this._L10NSharpExtender.SetLocalizationPriority(this.toolStrip1, L10NSharp.LocalizationPriority.NotLocalizable); - this._L10NSharpExtender.SetLocalizingId(this.toolStrip1, "ImageToolbox.AcquireImageControl.toolStrip1"); - this.toolStrip1.Location = new System.Drawing.Point(0, 0); - this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.toolStrip1.Size = new System.Drawing.Size(556, 54); - this.toolStrip1.TabIndex = 0; - this.toolStrip1.Text = "toolStrip1"; - // - // _galleryButton - // - this._galleryButton.Image = ((System.Drawing.Image)(resources.GetObject("_galleryButton.Image"))); - this._galleryButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._L10NSharpExtender.SetLocalizableToolTip(this._galleryButton, null); - this._L10NSharpExtender.SetLocalizationComment(this._galleryButton, null); - this._L10NSharpExtender.SetLocalizingId(this._galleryButton, "ImageToolbox.ImageGalleries"); - this._galleryButton.Margin = new System.Windows.Forms.Padding(20, 1, 0, 2); - this._galleryButton.Name = "_galleryButton"; - this._galleryButton.Size = new System.Drawing.Size(89, 51); - this._galleryButton.Text = "Image Galleries"; - this._galleryButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; - this._galleryButton.Click += new System.EventHandler(this.OnGalleryClick); - // - // _scannerButton - // - this._scannerButton.Image = ((System.Drawing.Image)(resources.GetObject("_scannerButton.Image"))); - this._scannerButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._L10NSharpExtender.SetLocalizableToolTip(this._scannerButton, null); - this._L10NSharpExtender.SetLocalizationComment(this._scannerButton, null); - this._L10NSharpExtender.SetLocalizingId(this._scannerButton, "ImageToolbox.Scanner"); - this._scannerButton.Margin = new System.Windows.Forms.Padding(20, 1, 0, 2); - this._scannerButton.Name = "_scannerButton"; - this._scannerButton.Size = new System.Drawing.Size(53, 51); - this._scannerButton.Text = "Scanner"; - this._scannerButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; - this._scannerButton.Click += new System.EventHandler(this.OnScannerClick); - // - // _cameraButton - // - this._cameraButton.Image = ((System.Drawing.Image)(resources.GetObject("_cameraButton.Image"))); - this._cameraButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._L10NSharpExtender.SetLocalizableToolTip(this._cameraButton, null); - this._L10NSharpExtender.SetLocalizationComment(this._cameraButton, null); - this._L10NSharpExtender.SetLocalizingId(this._cameraButton, "ImageToolbox.Camera"); - this._cameraButton.Margin = new System.Windows.Forms.Padding(20, 1, 0, 2); - this._cameraButton.Name = "_cameraButton"; - this._cameraButton.Size = new System.Drawing.Size(52, 51); - this._cameraButton.Text = "Camera"; - this._cameraButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; - this._cameraButton.Click += new System.EventHandler(this.OnCameraClick); - // - // toolStripButton1 - // - this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); - this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; - this._L10NSharpExtender.SetLocalizableToolTip(this.toolStripButton1, null); - this._L10NSharpExtender.SetLocalizationComment(this.toolStripButton1, null); - this._L10NSharpExtender.SetLocalizingId(this.toolStripButton1, "ImageToolbox.FileButton"); - this.toolStripButton1.Margin = new System.Windows.Forms.Padding(20, 1, 0, 2); - this.toolStripButton1.Name = "toolStripButton1"; - this.toolStripButton1.Size = new System.Drawing.Size(36, 51); - this.toolStripButton1.Text = "File"; - this.toolStripButton1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; - this.toolStripButton1.Click += new System.EventHandler(this.OnGetFromFileSystemClick); - // - // _pictureBox - // - this._pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._L10NSharpExtender.SetLocalizableToolTip(this._pictureBox, null); - this._L10NSharpExtender.SetLocalizationComment(this._pictureBox, null); - this._L10NSharpExtender.SetLocalizingId(this._pictureBox, "ImageToolbox.AcquireImageControl._pictureBox"); - this._pictureBox.Location = new System.Drawing.Point(0, 57); - this._pictureBox.Name = "_pictureBox"; - this._pictureBox.Size = new System.Drawing.Size(556, 349); - this._pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this._pictureBox.TabIndex = 6; - this._pictureBox.TabStop = false; - // - // _galleryControl - // - this._galleryControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._L10NSharpExtender.SetLocalizableToolTip(this._galleryControl, null); - this._L10NSharpExtender.SetLocalizationComment(this._galleryControl, null); - this._L10NSharpExtender.SetLocalizingId(this._galleryControl, "ImageToolbox.AcquireImageControl.ArtOfReadingChooser"); - this._galleryControl.Location = new System.Drawing.Point(3, 57); - this._galleryControl.Name = "_galleryControl"; - this._galleryControl.Size = new System.Drawing.Size(551, 349); - this._galleryControl.TabIndex = 7; - // - // _messageLabel - // - this._messageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._messageLabel.BorderStyle = System.Windows.Forms.BorderStyle.None; - this._messageLabel.Enabled = false; - this._messageLabel.Font = new System.Drawing.Font("Segoe UI", 9F); - this._messageLabel.ForeColor = System.Drawing.Color.Gray; - this._L10NSharpExtender.SetLocalizableToolTip(this._messageLabel, null); - this._L10NSharpExtender.SetLocalizationComment(this._messageLabel, null); - this._L10NSharpExtender.SetLocalizationPriority(this._messageLabel, L10NSharp.LocalizationPriority.NotLocalizable); - this._L10NSharpExtender.SetLocalizingId(this._messageLabel, "ImageToolbox.AcquireImageControl._messageLabel"); - this._messageLabel.Location = new System.Drawing.Point(97, 171); - this._messageLabel.Multiline = true; - this._messageLabel.Name = "_messageLabel"; - this._messageLabel.ReadOnly = true; - this._messageLabel.Size = new System.Drawing.Size(333, 17); - this._messageLabel.TabIndex = 11; - this._messageLabel.TabStop = false; - this._messageLabel.Text = "This will notify you of problems"; - this._messageLabel.Visible = false; - // - // _focusTimer - // - this._focusTimer.Tick += new System.EventHandler(this._focusTimer_Tick); - // - // _L10NSharpExtender - // - this._L10NSharpExtender.LocalizationManagerId = "Palaso"; - this._L10NSharpExtender.PrefixForNewItems = "ImageToolbox"; - // - // AcquireImageControl - // - this.AllowDrop = true; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._messageLabel); - this.Controls.Add(this._galleryControl); - this.Controls.Add(this._pictureBox); - this.Controls.Add(this.toolStrip1); - this._L10NSharpExtender.SetLocalizableToolTip(this, null); - this._L10NSharpExtender.SetLocalizationComment(this, null); - this._L10NSharpExtender.SetLocalizingId(this, "ImageToolbox.AcquireImageControl.AcquireImageControl"); - this.Name = "AcquireImageControl"; - this.Size = new System.Drawing.Size(556, 409); - this.Load += new System.EventHandler(this.AcquireImageControl_Load); - this.DragDrop += new System.Windows.Forms.DragEventHandler(this.OnDragDrop); - this.DragEnter += new System.Windows.Forms.DragEventHandler(this.AcquireImageControl_DragEnter); - this.toolStrip1.ResumeLayout(false); - this.toolStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._pictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._L10NSharpExtender)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.ToolStrip toolStrip1; - private System.Windows.Forms.ToolStripButton toolStripButton1; - private System.Windows.Forms.ToolStripButton _cameraButton; - private System.Windows.Forms.ToolStripButton _scannerButton; - private System.Windows.Forms.ToolStripButton _galleryButton; - private System.Windows.Forms.PictureBox _pictureBox; - private ImageGalleryControl _galleryControl; - private Widgets.BetterLabel _messageLabel; - private System.Windows.Forms.Timer _focusTimer; - private L10NSharp.UI.L10NSharpExtender _L10NSharpExtender; - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/AcquireImageControl.cs b/SIL.Windows.Forms/ImageToolbox/AcquireImageControl.cs deleted file mode 100644 index 09309cba2..000000000 --- a/SIL.Windows.Forms/ImageToolbox/AcquireImageControl.cs +++ /dev/null @@ -1,585 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; -using L10NSharp; -using SIL.PlatformUtilities; -using SIL.Reporting; -using System.Drawing.Imaging; -using SIL.IO; -using WIA; - -namespace SIL.Windows.Forms.ImageToolbox -{ - /// - /// Provides 4 ways to get an image: Gallery (art of reading), scanner, camera, or file system. - /// - public partial class AcquireImageControl : UserControl, IImageToolboxControl - { - private PalasoImage _previousImage; - private PalasoImage _currentImage; - - public event EventHandler ImageChanged; - - public AcquireImageControl() - { - InitializeComponent(); - - if (!Platform.IsWindows) - { - _scannerButton.Enabled = _cameraButton.Enabled = false; - // Mono layout doesn't always handle Anchor point properly. Fix it. - FixMyLayoutForMono(); - } - - _galleryControl.ImageChanged += _galleryControl_ImageChanged; - } - - void _galleryControl_ImageChanged(object sender, EventArgs e) - { - // Propagate that event to the outer toolbox - if (ImageChanged != null) - ImageChanged(sender, e); - } - - private bool _actModal; - - private void OnGetFromFileSystemClick(object sender, EventArgs e) - { - if (_actModal) - return; // The GTK file chooser on Linux isn't acting modal, so we simulate it. - _actModal = true; - // Something in the Mono runtime state machine keeps the GTK file chooser from getting the - // focus immediately when we invoke OpenFileDialogWithViews.ShowDialog() directly at this - // point. Waiting for the next idle gets it into a state where the file chooser does receive - // the focus as desired. See https://silbloom.myjetbrains.com/youtrack/issue/BL-5809. - if (Platform.IsMono) - Application.Idle += DelayGetImageFileFromSystem; - else - GetImageFileFromSystem(); - } - - private void DelayGetImageFileFromSystem(object sender, EventArgs e) - { - Application.Idle -= DelayGetImageFileFromSystem; - GetImageFileFromSystem(); - } - - // If this is set, and an image fails to load, the control will use it instead of the standard - // ErrorReport.NotifyUserOfProblem to report an image that fails to load. It is passed the path - // of the problem image, the exception that was thrown, and the standard message that would - // normally be displayed. - // Typical exceptions are OutOfMemoryException (hopefully when an image really is too big to - // load, but it's the default exception if anything is wrong with a file loaded by - // Image.FromFile(), so it could happen with a largish image that's corrupted; - // TagLib.CorruptFileException (most cases where file is not valid image data, though - // its main meaning is that specifically the metadata can't be read). - public Action ImageLoadingExceptionReporter { get; set; } - - private void GetImageFileFromSystem() - { - try - { - // Used to simulate having a FileOk event handler that can cancel the OK button click. - bool invalidFileChosen; - SetMode(Modes.SingleImage); - do - { - invalidFileChosen = false; - // The primary thing that OpenFileDialogWithViews buys us is the ability to default to large icons. - // OpenFileDialogWithViews still doesn't let us read (and thus remember) the selected view. - using (var dlg = new OpenFileDialogWithViews(OpenFileDialogWithViews.DialogViewTypes.Large_Icons)) - { - if (string.IsNullOrEmpty(ImageToolboxSettings.Default.LastImageFolder)) - { - dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); - } - else - { - dlg.InitialDirectory = ImageToolboxSettings.Default.LastImageFolder; ; - } - - dlg.Title = "Choose Picture File".Localize("ImageToolbox.FileChooserTitle", "Title shown for a file chooser dialog brought up by the ImageToolbox"); - - //NB: disallowed gif because of a .net crash: http://jira.palaso.org/issues/browse/BL-85 - dlg.Filter = "picture files".Localize("ImageToolbox.PictureFiles", "Shown in the file-picking dialog to describe what kind of files the dialog is filtering for") + "(*.png;*.tif;*.tiff;*.jpg;*.jpeg;*.bmp)|*.png;*.tif;*.tiff;*.jpg;*.jpeg;*.bmp;"; - - if (DialogResult.OK == dlg.ShowDialog(this.ParentForm)) - { - // Simulate having a FileOk event handler that can cancel the OK button click. - // We would prefer to actually use the event handler since that can prevent the - // dialog from closing, but we can't do that because of using DialogAdapters for - // cross-platform compatibility. It's not worth messing with DialogAdapters at - // this point just to get this feature, which might not be cross-platform. - if (!DoubleCheckFileFilter(dlg.Filter, dlg.FileName)) - { - invalidFileChosen = true; - continue; - } - ImageToolboxSettings.Default.LastImageFolder = Path.GetDirectoryName(dlg.FileName); - ImageToolboxSettings.Default.Save(); - - try - { - _currentImage = PalasoImage.FromFile(dlg.FileName); - } - catch (Exception err) //for example, http://jira.palaso.org/issues/browse/BL-199 - { - var msg = "Sorry, there was a problem loading that image.".Localize( - "ImageToolbox.ProblemLoadingImage"); - if (ImageLoadingExceptionReporter!= null) - { - ImageLoadingExceptionReporter(dlg.FileName, err, msg); - } - else - { - ErrorReport.NotifyUserOfProblem(err, msg); - } - - return; - } - _pictureBox.Image = _currentImage.Image; - if (ImageChanged != null) - ImageChanged.Invoke(this, null); - } - } - } while (invalidFileChosen); - } - finally - { - _actModal = false; - } - } - - /// - /// Return true if the filePath truly passes the filtering of the filterString. - /// People can defeat the filtering by typing or pasting a file path into the file path box. - /// - /// filter string like those used in file dialogs - /// file path returned by a file dialog - internal static bool DoubleCheckFileFilter(string filterString, string filePath) - { - if (string.IsNullOrEmpty(filterString)) - return true; // no filter, so everything passes - if (string.IsNullOrEmpty(filePath)) - return false; // no file, so nothing passes - var filterSections = filterString.Split('|'); - if (filterSections.Length < 2) - return true; // no filter, so everything passes - var fileName = Path.GetFileName(filePath); - for (int i = 1; i < filterSections.Length; i += 2) - { - if (PassesFilter(filterSections[i], fileName)) - return true; - } - return false; - } - private static bool PassesFilter(string filterList, string fileName) - { - var parts = filterList.Split(';'); - foreach (var part in parts) - { - if (part == "*.*" || part == "*") - return true; - var filter = part.Trim(); - if (filter.StartsWith("*")) - { - filter = filter.Substring(1); - if (fileName.EndsWith(filter, StringComparison.InvariantCultureIgnoreCase)) - return true; - } - else if (filter.EndsWith("*")) - { - filter = filter.Substring(0, filter.Length - 1); - if (fileName.StartsWith(filter, StringComparison.InvariantCultureIgnoreCase)) - return true; - } - else if (fileName.Equals(filter, StringComparison.InvariantCultureIgnoreCase)) - return true; - } - return false; - } - - private void OpenFileFromDrag(string path) - { - SetMode(Modes.SingleImage); - _currentImage = PalasoImage.FromFile(path); - _pictureBox.Image = _currentImage.Image; - ImageToolboxSettings.Default.LastImageFolder = Path.GetDirectoryName(path); - ImageToolboxSettings.Default.Save(); - if (ImageChanged != null) - ImageChanged.Invoke(this, null); - } - - private void OnDragDrop(object sender, DragEventArgs e) - { - try - { - var a = (Array)e.Data.GetData(DataFormats.FileDrop); - - if (a != null) - { - // Extract string from first array element - // (ignore all files except first if number of files are dropped). - string s = a.GetValue(0).ToString(); - - // Call OpenFile asynchronously. - // Explorer instance from which file is dropped is not responding - // all the time when DragDrop handler is active, so we need to return - // immediately (especially if OpenFile shows MessageBox). - - BeginInvoke(new Action(OpenFileFromDrag), s); - - ParentForm?.Activate(); // in the case Explorer overlaps this form - } - } - catch (Exception) - { -#if DEBUG - throw; -#endif - } - } - - public void SetImage(PalasoImage image) - { - _previousImage = image; - _scannerButton.Checked = _cameraButton.Checked = false; - _currentImage = image; - SetMode(Modes.SingleImage); - _pictureBox.Image = image?.Image; - } - - public PalasoImage GetImage() - { - if (_galleryControl.Visible) - { - return _galleryControl.GetImage(); - } - if (_currentImage != null) - // if (_pictureBox.Image != null) - { - //return new PalasoImage() { Image = _pictureBox.Image, FileName = _fileName }; - return _currentImage; - } - return _previousImage; - } - - - private void OnScannerClick(object sender, EventArgs e) - { - _scannerButton.Checked = true; - SetImage(null); - UsageReporter.SendNavigationNotice("ImageToolbox:GetFromScanner"); - GetFromDevice(ImageAcquisitionService.DeviceKind.Scanner); - } - - private void OnCameraClick(object sender, EventArgs e) - { - SetImage(null); - _cameraButton.Checked = true; - UsageReporter.SendNavigationNotice("ImageToolbox:GetFromCamera"); - GetFromDevice(ImageAcquisitionService.DeviceKind.Camera); - } - - private void GetFromDevice(ImageAcquisitionService.DeviceKind deviceKind) - { - //_pictureBox.Image = SampleImages.sampleScan; - try - { - var acquisitionService = new ImageAcquisitionService(deviceKind); - - var wiaImageFile = acquisitionService.Acquire(); - if (wiaImageFile == null) - return; - - var imageFile = ConvertToPngOrJpegIfNotAlready(wiaImageFile); - _currentImage = PalasoImage.FromFile(imageFile); - _pictureBox.Image = _currentImage.Image; - - if (ImageChanged != null) - ImageChanged.Invoke(this, null); - } - catch (ImageDeviceNotFoundException error) - { - _messageLabel.Text = error.Message + Environment.NewLine + Environment.NewLine + - TwainDriverNotSupportedMessage; - _messageLabel.Visible = true; - } - catch (WIA_Version2_MissingException) - { - _messageLabel.Text = WIAVersion2MissingMessage; - _messageLabel.Visible = true; - } - catch (Exception error) - { - ErrorReport.NotifyUserOfProblem(error, ProblemGettingImageFromDeviceMessage); - } - } - - // This is a separate property because L10nSharp's extraction code cannot properly load - // Interop.WIA by reflection, so any strings contained in methods that depend on WIA - // calls are omitted. - private string TwainDriverNotSupportedMessage => - LocalizationManager.GetString("ImageToolbox.TwainDriverNotSupported", - "Note: this program works with devices that have a \"WIA\" driver, not the " + - "old-style \"TWAIN\" driver"); - - // This is a separate property because L10nSharp's extraction code cannot properly load - // Interop.WIA by reflection, so any strings contained in methods that depend on WIA - // calls are omitted. - private string WIAVersion2MissingMessage => - string.Format( - LocalizationManager.GetString("ImageToolbox.WindowsXpMissingWiaV2Dll", - "Windows XP does not come with a crucial DLL that lets you use a WIA scanner with " + - "this program. Get a technical person to download and follow the directions at {0}", - "Param 0: URL to download a zip file"), - "http://vbnet.mvps.org/files/updates/wiaautsdk.zip"); - - // This is a separate property because L10nSharp's extraction code cannot properly load - // Interop.WIA by reflection, so any strings contained in methods that depend on WIA - // calls are omitted. - private string ProblemGettingImageFromDeviceMessage => - "Problem Getting Image".Localize("ImageToolbox.ProblemGettingImageFromDevice"); - - /// - /// Use if the calling app already has some notion of what the user might be looking for (e.g. the definition in a dictionary program) - /// - /// - public void SetInitialSearchString(string searchTerm) - { - _galleryControl.SetInitialSearchTerm(searchTerm); - } - - /// - /// Gets or sets the language used in searching for an image by words. - /// - public string SearchLanguage - { - get => _galleryControl.SearchLanguage; - set => _galleryControl.SearchLanguage = value; - } - - /* - /// - /// Bitmaps --> PNG, JPEGs stay as JPEGs. - /// Will delete the incoming file if it needs to do a conversion. - /// - private string ConvertToPngOrJpegIfNotAlready(string incoming) - { - string outgoing = incoming; - //important to dispose of these things, they lock down the file. - using (var image = Image.FromFile(incoming)) - { - if (!ImageFormat.Png.Equals(image.PixelFormat) && !ImageFormat.Jpeg.Equals(image.PixelFormat)) - { - using (var stream = new MemoryStream()) - { - incoming.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); - var oldCropped = cropped; - cropped = System.Drawing.Image.FromStream(stream) as Bitmap; - oldCropped.Dispose(); - Require.That(ImageFormat.Jpeg.Guid == cropped.RawFormat.Guid, "lost jpeg formatting"); - } - - outgoing = Path.GetTempFileName(); - image.Save(outgoing, ImageFormat.Png); - } - } - if (outgoing != incoming) - { - try - { - File.Delete(incoming); - } - catch (Exception e) - { - Debug.Fail(e.Message); - //in release, just keep going - } - } - return outgoing; - } - */ - - private string ConvertToPngOrJpegIfNotAlready(ImageFile wiaImageFile) - { - var imageBytes = (byte[])wiaImageFile.FileData.get_BinaryData(); - if (wiaImageFile.FileExtension == ".jpg" || wiaImageFile.FileExtension == ".png") - { - var temp = TempFile.WithExtension(wiaImageFile.FileExtension); - wiaImageFile.SaveFile(temp.Path); - return temp.Path; - } - - using (var stream = new MemoryStream(imageBytes)) - { - //Ok, so we want to know if we should save a jpeg (photo) or a png (line art). - //Here, we just chose whichever makes for a the smaller file. - //Test results - // PNG JPG - //B&W Drawing 110k 813k - //Newspaper photo 1.3M 97k - //Little doodle 1.7k 11k - - //NB: we do not want to dispose of these, because we will be passing back the path of one - //(and will manually delete the other) - TempFile jpeg = TempFile.WithExtension(".jpg"); - TempFile png = TempFile.WithExtension(".png"); - - //DOCS: "You must keep the stream open for the lifetime of the Image." (maybe just true for jpeg images) - using (var acquiredImage = Image.FromStream(stream)) - { - acquiredImage.Save(jpeg.Path, ImageFormat.Jpeg); - acquiredImage.Save(png.Path, ImageFormat.Png); - } - - //now return the smaller of the two; - if (new FileInfo(jpeg.Path).Length > new FileInfo(png.Path).Length) - { - File.Delete(jpeg.Path); - return png.Path; - } - else - { - File.Delete(png.Path); - return jpeg.Path; - } - } - } - - private enum Modes { Gallery, SingleImage } - private void SetMode(Modes mode) - { - _messageLabel.Visible = false; - switch (mode) - { - case Modes.Gallery: - _pictureBox.Visible = false; - _pictureBox.Image = null; //prevent error upon resetting visibility to true - _galleryControl.Visible = true; - //_galleryButton.Select(); - _galleryButton.Checked = true; - _galleryControl.Focus(); - break; - case Modes.SingleImage: - _galleryButton.Checked = false; - _pictureBox.Visible = true; - _galleryControl.Visible = false; - break; - default: - throw new ArgumentOutOfRangeException(nameof(mode)); - } - } - - private void OnGalleryClick(object sender, EventArgs e) - { - SetMode(Modes.Gallery); - _galleryControl.Focus(); - } - - private void AcquireImageControl_Load(object sender, EventArgs e) - { - if (_galleryControl.HaveImageCollectionOnThisComputer) - { - SetMode(Modes.Gallery); - _focusTimer.Interval = 100; - _focusTimer.Enabled = true; - } - else - { - SetMode(Modes.SingleImage); - } - // This control can get loaded when the overall dialog is being disposed. - // See https://issues.bloomlibrary.org/youtrack/issue/BL-10314 if you don't believe me. - Load -= AcquireImageControl_Load; - } - - /// - /// Set the focus on the search box in the ArtOfReadingChooser after a delay - /// to let things settle down. It's unfortunate, but the Mono runtime - /// library appears to need this. (See https://jira.sil.org/browse/BL-964.) - /// - private void _focusTimer_Tick(object sender, EventArgs e) - { - _focusTimer.Enabled = false; - _focusTimer.Dispose(); - _focusTimer = null; - _galleryControl.FocusSearchBox(); - } - - private void AcquireImageControl_DragEnter(object sender, DragEventArgs e) - { - try - { - - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - { - var a = (Array)e.Data.GetData(DataFormats.FileDrop); - - if (a != null) - { - var path = a.GetValue(0).ToString(); - if ((new List(new[] { ".tif", ".png", ".bmp", ".jpg", ".jpeg" })).Contains(Path.GetExtension(path).ToLower())) - { - e.Effect = DragDropEffects.Copy; - return; - } - } - - } - } - catch (Exception) - { - } - e.Effect = DragDropEffects.None; - } - - /// - /// _galleryControl is supposed to fill us with just some minor margins to the left and right. - /// Mono changes our size before it calculates the margin to maintain with those anchors being - /// set left and right. Being a timing/sequencing issue, this is hard to fix in Mono, so for - /// now we'll patch it with a workaround here. - /// - /// - /// I know this is a hack, but my first attempt to patch Mono had no effect, and I'm not sure - /// this bug is worth spending much more time on. (https://jira.sil.org/browse/BL-778 "[Linux] - /// Image Toolbox only displays 2 columns of AoR images (Windows does 3)") - /// - protected void FixMyLayoutForMono() - { - // The numbers used here come from comparing the Size assignments of the various - // controls in the .Designer.cs file, taking into account also the Location - // assignments of the child controls. These exact values are gone by the time - // we get here, so the differences (the margins for anchor right and bottom) are - // also gone. This is exactly the bug in the Mono code: the anchor margins are - // calculated at the wrong point when sizes have already changed. (Note that the - // Location gives the margins for anchor left and top.) - if (_galleryControl != null && Contains(_galleryControl) && - (Width - _galleryControl.Width > 6 || Height - _galleryControl.Height > 60)) - { - var oldSize = _galleryControl.Size; - _galleryControl.Anchor = AnchorStyles.Top | AnchorStyles.Left; - _galleryControl.Size = new Size(Width - 6, Height - 60); - _galleryControl.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | - AnchorStyles.Left | AnchorStyles.Right; - } - if (_messageLabel != null && Contains(_messageLabel) && Width - _messageLabel.Width != 223) - { - _messageLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left; - _messageLabel.Size = new Size(Width - 223, _messageLabel.Height); - _messageLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | - AnchorStyles.Right; - } - if (_pictureBox != null && Contains(_pictureBox) && - (Width != _pictureBox.Width || Height - _pictureBox.Height != 60)) - { - _pictureBox.Anchor = AnchorStyles.Top | AnchorStyles.Left; - _pictureBox.Size = new Size(Width, Height - 60); - _pictureBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | - AnchorStyles.Left | AnchorStyles.Right; - } - } - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/AcquireImageControl.resx b/SIL.Windows.Forms/ImageToolbox/AcquireImageControl.resx deleted file mode 100644 index 522440395..000000000 --- a/SIL.Windows.Forms/ImageToolbox/AcquireImageControl.resx +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - - - iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABjESURBVHhe7ZoJdFP3lYc7bWfO6UybdtLJdLJMSNJO02mS - tqENCQlpdhISkkATEgKhlAAJhJCEHbMZg1m84A1jAzbG2Nh4w8b7KsuyLcva932zJMuS91VeZf3mPvk5 - 8fRMWkg7c+ac+p7zHT09PfR0v3fvff8HfGM+5mM+5mM+5mM+5mM+5uPWQpP3zHfFV194RJj90kp16Tth - 2sr1+ary92IlWc/8C3vIXz0A/B1DS8oTt/POL1zYmLpktSjnjdP8jJdWs4f8dYJO8k1r7b7vKyrWPaot - W/2OvmbTSSPn4yJby8FGuzRa3aFIdHRbcrsH7WXDblt1YHJUj8C0A5M+E9QVm9LYr7nlYBP8pq5w2w9F - OcsfE+WueF9Vsi5CVbm9wiKIkrrUmbYuW1X3gIU/0tmpnxgfaYN/shM9mqrR2rO/+Cn7NX9ZqKq2Fxv4 - EY4uQ6p3wHV90GXKD0wMCzE9qUHAr2XRUcIGwka4CC8Q6KH9FrgUyTr2q4LBJvVt4h8CgcB3iO9162/c - pa7+/Cll6eb12qotZ3ScPRVWcYzMpcm2ddspQe9sgnZMTXrp+3sRCHQRbsJB0HkD1i8Y6ROi8fIzm9lT - fv2Q5L34/WsXN/WM9PMQmBQjMCUj1AQl66eT+V3AtIfoJLop6V6inxgkhuhzIzyarPYxr+gBCz/qeQMv - ZKOxfm+MnhdSbm+JFLerUkydhnxvv4s72NPdOu5xCAJT45QQCQwEOggnK9VM2yYWZpvBQnyZ9FzGhsRo - yVoWxabx9UOR8dI/ZSav7QpMiChpI0En9tMP8rcBf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IQAVQpQTxbalo8X7xR - qHJhJRXwYyaexRJLW+6nVKyNb2/pQaVKaxZgyA4Gg9bQfw9Aq8cYGl2G2C8AaGcA7mkxANGQ2ApI7yWA - A9QDa6YHx2k9WYl11UpYVbkeUkXSd4VqFqYw0bMSq1imqZC6A2uKttOMrXBwxAFGAgC+zQyA7oA5tPsY - gG4j7BMA3CeANgagRWMWgD5C0qrUA12mB4Jr2YcAAgiAo4RvqjZCpkS2+6ubEu8KKNDcKgm5xZeV3iik - fwuTUSccHHWA4bAdDggAeAxAvyk0e42hLgDonAXY3U4ArR8CSO2kHmhRDwTXsuPstbzCv4IANmNN1SbI - li3lzrklZs9Ez2p+2fzP58esnlidsQXG444fAOgRgA7XHFoEoNFnjP09swBqHbMAuwhg5913AJJ/ox7s - pzEYzV7LKz3oJHwJoIYAqjdBunLpyGdt4quY6Head16evzZj2wyA0ag9DAhAf4gABq2gwyOAgXcAe7sM - sKdTD6r3daBCADvuaWCZe8zb3wLSajQGupaXWtF/706rVxlECsV+kri2+PlXlZLXWdmsPzCx7zQvUr5z - c74qTH50xsFxOoFROgEBAJ8B4L4H0P0OYHvTfmxm7/xZRu/sm38BSO0iAB3qgeDzTNeylAtn+LNWCQUW - R/zPTNyvJRqyuE+jwRimD1xgMu4EozGHmVPQ6jDF7hLtn1emq0wrsBVeLM1RfLwkZ82wTNayLrF0+VsL - 2HIFwpUyvnP3XIh8C7CDeqDJXMv0eZY1a8phYv69JJOXlyomKb5ckaH8ZFXShjH5hLW9snEKzdIpy0ok - 2EtOLShbvE00X34u8/ivNFcuWHTRhvFBAYDkd9QDwbVMn+f5luOvxFRTdzOP/QfRXMRS5UXefqH+C30p - n7BhwdrWv4st501Lqb6CuEpHt/C3SYbM9m+IxfonlyglMFY6wckAAAAASUVORK5CYII= - - - - 122, 17 - - \ No newline at end of file diff --git a/SIL.Windows.Forms/ImageToolbox/Cropping/Grip.cs b/SIL.Windows.Forms/ImageToolbox/Cropping/Grip.cs deleted file mode 100644 index 7faeb964b..000000000 --- a/SIL.Windows.Forms/ImageToolbox/Cropping/Grip.cs +++ /dev/null @@ -1,169 +0,0 @@ -using System; -using System.Drawing; - -namespace SIL.Windows.Forms.ImageToolbox.Cropping -{ - internal class Grip - { - internal Rectangle Rectangle; - - internal enum Sides {Left, Right, Top, Bottom}; - - internal Grip(int value, int width, int height, Sides side, System.Func getCenterValue, System.Func getMinValue , System.Func getMaxValue) - { - Side = side; - _getCenterValue = getCenterValue; - _getMinValue = getMinValue; - _getMaxValue = getMaxValue; - /*not VALUE property!*/_value = value; - Rectangle = new Rectangle(value, value, width, height); - } - - internal Sides Side; - - //these are functions becuase they are dependent on the location of other grips - private readonly System.Func _getCenterValue; - private readonly System.Func _getMinValue; - private readonly System.Func _getMaxValue; - private int _value; - - internal int Width - { - get { return Rectangle.Width; } - } - internal int Height - { - get { return Rectangle.Height; } - } - - internal Point Location - { - get { return Rectangle.Location; } - set { Rectangle.Location = value; } - } - - internal int Top - { - get { return Rectangle.Top; } - } - - internal int Bottom - { - get { return Rectangle.Bottom; } - } - - internal int Right - { - get { return Rectangle.Right; } - - } - internal int Left - { - get { return Rectangle.Left; } - - } - - internal bool MovesVertically { get { return Rectangle.Width > Rectangle.Height; } } - - internal int Value - { - get - { - return _value; - } - - set - { - _value = Math.Max(_getMinValue(),value); - _value = Math.Min(_value, _getMaxValue()); - UpdateRectangle(); - } - } - - internal int InnerEdge - { - get - { - switch (Side) - { - case Sides.Left: - return Value + Width; - case Sides.Right: - return Value+Width; - case Sides.Top: - return Value+Height; - case Sides.Bottom: - return Value+Height; - default: - throw new ArgumentOutOfRangeException(); - } - } - } - - internal void UpdateRectangle() - { - switch (Side) - { - case Sides.Left: - var top = _getCenterValue() - (Height / 2); - Location = new Point(_value, top);//at value 0, our left is at 0 (and it's the right edge of the affordance which counts) - break; - case Sides.Right: - var left = _getCenterValue() - (Height / 2); - Location = new Point(_value + Width, left); - break; - case Sides.Top: - var top2 = _getCenterValue() - (Width / 2); - Location = new Point(top2, _value);//at value 0, out bottom is at 0+height, but our top is at 0 - break; - case Sides.Bottom: - var left2 = _getCenterValue() - (Width / 2); - Location = new Point(left2, _value + Height); - break; - default: - throw new ArgumentOutOfRangeException(); - } - } - - - - internal bool Contains(Point location) - { - return Rectangle.Contains(location); - } - - const int GripDotSpacing = 3; - internal void Paint(Graphics g) - { -// int rows = Rectangle.Height / GripDotSpacing; -// for (int row = 0; row < rows; row += 2) -// { -// DrawOneRowGrip(g, Rectangle, row, 0); -// DrawOneRowGrip(g, Rectangle, row + 1, 2); -// } - - g.FillRectangle(Brushes.Gray, Rectangle); - } - - private void DrawOneRowGrip(Graphics graphics, Rectangle r, int row, int offset) - { - for (int column = 0; column < r.Width; column += 4) - { - // light dot - graphics.DrawRectangle(new Pen(SystemColors.ControlLightLight), - r.X + offset + column, - r.Y + 1 + (row * GripDotSpacing), - 1, - 1); - // dark dot - graphics.DrawRectangle(new Pen(SystemColors.ControlDark), - r.X + offset + column - 1, - r.Y + (row * GripDotSpacing), - 1, - 1); - } - } - - - } -} \ No newline at end of file diff --git a/SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.cs b/SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.cs deleted file mode 100644 index 2699d03da..000000000 --- a/SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.cs +++ /dev/null @@ -1,511 +0,0 @@ -using System; -using System.Diagnostics; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Windows.Forms; -using SIL.Code; -using SIL.IO; -using SIL.Reporting; - -namespace SIL.Windows.Forms.ImageToolbox.Cropping -{ - public partial class ImageCropper : UserControl, IImageToolboxControl - { - private PalasoImage _image; - private Grip _gripperBeingDragged; - private Rectangle _sourceImageArea; - private const int GripThickness = 20; - private const int GripLength = 80; - private const int BorderSize = GripThickness; - private Grip _bottomGrip; - private Grip _topGrip; - private Grip _leftGrip; - private Grip _rightGrip; - - /// - /// Used to mark the spot where the user first started dragging the mouse, when he clicks somewhere other than one of the grips. - /// We use this to create the new crop rectangle as he continues the drag. - /// - private Point _startOfDrag = default(Point); - - //we will be cropping the image, so we need to keep the original lest we be cropping the crop, so to speak - private ImageFormat _originalFormat; - private TempFile _savedOriginalImage; - private Image _croppingImage; - - private const int MarginAroundPicture = GripThickness; - private const int MinDistanceBetweenGrips = 20; - private bool didReportThatUserCameInHere; - - public ImageCropper() - { - InitializeComponent(); - - Application.Idle += new EventHandler(Application_Idle); - } - - private void Application_Idle(object sender, EventArgs e) - { - if (_image == null) - return; - - if (_startOfDrag != default(Point)) - { - DoCropDrag(); - } - else if (_gripperBeingDragged != null) - { - DoGripDrag(); - } - Invalidate(); - } - - private void DoGripDrag() - { - Point mouse = PointToClient(MousePosition); - if (_gripperBeingDragged.MovesVertically) - { - _gripperBeingDragged.Value = mouse.Y - MarginAroundPicture; - - //adjust the vertical position of other axis' grips - foreach (var grip in HorizontalControlGrips) - { - grip.UpdateRectangle(); - } - } - else - { - _gripperBeingDragged.Value = mouse.X - MarginAroundPicture; - foreach (var grip in VerticalControlGrips) - { - grip.UpdateRectangle(); - } - } - if(!didReportThatUserCameInHere) - { - didReportThatUserCameInHere = true; - UsageReporter.SendNavigationNotice("ImageToolbox:Cropper"); - } - } - - private void DoCropDrag() - { - return; - // REVIEW: Is this code intentionally disabled? - // REVIEW (Hasso) 2020.04: looks like hatton started work on this in 2010-12 and gave up in 2012-04 - /* - Grip hStart, vStart, hEnd, vEnd; - - Point mouse = PointToClient(MousePosition); - if (_startOfDrag.X < mouse.X) - { - hStart = _leftGrip; - hEnd = _rightGrip; - } - else - { - hEnd = _leftGrip; - hStart = _rightGrip; - } - - if (_startOfDrag.Y < mouse.Y) - { - vStart = _topGrip; - vEnd = _bottomGrip; - } - else - { - vEnd = _topGrip; - vStart = _bottomGrip; - } - - hStart.Value = _startOfDrag.X - MarginAroundPicture; - vStart.Value = _startOfDrag.Y - MarginAroundPicture; - hEnd.Value = mouse.X - MarginAroundPicture; - vEnd.Value = mouse.Y - MarginAroundPicture; - */ - } - - protected int MiddleOfVerticalGrips() - { - return _leftGrip.Right + ((_rightGrip.Left - _leftGrip.Right)/2); - } - - protected int MiddleOfHorizontalGrips() - { - return _topGrip.Bottom + ((_bottomGrip.Top - _topGrip.Bottom)/2); - } - - public PalasoImage Image - { - get { return _image; } - set - { - if (value == null) - return; - - //other code changes the image of this palaso image, at which time the PI disposes of its copy, - //so we better keep our own. - - // save the original in a temp file instead of an Image object to free up memory - _savedOriginalImage = TempFile.CreateAndGetPathButDontMakeTheFile(); - value.Image.Save(_savedOriginalImage.Path, ImageFormat.Png); - - // make a reasonable sized copy to crop - if ((value.Image.Width > 1000) || (value.Image.Width > 1000)) - { - _croppingImage = CreateCroppingImage(value.Image.Height, value.Image.Width); - - var srcRect = new Rectangle(0, 0, value.Image.Width, value.Image.Height); - var destRect = new Rectangle(0, 0, _croppingImage.Width, _croppingImage.Height); - - using (var g = Graphics.FromImage(_croppingImage)) - { - g.DrawImage(value.Image, destRect, srcRect, GraphicsUnit.Pixel); - } - } - else - { - _croppingImage = (Image)value.Image.Clone(); - } - - _image = value; - - CalculateSourceImageArea(); - CreateGrips(); - - foreach (var grip in Grips) - { - grip.UpdateRectangle(); - } - - Invalidate(); - } - } - - /// - /// To conserve memory we will shrink large images before cropping - /// - /// - /// - /// - private static Image CreateCroppingImage(int oldHeight, int oldWidth) - { - int newHeight; - int newWidth; - - if (oldHeight > oldWidth) - { - newHeight = 800; - newWidth = newHeight * oldWidth / oldHeight; - } - else - { - newWidth = 800; - newHeight = newWidth * oldHeight / oldWidth; - } - - return new Bitmap(newWidth, newHeight); - } - - private void CreateGrips() - { - _bottomGrip = new Grip(_sourceImageArea.Height, GripLength, GripThickness, Grip.Sides.Bottom, - MiddleOfVerticalGrips, - () => _topGrip.Value + MinDistanceBetweenGrips, - () => _sourceImageArea.Height); - - _topGrip = new Grip(0, GripLength, GripThickness, Grip.Sides.Top, - MiddleOfVerticalGrips, - () => 0, - () => _bottomGrip.Value - MinDistanceBetweenGrips); - _leftGrip = new Grip(0, GripThickness, GripLength, Grip.Sides.Left, - MiddleOfHorizontalGrips, - () => 0, - () => _rightGrip.Value - MinDistanceBetweenGrips); - - _rightGrip = new Grip(_sourceImageArea.Width, GripThickness, GripLength, Grip.Sides.Right, - MiddleOfHorizontalGrips, - () => _leftGrip.Value + MinDistanceBetweenGrips, - () => _sourceImageArea.Width); - } - - - private void ImageCropper_Resize(object sender, EventArgs e) - { - if (_image == null) - return; - - var old = _sourceImageArea; - - - CalculateSourceImageArea(); - - if (old.Width == 0 || old.Height == 0) - return; - - float horizontalGrowthFactor = ((float) _sourceImageArea.Width)/((float) old.Width); - float verticalGrowthFactor = ((float) _sourceImageArea.Height)/((float) old.Height); - - foreach (var grip in VerticalControlGrips) - { - grip.Value = (int) ((float) grip.Value*verticalGrowthFactor); - } - foreach (var grip in HorizontalControlGrips) - { - grip.Value = (int) ((float) grip.Value*horizontalGrowthFactor); - } - - foreach (var grip in Grips) - { - grip.UpdateRectangle(); - } - - Invalidate(); - } - - private void CalculateSourceImageArea() - { - float imageToCanvaseScaleFactor = GetImageToCanvasScaleFactor(_croppingImage); - _sourceImageArea = new Rectangle(GripThickness, GripThickness, - (int)(_croppingImage.Width*imageToCanvaseScaleFactor), - (int)(_croppingImage.Height*imageToCanvaseScaleFactor)); - } - - private float GetImageToCanvasScaleFactor(Image img) - { - var availArea = new Rectangle(BorderSize, BorderSize, Width - (2*BorderSize), Height - (2*BorderSize)); - float hProportion = (float)availArea.Width / ((float)img.Width); - float vProportion = (float)availArea.Height / ((float)img.Height); - return Math.Min(hProportion, vProportion); - } - - protected override void OnPaint(PaintEventArgs e) - { - if (_croppingImage == null || _sourceImageArea.Width == 0) - return; - - try - { - - e.Graphics.FillRectangle(Brushes.Gray, ClientRectangle); - e.Graphics.DrawImage( - _croppingImage, - _sourceImageArea, - new Rectangle( // Source - 0, 0, - _croppingImage.Width, _croppingImage.Height), - GraphicsUnit.Pixel); - - using (Brush brush = new Pen(Color.FromArgb(150, Color.LightBlue)).Brush) - { - e.Graphics.FillRectangle(brush, _leftGrip.InnerEdge, _bottomGrip.InnerEdge, - _rightGrip.InnerEdge - _leftGrip.InnerEdge - /*this avoids overlapp which makes it twice as light*/ - , Height - _bottomGrip.InnerEdge); - e.Graphics.FillRectangle(brush, _leftGrip.InnerEdge, 0, _rightGrip.InnerEdge - _leftGrip.InnerEdge, - _topGrip.InnerEdge); - e.Graphics.FillRectangle(brush, 0, 0, _leftGrip.InnerEdge, Height); - e.Graphics.FillRectangle(brush, _rightGrip.InnerEdge, 0, Width - _rightGrip.InnerEdge, Height); - } - e.Graphics.DrawRectangle(Pens.LightBlue, _leftGrip.Right, _topGrip.Bottom, - _rightGrip.Left - _leftGrip.Right, _bottomGrip.Top - _topGrip.Bottom); - - _bottomGrip.Paint(e.Graphics); - _topGrip.Paint(e.Graphics); - _leftGrip.Paint(e.Graphics); - _rightGrip.Paint(e.Graphics); - - } - catch (Exception error) - { - Debug.Fail(error.Message); - // UserControl does not have UseCompatibleTextRendering. - TextRenderer.DrawText(e.Graphics, "Error in OnPaint()", SystemFonts.DefaultFont, new Point(20,20), Color.Red); - //swallow in release build - } - } - - private Grip[] Grips - { - get { return new Grip[] {_bottomGrip, _topGrip, _leftGrip, _rightGrip}; } - } - - private Grip[] VerticalControlGrips - { - get { return new Grip[] {_bottomGrip, _topGrip}; } - } - - private Grip[] HorizontalControlGrips - { - get { return new Grip[] {_leftGrip, _rightGrip}; } - } - - private void ImageCropper_MouseDown(object sender, MouseEventArgs e) - { - - foreach (var grip in Grips) - { - if (grip.Contains(e.Location)) - { - _gripperBeingDragged = grip; - return; - } - } - _startOfDrag = e.Location; - } - - private void ImageCropper_MouseUp(object sender, MouseEventArgs e) - { - _gripperBeingDragged = null; - - _startOfDrag = default(Point); - if (ImageChanged != null) - ImageChanged.Invoke(this, null); - } - -// public void CheckBug() -// { -// var z = 1.0/GetImageToCanvasScaleFactor(); -// double d = z*_leftGrip.Value + z*(_rightGrip.Value - _leftGrip.Value); -// { -// var s = ""; -// if (d > _image.Width) -// s = " > ImageWidth="+_image.Width; -// Debug.WriteLine(string.Format("scale={0} z={1} left={2} right={3} left+(right-left)={4} "+s, -// GetImageToCanvasScaleFactor(), z, _leftGrip.Value, _rightGrip.Value, d)); -// } -// } - - public Image GetCroppedImage() - { - if (_image == null || _image.Disposed) - return null; - - try - { - //jpeg = b96b3c *AE* -0728-11d3-9d7b-0000f81ef32e - //bitmap = b96b3c *AA* -0728-11d3-9d7b-0000f81ef32e - - //NB: this worked for tiff and png, but would crash with Out Of Memory for jpegs. - //This may be because I closed the stream? THe doc says you have to keep that stream open. - //Also, note that this method, too, lost our jpeg encoding: - // return bmp.Clone(selection, _image.PixelFormat); - //So now, I first copy it, then clone with the bounds of our crop: - - using (var originalImage = new Bitmap(_savedOriginalImage.Path)) //**** here we lose the jpeg rawimageformat, if it's a jpeg. Grrr. - { - double z = 1.0 / GetImageToCanvasScaleFactor(originalImage); - - int width = Math.Max(1, _rightGrip.Value - _leftGrip.Value); - int height = Math.Max(1, _bottomGrip.Value - _topGrip.Value); - var left = (int)Math.Round(z * _leftGrip.Value); - var top = (int)Math.Round(z * _topGrip.Value); - // Rounding may yield e.g. left + width > originalImage.Width, which will cause - // Clone (unhelpfully!!!) to throw OutOfMemory. So if the total we came up with - // is too big, make it just slightly smaller. This typically comes up when - // dragging the top and left sliders, so going all the way to the opposite edge - // is likely to be right. - var selectionWidth = Math.Min((int)Math.Round(z * width), originalImage.Width - left); - var selectionHeight = Math.Min((int)Math.Round(z * height), originalImage.Height - top); - // If the bottom and top grips haven't moved, make sure we don't trim anything off those sides. - if (_rightGrip.Value == _sourceImageArea.Width) - selectionWidth = originalImage.Width - left; - if (_bottomGrip.Value == _sourceImageArea.Height) - selectionHeight = originalImage.Height - top; - var selection = new Rectangle(left, top, selectionWidth, selectionHeight); - - var cropped = originalImage.Clone(selection, originalImage.PixelFormat); //do the actual cropping - - if (_originalFormat.Guid == ImageFormat.Jpeg.Guid) - { - //We've sadly lost our jpeg formatting, so now we encode a new image in jpeg - using (var stream = new MemoryStream()) - { - cropped.Save(stream, ImageFormat.Jpeg); - var oldCropped = cropped; - cropped = System.Drawing.Image.FromStream(stream) as Bitmap; - oldCropped.Dispose(); - Require.That(ImageFormat.Jpeg.Guid == cropped.RawFormat.Guid, "lost jpeg formatting"); - } - } - return cropped; - } - } - catch (Exception e) - { - Debug.Fail(e.Message); - ErrorReport.NotifyUserOfProblem(e, "Sorry, there was a problem getting the image"); - return null; - } - } - - public void SetImage(PalasoImage image) - { - if (image == null) - { - Image = null; - } - else - { - _originalFormat = image.Image.RawFormat; - Image = image; - } - } - - public PalasoImage GetImage() - { - Image x = GetCroppedImage(); - // BL-5830 somehow user was cropping an image and this PalasoImage was already disposed - if (x == null || _image.Disposed) - return null; - //we want to retain the metdata of the PalasoImage we started with; we just want to update its actual image - _image.Image = x; - - return _image; - } - - public event EventHandler ImageChanged; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (components != null) - { - components.Dispose(); - components = null; - } - - try - { - if (_savedOriginalImage != null) - { - _savedOriginalImage.Dispose(); - _savedOriginalImage = null; - } - - if (_croppingImage != null) - { - _croppingImage.Dispose(); - _croppingImage = null; - } - } - // BL-2680, somehow user can get in a state where we CAN'T delete a temp file. - // I think we can afford to just ignore it. One temp file will be leaked. - catch (IOException) - { - } - catch (UnauthorizedAccessException) - { - } - } - base.Dispose(disposing); - } - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.designer.cs b/SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.designer.cs deleted file mode 100644 index 89588baa3..000000000 --- a/SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace SIL.Windows.Forms.ImageToolbox.Cropping -{ - partial class ImageCropper - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // ImageCropper - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.DoubleBuffered = true; - this.Name = "ImageCropper"; - this.Size = new System.Drawing.Size(362, 293); - this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ImageCropper_MouseDown); - this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ImageCropper_MouseUp); - this.Resize += new System.EventHandler(this.ImageCropper_Resize); - this.ResumeLayout(false); - - } - - #endregion - - - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.resx b/SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.resx deleted file mode 100644 index 1cd0b4831..000000000 --- a/SIL.Windows.Forms/ImageToolbox/Cropping/ImageCropper.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.Designer.cs b/SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.Designer.cs deleted file mode 100644 index 7a82baaad..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.Designer.cs +++ /dev/null @@ -1,258 +0,0 @@ -namespace SIL.Windows.Forms.ImageToolbox.ImageGallery -{ - partial class ImageGalleryControl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - private bool disposed = false; - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposed) - return; - disposed = true; - if (disposing) - { - if (_thumbnailViewer != null) - _thumbnailViewer.Closing(); //this guy was working away in the background - if (_messageLabel != null) - _messageLabel.SizeChanged -= MessageLabelSizeChanged; - - if (components != null) - components.Dispose(); - if (_thumbnailViewer != null) - { - _thumbnailViewer.Dispose(); - _thumbnailViewer = null; - } - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this._searchButton = new System.Windows.Forms.Button(); - this._searchResultStats = new System.Windows.Forms.Label(); - this._labelSearch = new System.Windows.Forms.Label(); - this.toolStrip1 = new System.Windows.Forms.ToolStrip(); - this._searchLanguageMenu = new System.Windows.Forms.ToolStripDropDownButton(); - this._downloadInstallerLink = new SIL.Windows.Forms.Widgets.BetterLinkLabel(); - this._messageLabel = new SIL.Windows.Forms.Widgets.BetterLabel(); - this._searchTermsBox = new SIL.Windows.Forms.Widgets.TextInputBox(); - this._thumbnailViewer = new ThumbnailViewer(); - this._localizationHelper = new SIL.Windows.Forms.i18n.LocalizationHelper(this.components); - this._collectionToolStrip = new System.Windows.Forms.ToolStrip(); - this._collectionDropDown = new System.Windows.Forms.ToolStripDropDownButton(); - this.toolStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._localizationHelper)).BeginInit(); - this._collectionToolStrip.SuspendLayout(); - this.SuspendLayout(); - // - // _searchButton - // - this._searchButton.Font = new System.Drawing.Font("Segoe UI", 9F); - this._searchButton.Image = global::SIL.Windows.Forms.Properties.Resources.search18x18; - this._searchButton.Location = new System.Drawing.Point(175, 35); - this._searchButton.Name = "_searchButton"; - this._searchButton.Size = new System.Drawing.Size(48, 28); - this._searchButton.TabIndex = 1; - this._searchButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._searchButton.UseVisualStyleBackColor = true; - this._searchButton.Click += new System.EventHandler(this._searchButton_Click); - // - // _searchResultStats - // - this._searchResultStats.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left))); - this._searchResultStats.Font = new System.Drawing.Font("Segoe UI", 10F); - this._searchResultStats.Location = new System.Drawing.Point(9, 70); - this._searchResultStats.Name = "_searchResultStats"; - this._searchResultStats.Size = new System.Drawing.Size(375, 22); - this._searchResultStats.TabIndex = 12; - this._searchResultStats.Text = "~Search Result Stats"; - // - // _labelSearch - // - this._labelSearch.AutoSize = true; - this._labelSearch.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._labelSearch.Location = new System.Drawing.Point(8, 8); - this._labelSearch.Name = "_labelSearch"; - this._labelSearch.Size = new System.Drawing.Size(120, 20); - this._labelSearch.TabIndex = 14; - this._labelSearch.Text = "Image Galleries"; - // - // toolStrip1 - // - this.toolStrip1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.toolStrip1.AutoSize = false; - this.toolStrip1.BackColor = System.Drawing.Color.Transparent; - this.toolStrip1.CanOverflow = false; - this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None; - this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._searchLanguageMenu}); - this.toolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; - this.toolStrip1.Location = new System.Drawing.Point(228, 35); - this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(200, 28); - this.toolStrip1.TabIndex = 15; - this.toolStrip1.Text = "toolStrip1"; - // - // _searchLanguageMenu - // - this._searchLanguageMenu.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this._searchLanguageMenu.ImageTransparentColor = System.Drawing.Color.Magenta; - this._searchLanguageMenu.Name = "_searchLanguageMenu"; - this._searchLanguageMenu.Size = new System.Drawing.Size(107, 19); - this._searchLanguageMenu.Text = "Language Name"; - this._searchLanguageMenu.Visible = false; - // - // _downloadInstallerLink - // - this._downloadInstallerLink.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._downloadInstallerLink.BorderStyle = System.Windows.Forms.BorderStyle.None; - this._downloadInstallerLink.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Underline); - this._downloadInstallerLink.ForeColor = System.Drawing.Color.Blue; - this._downloadInstallerLink.IsTextSelectable = true; - this._downloadInstallerLink.Location = new System.Drawing.Point(24, 269); - this._downloadInstallerLink.Multiline = true; - this._downloadInstallerLink.Name = "_downloadInstallerLink"; - this._downloadInstallerLink.ReadOnly = true; - this._downloadInstallerLink.Size = new System.Drawing.Size(470, 17); - this._downloadInstallerLink.TabIndex = 11; - this._downloadInstallerLink.TabStop = false; - this._downloadInstallerLink.Text = "Download Art Of Reading Installer"; - this._downloadInstallerLink.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._downloadInstallerLink.URL = "https://bloomlibrary.org/artofreading"; - this._downloadInstallerLink.Visible = false; - // - // _messageLabel - // - this._messageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._messageLabel.BorderStyle = System.Windows.Forms.BorderStyle.None; - this._messageLabel.Enabled = false; - this._messageLabel.Font = new System.Drawing.Font("Segoe UI", 9F); - this._messageLabel.ForeColor = System.Drawing.Color.Gray; - this._messageLabel.IsTextSelectable = false; - this._messageLabel.Location = new System.Drawing.Point(24, 124); - this._messageLabel.Multiline = true; - this._messageLabel.Name = "_messageLabel"; - this._messageLabel.ReadOnly = true; - this._messageLabel.Size = new System.Drawing.Size(470, 17); - this._messageLabel.TabIndex = 10; - this._messageLabel.TabStop = false; - this._messageLabel.Text = "~No matching images"; - this._messageLabel.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // _searchTermsBox - // - this._searchTermsBox.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._searchTermsBox.Location = new System.Drawing.Point(12, 35); - this._searchTermsBox.Name = "_searchTermsBox"; - this._searchTermsBox.Size = new System.Drawing.Size(157, 28); - this._searchTermsBox.TabIndex = 0; - this._searchTermsBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this._searchTermsBox_KeyDown); - // - // _thumbnailViewer - // - this._thumbnailViewer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._thumbnailViewer.CaptionMethod = null; - this._thumbnailViewer.Location = new System.Drawing.Point(12, 95); - this._thumbnailViewer.Name = "_thumbnailViewer"; - this._thumbnailViewer.Size = new System.Drawing.Size(494, 228); - this._thumbnailViewer.TabIndex = 2; - this._thumbnailViewer.ThumbBorderColor = System.Drawing.Color.Wheat; - this._thumbnailViewer.ThumbNailSize = 95; - this._thumbnailViewer.DoubleClick += new System.EventHandler(this._thumbnailViewer_DoubleClick); - // - // _localizationHelper - // - this._localizationHelper.Parent = this; - // - // _collectionToolStrip - // - this._collectionToolStrip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._collectionToolStrip.AutoSize = false; - this._collectionToolStrip.BackColor = System.Drawing.Color.Transparent; - this._collectionToolStrip.CanOverflow = false; - this._collectionToolStrip.Dock = System.Windows.Forms.DockStyle.None; - this._collectionToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this._collectionToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._collectionDropDown}); - this._collectionToolStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; - this._collectionToolStrip.Location = new System.Drawing.Point(373, 35); - this._collectionToolStrip.Name = "_collectionToolStrip"; - this._collectionToolStrip.Size = new System.Drawing.Size(133, 28); - this._collectionToolStrip.TabIndex = 18; - this._collectionToolStrip.Text = "_collectionToolStrip"; - // - // _collectionDropDown - // - this._collectionDropDown.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this._collectionDropDown.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._collectionDropDown.ImageTransparentColor = System.Drawing.Color.Magenta; - this._collectionDropDown.Name = "_collectionDropDown"; - this._collectionDropDown.Size = new System.Drawing.Size(64, 19); - this._collectionDropDown.Text = "Galleries"; - this._collectionDropDown.Visible = false; - // - // ArtOfReadingChooser - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._labelSearch); - this.Controls.Add(this._collectionToolStrip); - this.Controls.Add(this.toolStrip1); - this.Controls.Add(this._searchResultStats); - this.Controls.Add(this._downloadInstallerLink); - this.Controls.Add(this._messageLabel); - this.Controls.Add(this._searchButton); - this.Controls.Add(this._searchTermsBox); - this.Controls.Add(this._thumbnailViewer); - this.Name = "ImageGalleryControl"; - this.Size = new System.Drawing.Size(530, 325); - this.Load += new System.EventHandler(this.ArtOfReadingChooser_Load); - this.toolStrip1.ResumeLayout(false); - this.toolStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._localizationHelper)).EndInit(); - this._collectionToolStrip.ResumeLayout(false); - this._collectionToolStrip.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private ImageGallery.ThumbnailViewer _thumbnailViewer; - private System.Windows.Forms.Button _searchButton; - private SIL.Windows.Forms.Widgets.TextInputBox _searchTermsBox; - private Widgets.BetterLabel _messageLabel; - private i18n.LocalizationHelper _localizationHelper; - private Widgets.BetterLinkLabel _downloadInstallerLink; - private System.Windows.Forms.Label _searchResultStats; - private System.Windows.Forms.Label _labelSearch; - private System.Windows.Forms.ToolStrip toolStrip1; - private System.Windows.Forms.ToolStripDropDownButton _searchLanguageMenu; - private System.Windows.Forms.ToolStrip _collectionToolStrip; - private System.Windows.Forms.ToolStripDropDownButton _collectionDropDown; - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.cs b/SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.cs deleted file mode 100644 index acc144042..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.cs +++ /dev/null @@ -1,498 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Diagnostics; -using System.Drawing; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Windows.Forms; -using L10NSharp; -using SIL.Reporting; -using SIL.Windows.Forms.Extensions; - -namespace SIL.Windows.Forms.ImageToolbox.ImageGallery -{ - public partial class ImageGalleryControl : UserControl, IImageToolboxControl - { - private ImageCollectionManager _imageCollectionManager; - private PalasoImage _previousImage; - - public ImageGalleryControl() - { - InitializeComponent(); - _thumbnailViewer.CaptionMethod = ((s) => string.Empty);//don't show a caption - _thumbnailViewer.LoadComplete += ThumbnailViewerOnLoadComplete; - _searchResultStats.Text = ""; - if (Environment.OSVersion.Platform == PlatformID.Unix) - { - // For Linux, we can install the package if requested. - _downloadInstallerLink.Text = "Install the Art Of Reading package (this may be very slow)".Localize("ImageToolbox.InstallArtOfReading"); - _downloadInstallerLink.URL = null; - _downloadInstallerLink.LinkClicked += InstallLinkClicked; - } - else - { - // Ensure that we can get localized text here. - _downloadInstallerLink.Text = "Download Art Of Reading Installer".Localize("ImageToolbox.DownloadArtOfReading"); - } - _labelSearch.Text = "Image Galleries".Localize("ImageToolbox.ImageGalleries"); - SearchLanguage = "en"; // until/unless the owner specifies otherwise explicitly - // Get rid of any trace of a border on the toolstrip. - toolStrip1.Renderer = new NoBorderToolStripRenderer(); - - // For some reason, setting these BackColor values in InitializeComponent() doesn't work. - // The BackColor gets set back to the standard control background color somewhere... - _downloadInstallerLink.BackColor = Color.White; - _messageLabel.BackColor = Color.White; - _messageLabel.SizeChanged += MessageLabelSizeChanged; - } - - /// - /// use if the calling app already has some notion of what the user might be looking for (e.g. the definition in a dictionary program) - /// - /// - public void SetInitialSearchTerm(string searchTerm) - { - _searchTermsBox.Text = searchTerm; - } - - /// - /// use if the calling app already has some notion of what the user might be looking for (e.g. the definition in a dictionary program) - /// - /// - [Obsolete("Use SetInitialSearchTerm (spelling corrected)")] - public void SetIntialSearchTerm(string searchTerm) - { - SetInitialSearchTerm(searchTerm); - } - - /// - /// Gets or sets the language used in searching for an image by words. - /// - public string SearchLanguage { get; set; } - - void _thumbnailViewer_SelectedIndexChanged(object sender, EventArgs e) - { - if(ImageChanged!=null && _thumbnailViewer.HasSelection) - { - ImageChanged.Invoke(this, null); - } - } - - private void _thumbnailViewer_DoubleClick(object sender, EventArgs e) - { - if (ImageChangedAndAccepted != null && _thumbnailViewer.HasSelection) - { - ImageChangedAndAccepted.Invoke(this, null); - } - } - - private void _searchButton_Click(object sender, EventArgs e) - { - Cursor.Current = Cursors.WaitCursor; - _searchButton.Enabled = false; - - try - { - _thumbnailViewer.Clear(); - if (!string.IsNullOrWhiteSpace(_searchTermsBox.Text)) - { - bool foundExactMatches; - // (avoid enumerating the returned IEnumerable more than once by copying to a List.) - var results = _imageCollectionManager.GetMatchingImages(_searchTermsBox.Text, true, out foundExactMatches).ToList(); - if (results.Any()) - { - _messageLabel.Visible = false; - _downloadInstallerLink.Visible = false; - _thumbnailViewer.LoadItems(results); - var fmt = results.Count == 1 ? - "Found 1 image".Localize("ImageToolbox.MatchingImageSingle") : - "Found {0} images".Localize("ImageToolbox.MatchingImages", "The {0} will be replaced by the number of matching images"); - if (!foundExactMatches) - { - fmt = results.Count == 1 ? - "Found 1 image with a name close to \u201C{1}\u201D".Localize("ImageToolbox.AlmostMatchingImageSingle", - "The {1} will be replaced with the search string.") : - "Found {0} images with names close to \u201C{1}\u201D".Localize( - "ImageToolbox.AlmostMatchingImages", - "The {0} will be replaced by the number of images found. The {1} will be replaced with the search string."); - } - - _searchResultStats.Text = string.Format(fmt, results.Count, _searchTermsBox.Text); - _searchResultStats.ForeColor = foundExactMatches ? Color.Black : Color.FromArgb(0x34, 0x65, 0xA4); //#3465A4 - _searchResultStats.Font = new Font("Segoe UI", 9F, foundExactMatches ? FontStyle.Regular : FontStyle.Bold); - } - else - { - _messageLabel.Visible = true; - if (!_searchLanguageMenu.Visible) - _downloadInstallerLink.Visible = true; - _searchResultStats.Text = "Found no matching images".Localize("ImageToolbox.NoMatchingImages"); - _searchResultStats.ForeColor = Color.Black; - _searchResultStats.Font = new Font("Segoe UI", 9F, FontStyle.Regular); - } - } - } - catch (Exception) - { - } - _searchButton.Enabled = true; - //_okButton.Enabled = false; - } - - private void ThumbnailViewerOnLoadComplete(object sender, EventArgs eventArgs) - { - Cursor.Current = Cursors.Default; - } - - public string ChosenPath { get { return _thumbnailViewer.SelectedPath; } } - - public bool HaveImageCollectionOnThisComputer - { - get { return _imageCollectionManager != null; } - } - - - private void OnFormClosing(object sender, FormClosingEventArgs e) - { - _thumbnailViewer.Closing(); - } - - public void SetImage(PalasoImage image) - { - _previousImage = image; - if(ImageChanged!=null) - ImageChanged.Invoke(this,null); - } - - public PalasoImage GetImage() - { - if(ChosenPath!=null && File.Exists(ChosenPath)) - { - try - { - return PalasoImage.FromFile(ChosenPath); - } - catch (Exception error) - { - ErrorReport.ReportNonFatalExceptionWithMessage(error, "There was a problem choosing that image."); - return _previousImage; - } - } - return _previousImage; - } - - public event EventHandler ImageChanged; - /// - /// happens when you double click an item - /// - public event EventHandler ImageChangedAndAccepted; - - private void _searchTermsBox_KeyDown(object sender, KeyEventArgs e) - { - if(e.KeyCode ==Keys.Enter) - { - e.SuppressKeyPress = true; - _searchButton_Click(sender, null); - } - else - { - _searchResultStats.Text = ""; - } - } - - private new bool DesignMode - { - get - { - return (base.DesignMode || GetService(typeof(IDesignerHost)) != null) || - (LicenseManager.UsageMode == LicenseUsageMode.Designtime); - } - } - - private void ArtOfReadingChooser_Load(object sender, EventArgs e) - { - if (DesignMode) - return; - - _imageCollectionManager = ImageCollectionManager.FromStandardLocations(SearchLanguage); - _collectionToolStrip.Visible = false; - if (_imageCollectionManager == null) - { - _messageLabel.Visible = true; - _messageLabel.Text = "This computer doesn't appear to have any galleries installed yet.".Localize("ImageToolbox.NoGalleries"); - _downloadInstallerLink.Visible = true; - _searchTermsBox.Enabled = false; - _searchButton.Enabled = false; - } - else - { -#if DEBUG - // _searchTermsBox.Text = @"flower"; -#endif - SetupSearchLanguageChoice(); - _messageLabel.Visible = string.IsNullOrEmpty(_searchTermsBox.Text); - // Adjust size to avoid text truncation - _messageLabel.Height = 200; - SetMessageLabelText(); - _thumbnailViewer.SelectedIndexChanged += new EventHandler(_thumbnailViewer_SelectedIndexChanged); - if (_imageCollectionManager.Collections.Count() > 1) - { - _collectionToolStrip.Visible = true; - _collectionDropDown.Visible = true; - _collectionDropDown.Text = - "Galleries".Localize("ImageToolbox.Galleries"); - if (ImageToolboxSettings.Default.DisabledImageCollections == null) - { - ImageToolboxSettings.Default.DisabledImageCollections = new StringCollection(); - } - - foreach (var collection in _imageCollectionManager.Collections) - { - if(ImageToolboxSettings.Default.DisabledImageCollections.Contains(collection.FolderPath)) - { - collection.Enabled = false; - } - var text = Path.GetFileNameWithoutExtension(collection.Name); - var item = new ToolStripMenuItem(text); - _collectionDropDown.DropDownItems.Add(item); - item.CheckOnClick = true; - item.CheckState = collection.Enabled ? CheckState.Checked : CheckState.Unchecked; - item.CheckedChanged += (o, args) => - { - if(_collectionDropDown.DropDownItems.Cast().Count(x => x.Checked) == 0) - item.Checked = true; // tried to uncheck the last one, don't allow it. - else - { - collection.Enabled = item.Checked; - var disabledSettings = ImageToolboxSettings.Default.DisabledImageCollections; - if (disabledSettings == null) - ImageToolboxSettings.Default.DisabledImageCollections = disabledSettings = new StringCollection(); - if (item.Checked && disabledSettings.Contains(collection.FolderPath)) - disabledSettings.Remove(collection.FolderPath); - if (!item.Checked && !disabledSettings.Contains(collection.FolderPath)) - disabledSettings.Add(collection.FolderPath); - ImageToolboxSettings.Default.Save(); - } - }; - } - } - else - { - // otherwise, just leave them all enabled - } - } - _messageLabel.Font = new Font(SystemFonts.DialogFont.FontFamily, 10); - -#if DEBUG - //if (!HaveImageCollectionOnThisComputer) - // return; - //when just testing, I just want to see some choices. - // _searchTermsBox.Text = @"flower"; - //_searchButton_Click(this,null); -#endif - } - - private void SetMessageLabelText() - { - var msg = "In the box above, type what you are searching for, then press ENTER.".Localize("ImageToolbox.EnterSearchTerms"); - // Allow for the old index that contained English and Indonesian together. - var searchLang = "English + Indonesian"; - // If we have the new multilingual index, _searchLanguageMenu will be visible. Its tooltip - // contains both the native name of the current search language + its English name in - // parentheses if its in a nonRoman script or otherwise thought to be unguessable by a - // literate speaker of an European language. (The menu displays only the native name, and - // SearchLanguage stores only the ISO code.) - if (_searchLanguageMenu.Visible) - searchLang = _searchLanguageMenu.ToolTipText; - msg += Environment.NewLine + Environment.NewLine + - String.Format("The search box is currently set to {0}".Localize("ImageToolbox.SearchLanguage"), searchLang); - if (PlatformUtilities.Platform.IsWindows && !_searchLanguageMenu.Visible) - { - msg += Environment.NewLine + Environment.NewLine + - "Did you know that there is a new version of this collection which lets you search in Arabic, Bengali, Chinese, English, French, Indonesian, Hindi, Portuguese, Spanish, Thai, or Swahili? It is free and available for downloading." - .Localize("ImageToolbox.NewMultilingual"); - _downloadInstallerLink.Visible = true; - _downloadInstallerLink.BackColor = Color.White; - } - // Restore alignment (from center) for messages. (See https://silbloom.myjetbrains.com/youtrack/issue/BL-2753.) - _messageLabel.TextAlign = _messageLabel.RightToLeft==RightToLeft.Yes ? HorizontalAlignment.Right : HorizontalAlignment.Left; - _messageLabel.Text = msg; - } - - /// - /// Position the download link label properly whenever the size of the main message label changes, - /// whether due to changing its text or changing the overall dialog box size. (BL-2853) - /// - private void MessageLabelSizeChanged(object sender, EventArgs eventArgs) - { - if (_searchLanguageMenu.Visible || !PlatformUtilities.Platform.IsWindows || !_downloadInstallerLink.Visible) - return; - _downloadInstallerLink.Width = _messageLabel.Width; // not sure why this isn't automatic - if (_downloadInstallerLink.Location.Y != _messageLabel.Bottom + 5) - _downloadInstallerLink.Location = new Point(_downloadInstallerLink.Left, _messageLabel.Bottom + 5); - } - - protected class LanguageChoice - { - static readonly List idsOfRecognizableLanguages = new List { "en", "fr", "es", "it", "tpi", "pt", "id" }; - private readonly CultureInfo _info; - - public LanguageChoice(CultureInfo ci) - { - _info = ci; - } - - public string Id { get { return _info.Name == "zh-Hans" ? "zh" : _info.Name; } } - - public string NativeName - { - get - { - if (_info.Name == "id" && _info.NativeName == "Indonesia") - return "Bahasa Indonesia"; // This is a known problem in Windows/.Net. - return _info.NativeName; - } - } - - public override string ToString() - { - if (_info.NativeName == _info.EnglishName) - return NativeName; // English (English) looks rather silly... - if (idsOfRecognizableLanguages.Contains(Id)) - return NativeName; - return String.Format("{0} ({1})", _info.NativeName, _info.EnglishName); - } - } - - private void SetupSearchLanguageChoice() - { - var indexLangs = _imageCollectionManager.IndexLanguageIds; - if (indexLangs == null) - { - _searchLanguageMenu.Visible = false; - } - else - { - _searchLanguageMenu.Visible = true; - foreach (var id in indexLangs) - { - var ci = id == "zh" ? new CultureInfo("zh-Hans") : new CultureInfo(id); - var choice = new LanguageChoice(ci); - var item = _searchLanguageMenu.DropDownItems.Add(choice.ToString()); - item.Tag = choice; - item.Click += SearchLanguageClick; - if (id == SearchLanguage) - { - _searchLanguageMenu.Text = choice.NativeName; - _searchLanguageMenu.ToolTipText = choice.ToString(); - } - } - } - // The Mono renderer makes the toolstrip stick out. (This is a Mono bug that - // may not be worth spending time on.) Let's not poke the user in the eye - // with an empty toolstrip. - if (Environment.OSVersion.Platform == PlatformID.Unix) - toolStrip1.Visible = _searchLanguageMenu.Visible; - } - - void SearchLanguageClick(object sender, EventArgs e) - { - var item = sender as ToolStripItem; - if (item != null) - { - var lang = item.Tag as LanguageChoice; - if (lang != null && SearchLanguage != lang.Id) - { - _searchLanguageMenu.Text = lang.NativeName; - _searchLanguageMenu.ToolTipText = lang.ToString(); - SearchLanguage = lang.Id; - _imageCollectionManager.ChangeSearchLanguageAndReloadIndex(lang.Id); - SetMessageLabelText(); // Update with new language name. - } - } - } - - /// - /// To actually focus on the search box, the Mono runtime library appears to - /// first need us to focus the search button, wait a bit, and then focus the - /// search box. Bizarre, unfortunate, but true. (One of those bugs that we - /// couldn't write code to do if we tried!) - /// See https://jira.sil.org/browse/BL-964. - /// - internal void FocusSearchBox() - { - _searchButton.GotFocus += _searchButtonGotSetupFocus; - _searchButton.Select(); - } - - private System.Windows.Forms.Timer _focusTimer1; - - private void _searchButtonGotSetupFocus(object sender, EventArgs e) - { - _searchButton.GotFocus -= _searchButtonGotSetupFocus; - _focusTimer1 = new System.Windows.Forms.Timer(this.components); - _focusTimer1.Tick += new System.EventHandler(this._focusTimer1_Tick); - _focusTimer1.Interval = 100; - _focusTimer1.Enabled = true; - } - - private void _focusTimer1_Tick(object sender, EventArgs e) - { - _focusTimer1.Enabled = false; - _focusTimer1.Dispose(); - _focusTimer1 = null; - _searchTermsBox.TextBox.Focus(); - } - - /// - /// Try to install the artofreading package if possible. Use a GUI program if - /// possible, but if not, try the command-line program with a GUI password - /// dialog. - /// - /// - /// On Windows, the link label opens a web page to let the user download the - /// installer. This is the analogous behavior for Linux, but is potentially - /// so slow (300MB download) that we fire off the program without waiting for - /// it to finish. - /// - private void InstallLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - if (Environment.OSVersion.Platform != PlatformID.Unix) - return; - // Install the artofreading package if at all possible. - if (File.Exists("/usr/bin/software-center")) - { - using (var process = new Process()) - { - process.StartInfo = new ProcessStartInfo { - FileName = "/usr/bin/python", - Arguments = "/usr/bin/software-center art-of-reading", - UseShellExecute = false, - RedirectStandardOutput = false, - CreateNoWindow = false - }; - process.Start(); - } - } - else if (File.Exists("/usr/bin/ssh-askpass")) - { - using (var process = new Process()) - { - process.StartInfo = new ProcessStartInfo { - FileName = "/usr/bin/sudo", - Arguments = "-A /usr/bin/apt-get -y install art-of-reading", - UseShellExecute = false, - RedirectStandardOutput = false, - CreateNoWindow = false - }; - process.StartInfo.EnvironmentVariables.Add("SUDO_ASKPASS", "/usr/bin/ssh-askpass"); - process.Start(); - } - } - } - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.resx b/SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.resx deleted file mode 100644 index 5858fa879..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageGallery/ImageGalleryControl.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 171, 17 - - - 276, 17 - - \ No newline at end of file diff --git a/SIL.Windows.Forms/ImageToolbox/ImageGallery/ThumbnailViewer.cs b/SIL.Windows.Forms/ImageToolbox/ImageGallery/ThumbnailViewer.cs index 4bca76cd3..322cd5ecc 100644 --- a/SIL.Windows.Forms/ImageToolbox/ImageGallery/ThumbnailViewer.cs +++ b/SIL.Windows.Forms/ImageToolbox/ImageGallery/ThumbnailViewer.cs @@ -42,7 +42,7 @@ public IThumbnailViewer CreateViewer() { if (UseWebViewer) { - var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), + var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().Location).LocalPath), "SIL.Windows.Forms.GeckoBrowserAdapter.dll"); if (File.Exists(path)) { diff --git a/SIL.Windows.Forms/ImageToolbox/ImageToolboxButtons.Designer.cs b/SIL.Windows.Forms/ImageToolbox/ImageToolboxButtons.Designer.cs deleted file mode 100644 index aaa475033..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageToolboxButtons.Designer.cs +++ /dev/null @@ -1,143 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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. -// -//------------------------------------------------------------------------------ - -namespace SIL.Windows.Forms.ImageToolbox { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // 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. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class ImageToolboxButtons { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal ImageToolboxButtons() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SIL.Windows.Forms.ImageToolbox.ImageToolboxButtons", typeof(ImageToolboxButtons).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap browse { - get { - object obj = ResourceManager.GetObject("browse", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap camera { - get { - object obj = ResourceManager.GetObject("camera", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap camera64x64 { - get { - object obj = ResourceManager.GetObject("camera64x64", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap credits { - get { - object obj = ResourceManager.GetObject("credits", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap crop { - get { - object obj = ResourceManager.GetObject("crop", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap scanner { - get { - object obj = ResourceManager.GetObject("scanner", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap scanner64x64 { - get { - object obj = ResourceManager.GetObject("scanner64x64", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap searchFolder { - get { - object obj = ResourceManager.GetObject("searchFolder", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/ImageToolboxButtons.resx b/SIL.Windows.Forms/ImageToolbox/ImageToolboxButtons.resx deleted file mode 100644 index 6e9f952b9..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageToolboxButtons.resx +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\browse.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\credits.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\crop.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\scanner.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\searchFolder.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - - ..\Resources\camera.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\camera64x64.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\scanner64x64.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.Designer.cs b/SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.Designer.cs deleted file mode 100644 index 66092733f..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.Designer.cs +++ /dev/null @@ -1,243 +0,0 @@ -using SIL.Windows.Forms.ClearShare.WinFormsUI; -using SIL.Windows.Forms.Widgets; - -namespace SIL.Windows.Forms.ImageToolbox -{ - partial class ImageToolboxControl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("test", System.Windows.Forms.HorizontalAlignment.Left); - System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("testing"); - this._toolListView = new System.Windows.Forms.ListView(); - this._panelForControls = new System.Windows.Forms.Panel(); - this.panel1 = new System.Windows.Forms.Panel(); - this._editLink = new System.Windows.Forms.LinkLabel(); - this._invitationToMetadataPanel = new System.Windows.Forms.Panel(); - this._copyExemplarMetadata = new BetterLinkLabel(); - this.betterLabel1 = new BetterLabel(); - this._editMetadataLink = new System.Windows.Forms.LinkLabel(); - this._metadataDisplayControl = new MetadataDisplayControl(); - this._currentImageBox = new System.Windows.Forms.PictureBox(); - this._toolTip = new System.Windows.Forms.ToolTip(this.components); - this._l10nSharpExtender = new L10NSharp.UI.L10NSharpExtender(this.components); - this.panel1.SuspendLayout(); - this._invitationToMetadataPanel.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._currentImageBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._l10nSharpExtender)).BeginInit(); - this.SuspendLayout(); - // - // _toolListView - // - this._toolListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this._toolListView.BackColor = System.Drawing.SystemColors.Control; - this._toolListView.BorderStyle = System.Windows.Forms.BorderStyle.None; - listViewGroup1.Header = "test"; - listViewGroup1.Name = "listViewGroup1"; - this._toolListView.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] { - listViewGroup1}); - this._toolListView.HideSelection = false; - this._toolListView.Items.AddRange(new System.Windows.Forms.ListViewItem[] { - listViewItem1}); - this._toolListView.Location = new System.Drawing.Point(0, 0); - this._toolListView.Name = "_toolListView"; - this._toolListView.ShowGroups = false; - this._toolListView.Size = new System.Drawing.Size(112, 495); - this._toolListView.TabIndex = 0; - this._toolListView.UseCompatibleStateImageBehavior = false; - this._toolListView.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged); - // - // _panelForControls - // - this._panelForControls.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._panelForControls.BackColor = System.Drawing.SystemColors.Control; - this._panelForControls.Location = new System.Drawing.Point(118, 0); - this._panelForControls.Name = "_panelForControls"; - this._panelForControls.Size = new System.Drawing.Size(424, 495); - this._panelForControls.TabIndex = 3; - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.Controls.Add(this._editLink); - this.panel1.Controls.Add(this._invitationToMetadataPanel); - this.panel1.Controls.Add(this._metadataDisplayControl); - this.panel1.Controls.Add(this._currentImageBox); - this.panel1.Location = new System.Drawing.Point(548, 2); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(267, 496); - this.panel1.TabIndex = 5; - // - // _editLink - // - this._editLink.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._editLink.AutoSize = true; - this._editLink.LinkColor = System.Drawing.Color.Black; - this._l10nSharpExtender.SetLocalizableToolTip(this._editLink, null); - this._l10nSharpExtender.SetLocalizationComment(this._editLink, null); - this._l10nSharpExtender.SetLocalizingId(this._editLink, "ImageToolbox.EditMetadataLink"); - this._editLink.Location = new System.Drawing.Point(12, 473); - this._editLink.Name = "_editLink"; - this._editLink.Size = new System.Drawing.Size(34, 13); - this._editLink.TabIndex = 9; - this._editLink.TabStop = true; - this._editLink.Text = "Edit..."; - this._editLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnEditMetadataLink_LinkClicked); - // - // _invitationToMetadataPanel - // - this._invitationToMetadataPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._invitationToMetadataPanel.Controls.Add(this._copyExemplarMetadata); - this._invitationToMetadataPanel.Controls.Add(this.betterLabel1); - this._invitationToMetadataPanel.Controls.Add(this._editMetadataLink); - this._invitationToMetadataPanel.Location = new System.Drawing.Point(9, 271); - this._invitationToMetadataPanel.Name = "_invitationToMetadataPanel"; - this._invitationToMetadataPanel.Size = new System.Drawing.Size(251, 195); - this._invitationToMetadataPanel.TabIndex = 8; - // - // _copyExemplarMetadata - // - this._copyExemplarMetadata.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._copyExemplarMetadata.BorderStyle = System.Windows.Forms.BorderStyle.None; - this._copyExemplarMetadata.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Underline); - this._copyExemplarMetadata.ForeColor = System.Drawing.Color.Blue; - this._l10nSharpExtender.SetLocalizableToolTip(this._copyExemplarMetadata, null); - this._l10nSharpExtender.SetLocalizationComment(this._copyExemplarMetadata, null); - this._l10nSharpExtender.SetLocalizationPriority(this._copyExemplarMetadata, L10NSharp.LocalizationPriority.NotLocalizable); - this._l10nSharpExtender.SetLocalizingId(this._copyExemplarMetadata, "ImageToolbox.CopyExemplar"); - this._copyExemplarMetadata.Location = new System.Drawing.Point(5, 104); - this._copyExemplarMetadata.Multiline = true; - this._copyExemplarMetadata.Name = "_copyExemplarMetadata"; - this._copyExemplarMetadata.ReadOnly = true; - this._copyExemplarMetadata.Size = new System.Drawing.Size(237, 17); - this._copyExemplarMetadata.TabIndex = 11; - this._copyExemplarMetadata.TabStop = false; - this._copyExemplarMetadata.Text = "Copy Exemplar that is really long"; - this._copyExemplarMetadata.URL = null; - this._copyExemplarMetadata.MouseClick += new System.Windows.Forms.MouseEventHandler(this.OnCopyExemplar_MouseClick); - // - // betterLabel1 - // - this.betterLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.betterLabel1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.betterLabel1.Enabled = false; - this.betterLabel1.Font = new System.Drawing.Font("Segoe UI", 9F); - this._l10nSharpExtender.SetLocalizableToolTip(this.betterLabel1, null); - this._l10nSharpExtender.SetLocalizationComment(this.betterLabel1, null); - this._l10nSharpExtender.SetLocalizingId(this.betterLabel1, "ImageToolbox.PromptForMissingMetadata"); - this.betterLabel1.Location = new System.Drawing.Point(0, 6); - this.betterLabel1.Multiline = true; - this.betterLabel1.Name = "betterLabel1"; - this.betterLabel1.ReadOnly = true; - this.betterLabel1.Size = new System.Drawing.Size(245, 65); - this.betterLabel1.TabIndex = 9; - this.betterLabel1.TabStop = false; - this.betterLabel1.Text = "This image does not know:\r\n\r\nWho created it?\r\nWho can use it?"; - // - // _editMetadataLink - // - this._editMetadataLink.AutoSize = true; - this._editMetadataLink.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._l10nSharpExtender.SetLocalizableToolTip(this._editMetadataLink, null); - this._l10nSharpExtender.SetLocalizationComment(this._editMetadataLink, null); - this._l10nSharpExtender.SetLocalizingId(this._editMetadataLink, "ImageToolbox.SetUpMetadataLink"); - this._editMetadataLink.Location = new System.Drawing.Point(4, 82); - this._editMetadataLink.Name = "_editMetadataLink"; - this._editMetadataLink.Size = new System.Drawing.Size(119, 19); - this._editMetadataLink.TabIndex = 8; - this._editMetadataLink.TabStop = true; - this._editMetadataLink.Text = "Set up metadata..."; - this._editMetadataLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnEditMetadataLink_LinkClicked); - // - // _metadataDisplayControl - // - this._metadataDisplayControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._l10nSharpExtender.SetLocalizableToolTip(this._metadataDisplayControl, null); - this._l10nSharpExtender.SetLocalizationComment(this._metadataDisplayControl, null); - this._l10nSharpExtender.SetLocalizingId(this._metadataDisplayControl, "ImageToolboxControl.MetadataDisplayControl"); - this._metadataDisplayControl.Location = new System.Drawing.Point(7, 298); - this._metadataDisplayControl.Name = "_metadataDisplayControl"; - this._metadataDisplayControl.Size = new System.Drawing.Size(253, 172); - this._metadataDisplayControl.TabIndex = 6; - // - // _currentImageBox - // - this._currentImageBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._currentImageBox.BackColor = System.Drawing.SystemColors.Control; - this._l10nSharpExtender.SetLocalizableToolTip(this._currentImageBox, null); - this._l10nSharpExtender.SetLocalizationComment(this._currentImageBox, null); - this._l10nSharpExtender.SetLocalizingId(this._currentImageBox, "ImageToolboxControl._currentImageBox"); - this._currentImageBox.Location = new System.Drawing.Point(7, 0); - this._currentImageBox.MinimumSize = new System.Drawing.Size(251, 245); - this._currentImageBox.Name = "_currentImageBox"; - this._currentImageBox.Size = new System.Drawing.Size(253, 245); - this._currentImageBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this._currentImageBox.TabIndex = 5; - this._currentImageBox.TabStop = false; - // - // _l10nSharpExtender - // - this._l10nSharpExtender.LocalizationManagerId = "Palaso"; - this._l10nSharpExtender.PrefixForNewItems = "ImageToolbox"; - // - // ImageToolboxControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.Controls.Add(this.panel1); - this.Controls.Add(this._panelForControls); - this.Controls.Add(this._toolListView); - this._l10nSharpExtender.SetLocalizableToolTip(this, null); - this._l10nSharpExtender.SetLocalizationComment(this, null); - this._l10nSharpExtender.SetLocalizingId(this, "ImageToolboxControl.ImageToolboxControl"); - this.Name = "ImageToolboxControl"; - this.Size = new System.Drawing.Size(814, 498); - this.Load += new System.EventHandler(this.OnLoad); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this._invitationToMetadataPanel.ResumeLayout(false); - this._invitationToMetadataPanel.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._currentImageBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._l10nSharpExtender)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.ListView _toolListView; - private System.Windows.Forms.Panel _panelForControls; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.PictureBox _currentImageBox; - private MetadataDisplayControl _metadataDisplayControl; - private System.Windows.Forms.Panel _invitationToMetadataPanel; - private Widgets.BetterLabel betterLabel1; - private System.Windows.Forms.LinkLabel _editMetadataLink; - private System.Windows.Forms.LinkLabel _editLink; - private Widgets.BetterLinkLabel _copyExemplarMetadata; - private System.Windows.Forms.ToolTip _toolTip; - private L10NSharp.UI.L10NSharpExtender _l10nSharpExtender; - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.cs b/SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.cs deleted file mode 100644 index 64a6b976f..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.cs +++ /dev/null @@ -1,461 +0,0 @@ -using System; -using System.Drawing; -using System.IO; -using System.Windows.Forms; -using L10NSharp; -using SIL.Code; -using SIL.Core.ClearShare; -using SIL.PlatformUtilities; -using SIL.Reporting; -using SIL.Windows.Forms.ClearShare; -using SIL.Windows.Forms.ClearShare.WinFormsUI; -using SIL.Windows.Forms.ImageToolbox.Cropping; - -namespace SIL.Windows.Forms.ImageToolbox -{ - /// - /// The ImageToolbox lets you acquire images from camera, scanner, image collection, or the file system. - /// It has a cropping control. - /// It can read metadata, and allow you to enter metadata for an image. - /// - public partial class ImageToolboxControl : UserControl - { - private readonly ImageList _toolImages; - private Control _currentControl; - private PalasoImage _imageInfo; - private ListViewItem _cropToolListItem; - private string _incomingSearchLanguage; - private AcquireImageControl _acquireImageControl; - - public ImageToolboxControl() - { - InitializeComponent(); - _toolImages = new ImageList(); - ImageInfo = new PalasoImage(); - _copyExemplarMetadata.Font = _editMetadataLink.Font; - SearchLanguage = "en"; // unless/until the owner specifies otherwise explicitly - } - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing) - { - _toolImages.Dispose(); - if (_imageInfo!=null) - { - _imageInfo.Dispose(); - _imageInfo = null; - } - if (components != null) - { - components.Dispose(); - components = null; - } - } - base.Dispose(disposing); - } - - /// - /// This is the main input/output of this dialog - /// - public PalasoImage ImageInfo - { - get { return _imageInfo; } - set - { - try - { - var oldValue = _imageInfo; - // We've been having trouble with an obscure situation where one of the edit metadata links is - // clicked while _imageInfo is null. Wondering whether an exception might somehow be caught - // in such a way that SetupMetaDataControls is called here based on value being non-null, - // but _imageInfo never actually gets set to the new value. Seems a setter should always - // set the backing variable to the new value, so we now do this first. - _imageInfo = value; - - if (value == null || value.Image == null) - { - _currentImageBox.Image = null; - _metadataDisplayControl.Visible = false; - // These two controls when clicked run code that requires _imageInfo to be non-null. - // Make sure they are hidden if it is set to null. - _invitationToMetadataPanel.Visible = false; - _editLink.Visible = false; - } - else - { - if (value.Image == _currentImageBox.Image) - { - return; - } - /* this seemed like a good idea, but it lead to "parameter errors" later in the image - * try - { - if (_currentImageBox.Image != null) - { - _currentImageBox.Image.Dispose(); - } - } - catch (Exception) - { - //ah well. I haven't got a way to know when it's disposable and when it isn't - throw; - } - */ - _currentImageBox.Image = value.Image; - - SetCurrentImageToolTip(value); - SetupMetaDataControls(value.Metadata); - } - if (oldValue != null && oldValue != value) - { - oldValue.Dispose(); - } - - GC.Collect(); //having trouble reliably tracking down a PalasoImage which is not being disposed of. - } - catch (Exception e) - { - ErrorReport.NotifyUserOfProblem(e, "Sorry, something went wrong while getting the image.".Localize("ImageToolbox.GenericGettingImageProblem")); - } - } - } - - /// - /// Gets or sets the language used in searching for an image by words. - /// - public string SearchLanguage - { - //the acquireImageControl is added at some point during use; if we have it, we want to tell - //the client what search language the user has actually chosen. But if we don't have that - //control yet, just return whatever value they set us to. - get { return _acquireImageControl != null ? _acquireImageControl.SearchLanguage : _incomingSearchLanguage; } - - // We store this until we get an acquireImageControl, then pass it along to it when it is created. - set { _incomingSearchLanguage = value; } - } - - private void SetCurrentImageToolTip(PalasoImage image) - { - _toolTip.SetToolTip(_currentImageBox, ""); - - // ENHANCE: this only uses the "originalpath" version, which may be a lot larger than what we - // currently have, if we cropped, for example. But I'm loath to save it to disk just to get an accurate size. - if (image!=null && !string.IsNullOrEmpty(image.OriginalFilePath) && File.Exists(image.OriginalFilePath)) - { - try - { - float size = new System.IO.FileInfo(image.OriginalFilePath).Length; - if (size > 1000*1024) - _toolTip.SetToolTip(_currentImageBox, - string.Format("{0} {1:N2}M", image.OriginalFilePath, size/(1024f*1000f))); - else - { - _toolTip.SetToolTip(_currentImageBox, string.Format("{0} {1:N2}K", image.OriginalFilePath, size/1024f)); - } - } - catch (Exception error) - { - _toolTip.SetToolTip(_currentImageBox, error.Message); - } - } - } - - /// - /// used by galleries (e.g. art of reading) - /// - public string InitialSearchString { get; set; } - - /// - /// Used to report problems loading images. See more detail on AcquireImageControl - /// - public Action ImageLoadingExceptionReporter - { - get { return _imageLoadingExceptionReporter; } - set - { - _imageLoadingExceptionReporter = value; - if (_acquireImageControl != null) - _acquireImageControl.ImageLoadingExceptionReporter = value; - } - } - - /// - /// A new image was selected, or the image was cropped. Sender will be the IImageToolboxControl that changed the image - /// - public event EventHandler ImageChanged; - - /// Metadata (copyright info) changed - public event EventHandler MetadataChanged; - - private void SetupMetaDataControls(Metadata metaData) - { - Guard.AgainstNull(_imageInfo, "_imageInfo"); - if (_currentImageBox.Image == null) - { - // Otherwise, the metadata controls are visible upon first load (with no image). - // Clicking them causes crashes. - _invitationToMetadataPanel.Visible = false; - _metadataDisplayControl.Visible = false; - return; - } - - //NB: there was a bug here where the display control refused to go to visible, if this was called before loading. Weird. So now, we have an OnLoad() to call it again. - _invitationToMetadataPanel.Visible = (metaData == null || metaData.IsEmpty); - _metadataDisplayControl.Visible = !_invitationToMetadataPanel.Visible; - bool looksOfficial = !string.IsNullOrEmpty(metaData.CollectionUri); - _editLink.Visible = metaData!=null && _metadataDisplayControl.Visible && !looksOfficial; - if (_metadataDisplayControl.Visible) - _metadataDisplayControl.SetMetadata(metaData); - - _copyExemplarMetadata.Visible = Metadata.HaveStoredExemplar(Metadata.FileCategory.Image); - if (_invitationToMetadataPanel.Visible && _copyExemplarMetadata.Visible) - { - var s = LocalizationManager.GetString("ImageToolbox.CopyExemplarMetadata", "Use {0}", "Used to copy a previous metadata set to the current image. The {0} will be replaced with the name of the exemplar image."); - _copyExemplarMetadata.Text = string.Format(s, Metadata.GetStoredExemplarSummaryString(Metadata.FileCategory.Image)); - } - - if (Platform.IsWindows) - return; - - // Ensure that the metadata gets fully displayed if at all possible. - // See https://silbloom.myjetbrains.com/youtrack/issue/BL-2354 for what can happen otherwise. - // The need for this appears to be a bug in the Mono library that allows _metadataDisplayControl - // to grow taller as its internal content exceeds its initial external size. (Any difference - // from Windows/.Net behavior is by definition a bug.) - if (_metadataDisplayControl.Visible) - { - var heightClipped = (_metadataDisplayControl.Location.Y + _metadataDisplayControl.Height) - panel1.Height; - if (_editLink.Visible) - heightClipped = (_metadataDisplayControl.Location.Y + _metadataDisplayControl.Height) - _editLink.Location.Y; - if (heightClipped != 0) - { - var yNew = _metadataDisplayControl.Location.Y - heightClipped; - var loc = new Point(_metadataDisplayControl.Location.X, yNew < 0 ? 0 : yNew); - _metadataDisplayControl.Location = loc; - } - } - } - - private ListViewItem AddControl(string label, Bitmap bitmap, string imageKey, System.Func makeControl) - { - _toolImages.Images.Add(bitmap); - _toolImages.Images.SetKeyName(_toolImages.Images.Count - 1, imageKey); - - var item= new ListViewItem(label); - item.ImageKey = imageKey; - - item.Tag = makeControl; - this._toolListView.Items.Add(item); - return item; - } - - // Changed this to remember the selected index because something is causing the SelectedIndexChanged - // event to fire twice each time an icon is clicked. - int _previousSelectedIndex = -1; - private Action _imageLoadingExceptionReporter; - - private void listView1_SelectedIndexChanged(object sender, EventArgs e) - { - try - { - if (_toolListView.SelectedItems.Count == 0) - { - _previousSelectedIndex = -1; - return; - } - - if (_previousSelectedIndex == _toolListView.SelectedIndices[0]) - return; - - _previousSelectedIndex = _toolListView.SelectedIndices[0]; - - ListViewItem selectedItem = _toolListView.SelectedItems[0]; - - if (selectedItem.Tag == _currentControl) - return; - - bool haveImage = !(ImageInfo == null || ImageInfo.Image == null); - - //don't let them select crop (don't have a cheap way of 'disabling' a list item, sigh) - - if (!haveImage && selectedItem == _cropToolListItem) - { - _cropToolListItem.Selected = false; - _toolListView.Items[0].Selected = true; - return; - } - - if (_currentControl != null) - { - GetImageFromCurrentControl(); - - _panelForControls.Controls.Remove(_currentControl); - ((IImageToolboxControl) _currentControl).ImageChanged -= new EventHandler(imageToolboxControl_ImageChanged); - _currentControl.Dispose(); - } - System.Func fun = - (System.Func) selectedItem.Tag; - _currentControl = fun(ImageInfo); - - _currentControl.Dock = DockStyle.Fill; - _panelForControls.Controls.Add(_currentControl); - - IImageToolboxControl imageToolboxControl = ((IImageToolboxControl) _currentControl); - if (ImageInfo!=null && ImageInfo.Image != null) - { - imageToolboxControl.SetImage(ImageInfo); - } - imageToolboxControl.ImageChanged += new EventHandler(imageToolboxControl_ImageChanged); - Refresh(); - } - catch (Exception error) - { - ErrorReport.NotifyUserOfProblem(error, "Sorry, something went wrong with the ImageToolbox".Localize("ImageToolbox.GenericProblem")); - } - } - - private void GetImageFromCurrentControl() - { - ImageInfo = ((IImageToolboxControl) _currentControl).GetImage(); - if (ImageInfo == null) - _currentImageBox.Image = null; - else - _currentImageBox.Image = ImageInfo.Image; - } - - void imageToolboxControl_ImageChanged(object sender, EventArgs e) - { - GetImageFromCurrentControl(); - // Use the original sender, not this, because clients would like to know who originally sent the event - ImageChanged?.Invoke(sender, e); - } - - public void Closing() - { - if (_currentControl == null) - { - - } - else - { - ImageInfo = ((IImageToolboxControl)_currentControl).GetImage(); - Controls.Remove(_currentControl); - _currentControl.Dispose(); - } - - } - - /// - /// If set, this action will be used instead of the default (launching ). - /// For example, the client may want to use a different UI to edit the `Metadata`. - /// The `Action<Metadata>` callback saves the modified `Metadata` to the image. - /// - /// - public Action> EditMetadataActionOverride { get; set; } - - private void OnEditMetadataLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - // https://issues.bloomlibrary.org/youtrack/issue/BL-282 had a null in here somewhere - Guard.AgainstNull(_imageInfo, "_imageInfo"); - Guard.AgainstNull(_imageInfo.Metadata, "_imageInfo.Metadata"); - - //it's not clear at the moment where the following belongs... but we want - //to encourage Creative Commons Licensing, so if there is no license, we'll start - //the following dialog out with a reasonable default. - var isSuggesting = false; - var hadChanges = false; - if (_imageInfo.Metadata.IsLicenseNotSet) - { - isSuggesting = true; - hadChanges = _imageInfo.Metadata.HasChanges; - _imageInfo.Metadata.SetupReasonableLicenseDefaultBeforeEditing(); - } - - if (EditMetadataActionOverride != null) - { - EditMetadataActionOverride(_imageInfo.Metadata, SetNewImageMetadata); - return; - } - - using var dlg = new MetadataEditorDialog(_imageInfo.Metadata); - if (DialogResult.OK == dlg.ShowDialog()) - { - Guard.AgainstNull(dlg.Metadata, " dlg.Metadata"); - SetNewImageMetadata(dlg.Metadata); - } - else if (isSuggesting) - { - _imageInfo.Metadata.License = new NullLicense(); - _imageInfo.Metadata.HasChanges = hadChanges; - } - } - - private void SetNewImageMetadata(Metadata newMetadata) - { - _imageInfo.Metadata = newMetadata; - SetupMetaDataControls(_imageInfo.Metadata); - // Too risky (see https://issues.bloomlibrary.org/youtrack/issue/BL-1001): _imageInfo.SaveUpdatedMetadataIfItMakesSense(); - _imageInfo.Metadata.StoreAsExemplar(Metadata.FileCategory.Image); - MetadataChanged?.Invoke(this, EventArgs.Empty); - } - - private void OnLoad(object sender, EventArgs e) - { - _toolListView.Items.Clear(); - - - //doing our own image list because VS2010 croaks their resx if have an imagelist while set to .net 3.5 with x86 on a 64bit os (something like that). This is a known bug MS doesn't plan to fix. - - _toolListView.LargeImageList = _toolImages; - _toolImages.ColorDepth = ColorDepth.Depth24Bit; - _toolImages.ImageSize = new Size(32, 32); - - // These two controls should never be visible except when made so by SetupMetaDataControls when ImageInfo is not null. - // To help ensure this we make both not visible right at the start. - _editLink.Visible = false; - _invitationToMetadataPanel.Visible = false; - - AddControl("Get Picture".Localize("ImageToolbox.GetPicture"), ImageToolboxButtons.browse, "browse", (x) => - { - _acquireImageControl = new AcquireImageControl(); - _acquireImageControl.ImageLoadingExceptionReporter = - ImageLoadingExceptionReporter; - _acquireImageControl.SetInitialSearchString(InitialSearchString); - _acquireImageControl.SearchLanguage = _incomingSearchLanguage; - return _acquireImageControl; - }); - _cropToolListItem = AddControl("Crop".Localize("ImageToolbox.Crop"), ImageToolboxButtons.crop, "crop", (x) => new ImageCropper()); - - _toolListView.Items[0].Selected = true; - _toolListView.Refresh(); - - if (ImageInfo == null) - return; - - SetupMetaDataControls(ImageInfo.Metadata); - this._toolListView.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged); - - } - - - private void OnCopyExemplar_MouseClick(object sender, MouseEventArgs e) - { - _imageInfo.Metadata.LoadFromStoredExemplar(Metadata.FileCategory.Image); - SetupMetaDataControls(ImageInfo.Metadata); - MetadataChanged?.Invoke(this, EventArgs.Empty); - // Too risky (see https://issues.bloomlibrary.org/youtrack/issue/BL-1001): _imageInfo.SaveUpdatedMetadataIfItMakesSense(); - } - } - - public interface IImageToolboxControl - { - void SetImage(PalasoImage image); - PalasoImage GetImage(); - event EventHandler ImageChanged; - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.resx b/SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.resx deleted file mode 100644 index f7a41d2da..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageToolboxControl.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 112, 17 - - - 17, 17 - - \ No newline at end of file diff --git a/SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.Designer.cs b/SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.Designer.cs deleted file mode 100644 index 40d4e8510..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.Designer.cs +++ /dev/null @@ -1,136 +0,0 @@ -using SIL.Core.ClearShare; -using SIL.Windows.Forms.ClearShare; - -namespace SIL.Windows.Forms.ImageToolbox -{ - partial class ImageToolboxDialog - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - PalasoImage palasoImage1 = new PalasoImage(); - Metadata metadata1 = new Metadata(); - this._cancelButton = new System.Windows.Forms.Button(); - this._okButton = new System.Windows.Forms.Button(); - this._imageToolboxControl = new ImageToolboxControl(); - this._L10NSharpExtender = new L10NSharp.UI.L10NSharpExtender(this.components); - ((System.ComponentModel.ISupportInitialize)(this._L10NSharpExtender)).BeginInit(); - this.SuspendLayout(); - // - // _cancelButton - // - this._cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._L10NSharpExtender.SetLocalizableToolTip(this._cancelButton, null); - this._L10NSharpExtender.SetLocalizationComment(this._cancelButton, null); - this._L10NSharpExtender.SetLocalizingId(this._cancelButton, "Common.CancelButton"); - this._cancelButton.Location = new System.Drawing.Point(799, 457); - this._cancelButton.Name = "_cancelButton"; - this._cancelButton.Size = new System.Drawing.Size(75, 23); - this._cancelButton.TabIndex = 1; - this._cancelButton.Text = "&Cancel"; - this._cancelButton.UseVisualStyleBackColor = true; - this._cancelButton.Click += new System.EventHandler(this._cancelButton_Click); - // - // _okButton - // - this._okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._L10NSharpExtender.SetLocalizableToolTip(this._okButton, null); - this._L10NSharpExtender.SetLocalizationComment(this._okButton, null); - this._L10NSharpExtender.SetLocalizingId(this._okButton, "Common.OKButton"); - this._okButton.Location = new System.Drawing.Point(718, 457); - this._okButton.Name = "_okButton"; - this._okButton.Size = new System.Drawing.Size(75, 23); - this._okButton.TabIndex = 2; - this._okButton.Text = "&OK"; - this._okButton.UseVisualStyleBackColor = true; - this._okButton.Click += new System.EventHandler(this._okButton_Click); - // - // imageToolboxControl1 - // - this._imageToolboxControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._imageToolboxControl.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this._imageToolboxControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - palasoImage1.Image = null; - metadata1.AttributionUrl = null; - metadata1.CollectionName = null; - metadata1.CollectionUri = null; - metadata1.CopyrightNotice = ""; - metadata1.Creator = null; - metadata1.HasChanges = true; - metadata1.License = null; - palasoImage1.Metadata = metadata1; - palasoImage1.MetadataLocked = false; - this._imageToolboxControl.ImageInfo = palasoImage1; - this._imageToolboxControl.InitialSearchString = null; - this._L10NSharpExtender.SetLocalizableToolTip(this._imageToolboxControl, null); - this._L10NSharpExtender.SetLocalizationComment(this._imageToolboxControl, null); - this._L10NSharpExtender.SetLocalizationPriority(this._imageToolboxControl, L10NSharp.LocalizationPriority.NotLocalizable); - this._L10NSharpExtender.SetLocalizingId(this._imageToolboxControl, "ImageToolbox.ImageToolboxDialog.ImageToolboxControl"); - this._imageToolboxControl.Location = new System.Drawing.Point(1, 1); - this._imageToolboxControl.Name = "_imageToolboxControl"; - this._imageToolboxControl.Size = new System.Drawing.Size(873, 450); - this._imageToolboxControl.TabIndex = 3; - // - // _L10NSharpExtender - // - this._L10NSharpExtender.LocalizationManagerId = "Palaso"; - this._L10NSharpExtender.PrefixForNewItems = "ImageToolbox"; - // - // ImageToolboxDialog - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.CancelButton = this._cancelButton; - this.ClientSize = new System.Drawing.Size(886, 485); - this.Controls.Add(this._imageToolboxControl); - this.Controls.Add(this._okButton); - this.Controls.Add(this._cancelButton); - this._L10NSharpExtender.SetLocalizableToolTip(this, null); - this._L10NSharpExtender.SetLocalizationComment(this, null); - this._L10NSharpExtender.SetLocalizingId(this, "ImageToolbox.ImageToolboxWindowTitle"); - this.MinimumSize = new System.Drawing.Size(732, 432); - this.Name = "ImageToolboxDialog"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Image Toolbox"; - this.Load += new System.EventHandler(this.ImageToolboxDialog_Load); - ((System.ComponentModel.ISupportInitialize)(this._L10NSharpExtender)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button _cancelButton; - private System.Windows.Forms.Button _okButton; - private ImageToolboxControl _imageToolboxControl; - private L10NSharp.UI.L10NSharpExtender _L10NSharpExtender; - } -} \ No newline at end of file diff --git a/SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.cs b/SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.cs deleted file mode 100644 index 9c74640b9..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Windows.Forms; -using SIL.Core.ClearShare; -using SIL.Reporting; -using SIL.Windows.Forms.ClearShare; - -namespace SIL.Windows.Forms.ImageToolbox -{ - public partial class ImageToolboxDialog : Form - { - /// optional (can be null) - /// optional - public ImageToolboxDialog(PalasoImage imageInfo, string initialSearchString) : this(imageInfo, initialSearchString, null) { } - - /// optional (can be null) - /// optional - /// If non-null, this action will be used - /// instead of the default (launching ). - /// For example, the client may want to use a different UI to edit the `Metadata`. - /// The `Action` callback saves the modified `Metadata` to the image. - /// - public ImageToolboxDialog(PalasoImage imageInfo, string initialSearchString, Action> editMetadataActionOverride) - { - InitializeComponent(); - _imageToolboxControl.ImageInfo = imageInfo; - _imageToolboxControl.InitialSearchString = initialSearchString; - _imageToolboxControl.EditMetadataActionOverride = editMetadataActionOverride; - SearchLanguage = "en"; // unless the caller specifies otherwise explicitly - } - - public PalasoImage ImageInfo { get { return _imageToolboxControl.ImageInfo; } } - /// - /// Used to report problems loading images. See more detail on AcquireImageControl - /// - public Action ImageLoadingExceptionReporter - { - get { return _imageToolboxControl.ImageLoadingExceptionReporter; } - set - { - _imageToolboxControl.ImageLoadingExceptionReporter = value; - } - } - - /// - /// Sets the language used in searching for an image by words. - /// - public string SearchLanguage - { - get { return _imageToolboxControl.SearchLanguage; } - set { _imageToolboxControl.SearchLanguage = value; } - } - - private void _okButton_Click(object sender, EventArgs e) - { - //enhance: doesn't tell us all that much. - UsageReporter.SendNavigationNotice("ImageToolboxDialog/Ok"); - DialogResult = (ImageInfo==null || ImageInfo.Image==null)? DialogResult.Cancel : DialogResult.OK; - _imageToolboxControl.Closing(); - Close(); - } - - private void _cancelButton_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.Cancel; - _imageToolboxControl.Closing(); - Close(); - } - - private void ImageToolboxDialog_Load(object sender, EventArgs e) - { - UsageReporter.SendNavigationNotice("ImageToolbox"); - } - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.resx b/SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.resx deleted file mode 100644 index 1512b7c48..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageToolboxDialog.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/SIL.Windows.Forms/ImageToolbox/ImageToolboxSettings.Designer.cs b/SIL.Windows.Forms/ImageToolbox/ImageToolboxSettings.Designer.cs deleted file mode 100644 index d16da662d..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageToolboxSettings.Designer.cs +++ /dev/null @@ -1,49 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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. -// -//------------------------------------------------------------------------------ - -namespace SIL.Windows.Forms.ImageToolbox { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")] - internal sealed partial class ImageToolboxSettings : global::System.Configuration.ApplicationSettingsBase { - - private static ImageToolboxSettings defaultInstance = ((ImageToolboxSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new ImageToolboxSettings()))); - - public static ImageToolboxSettings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string LastImageFolder { - get { - return ((string)(this["LastImageFolder"])); - } - set { - this["LastImageFolder"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public global::System.Collections.Specialized.StringCollection DisabledImageCollections { - get { - return ((global::System.Collections.Specialized.StringCollection)(this["DisabledImageCollections"])); - } - set { - this["DisabledImageCollections"] = value; - } - } - } -} diff --git a/SIL.Windows.Forms/ImageToolbox/ImageToolboxSettings.settings b/SIL.Windows.Forms/ImageToolbox/ImageToolboxSettings.settings deleted file mode 100644 index 493444703..000000000 --- a/SIL.Windows.Forms/ImageToolbox/ImageToolboxSettings.settings +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/SIL.Windows.Forms/ImageToolbox/OpenFileDialogWithViews.cs b/SIL.Windows.Forms/ImageToolbox/OpenFileDialogWithViews.cs deleted file mode 100644 index 49fef51b9..000000000 --- a/SIL.Windows.Forms/ImageToolbox/OpenFileDialogWithViews.cs +++ /dev/null @@ -1,281 +0,0 @@ -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Threading; -using System.Windows.Forms; -using SIL.PlatformUtilities; - -//This cam from a comment by Henrik Stromberg, posted on at http://www.codeproject.com/Messages/2238408/Like-the-code-below-you-dont-have-to-call-StartWat.aspx -namespace SIL.Windows.Forms.ImageToolbox -{ - /// - /// Acts like a normal OpenFileDialog, but with the addition of letting you set the initial view (e.g. to Large_Icons) - /// On Linux, this will use the GTK file open dialog instead of the WinForms dialog. - /// - public class OpenFileDialogWithViews : Component - { - - #region Dll import - - [DllImport("user32.dll", EntryPoint = "SendMessageA", CallingConvention = CallingConvention.StdCall, - CharSet = CharSet.Ansi)] - private static extern uint SendMessage(uint Hdc, uint Msg_Const, uint wParam, uint lParam); - - [DllImport("user32.dll", EntryPoint = "FindWindowExA", CallingConvention = CallingConvention.StdCall, - CharSet = CharSet.Ansi)] - private static extern uint FindWindowEx(uint hwndParent, uint hwndChildAfter, string lpszClass, string lpszWindow); - - [DllImport("user32.dll", EntryPoint = "GetForegroundWindow", CallingConvention = CallingConvention.StdCall, - CharSet = CharSet.Ansi)] - private static extern uint GetForegroundWindow(); - - #endregion - - - public enum DialogViewTypes - { -/* LargeIcons = 0x7029, - List = 0x702b, - Details = 0x702c, - Thumbnails = 0x702d, // Try between 0x7031 and 0x702d - SmallIcons = 0x702a - */ - //comment suggested these were correct for windows 7 - Details = 0x704B, - Tiles = 0x704C, - Extra_Large_Icons = 0x704D, - Medium_Icons = 0x704E, - Large_Icons = 0x704F, - Small_Icons = 0x7050, - List = 0x7051, - Content = 0x7052 - } - - private bool m_IsWatching = false; - private DialogViewTypes m_DialogViewTypes; - private const int WM_COMMAND = 0x0111; - private DialogAdapters.OpenFileDialogAdapter m_OpenFileDialog; - - public OpenFileDialogWithViews() - { - m_IsWatching = false; - DialogViewType = DialogViewTypes.Small_Icons; - } - - public OpenFileDialogWithViews(DialogViewTypes dialogViewType) - : this() - { - DialogViewType = dialogViewType; - } - - private DialogViewTypes DialogViewType - { - get { return m_DialogViewTypes; } - set { m_DialogViewTypes = value; } - } - - private DialogAdapters.OpenFileDialogAdapter OpenFileDialog - { - get - { - if (m_OpenFileDialog == null) - { - m_OpenFileDialog = new DialogAdapters.OpenFileDialogAdapter(); - if (DialogAdapters.CommonDialogAdapter.UseGtkDialogs) - { - DialogAdapters.CommonDialogAdapter.WindowType = Platform.IsCinnamon ? - DialogAdapters.CommonDialogAdapter.WindowTypeHintAdaptor.Dialog : - DialogAdapters.CommonDialogAdapter.WindowTypeHintAdaptor.Utility; - DialogAdapters.CommonDialogAdapter.ForceKeepAbove = true; - } - } - return m_OpenFileDialog; - } - - } - - public bool Multiselect - { - get { return OpenFileDialog.Multiselect; } - set { OpenFileDialog.Multiselect = value; } - } - - public bool ReadOnlyChecked - { - get { return OpenFileDialog.ReadOnlyChecked; } - set { OpenFileDialog.ReadOnlyChecked = value; } - } - - - public bool ShowReadOnly - { - get { return OpenFileDialog.ShowReadOnly; } - set { OpenFileDialog.ShowReadOnly = value; } - } - - public Stream OpenFile() - { - return OpenFileDialog.OpenFile(); - } - - [DefaultValue(true)] - public bool AddExtension - { - get { return OpenFileDialog.AddExtension; } - set { OpenFileDialog.AddExtension = value; } - } - - [DefaultValue(true)] - public bool CheckPathExists - { - get { return OpenFileDialog.CheckPathExists; } - set { OpenFileDialog.CheckPathExists = value; } - } - - [DefaultValue("")] - public string DefaultExt - { - get { return OpenFileDialog.DefaultExt; } - set { OpenFileDialog.DefaultExt = value; } - } - - [DefaultValue(true)] - public bool DereferenceLinks - { - get { return OpenFileDialog.DereferenceLinks; } - set { OpenFileDialog.DereferenceLinks = value; } - } - - [DefaultValue("")] - public string FileName - { - get { return OpenFileDialog.FileName; } - set { OpenFileDialog.FileName = value; } - } - - [DesignerSerializationVisibility(0)] - [Browsable(false)] - public string[] FileNames - { - get { return OpenFileDialog.FileNames; } - } - - [DefaultValue("")] - [Localizable(true)] - public string Filter - { - get { return OpenFileDialog.Filter; } - set { OpenFileDialog.Filter = value; } - } - - [DefaultValue(1)] - public int FilterIndex - { - get { return OpenFileDialog.FilterIndex; } - set { OpenFileDialog.FilterIndex = value; } - } - - [DefaultValue("")] - public string InitialDirectory - { - get { return OpenFileDialog.InitialDirectory; } - set { OpenFileDialog.InitialDirectory = value; } - } - - - [DefaultValue(false)] - public bool RestoreDirectory - { - get { return OpenFileDialog.RestoreDirectory; } - set { OpenFileDialog.RestoreDirectory = value; } - } - - [DefaultValue(false)] - public bool ShowHelp - { - get { return OpenFileDialog.ShowHelp; } - set { OpenFileDialog.ShowHelp = value; } - } - - [DefaultValue(false)] - public bool SupportMultiDottedExtensions - { - get { return OpenFileDialog.SupportMultiDottedExtensions; } - set { OpenFileDialog.SupportMultiDottedExtensions = value; } - } - - [Localizable(true)] - [DefaultValue("")] - - public string Title - { - get { return OpenFileDialog.Title; } - set { OpenFileDialog.Title = value; } - } - - [DefaultValue(true)] - public bool ValidateNames - { - get { return OpenFileDialog.ValidateNames; } - set { OpenFileDialog.ValidateNames = value; } - } - - private void StartWatching() - { - m_IsWatching = true; - - if (!Platform.IsWindows) - return; - - var t = new Thread(CheckActiveWindow); - t.Start(); - } - - public DialogResult ShowDialog() - { - return ShowDialog(null); - } - - - public DialogResult ShowDialog(IWin32Window owner) - { - StartWatching(); - - DialogResult dialogResult = OpenFileDialog.ShowDialog(owner); - - StopWatching(); - - return dialogResult; - - } - - private void StopWatching() - { - m_IsWatching = false; - } - - private void CheckActiveWindow() - { - Debug.Assert(Platform.IsWindows, "Should not be called on Linux!"); - - lock (this) - { - uint listviewHandle = 0; - - while (listviewHandle == 0 && m_IsWatching) - { - listviewHandle = FindWindowEx(GetForegroundWindow(), 0, "SHELLDLL_DefView", ""); - } - - if (listviewHandle != 0) - { - SendMessage(listviewHandle, WM_COMMAND, (uint) this.DialogViewType, 0); - } - } - } - } - -} diff --git a/SIL.Windows.Forms/Miscellaneous/PortableClipboard.cs b/SIL.Windows.Forms/Miscellaneous/PortableClipboard.cs index da4863988..88d0921fc 100644 --- a/SIL.Windows.Forms/Miscellaneous/PortableClipboard.cs +++ b/SIL.Windows.Forms/Miscellaneous/PortableClipboard.cs @@ -66,7 +66,7 @@ public static void RemoveTextboxMenus(Control control) { if (control is TextBoxBase textBoxBase) { - textBoxBase.ContextMenu = null; + textBoxBase.ContextMenuStrip = null; return; } diff --git a/SIL.Windows.Forms/Miscellaneous/SILAboutBox.cs b/SIL.Windows.Forms/Miscellaneous/SILAboutBox.cs index 9ddf4139b..99bc650ff 100644 --- a/SIL.Windows.Forms/Miscellaneous/SILAboutBox.cs +++ b/SIL.Windows.Forms/Miscellaneous/SILAboutBox.cs @@ -91,7 +91,7 @@ public string AssemblyTitle return titleAttribute.Title; } } - return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); + return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location); } } @@ -156,7 +156,7 @@ public AcknowledgementAttribute[] AssemblyAcknowledgements private string GetBuiltOnDate() { - var file = PathHelper.StripFilePrefix(_assembly.CodeBase); + var file = PathHelper.StripFilePrefix(_assembly.Location); var fi = new FileInfo(file); // Use UTC for calculation of build-on-date so that we get the same date regardless diff --git a/SIL.Windows.Forms/SIL.Windows.Forms.csproj b/SIL.Windows.Forms/SIL.Windows.Forms.csproj index bb04b45b0..0a0a660b8 100644 --- a/SIL.Windows.Forms/SIL.Windows.Forms.csproj +++ b/SIL.Windows.Forms/SIL.Windows.Forms.csproj @@ -8,13 +8,13 @@ portable true true + $(TargetFrameworks);net8.0-windows - - + @@ -32,12 +32,15 @@ + + + + + ..\lib\Interop.WIA.dll - - diff --git a/SIL.Windows.Forms/Widgets/Prompt.cs b/SIL.Windows.Forms/Widgets/Prompt.cs index e6b7947de..bcf9048bd 100644 --- a/SIL.Windows.Forms/Widgets/Prompt.cs +++ b/SIL.Windows.Forms/Widgets/Prompt.cs @@ -4,6 +4,7 @@ using System.Drawing; using System.Security.Permissions; using System.Windows.Forms; +using SIL.Windows.Forms.Miscellaneous; namespace SIL.Windows.Forms.Widgets { @@ -135,7 +136,6 @@ private void VerifyNotDisposed() #region Nested type: PromptPainter - [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] private class PromptPainter: NativeWindow, IDisposable { private readonly Control _control; diff --git a/SIL.Windows.Forms/Widgets/TextInputBox.cs b/SIL.Windows.Forms/Widgets/TextInputBox.cs index f94ed8e07..e1dd7baa4 100644 --- a/SIL.Windows.Forms/Widgets/TextInputBox.cs +++ b/SIL.Windows.Forms/Widgets/TextInputBox.cs @@ -37,7 +37,7 @@ private ITextInputBox CreateTextBox() { if (UseWebTextBox) { - var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), + var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().Location).LocalPath), "SIL.Windows.Forms.GeckoBrowserAdapter.dll"); if (File.Exists(path)) { diff --git a/TestApps/ArchivingTestApp/ArchivingTestApp.csproj b/TestApps/ArchivingTestApp/ArchivingTestApp.csproj index 6f5d65f4b..771ee48d4 100644 --- a/TestApps/ArchivingTestApp/ArchivingTestApp.csproj +++ b/TestApps/ArchivingTestApp/ArchivingTestApp.csproj @@ -11,10 +11,6 @@ ArchivingTestApp.Program - - - - diff --git a/TestApps/ClipboardTestApp/ClipboardTestApp.csproj b/TestApps/ClipboardTestApp/ClipboardTestApp.csproj deleted file mode 100644 index 439d72787..000000000 --- a/TestApps/ClipboardTestApp/ClipboardTestApp.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - WinExe - false - false - true - true - - - - - - - \ No newline at end of file diff --git a/TestApps/ClipboardTestApp/Form1.Designer.cs b/TestApps/ClipboardTestApp/Form1.Designer.cs deleted file mode 100644 index 63e0d61a0..000000000 --- a/TestApps/ClipboardTestApp/Form1.Designer.cs +++ /dev/null @@ -1,212 +0,0 @@ -namespace ClipboardTestApp -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.btnCopyText = new System.Windows.Forms.Button(); - this.btnPasteText = new System.Windows.Forms.Button(); - this.btnCopyImage = new System.Windows.Forms.Button(); - this.btnPasteImage = new System.Windows.Forms.Button(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.labelContainsText = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.labelContainsImage = new System.Windows.Forms.Label(); - this.btnClose = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.SuspendLayout(); - // - // btnCopyText - // - this.btnCopyText.Location = new System.Drawing.Point(13, 11); - this.btnCopyText.Name = "btnCopyText"; - this.btnCopyText.Size = new System.Drawing.Size(75, 23); - this.btnCopyText.TabIndex = 0; - this.btnCopyText.Text = "Copy Text"; - this.btnCopyText.UseVisualStyleBackColor = true; - this.btnCopyText.Click += new System.EventHandler(this.OnCopyText); - // - // btnPasteText - // - this.btnPasteText.Location = new System.Drawing.Point(94, 11); - this.btnPasteText.Name = "btnPasteText"; - this.btnPasteText.Size = new System.Drawing.Size(75, 23); - this.btnPasteText.TabIndex = 1; - this.btnPasteText.Text = "Paste Text"; - this.btnPasteText.UseVisualStyleBackColor = true; - this.btnPasteText.Click += new System.EventHandler(this.OnPasteText); - // - // btnCopyImage - // - this.btnCopyImage.Location = new System.Drawing.Point(175, 11); - this.btnCopyImage.Name = "btnCopyImage"; - this.btnCopyImage.Size = new System.Drawing.Size(75, 23); - this.btnCopyImage.TabIndex = 2; - this.btnCopyImage.Text = "Copy Image"; - this.btnCopyImage.UseVisualStyleBackColor = true; - this.btnCopyImage.Click += new System.EventHandler(this.OnCopyImage); - // - // btnPasteImage - // - this.btnPasteImage.Location = new System.Drawing.Point(256, 11); - this.btnPasteImage.Name = "btnPasteImage"; - this.btnPasteImage.Size = new System.Drawing.Size(75, 23); - this.btnPasteImage.TabIndex = 1; - this.btnPasteImage.Text = "Paste Image"; - this.btnPasteImage.UseVisualStyleBackColor = true; - this.btnPasteImage.Click += new System.EventHandler(this.OnPasteImage); - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(16, 57); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(223, 100); - this.textBox1.TabIndex = 3; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(13, 41); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(31, 13); - this.label1.TabIndex = 4; - this.label1.Text = "Text:"; - // - // pictureBox1 - // - this.pictureBox1.Location = new System.Drawing.Point(19, 180); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(220, 135); - this.pictureBox1.TabIndex = 5; - this.pictureBox1.TabStop = false; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(16, 164); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(39, 13); - this.label2.TabIndex = 6; - this.label2.Text = "Image:"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(253, 41); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(117, 13); - this.label3.TabIndex = 7; - this.label3.Text = "Clipboard contains text:"; - // - // labelContainsText - // - this.labelContainsText.AutoSize = true; - this.labelContainsText.Location = new System.Drawing.Point(256, 58); - this.labelContainsText.Name = "labelContainsText"; - this.labelContainsText.Size = new System.Drawing.Size(25, 13); - this.labelContainsText.TabIndex = 8; - this.labelContainsText.Text = "???"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(256, 180); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(129, 13); - this.label4.TabIndex = 9; - this.label4.Text = "Clipboard contains Image:"; - // - // labelContainsImage - // - this.labelContainsImage.AutoSize = true; - this.labelContainsImage.Location = new System.Drawing.Point(256, 197); - this.labelContainsImage.Name = "labelContainsImage"; - this.labelContainsImage.Size = new System.Drawing.Size(25, 13); - this.labelContainsImage.TabIndex = 10; - this.labelContainsImage.Text = "???"; - // - // btnClose - // - this.btnClose.DialogResult = System.Windows.Forms.DialogResult.OK; - this.btnClose.Location = new System.Drawing.Point(322, 335); - this.btnClose.Name = "btnClose"; - this.btnClose.Size = new System.Drawing.Size(75, 23); - this.btnClose.TabIndex = 11; - this.btnClose.Text = "Close"; - this.btnClose.UseVisualStyleBackColor = true; - this.btnClose.Click += OnClose; - // Form1 - // - this.AcceptButton = this.btnClose; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(409, 370); - this.Controls.Add(this.btnClose); - this.Controls.Add(this.labelContainsImage); - this.Controls.Add(this.label4); - this.Controls.Add(this.labelContainsText); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.pictureBox1); - this.Controls.Add(this.label1); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.btnCopyImage); - this.Controls.Add(this.btnPasteImage); - this.Controls.Add(this.btnPasteText); - this.Controls.Add(this.btnCopyText); - this.Name = "Form1"; - this.Text = "Clipboard Test App"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - private System.Windows.Forms.Button btnCopyText; - - #endregion - - private System.Windows.Forms.Button btnPasteText; - private System.Windows.Forms.Button btnCopyImage; - private System.Windows.Forms.Button btnPasteImage; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label labelContainsText; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label labelContainsImage; - private System.Windows.Forms.Button btnClose; - } -} \ No newline at end of file diff --git a/TestApps/ClipboardTestApp/Form1.cs b/TestApps/ClipboardTestApp/Form1.cs deleted file mode 100644 index 06e24536c..000000000 --- a/TestApps/ClipboardTestApp/Form1.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using SIL.PlatformUtilities; -using SIL.Windows.Forms.ImageToolbox; -using SIL.Windows.Forms.Miscellaneous; - -namespace ClipboardTestApp -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - - private void OnCopyText(object sender, EventArgs e) - { - PortableClipboard.SetText(textBox1.Text); - UpdateLabels(); - } - - private void OnPasteText(object sender, EventArgs e) - { - textBox1.Text = PortableClipboard.GetText(); - } - - private void OnCopyImage(object sender, EventArgs e) - { - try - { - using var openFileDialog = - new OpenFileDialogWithViews(OpenFileDialogWithViews.DialogViewTypes.Details); - if (openFileDialog.ShowDialog(this) != DialogResult.OK) - return; - - using var image = PalasoImage.FromFile(openFileDialog.FileName); - PortableClipboard.CopyImageToClipboard(image); - UpdateLabels(); - } - catch (NotImplementedException) - { - if (Platform.IsWindows) - throw; - // ignore on Linux - currently not yet implemented - } - } - - private void OnPasteImage(object sender, EventArgs e) - { - pictureBox1.Image = PortableClipboard.GetImage(); - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - UpdateLabels(); - } - - protected override void OnActivated(EventArgs e) - { - base.OnActivated(e); - UpdateLabels(); - } - - private void UpdateLabels() - { - labelContainsText.Text = PortableClipboard.ContainsText() ? "true" : "false"; - labelContainsImage.Text = PortableClipboard.ContainsImage() ? "true" : "false"; - } - - private void OnClose(object sender, EventArgs e) - { - Close(); - } - } -} \ No newline at end of file diff --git a/TestApps/ClipboardTestApp/Form1.resx b/TestApps/ClipboardTestApp/Form1.resx deleted file mode 100644 index d58980a38..000000000 --- a/TestApps/ClipboardTestApp/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/TestApps/ClipboardTestApp/Program.cs b/TestApps/ClipboardTestApp/Program.cs deleted file mode 100644 index 12b14044f..000000000 --- a/TestApps/ClipboardTestApp/Program.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace ClipboardTestApp -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); - } - } -} \ No newline at end of file diff --git a/TestApps/SIL.Windows.Forms.TestApp/SIL.Windows.Forms.TestApp.csproj b/TestApps/SIL.Windows.Forms.TestApp/SIL.Windows.Forms.TestApp.csproj index 302f0679d..836f5812b 100644 --- a/TestApps/SIL.Windows.Forms.TestApp/SIL.Windows.Forms.TestApp.csproj +++ b/TestApps/SIL.Windows.Forms.TestApp/SIL.Windows.Forms.TestApp.csproj @@ -21,7 +21,6 @@ - diff --git a/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.Designer.cs b/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.Designer.cs index 005e15e3b..8b34251c4 100644 --- a/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.Designer.cs +++ b/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.Designer.cs @@ -87,9 +87,9 @@ private void InitializeComponent() this.btnOpenProject = new System.Windows.Forms.Button(); this.toolStrip1.SuspendLayout(); this.SuspendLayout(); - // + // // toolStrip1 - // + // this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this._uiLanguageMenu}); this.toolStrip1.Location = new System.Drawing.Point(0, 0); @@ -97,18 +97,18 @@ private void InitializeComponent() this.toolStrip1.Size = new System.Drawing.Size(187, 25); this.toolStrip1.TabIndex = 9; this.toolStrip1.Text = "toolStrip1"; - // + // // _uiLanguageMenu - // + // this._uiLanguageMenu.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this._uiLanguageMenu.ImageTransparentColor = System.Drawing.Color.Magenta; this._uiLanguageMenu.Name = "_uiLanguageMenu"; this._uiLanguageMenu.Size = new System.Drawing.Size(58, 22); this._uiLanguageMenu.Text = "English"; this._uiLanguageMenu.ToolTipText = "User-interface Language"; - // + // // btnThrowException - // + // this.btnThrowException.Location = new System.Drawing.Point(12, 440); this.btnThrowException.Name = "btnThrowException"; this.btnThrowException.Size = new System.Drawing.Size(157, 23); @@ -116,9 +116,9 @@ private void InitializeComponent() this.btnThrowException.Text = "Throw Unhandled Exception"; this.btnThrowException.UseVisualStyleBackColor = true; this.btnThrowException.Click += new System.EventHandler(this.btnThrowException_Click); - // + // // btnShowFormWithModalChild - // + // this.btnShowFormWithModalChild.Location = new System.Drawing.Point(12, 411); this.btnShowFormWithModalChild.Name = "btnShowFormWithModalChild"; this.btnShowFormWithModalChild.Size = new System.Drawing.Size(157, 23); @@ -126,9 +126,9 @@ private void InitializeComponent() this.btnShowFormWithModalChild.Text = "Form w/ Modal Child..."; this.btnShowFormWithModalChild.UseVisualStyleBackColor = true; this.btnShowFormWithModalChild.Click += new System.EventHandler(this.btnShowFormWithModalChild_Click); - // + // // btnTestContributorsList - // + // this.btnTestContributorsList.Location = new System.Drawing.Point(12, 382); this.btnTestContributorsList.Name = "btnTestContributorsList"; this.btnTestContributorsList.Size = new System.Drawing.Size(157, 23); @@ -136,9 +136,9 @@ private void InitializeComponent() this.btnTestContributorsList.Text = "Test Contributors List..."; this.btnTestContributorsList.UseVisualStyleBackColor = true; this.btnTestContributorsList.Click += new System.EventHandler(this.btnTestContributorsList_Click); - // + // // recordPlayButton - // + // this.recordPlayButton.Location = new System.Drawing.Point(12, 353); this.recordPlayButton.Name = "recordPlayButton"; this.recordPlayButton.Size = new System.Drawing.Size(157, 23); @@ -147,9 +147,9 @@ private void InitializeComponent() this.recordPlayButton.UseVisualStyleBackColor = true; this.recordPlayButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.recordPlayButton_MouseDown); this.recordPlayButton.MouseUp += new System.Windows.Forms.MouseEventHandler(this.recordPlayButton_MouseUp); - // + // // btnFlexibleMessageBox - // + // this.btnFlexibleMessageBox.Location = new System.Drawing.Point(12, 324); this.btnFlexibleMessageBox.Name = "btnFlexibleMessageBox"; this.btnFlexibleMessageBox.Size = new System.Drawing.Size(157, 23); @@ -157,9 +157,9 @@ private void InitializeComponent() this.btnFlexibleMessageBox.Text = "Flexible Message Box"; this.btnFlexibleMessageBox.UseVisualStyleBackColor = true; this.btnFlexibleMessageBox.Click += new System.EventHandler(this.btnFlexibleMessageBox_Click); - // + // // btnSettingProtectionDialog - // + // this.btnSettingProtectionDialog.Location = new System.Drawing.Point(12, 294); this.btnSettingProtectionDialog.Name = "btnSettingProtectionDialog"; this.btnSettingProtectionDialog.Size = new System.Drawing.Size(157, 23); @@ -167,9 +167,9 @@ private void InitializeComponent() this.btnSettingProtectionDialog.Text = "SettingProtectionDialog"; this.btnSettingProtectionDialog.UseVisualStyleBackColor = true; this.btnSettingProtectionDialog.Click += new System.EventHandler(this.btnSettingProtectionDialog_Click); - // + // // _silAboutBoxGecko - // + // this._silAboutBoxGecko.Location = new System.Drawing.Point(12, 179); this._silAboutBoxGecko.Name = "_silAboutBoxGecko"; this._silAboutBoxGecko.Size = new System.Drawing.Size(157, 23); @@ -177,9 +177,9 @@ private void InitializeComponent() this._silAboutBoxGecko.Text = "SIL AboutBox (Gecko)"; this._silAboutBoxGecko.UseVisualStyleBackColor = true; this._silAboutBoxGecko.Click += new System.EventHandler(this.OnSilAboutBoxGeckoClicked); - // + // // label1 - // + // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 569); @@ -201,9 +201,9 @@ private void InitializeComponent() this.superToolTip1.SetSuperStuff(this.label1, superToolTipInfoWrapper1); this.label1.TabIndex = 1; this.label1.Text = "Hover over me to see a tooltip"; - // + // // label2 - // + // this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 589); @@ -220,9 +220,9 @@ private void InitializeComponent() this.superToolTip2.SetSuperStuff(this.label2, superToolTipInfoWrapper2); this.label2.TabIndex = 1; this.label2.Text = "Hover for simple, long tooltip"; - // + // // btnSelectFile - // + // this.btnSelectFile.Location = new System.Drawing.Point(12, 265); this.btnSelectFile.Name = "btnSelectFile"; this.btnSelectFile.Size = new System.Drawing.Size(157, 23); @@ -230,9 +230,9 @@ private void InitializeComponent() this.btnSelectFile.Text = "Select File"; this.btnSelectFile.UseVisualStyleBackColor = true; this.btnSelectFile.Click += new System.EventHandler(this.OnSelectFileClicked); - // + // // btnMetaDataEditor - // + // this.btnMetaDataEditor.Location = new System.Drawing.Point(12, 236); this.btnMetaDataEditor.Name = "btnMetaDataEditor"; this.btnMetaDataEditor.Size = new System.Drawing.Size(157, 23); @@ -240,9 +240,9 @@ private void InitializeComponent() this.btnMetaDataEditor.Text = "Meta Data Editor"; this.btnMetaDataEditor.UseVisualStyleBackColor = true; this.btnMetaDataEditor.Click += new System.EventHandler(this.OnShowMetaDataEditorClicked); - // + // // btnShowReleaseNotes - // + // this.btnShowReleaseNotes.Location = new System.Drawing.Point(12, 207); this.btnShowReleaseNotes.Name = "btnShowReleaseNotes"; this.btnShowReleaseNotes.Size = new System.Drawing.Size(157, 23); @@ -250,9 +250,9 @@ private void InitializeComponent() this.btnShowReleaseNotes.Text = "Show Release Notes"; this.btnShowReleaseNotes.UseVisualStyleBackColor = true; this.btnShowReleaseNotes.Click += new System.EventHandler(this.OnShowReleaseNotesClicked); - // + // // btnSilAboutBox - // + // this.btnSilAboutBox.Location = new System.Drawing.Point(12, 150); this.btnSilAboutBox.Name = "btnSilAboutBox"; this.btnSilAboutBox.Size = new System.Drawing.Size(157, 23); @@ -260,19 +260,9 @@ private void InitializeComponent() this.btnSilAboutBox.Text = "SIL AboutBox"; this.btnSilAboutBox.UseVisualStyleBackColor = true; this.btnSilAboutBox.Click += new System.EventHandler(this.OnSilAboutBoxClicked); - // - // btnImageToolbox - // - this.btnImageToolbox.Location = new System.Drawing.Point(12, 121); - this.btnImageToolbox.Name = "btnImageToolbox"; - this.btnImageToolbox.Size = new System.Drawing.Size(157, 23); - this.btnImageToolbox.TabIndex = 0; - this.btnImageToolbox.Text = "Image Toolbox"; - this.btnImageToolbox.UseVisualStyleBackColor = true; - this.btnImageToolbox.Click += new System.EventHandler(this.OnImageToolboxClicked); - // + // // btnWritingSystemSetupDialog - // + // this.btnWritingSystemSetupDialog.Location = new System.Drawing.Point(12, 92); this.btnWritingSystemSetupDialog.Name = "btnWritingSystemSetupDialog"; this.btnWritingSystemSetupDialog.Size = new System.Drawing.Size(157, 23); @@ -280,9 +270,9 @@ private void InitializeComponent() this.btnWritingSystemSetupDialog.Text = "WritingSystemSetupDialog"; this.btnWritingSystemSetupDialog.UseVisualStyleBackColor = true; this.btnWritingSystemSetupDialog.Click += new System.EventHandler(this.OnWritingSystemSetupDialogClicked); - // + // // btnLookupISOCodeDialog - // + // this.btnLookupISOCodeDialog.Location = new System.Drawing.Point(12, 63); this.btnLookupISOCodeDialog.Name = "btnLookupISOCodeDialog"; this.btnLookupISOCodeDialog.Size = new System.Drawing.Size(157, 23); @@ -290,9 +280,9 @@ private void InitializeComponent() this.btnLookupISOCodeDialog.Text = "LanguageLookupDialog"; this.btnLookupISOCodeDialog.UseVisualStyleBackColor = true; this.btnLookupISOCodeDialog.Click += new System.EventHandler(this.OnLanguageLookupDialogClicked); - // + // // btnFolderBrowserControl - // + // this.btnFolderBrowserControl.Location = new System.Drawing.Point(12, 34); this.btnFolderBrowserControl.Name = "btnFolderBrowserControl"; this.btnFolderBrowserControl.Size = new System.Drawing.Size(157, 23); @@ -300,17 +290,17 @@ private void InitializeComponent() this.btnFolderBrowserControl.Text = "FolderBrowserControl"; this.btnFolderBrowserControl.UseVisualStyleBackColor = true; this.btnFolderBrowserControl.Click += new System.EventHandler(this.OnFolderBrowserControlClicked); - // + // // superToolTip1 - // + // this.superToolTip1.FadingInterval = 10; - // + // // superToolTip2 - // + // this.superToolTip2.FadingInterval = 10; - // + // // btnMediaFileInfo - // + // this.btnMediaFileInfo.Location = new System.Drawing.Point(12, 468); this.btnMediaFileInfo.Margin = new System.Windows.Forms.Padding(2); this.btnMediaFileInfo.Name = "btnMediaFileInfo"; @@ -319,9 +309,9 @@ private void InitializeComponent() this.btnMediaFileInfo.Text = "Get Media File Info"; this.btnMediaFileInfo.UseVisualStyleBackColor = true; this.btnMediaFileInfo.Click += new System.EventHandler(this.btnMediaFileInfo_Click); - // + // // btnShowFileOverwriteDlg - // + // this.btnShowFileOverwriteDlg.Location = new System.Drawing.Point(12, 496); this.btnShowFileOverwriteDlg.Margin = new System.Windows.Forms.Padding(2); this.btnShowFileOverwriteDlg.Name = "btnShowFileOverwriteDlg"; @@ -330,9 +320,9 @@ private void InitializeComponent() this.btnShowFileOverwriteDlg.Text = "Show File Overwrite Dialog"; this.btnShowFileOverwriteDlg.UseVisualStyleBackColor = true; this.btnShowFileOverwriteDlg.Click += new System.EventHandler(this.btnShowFileOverwriteDlg_Click); - // + // // btnOpenProject - // + // this.btnOpenProject.Location = new System.Drawing.Point(12, 523); this.btnOpenProject.Margin = new System.Windows.Forms.Padding(2); this.btnOpenProject.Name = "btnOpenProject"; @@ -341,9 +331,9 @@ private void InitializeComponent() this.btnOpenProject.Text = "Open Project"; this.btnOpenProject.UseVisualStyleBackColor = true; this.btnOpenProject.Click += new System.EventHandler(this.btnOpenProject_Click); - // + // // TestAppForm - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(187, 613); diff --git a/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.cs b/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.cs index fbb86f3c9..63d0b128d 100644 --- a/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.cs +++ b/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.cs @@ -135,16 +135,6 @@ private void OnWritingSystemSetupDialogClicked(object sender, EventArgs e) dialog.ShowDialog(); } - private void OnImageToolboxClicked(object sender, EventArgs e) - { - Application.EnableVisualStyles(); - ThumbnailViewer.UseWebViewer = true; - using (var dlg = new ImageToolboxDialog(new PalasoImage(), null)) - { - dlg.ShowDialog(); - } - } - private void OnSilAboutBoxClicked(object sender, EventArgs e) { ShowSilAboutBox(XWebBrowser.BrowserType.Default, true); diff --git a/TestApps/SIL.Windows.Forms.TestApp/app.config b/TestApps/SIL.Windows.Forms.TestApp/app.config index 8d7b742c0..cbc67198e 100644 --- a/TestApps/SIL.Windows.Forms.TestApp/app.config +++ b/TestApps/SIL.Windows.Forms.TestApp/app.config @@ -16,12 +16,4 @@ - - - - - - - -