diff --git a/NAPS2.Lib.Gtk/EntryPoints/GtkEntryPoint.cs b/NAPS2.Lib.Gtk/EntryPoints/GtkEntryPoint.cs index 16d5e1313..6f2f1f1a6 100644 --- a/NAPS2.Lib.Gtk/EntryPoints/GtkEntryPoint.cs +++ b/NAPS2.Lib.Gtk/EntryPoints/GtkEntryPoint.cs @@ -1,8 +1,8 @@ using Eto; using Eto.Forms; +using NAPS2.EtoForms; using NAPS2.EtoForms.Ui; using NAPS2.Modules; -using NAPS2.WinForms; using Ninject; using UnhandledExceptionEventArgs = Eto.UnhandledExceptionEventArgs; diff --git a/NAPS2.Lib.Gtk/EtoForms/Ui/GtkDesktopForm.cs b/NAPS2.Lib.Gtk/EtoForms/Ui/GtkDesktopForm.cs index 3c501dec5..327a15df0 100644 --- a/NAPS2.Lib.Gtk/EtoForms/Ui/GtkDesktopForm.cs +++ b/NAPS2.Lib.Gtk/EtoForms/Ui/GtkDesktopForm.cs @@ -3,9 +3,9 @@ using Eto.GtkSharp; using Eto.GtkSharp.Forms.ToolBar; using Gdk; using Gtk; +using NAPS2.EtoForms.Desktop; using NAPS2.EtoForms.Gtk; using NAPS2.ImportExport.Images; -using NAPS2.WinForms; using Command = Eto.Forms.Command; namespace NAPS2.EtoForms.Ui; diff --git a/NAPS2.Lib.Gtk/Modules/GtkModule.cs b/NAPS2.Lib.Gtk/Modules/GtkModule.cs index 3427d48eb..de11c8a30 100644 --- a/NAPS2.Lib.Gtk/Modules/GtkModule.cs +++ b/NAPS2.Lib.Gtk/Modules/GtkModule.cs @@ -1,4 +1,5 @@ using NAPS2.EtoForms; +using NAPS2.EtoForms.Desktop; using NAPS2.EtoForms.Gtk; using NAPS2.EtoForms.Ui; using NAPS2.Images.Gtk; @@ -6,7 +7,6 @@ using NAPS2.ImportExport; using NAPS2.ImportExport.Pdf; using NAPS2.Scan; using NAPS2.Update; -using NAPS2.WinForms; using Ninject; using Ninject.Modules; @@ -19,9 +19,9 @@ public class GtkModule : NinjectModule // Bind().To(); Bind().To(); Bind().To(); - Bind().To(); + Bind().To(); Bind().To().InSingletonScope(); - Bind().To(); + Bind().To(); Bind().To(); Bind().To().InSingletonScope(); Bind().ToMethod(ctx => ctx.Kernel.Get()); @@ -29,7 +29,7 @@ public class GtkModule : NinjectModule Bind().ToSelf().InSingletonScope(); Bind().To(); Bind().To(); - Bind().To(); + Bind().To(); Bind().To(); Bind().ToSelf().InSingletonScope(); Bind().To(); diff --git a/NAPS2.Lib.Mac/EntryPoints/MacEntryPoint.cs b/NAPS2.Lib.Mac/EntryPoints/MacEntryPoint.cs index b593c7a68..192376aaa 100644 --- a/NAPS2.Lib.Mac/EntryPoints/MacEntryPoint.cs +++ b/NAPS2.Lib.Mac/EntryPoints/MacEntryPoint.cs @@ -1,8 +1,8 @@ using Eto; using Eto.Forms; +using NAPS2.EtoForms; using NAPS2.EtoForms.Ui; using NAPS2.Modules; -using NAPS2.WinForms; using Ninject; using UnhandledExceptionEventArgs = Eto.UnhandledExceptionEventArgs; diff --git a/NAPS2.Lib.Mac/EtoForms/Ui/MacDesktopForm.cs b/NAPS2.Lib.Mac/EtoForms/Ui/MacDesktopForm.cs index 236366c17..0c189154b 100644 --- a/NAPS2.Lib.Mac/EtoForms/Ui/MacDesktopForm.cs +++ b/NAPS2.Lib.Mac/EtoForms/Ui/MacDesktopForm.cs @@ -2,9 +2,9 @@ using System.Threading; using Eto.Drawing; using Eto.Forms; using Eto.Mac; +using NAPS2.EtoForms.Desktop; using NAPS2.ImportExport.Images; using NAPS2.Scan; -using NAPS2.WinForms; namespace NAPS2.EtoForms.Ui; diff --git a/NAPS2.Lib.Mac/Modules/MacModule.cs b/NAPS2.Lib.Mac/Modules/MacModule.cs index f4f6fbf81..9912babb1 100644 --- a/NAPS2.Lib.Mac/Modules/MacModule.cs +++ b/NAPS2.Lib.Mac/Modules/MacModule.cs @@ -1,4 +1,5 @@ using NAPS2.EtoForms; +using NAPS2.EtoForms.Desktop; using NAPS2.EtoForms.Mac; using NAPS2.EtoForms.Ui; using NAPS2.Images.Mac; @@ -6,7 +7,6 @@ using NAPS2.ImportExport; using NAPS2.ImportExport.Pdf; using NAPS2.Scan; using NAPS2.Update; -using NAPS2.WinForms; using Ninject; using Ninject.Modules; @@ -19,9 +19,9 @@ public class MacModule : NinjectModule // Bind().To(); Bind().To(); Bind().To(); - Bind().To(); + Bind().To(); Bind().To().InSingletonScope(); - Bind().To(); + Bind().To(); Bind().To(); Bind().To().InSingletonScope(); Bind().ToMethod(ctx => ctx.Kernel.Get()); @@ -29,7 +29,7 @@ public class MacModule : NinjectModule Bind().ToSelf().InSingletonScope(); Bind().To(); Bind().To(); - Bind().To(); + Bind().To(); Bind().To(); Bind().ToSelf().InSingletonScope(); Bind().To(); diff --git a/NAPS2.Lib.Tests/Scan/AutoSaverTests.cs b/NAPS2.Lib.Tests/Scan/AutoSaverTests.cs index 76168acb9..61e9cf3b2 100644 --- a/NAPS2.Lib.Tests/Scan/AutoSaverTests.cs +++ b/NAPS2.Lib.Tests/Scan/AutoSaverTests.cs @@ -1,10 +1,10 @@ using Moq; +using NAPS2.EtoForms; using NAPS2.ImportExport; using NAPS2.ImportExport.Pdf; using NAPS2.Scan; using NAPS2.Sdk.Tests; using NAPS2.Sdk.Tests.Asserts; -using NAPS2.WinForms; using Xunit; namespace NAPS2.Lib.Tests.Scan; diff --git a/NAPS2.Lib.Tests/WinForms/DesktopControllerTests.cs b/NAPS2.Lib.Tests/WinForms/DesktopControllerTests.cs index 1a0b9c352..6d17b3021 100644 --- a/NAPS2.Lib.Tests/WinForms/DesktopControllerTests.cs +++ b/NAPS2.Lib.Tests/WinForms/DesktopControllerTests.cs @@ -1,4 +1,6 @@ using Moq; +using NAPS2.EtoForms; +using NAPS2.EtoForms.Desktop; using NAPS2.ImportExport; using NAPS2.ImportExport.Images; using NAPS2.Platform.Windows; @@ -6,7 +8,6 @@ using NAPS2.Recovery; using NAPS2.Sdk.Tests; using NAPS2.Sdk.Tests.Asserts; using NAPS2.Update; -using NAPS2.WinForms; using Xunit; namespace NAPS2.Lib.Tests.WinForms; @@ -28,7 +29,7 @@ public class DesktopControllerTests : ContextualTests private readonly Mock _notifcationManager; private readonly ImageTransfer _imageTransfer; private readonly ImageClipboard _imageClipboard; - private readonly Mock _exportHelper; + private readonly Mock _exportHelper; private readonly Mock _dialogHelper; private readonly DesktopImagesController _desktopImagesController; private readonly Mock _desktopScanController; @@ -51,7 +52,7 @@ public class DesktopControllerTests : ContextualTests _notifcationManager = new Mock(); _imageTransfer = new ImageTransfer(); _imageClipboard = new ImageClipboard(); - _exportHelper = new Mock(); + _exportHelper = new Mock(); _dialogHelper = new Mock(); _desktopImagesController = new DesktopImagesController(_imageList); _desktopScanController = new Mock(); diff --git a/NAPS2.Lib.WinForms.Tests/WinForms/BatchFormTests.cs b/NAPS2.Lib.WinForms.Tests/WinForms/BatchFormTests.cs index e10bac691..c619fc013 100644 --- a/NAPS2.Lib.WinForms.Tests/WinForms/BatchFormTests.cs +++ b/NAPS2.Lib.WinForms.Tests/WinForms/BatchFormTests.cs @@ -1,4 +1,5 @@ using Moq; +using NAPS2.EtoForms; using NAPS2.ImportExport; using NAPS2.Scan; using NAPS2.Scan.Batch; diff --git a/NAPS2.Lib.WinForms/EntryPoints/WinFormsEntryPoint.cs b/NAPS2.Lib.WinForms/EntryPoints/WinFormsEntryPoint.cs index 853e1cac7..a9426afe1 100644 --- a/NAPS2.Lib.WinForms/EntryPoints/WinFormsEntryPoint.cs +++ b/NAPS2.Lib.WinForms/EntryPoints/WinFormsEntryPoint.cs @@ -1,5 +1,6 @@ using System.Threading; using Eto.Forms; +using NAPS2.EtoForms; using NAPS2.EtoForms.Ui; using NAPS2.EtoForms.WinForms; using NAPS2.Modules; diff --git a/NAPS2.Lib.WinForms/WinForms/DesktopSubFormController.cs b/NAPS2.Lib.WinForms/EtoForms/Desktop/DesktopSubFormController.cs similarity index 97% rename from NAPS2.Lib.WinForms/WinForms/DesktopSubFormController.cs rename to NAPS2.Lib.WinForms/EtoForms/Desktop/DesktopSubFormController.cs index ca89e5bfc..da7d97a5a 100644 --- a/NAPS2.Lib.WinForms/WinForms/DesktopSubFormController.cs +++ b/NAPS2.Lib.WinForms/EtoForms/Desktop/DesktopSubFormController.cs @@ -1,7 +1,9 @@ using NAPS2.EtoForms.Ui; +using NAPS2.Images; using NAPS2.Ocr; +using NAPS2.WinForms; -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms.Desktop; public class DesktopSubFormController : IDesktopSubFormController { diff --git a/NAPS2.Lib.WinForms/EtoForms/Ui/WinFormsDesktopForm.cs b/NAPS2.Lib.WinForms/EtoForms/Ui/WinFormsDesktopForm.cs index a21d3ff87..44d586c81 100644 --- a/NAPS2.Lib.WinForms/EtoForms/Ui/WinFormsDesktopForm.cs +++ b/NAPS2.Lib.WinForms/EtoForms/Ui/WinFormsDesktopForm.cs @@ -2,6 +2,7 @@ using System.Drawing; using Eto.Forms; using Eto.WinForms; using Eto.WinForms.Forms.ToolBar; +using NAPS2.EtoForms.Desktop; using NAPS2.EtoForms.WinForms; using NAPS2.ImportExport.Images; using NAPS2.WinForms; diff --git a/NAPS2.Lib.WinForms/ImportExport/Pdf/WinFormsPdfPasswordProvider.cs b/NAPS2.Lib.WinForms/ImportExport/Pdf/WinFormsPdfPasswordProvider.cs index 0c333f262..ef4a300e0 100644 --- a/NAPS2.Lib.WinForms/ImportExport/Pdf/WinFormsPdfPasswordProvider.cs +++ b/NAPS2.Lib.WinForms/ImportExport/Pdf/WinFormsPdfPasswordProvider.cs @@ -1,4 +1,5 @@ using System.Windows.Forms; +using NAPS2.EtoForms; using NAPS2.WinForms; namespace NAPS2.ImportExport.Pdf; diff --git a/NAPS2.Lib.WinForms/Modules/WinFormsModule.cs b/NAPS2.Lib.WinForms/Modules/WinFormsModule.cs index dc9f03855..e926d8cfd 100644 --- a/NAPS2.Lib.WinForms/Modules/WinFormsModule.cs +++ b/NAPS2.Lib.WinForms/Modules/WinFormsModule.cs @@ -1,4 +1,5 @@ using NAPS2.EtoForms; +using NAPS2.EtoForms.Desktop; using NAPS2.EtoForms.Ui; using NAPS2.EtoForms.WinForms; using NAPS2.ImportExport; @@ -19,16 +20,16 @@ public class WinFormsModule : NinjectModule Bind().To(); Bind().To(); Bind().To(); - Bind().To(); + Bind().To(); Bind().To().InSingletonScope(); - Bind().To(); + Bind().To(); Bind().To(); Bind().To().InSingletonScope(); Bind().ToMethod(ctx => ctx.Kernel.Get()); Bind().To(); Bind().ToSelf().InSingletonScope(); Bind().To(); - Bind().To(); + Bind().To(); Bind().To(); Bind().To(); Bind().ToSelf().InSingletonScope(); diff --git a/NAPS2.Lib.WinForms/Recovery/RecoveryOperation.cs b/NAPS2.Lib.WinForms/Recovery/RecoveryOperation.cs index 18ac39602..f9113e0dc 100644 --- a/NAPS2.Lib.WinForms/Recovery/RecoveryOperation.cs +++ b/NAPS2.Lib.WinForms/Recovery/RecoveryOperation.cs @@ -1,4 +1,5 @@ using System.Windows.Forms; +using NAPS2.EtoForms; using NAPS2.WinForms; namespace NAPS2.Recovery; diff --git a/NAPS2.Lib.WinForms/Scan/Batch/BatchScanPerformer.cs b/NAPS2.Lib.WinForms/Scan/Batch/BatchScanPerformer.cs index b973f7f5f..91579e83e 100644 --- a/NAPS2.Lib.WinForms/Scan/Batch/BatchScanPerformer.cs +++ b/NAPS2.Lib.WinForms/Scan/Batch/BatchScanPerformer.cs @@ -1,9 +1,13 @@ using System.Threading; using System.Windows.Forms; +using NAPS2.Config; +using NAPS2.EtoForms; +using NAPS2.Images; using NAPS2.ImportExport; using NAPS2.ImportExport.Images; using NAPS2.ImportExport.Pdf; using NAPS2.Ocr; +using NAPS2.Operation; using NAPS2.Platform.Windows; using NAPS2.WinForms; diff --git a/NAPS2.Lib.WinForms/WinForms/FAutoSaveSettings.cs b/NAPS2.Lib.WinForms/WinForms/FAutoSaveSettings.cs index 29323ef48..8f28f4efa 100644 --- a/NAPS2.Lib.WinForms/WinForms/FAutoSaveSettings.cs +++ b/NAPS2.Lib.WinForms/WinForms/FAutoSaveSettings.cs @@ -1,4 +1,5 @@ using System.Windows.Forms; +using NAPS2.EtoForms; using NAPS2.ImportExport; using NAPS2.Scan; diff --git a/NAPS2.Lib.WinForms/WinForms/FBatchScan.cs b/NAPS2.Lib.WinForms/WinForms/FBatchScan.cs index 15043cf4b..24f1c60b4 100644 --- a/NAPS2.Lib.WinForms/WinForms/FBatchScan.cs +++ b/NAPS2.Lib.WinForms/WinForms/FBatchScan.cs @@ -2,6 +2,7 @@ using System.Globalization; using System.Threading; using System.Windows.Forms; using NAPS2.Config.Model; +using NAPS2.EtoForms; using NAPS2.ImportExport; using NAPS2.Scan; using NAPS2.Scan.Batch; diff --git a/NAPS2.Lib.WinForms/WinForms/FDesktop.cs b/NAPS2.Lib.WinForms/WinForms/FDesktop.cs index 5dfccd361..7aea5c839 100644 --- a/NAPS2.Lib.WinForms/WinForms/FDesktop.cs +++ b/NAPS2.Lib.WinForms/WinForms/FDesktop.cs @@ -2,6 +2,7 @@ using System.Drawing; using System.Threading; using System.Windows.Forms; using NAPS2.EtoForms; +using NAPS2.EtoForms.Desktop; using NAPS2.EtoForms.WinForms; using NAPS2.ImportExport; using NAPS2.Ocr; diff --git a/NAPS2.Lib.WinForms/WinForms/FImageSettings.cs b/NAPS2.Lib.WinForms/WinForms/FImageSettings.cs index 170aff9de..07a157f54 100644 --- a/NAPS2.Lib.WinForms/WinForms/FImageSettings.cs +++ b/NAPS2.Lib.WinForms/WinForms/FImageSettings.cs @@ -1,6 +1,7 @@ using System.Globalization; using System.Windows.Forms; using NAPS2.Config.Model; +using NAPS2.EtoForms; using NAPS2.ImportExport.Images; namespace NAPS2.WinForms; diff --git a/NAPS2.Lib.WinForms/WinForms/FPdfSettings.cs b/NAPS2.Lib.WinForms/WinForms/FPdfSettings.cs index d3adff63b..9cb1db56f 100644 --- a/NAPS2.Lib.WinForms/WinForms/FPdfSettings.cs +++ b/NAPS2.Lib.WinForms/WinForms/FPdfSettings.cs @@ -1,5 +1,6 @@ using System.Windows.Forms; using NAPS2.Config.Model; +using NAPS2.EtoForms; using NAPS2.ImportExport.Pdf; namespace NAPS2.WinForms; diff --git a/NAPS2.Lib.WinForms/WinForms/FViewer.cs b/NAPS2.Lib.WinForms/WinForms/FViewer.cs index 01889094c..a4bb3dd4a 100644 --- a/NAPS2.Lib.WinForms/WinForms/FViewer.cs +++ b/NAPS2.Lib.WinForms/WinForms/FViewer.cs @@ -1,6 +1,7 @@ using System.ComponentModel; using System.Globalization; using System.Windows.Forms; +using NAPS2.EtoForms; using NAPS2.Images.Gdi; using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon; @@ -31,7 +32,7 @@ public class FViewer : FormBase private ToolStripSeparator _toolStripSeparator2; private ToolStripButton _tsSaveImage; private readonly IOperationFactory _operationFactory; - private readonly IWinFormsExportHelper _exportHelper; + private readonly IExportController _exportController; private ToolStripButton _tsHueSaturation; private ToolStripButton _tsBlackWhite; private ToolStripButton _tsSharpen; @@ -43,12 +44,12 @@ public class FViewer : FormBase private UiImage? _currentImage; - public FViewer(IOperationFactory operationFactory, IWinFormsExportHelper exportHelper, + public FViewer(IOperationFactory operationFactory, IExportController exportController, KeyboardShortcutManager ksm, OperationProgress operationProgress, UiImageList imageList, INotificationManager notificationManager, ThumbnailController thumbnailController) { _operationFactory = operationFactory; - _exportHelper = exportHelper; + _exportController = exportController; _ksm = ksm; _operationProgress = operationProgress; _imageList = imageList; @@ -543,7 +544,7 @@ public class FViewer : FormBase private async void tsSavePDF_Click(object sender, EventArgs e) { using var imageToSave = CurrentImage.GetClonedImage(); - if (await _exportHelper.SavePDF(new List { imageToSave }, _notificationManager)) + if (await _exportController.SavePDF(new List { imageToSave }, _notificationManager)) { if (Config.Get(c => c.DeleteAfterSaving)) { @@ -555,7 +556,7 @@ public class FViewer : FormBase private async void tsSaveImage_Click(object sender, EventArgs e) { using var imageToSave = CurrentImage.GetClonedImage(); - if (await _exportHelper.SaveImages(new List { imageToSave }, _notificationManager)) + if (await _exportController.SaveImages(new List { imageToSave }, _notificationManager)) { if (Config.Get(c => c.DeleteAfterSaving)) { diff --git a/NAPS2.Lib.WinForms/WinForms/NotificationManager.cs b/NAPS2.Lib.WinForms/WinForms/NotificationManager.cs index 9882e8e03..3605006ec 100644 --- a/NAPS2.Lib.WinForms/WinForms/NotificationManager.cs +++ b/NAPS2.Lib.WinForms/WinForms/NotificationManager.cs @@ -1,5 +1,7 @@ using System.Drawing; using Eto.Forms; +using NAPS2.EtoForms; +using NAPS2.EtoForms.Desktop; using NAPS2.Update; using wf = System.Windows.Forms; diff --git a/NAPS2.Lib.WinForms/WinForms/WinFormsOperationProgress.cs b/NAPS2.Lib.WinForms/WinForms/WinFormsOperationProgress.cs index 022bdadb3..8fb6cd141 100644 --- a/NAPS2.Lib.WinForms/WinForms/WinFormsOperationProgress.cs +++ b/NAPS2.Lib.WinForms/WinForms/WinFormsOperationProgress.cs @@ -1,5 +1,6 @@ using System.Collections.Immutable; using System.Windows.Forms; +using NAPS2.EtoForms; namespace NAPS2.WinForms; diff --git a/NAPS2.Lib/Automation/AutomatedScanning.cs b/NAPS2.Lib/Automation/AutomatedScanning.cs index 1e2c97832..a35f36a39 100644 --- a/NAPS2.Lib/Automation/AutomatedScanning.cs +++ b/NAPS2.Lib/Automation/AutomatedScanning.cs @@ -1,4 +1,5 @@ using System.Threading; +using NAPS2.EtoForms; using NAPS2.ImportExport; using NAPS2.ImportExport.Email; using NAPS2.ImportExport.Images; @@ -8,7 +9,6 @@ using NAPS2.Ocr; using NAPS2.Recovery; using NAPS2.Scan; using NAPS2.Serialization; -using NAPS2.WinForms; namespace NAPS2.Automation; diff --git a/NAPS2.Lib/Automation/ConsoleOperationProgress.cs b/NAPS2.Lib/Automation/ConsoleOperationProgress.cs index f1284efee..67496979e 100644 --- a/NAPS2.Lib/Automation/ConsoleOperationProgress.cs +++ b/NAPS2.Lib/Automation/ConsoleOperationProgress.cs @@ -1,4 +1,4 @@ -using NAPS2.WinForms; +using NAPS2.EtoForms; namespace NAPS2.Automation; diff --git a/NAPS2.Lib/WinForms/DesktopController.cs b/NAPS2.Lib/EtoForms/Desktop/DesktopController.cs similarity index 97% rename from NAPS2.Lib/WinForms/DesktopController.cs rename to NAPS2.Lib/EtoForms/Desktop/DesktopController.cs index 5ba5c895c..e7e9e73ea 100644 --- a/NAPS2.Lib/WinForms/DesktopController.cs +++ b/NAPS2.Lib/EtoForms/Desktop/DesktopController.cs @@ -1,6 +1,5 @@ using System.Threading; using Eto.Forms; -using NAPS2.EtoForms; using NAPS2.ImportExport; using NAPS2.ImportExport.Images; using NAPS2.Platform.Windows; @@ -9,7 +8,7 @@ using NAPS2.Remoting; using NAPS2.Scan; using NAPS2.Update; -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms.Desktop; // TODO: We undoubtedly want to decompose this file even further. // We almost certainly want a DesktopScanController for the scanning-related logic. @@ -32,7 +31,7 @@ public class DesktopController private readonly ImageTransfer _imageTransfer; private readonly ImageClipboard _imageClipboard; private readonly ImageListActions _imageListActions; - private readonly IWinFormsExportHelper _exportHelper; + private readonly IExportController _exportController; private readonly DialogHelper _dialogHelper; private readonly DesktopImagesController _desktopImagesController; private readonly IDesktopScanController _desktopScanController; @@ -46,7 +45,7 @@ public class DesktopController OperationProgress operationProgress, Naps2Config config, IOperationFactory operationFactory, StillImage stillImage, IUpdateChecker updateChecker, INotificationManager notify, ImageTransfer imageTransfer, - ImageClipboard imageClipboard, ImageListActions imageListActions, IWinFormsExportHelper exportHelper, + ImageClipboard imageClipboard, ImageListActions imageListActions, IExportController exportController, DialogHelper dialogHelper, DesktopImagesController desktopImagesController, IDesktopScanController desktopScanController, DesktopFormProvider desktopFormProvider, IScannedImagePrinter scannedImagePrinter) @@ -64,7 +63,7 @@ public class DesktopController _imageTransfer = imageTransfer; _imageClipboard = imageClipboard; _imageListActions = imageListActions; - _exportHelper = exportHelper; + _exportController = exportController; _dialogHelper = dialogHelper; _desktopImagesController = desktopImagesController; _desktopScanController = desktopScanController; @@ -453,7 +452,7 @@ public class DesktopController public async Task SavePDF(ICollection images) { using var imagesToSave = images.Select(x => x.GetClonedImage()).ToDisposableList(); - if (await _exportHelper.SavePDF(imagesToSave.InnerList, _notify)) + if (await _exportController.SavePDF(imagesToSave.InnerList, _notify)) { if (_config.Get(c => c.DeleteAfterSaving)) { @@ -465,7 +464,7 @@ public class DesktopController public async Task SaveImages(ICollection images) { using var imagesToSave = images.Select(x => x.GetClonedImage()).ToDisposableList(); - if (await _exportHelper.SaveImages(imagesToSave.InnerList, _notify)) + if (await _exportController.SaveImages(imagesToSave.InnerList, _notify)) { if (_config.Get(c => c.DeleteAfterSaving)) { @@ -477,7 +476,7 @@ public class DesktopController public async Task EmailPDF(ICollection images) { using var imagesToEmail = images.Select(x => x.GetClonedImage()).ToDisposableList(); - await _exportHelper.EmailPDF(imagesToEmail.InnerList); + await _exportController.EmailPDF(imagesToEmail.InnerList); } public async Task Print() diff --git a/NAPS2.Lib/WinForms/DesktopFormProvider.cs b/NAPS2.Lib/EtoForms/Desktop/DesktopFormProvider.cs similarity index 88% rename from NAPS2.Lib/WinForms/DesktopFormProvider.cs rename to NAPS2.Lib/EtoForms/Desktop/DesktopFormProvider.cs index b04a01966..54b6ced6c 100644 --- a/NAPS2.Lib/WinForms/DesktopFormProvider.cs +++ b/NAPS2.Lib/EtoForms/Desktop/DesktopFormProvider.cs @@ -1,6 +1,4 @@ -using NAPS2.EtoForms; - -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms.Desktop; public class DesktopFormProvider { diff --git a/NAPS2.Lib/WinForms/DesktopImagesController.cs b/NAPS2.Lib/EtoForms/Desktop/DesktopImagesController.cs similarity index 96% rename from NAPS2.Lib/WinForms/DesktopImagesController.cs rename to NAPS2.Lib/EtoForms/Desktop/DesktopImagesController.cs index 0438820e6..c28c3e4c3 100644 --- a/NAPS2.Lib/WinForms/DesktopImagesController.cs +++ b/NAPS2.Lib/EtoForms/Desktop/DesktopImagesController.cs @@ -1,4 +1,4 @@ -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms.Desktop; public class DesktopImagesController { diff --git a/NAPS2.Lib/WinForms/DesktopScanController.cs b/NAPS2.Lib/EtoForms/Desktop/DesktopScanController.cs similarity index 99% rename from NAPS2.Lib/WinForms/DesktopScanController.cs rename to NAPS2.Lib/EtoForms/Desktop/DesktopScanController.cs index e42f68025..94a300ebe 100644 --- a/NAPS2.Lib/WinForms/DesktopScanController.cs +++ b/NAPS2.Lib/EtoForms/Desktop/DesktopScanController.cs @@ -4,7 +4,7 @@ using NAPS2.Scan; using NAPS2.Wia; #endif -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms.Desktop; public class DesktopScanController : IDesktopScanController { diff --git a/NAPS2.Lib/WinForms/IDesktopScanController.cs b/NAPS2.Lib/EtoForms/Desktop/IDesktopScanController.cs similarity index 85% rename from NAPS2.Lib/WinForms/IDesktopScanController.cs rename to NAPS2.Lib/EtoForms/Desktop/IDesktopScanController.cs index 2358eb9c6..9daf359c9 100644 --- a/NAPS2.Lib/WinForms/IDesktopScanController.cs +++ b/NAPS2.Lib/EtoForms/Desktop/IDesktopScanController.cs @@ -1,6 +1,6 @@ using NAPS2.Scan; -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms.Desktop; public interface IDesktopScanController { diff --git a/NAPS2.Lib/WinForms/IDesktopSubFormController.cs b/NAPS2.Lib/EtoForms/Desktop/IDesktopSubFormController.cs similarity index 93% rename from NAPS2.Lib/WinForms/IDesktopSubFormController.cs rename to NAPS2.Lib/EtoForms/Desktop/IDesktopSubFormController.cs index be03ed01f..c10aa2790 100644 --- a/NAPS2.Lib/WinForms/IDesktopSubFormController.cs +++ b/NAPS2.Lib/EtoForms/Desktop/IDesktopSubFormController.cs @@ -1,4 +1,4 @@ -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms.Desktop; public interface IDesktopSubFormController { diff --git a/NAPS2.Lib/WinForms/DialogHelper.cs b/NAPS2.Lib/EtoForms/DialogHelper.cs similarity index 92% rename from NAPS2.Lib/WinForms/DialogHelper.cs rename to NAPS2.Lib/EtoForms/DialogHelper.cs index 335d7b505..5623c8b74 100644 --- a/NAPS2.Lib/WinForms/DialogHelper.cs +++ b/NAPS2.Lib/EtoForms/DialogHelper.cs @@ -1,4 +1,4 @@ -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; public abstract class DialogHelper { diff --git a/NAPS2.Lib/EtoForms/EtoDevicePrompt.cs b/NAPS2.Lib/EtoForms/EtoDevicePrompt.cs index ba42e26e7..3a4ef7e85 100644 --- a/NAPS2.Lib/EtoForms/EtoDevicePrompt.cs +++ b/NAPS2.Lib/EtoForms/EtoDevicePrompt.cs @@ -1,6 +1,5 @@ using NAPS2.EtoForms.Ui; using NAPS2.Scan; -using NAPS2.WinForms; namespace NAPS2.EtoForms; diff --git a/NAPS2.Lib/EtoForms/EtoDialogBase.cs b/NAPS2.Lib/EtoForms/EtoDialogBase.cs index e7c16f03b..e84afb5e3 100644 --- a/NAPS2.Lib/EtoForms/EtoDialogBase.cs +++ b/NAPS2.Lib/EtoForms/EtoDialogBase.cs @@ -1,5 +1,4 @@ using Eto.Forms; -using NAPS2.WinForms; namespace NAPS2.EtoForms; diff --git a/NAPS2.Lib/WinForms/WinFormsDialogHelper.cs b/NAPS2.Lib/EtoForms/EtoDialogHelper.cs similarity index 95% rename from NAPS2.Lib/WinForms/WinFormsDialogHelper.cs rename to NAPS2.Lib/EtoForms/EtoDialogHelper.cs index 8b6b7f06a..e07999a78 100644 --- a/NAPS2.Lib/WinForms/WinFormsDialogHelper.cs +++ b/NAPS2.Lib/EtoForms/EtoDialogHelper.cs @@ -1,14 +1,13 @@ using Eto.Forms; -using NAPS2.EtoForms; -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; -public class WinFormsDialogHelper : DialogHelper +public class EtoDialogHelper : DialogHelper { private readonly Naps2Config _config; private readonly FileFilters _fileFilters; - public WinFormsDialogHelper(Naps2Config config, FileFilters fileFilters) + public EtoDialogHelper(Naps2Config config, FileFilters fileFilters) { _config = config; _fileFilters = fileFilters; diff --git a/NAPS2.Lib/EtoForms/EtoExtensions.cs b/NAPS2.Lib/EtoForms/EtoExtensions.cs index 622581e83..887469ab0 100644 --- a/NAPS2.Lib/EtoForms/EtoExtensions.cs +++ b/NAPS2.Lib/EtoForms/EtoExtensions.cs @@ -5,27 +5,6 @@ namespace NAPS2.EtoForms; public static class EtoExtensions { - public static DynamicRow AddSeparateRow(this DynamicLayout layout, params ControlWithLayoutAttributes[] controls) - { - layout.BeginVertical(); - var row = layout.BeginHorizontal(); - layout.AddAll(controls); - layout.EndHorizontal(); - layout.EndVertical(); - return row; - } - - public static void AddAll(this DynamicLayout layout, params ControlWithLayoutAttributes[] controls) - { - foreach (var control in controls) - { - layout.Add(control); - } - } - - public static void Add(this DynamicLayout layout, ControlWithLayoutAttributes control) => - control.AddTo(layout); - public static Icon ToEtoIcon(this byte[] bytes) => new(new MemoryStream(bytes)); public static Bitmap ToEtoImage(this byte[] bytes) => new(bytes); @@ -52,70 +31,6 @@ public static class EtoExtensions }; } - public static ControlWithLayoutAttributes Width(this Control control, int width) => - new ControlWithLayoutAttributes(control, width: width); - public static ControlWithLayoutAttributes Height(this Control control, int height) => - new ControlWithLayoutAttributes(control, height: height); - public static ControlWithLayoutAttributes Size(this Control control, int width, int height) => - new ControlWithLayoutAttributes(control, width: width, height: height); - public static ControlWithLayoutAttributes Center(this Control control) => - new ControlWithLayoutAttributes(control, center: true); - public static ControlWithLayoutAttributes XScale(this Control control) => - new ControlWithLayoutAttributes(control, xScale: true); - public static ControlWithLayoutAttributes YScale(this Control control) => - new ControlWithLayoutAttributes(control, yScale: true); - public static ControlWithLayoutAttributes AutoSize(this Control control) => - new ControlWithLayoutAttributes(control, autoSize: true); - public static ControlWithLayoutAttributes Padding(this Control control, Padding padding) => - new ControlWithLayoutAttributes(control, padding: padding); - public static ControlWithLayoutAttributes Padding(this Control control, int all) => - new ControlWithLayoutAttributes(control, padding: new Padding(all)); - public static ControlWithLayoutAttributes Padding(this Control control, int left = 0, int top = 0, int right = 0, int bottom = 0) => - new ControlWithLayoutAttributes(control, padding: new Padding(left, top, right, bottom)); - public static ControlWithLayoutAttributes Spacing(this Control control, Size spacing) => - new ControlWithLayoutAttributes(control, spacing: spacing); - - public static ControlWithLayoutAttributes Width(this ControlWithLayoutAttributes control, int width) => - new ControlWithLayoutAttributes(control, width: width); - public static ControlWithLayoutAttributes Height(this ControlWithLayoutAttributes control, int height) => - new ControlWithLayoutAttributes(control, height: height); - public static ControlWithLayoutAttributes Center(this ControlWithLayoutAttributes control) => - new ControlWithLayoutAttributes(control, center: true); - public static ControlWithLayoutAttributes XScale(this ControlWithLayoutAttributes control) => - new ControlWithLayoutAttributes(control, xScale: true); - public static ControlWithLayoutAttributes YScale(this ControlWithLayoutAttributes control) => - new ControlWithLayoutAttributes(control, yScale: true); - public static ControlWithLayoutAttributes AutoSize(this ControlWithLayoutAttributes control) => - new ControlWithLayoutAttributes(control, autoSize: true); - public static ControlWithLayoutAttributes Padding(this ControlWithLayoutAttributes control, Padding padding) => - new ControlWithLayoutAttributes(control, padding: padding); - public static ControlWithLayoutAttributes Padding(this ControlWithLayoutAttributes control, int all) => - new ControlWithLayoutAttributes(control, padding: new Padding(all)); - public static ControlWithLayoutAttributes Padding(this ControlWithLayoutAttributes control, int left = 0, int top = 0, int right = 0, int bottom = 0) => - new ControlWithLayoutAttributes(control, padding: new Padding(left, top, right, bottom)); - public static ControlWithLayoutAttributes Spacing(this ControlWithLayoutAttributes control, Size spacing) => - new ControlWithLayoutAttributes(control, spacing: spacing); - - public static LayoutColumn Padding(this LayoutColumn column, Padding padding) => - new LayoutColumn(column, padding: padding); - public static LayoutColumn Padding(this LayoutColumn column, int all) => - new LayoutColumn(column, padding: new Padding(all)); - public static LayoutColumn Padding(this LayoutColumn column, int left = 0, int top = 0, int right = 0, int bottom = 0) => - new LayoutColumn(column, padding: new Padding(left, top, right, bottom)); - public static LayoutColumn Spacing(this LayoutColumn column, Size spacing) => - new LayoutColumn(column, spacing: spacing); - public static LayoutColumn Spacing(this LayoutColumn column, int xSpacing, int ySpacing) => - new LayoutColumn(column, spacing: new Size(xSpacing, ySpacing)); - public static LayoutColumn XScale(this LayoutColumn column) => - new LayoutColumn(column, xScale: true); - public static LayoutColumn YScale(this LayoutColumn column) => - new LayoutColumn(column, yScale: true); - - public static LayoutRow YScale(this LayoutRow row) => - new LayoutRow(row, yScale: true); - public static LayoutRow Aligned(this LayoutRow row) => - new LayoutRow(row, aligned: true); - public static void AddItems(this ContextMenu contextMenu, params MenuItem[] menuItems) { contextMenu.Items.AddRange(menuItems); diff --git a/NAPS2.Lib/EtoForms/EtoFormBase.cs b/NAPS2.Lib/EtoForms/EtoFormBase.cs index 32bb1895e..7145679b2 100644 --- a/NAPS2.Lib/EtoForms/EtoFormBase.cs +++ b/NAPS2.Lib/EtoForms/EtoFormBase.cs @@ -1,5 +1,4 @@ using Eto.Forms; -using NAPS2.WinForms; namespace NAPS2.EtoForms; diff --git a/NAPS2.Lib/EtoForms/EtoOperationProgress.cs b/NAPS2.Lib/EtoForms/EtoOperationProgress.cs index 88da22eb8..59bf1c893 100644 --- a/NAPS2.Lib/EtoForms/EtoOperationProgress.cs +++ b/NAPS2.Lib/EtoForms/EtoOperationProgress.cs @@ -1,6 +1,5 @@ using Eto.Forms; using NAPS2.EtoForms.Ui; -using NAPS2.WinForms; namespace NAPS2.EtoForms; diff --git a/NAPS2.Lib/WinForms/WinFormsOverwritePrompt.cs b/NAPS2.Lib/EtoForms/EtoOverwritePrompt.cs similarity index 87% rename from NAPS2.Lib/WinForms/WinFormsOverwritePrompt.cs rename to NAPS2.Lib/EtoForms/EtoOverwritePrompt.cs index 1bc05fed4..776bdc9fd 100644 --- a/NAPS2.Lib/WinForms/WinFormsOverwritePrompt.cs +++ b/NAPS2.Lib/EtoForms/EtoOverwritePrompt.cs @@ -1,8 +1,8 @@ using Eto.Forms; -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; -public class WinFormsOverwritePrompt : IOverwritePrompt +public class EtoOverwritePrompt : IOverwritePrompt { public OverwriteResponse ConfirmOverwrite(string path) { diff --git a/NAPS2.Lib/WinForms/WinFormsExportHelper.cs b/NAPS2.Lib/EtoForms/ExportController.cs similarity index 93% rename from NAPS2.Lib/WinForms/WinFormsExportHelper.cs rename to NAPS2.Lib/EtoForms/ExportController.cs index f78372dca..8d65879e2 100644 --- a/NAPS2.Lib/WinForms/WinFormsExportHelper.cs +++ b/NAPS2.Lib/EtoForms/ExportController.cs @@ -3,10 +3,9 @@ using NAPS2.ImportExport.Email; using NAPS2.ImportExport.Images; using NAPS2.ImportExport.Pdf; -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; -// TODO: Rename this ImageExportController or something -public class WinFormsExportHelper : IWinFormsExportHelper +public class ExportController : IExportController { private readonly DialogHelper _dialogHelper; private readonly IOperationFactory _operationFactory; @@ -15,7 +14,7 @@ public class WinFormsExportHelper : IWinFormsExportHelper private readonly Naps2Config _config; private readonly UiImageList _uiImageList; - public WinFormsExportHelper(DialogHelper dialogHelper, IOperationFactory operationFactory, IFormFactory formFactory, OperationProgress operationProgress, Naps2Config config, UiImageList uiImageList) + public ExportController(DialogHelper dialogHelper, IOperationFactory operationFactory, IFormFactory formFactory, OperationProgress operationProgress, Naps2Config config, UiImageList uiImageList) { _dialogHelper = dialogHelper; _operationFactory = operationFactory; diff --git a/NAPS2.Lib/WinForms/IWinFormsExportHelper.cs b/NAPS2.Lib/EtoForms/IExportController.cs similarity index 84% rename from NAPS2.Lib/WinForms/IWinFormsExportHelper.cs rename to NAPS2.Lib/EtoForms/IExportController.cs index ca165f90a..641646e8b 100644 --- a/NAPS2.Lib/WinForms/IWinFormsExportHelper.cs +++ b/NAPS2.Lib/EtoForms/IExportController.cs @@ -1,8 +1,8 @@ using NAPS2.ImportExport.Email; -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; -public interface IWinFormsExportHelper +public interface IExportController { Task SavePDF(IList images, ISaveNotify notify); Task ExportPDF(string filename, IList images, bool email, EmailMessage emailMessage); diff --git a/NAPS2.Lib/EtoForms/IFormBase.cs b/NAPS2.Lib/EtoForms/IFormBase.cs index e5811db72..87542ba70 100644 --- a/NAPS2.Lib/EtoForms/IFormBase.cs +++ b/NAPS2.Lib/EtoForms/IFormBase.cs @@ -1,5 +1,3 @@ -using NAPS2.WinForms; - namespace NAPS2.EtoForms; public interface IFormBase diff --git a/NAPS2.Lib/WinForms/IFormFactory.cs b/NAPS2.Lib/EtoForms/IFormFactory.cs similarity index 58% rename from NAPS2.Lib/WinForms/IFormFactory.cs rename to NAPS2.Lib/EtoForms/IFormFactory.cs index 7983010f0..b407923ef 100644 --- a/NAPS2.Lib/WinForms/IFormFactory.cs +++ b/NAPS2.Lib/EtoForms/IFormFactory.cs @@ -1,6 +1,4 @@ -using NAPS2.EtoForms; - -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; public interface IFormFactory { diff --git a/NAPS2.Lib/WinForms/INotificationManager.cs b/NAPS2.Lib/EtoForms/INotificationManager.cs similarity index 91% rename from NAPS2.Lib/WinForms/INotificationManager.cs rename to NAPS2.Lib/EtoForms/INotificationManager.cs index 9e535d8d3..fb47fdf8c 100644 --- a/NAPS2.Lib/WinForms/INotificationManager.cs +++ b/NAPS2.Lib/EtoForms/INotificationManager.cs @@ -1,6 +1,6 @@ using NAPS2.Update; -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; public interface INotificationManager : ISaveNotify { diff --git a/NAPS2.Lib/WinForms/ImageClipboard.cs b/NAPS2.Lib/EtoForms/ImageClipboard.cs similarity index 98% rename from NAPS2.Lib/WinForms/ImageClipboard.cs rename to NAPS2.Lib/EtoForms/ImageClipboard.cs index 475059513..954384efa 100644 --- a/NAPS2.Lib/WinForms/ImageClipboard.cs +++ b/NAPS2.Lib/EtoForms/ImageClipboard.cs @@ -1,9 +1,8 @@ using System.Text; using Eto.Forms; -using NAPS2.EtoForms; using NAPS2.ImportExport.Images; -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; public class ImageClipboard { diff --git a/NAPS2.Lib/WinForms/ImageListActions.cs b/NAPS2.Lib/EtoForms/ImageListActions.cs similarity index 99% rename from NAPS2.Lib/WinForms/ImageListActions.cs rename to NAPS2.Lib/EtoForms/ImageListActions.cs index 5f9f91041..3021d8053 100644 --- a/NAPS2.Lib/WinForms/ImageListActions.cs +++ b/NAPS2.Lib/EtoForms/ImageListActions.cs @@ -1,4 +1,4 @@ -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; public class ImageListActions { diff --git a/NAPS2.Lib/EtoForms/C.cs b/NAPS2.Lib/EtoForms/Layout/C.cs similarity index 99% rename from NAPS2.Lib/EtoForms/C.cs rename to NAPS2.Lib/EtoForms/Layout/C.cs index 668714d42..584a46b9b 100644 --- a/NAPS2.Lib/EtoForms/C.cs +++ b/NAPS2.Lib/EtoForms/Layout/C.cs @@ -3,7 +3,7 @@ using Eto.Drawing; using Eto.Forms; using NAPS2.Scan; -namespace NAPS2.EtoForms; +namespace NAPS2.EtoForms.Layout; public static class C { diff --git a/NAPS2.Lib/EtoForms/ControlWithLayoutAttributes.cs b/NAPS2.Lib/EtoForms/Layout/ControlWithLayoutAttributes.cs similarity index 98% rename from NAPS2.Lib/EtoForms/ControlWithLayoutAttributes.cs rename to NAPS2.Lib/EtoForms/Layout/ControlWithLayoutAttributes.cs index e12fe6bff..7b7fa1e69 100644 --- a/NAPS2.Lib/EtoForms/ControlWithLayoutAttributes.cs +++ b/NAPS2.Lib/EtoForms/Layout/ControlWithLayoutAttributes.cs @@ -1,7 +1,7 @@ using Eto.Drawing; using Eto.Forms; -namespace NAPS2.EtoForms; +namespace NAPS2.EtoForms.Layout; public class ControlWithLayoutAttributes : LayoutElement { diff --git a/NAPS2.Lib/EtoForms/Layout/EtoLayoutExtensions.cs b/NAPS2.Lib/EtoForms/Layout/EtoLayoutExtensions.cs new file mode 100644 index 000000000..d98051698 --- /dev/null +++ b/NAPS2.Lib/EtoForms/Layout/EtoLayoutExtensions.cs @@ -0,0 +1,123 @@ +using Eto.Drawing; +using Eto.Forms; + +namespace NAPS2.EtoForms.Layout; + +public static class EtoLayoutExtensions +{ + public static DynamicRow AddSeparateRow(this DynamicLayout layout, params ControlWithLayoutAttributes[] controls) + { + layout.BeginVertical(); + var row = layout.BeginHorizontal(); + layout.AddAll(controls); + layout.EndHorizontal(); + layout.EndVertical(); + return row; + } + + public static void AddAll(this DynamicLayout layout, params ControlWithLayoutAttributes[] controls) + { + foreach (var control in controls) + { + layout.Add(control); + } + } + + public static void Add(this DynamicLayout layout, ControlWithLayoutAttributes control) => + control.AddTo(layout); + + public static Icon ToEtoIcon(this byte[] bytes) => new(new MemoryStream(bytes)); + + public static Bitmap ToEtoImage(this byte[] bytes) => new(bytes); + public static Bitmap ToEtoImage(this IMemoryImage image) => EtoPlatform.Current.ToBitmap(image); + + public static MessageBoxType ToEto(this MessageBoxIcon icon) + { + return icon switch + { + MessageBoxIcon.Information => MessageBoxType.Information, + MessageBoxIcon.Warning => MessageBoxType.Warning, + _ => MessageBoxType.Information // TODO: Default type with no icon? + }; + } + + public static DockPosition ToEto(this DockStyle dock) + { + return dock switch + { + DockStyle.Bottom => DockPosition.Bottom, + DockStyle.Left => DockPosition.Left, + DockStyle.Right => DockPosition.Right, + _ => DockPosition.Top + }; + } + + public static ControlWithLayoutAttributes Width(this Control control, int width) => + new ControlWithLayoutAttributes(control, width: width); + public static ControlWithLayoutAttributes Height(this Control control, int height) => + new ControlWithLayoutAttributes(control, height: height); + public static ControlWithLayoutAttributes Size(this Control control, int width, int height) => + new ControlWithLayoutAttributes(control, width: width, height: height); + public static ControlWithLayoutAttributes Center(this Control control) => + new ControlWithLayoutAttributes(control, center: true); + public static ControlWithLayoutAttributes XScale(this Control control) => + new ControlWithLayoutAttributes(control, xScale: true); + public static ControlWithLayoutAttributes YScale(this Control control) => + new ControlWithLayoutAttributes(control, yScale: true); + public static ControlWithLayoutAttributes AutoSize(this Control control) => + new ControlWithLayoutAttributes(control, autoSize: true); + public static ControlWithLayoutAttributes Padding(this Control control, Padding padding) => + new ControlWithLayoutAttributes(control, padding: padding); + public static ControlWithLayoutAttributes Padding(this Control control, int all) => + new ControlWithLayoutAttributes(control, padding: new Padding(all)); + public static ControlWithLayoutAttributes Padding(this Control control, int left = 0, int top = 0, int right = 0, int bottom = 0) => + new ControlWithLayoutAttributes(control, padding: new Padding(left, top, right, bottom)); + public static ControlWithLayoutAttributes Spacing(this Control control, Size spacing) => + new ControlWithLayoutAttributes(control, spacing: spacing); + + public static ControlWithLayoutAttributes Width(this ControlWithLayoutAttributes control, int width) => + new ControlWithLayoutAttributes(control, width: width); + public static ControlWithLayoutAttributes Height(this ControlWithLayoutAttributes control, int height) => + new ControlWithLayoutAttributes(control, height: height); + public static ControlWithLayoutAttributes Center(this ControlWithLayoutAttributes control) => + new ControlWithLayoutAttributes(control, center: true); + public static ControlWithLayoutAttributes XScale(this ControlWithLayoutAttributes control) => + new ControlWithLayoutAttributes(control, xScale: true); + public static ControlWithLayoutAttributes YScale(this ControlWithLayoutAttributes control) => + new ControlWithLayoutAttributes(control, yScale: true); + public static ControlWithLayoutAttributes AutoSize(this ControlWithLayoutAttributes control) => + new ControlWithLayoutAttributes(control, autoSize: true); + public static ControlWithLayoutAttributes Padding(this ControlWithLayoutAttributes control, Padding padding) => + new ControlWithLayoutAttributes(control, padding: padding); + public static ControlWithLayoutAttributes Padding(this ControlWithLayoutAttributes control, int all) => + new ControlWithLayoutAttributes(control, padding: new Padding(all)); + public static ControlWithLayoutAttributes Padding(this ControlWithLayoutAttributes control, int left = 0, int top = 0, int right = 0, int bottom = 0) => + new ControlWithLayoutAttributes(control, padding: new Padding(left, top, right, bottom)); + public static ControlWithLayoutAttributes Spacing(this ControlWithLayoutAttributes control, Size spacing) => + new ControlWithLayoutAttributes(control, spacing: spacing); + + public static LayoutColumn Padding(this LayoutColumn column, Padding padding) => + new LayoutColumn(column, padding: padding); + public static LayoutColumn Padding(this LayoutColumn column, int all) => + new LayoutColumn(column, padding: new Padding(all)); + public static LayoutColumn Padding(this LayoutColumn column, int left = 0, int top = 0, int right = 0, int bottom = 0) => + new LayoutColumn(column, padding: new Padding(left, top, right, bottom)); + public static LayoutColumn Spacing(this LayoutColumn column, Size spacing) => + new LayoutColumn(column, spacing: spacing); + public static LayoutColumn Spacing(this LayoutColumn column, int xSpacing, int ySpacing) => + new LayoutColumn(column, spacing: new Size(xSpacing, ySpacing)); + public static LayoutColumn XScale(this LayoutColumn column) => + new LayoutColumn(column, xScale: true); + public static LayoutColumn YScale(this LayoutColumn column) => + new LayoutColumn(column, yScale: true); + + public static LayoutRow YScale(this LayoutRow row) => + new LayoutRow(row, yScale: true); + public static LayoutRow Aligned(this LayoutRow row) => + new LayoutRow(row, aligned: true); + + public static void AddItems(this ContextMenu contextMenu, params MenuItem[] menuItems) + { + contextMenu.Items.AddRange(menuItems); + } +} \ No newline at end of file diff --git a/NAPS2.Lib/EtoForms/L.cs b/NAPS2.Lib/EtoForms/Layout/L.cs similarity index 96% rename from NAPS2.Lib/EtoForms/L.cs rename to NAPS2.Lib/EtoForms/Layout/L.cs index b44732ab9..07eddbd04 100644 --- a/NAPS2.Lib/EtoForms/L.cs +++ b/NAPS2.Lib/EtoForms/Layout/L.cs @@ -1,7 +1,7 @@ using Eto.Drawing; using Eto.Forms; -namespace NAPS2.EtoForms; +namespace NAPS2.EtoForms.Layout; public static class L { diff --git a/NAPS2.Lib/EtoForms/LayoutColumn.cs b/NAPS2.Lib/EtoForms/Layout/LayoutColumn.cs similarity index 96% rename from NAPS2.Lib/EtoForms/LayoutColumn.cs rename to NAPS2.Lib/EtoForms/Layout/LayoutColumn.cs index 189553418..a81f7e0cf 100644 --- a/NAPS2.Lib/EtoForms/LayoutColumn.cs +++ b/NAPS2.Lib/EtoForms/Layout/LayoutColumn.cs @@ -1,7 +1,7 @@ using Eto.Drawing; using Eto.Forms; -namespace NAPS2.EtoForms; +namespace NAPS2.EtoForms.Layout; public class LayoutColumn : LayoutElement { diff --git a/NAPS2.Lib/EtoForms/LayoutElement.cs b/NAPS2.Lib/EtoForms/Layout/LayoutElement.cs similarity index 91% rename from NAPS2.Lib/EtoForms/LayoutElement.cs rename to NAPS2.Lib/EtoForms/Layout/LayoutElement.cs index 6977c429c..d402e8769 100644 --- a/NAPS2.Lib/EtoForms/LayoutElement.cs +++ b/NAPS2.Lib/EtoForms/Layout/LayoutElement.cs @@ -1,6 +1,6 @@ using Eto.Forms; -namespace NAPS2.EtoForms; +namespace NAPS2.EtoForms.Layout; public abstract class LayoutElement { diff --git a/NAPS2.Lib/EtoForms/LayoutRoot.cs b/NAPS2.Lib/EtoForms/Layout/LayoutRoot.cs similarity index 96% rename from NAPS2.Lib/EtoForms/LayoutRoot.cs rename to NAPS2.Lib/EtoForms/Layout/LayoutRoot.cs index 1c39b2639..2ccdeaac5 100644 --- a/NAPS2.Lib/EtoForms/LayoutRoot.cs +++ b/NAPS2.Lib/EtoForms/Layout/LayoutRoot.cs @@ -1,7 +1,7 @@ using Eto.Drawing; using Eto.Forms; -namespace NAPS2.EtoForms; +namespace NAPS2.EtoForms.Layout; public class LayoutRoot : LayoutElement { diff --git a/NAPS2.Lib/EtoForms/LayoutRow.cs b/NAPS2.Lib/EtoForms/Layout/LayoutRow.cs similarity index 96% rename from NAPS2.Lib/EtoForms/LayoutRow.cs rename to NAPS2.Lib/EtoForms/Layout/LayoutRow.cs index c96a41a88..e519fa99b 100644 --- a/NAPS2.Lib/EtoForms/LayoutRow.cs +++ b/NAPS2.Lib/EtoForms/Layout/LayoutRow.cs @@ -1,6 +1,6 @@ using Eto.Forms; -namespace NAPS2.EtoForms; +namespace NAPS2.EtoForms.Layout; public class LayoutRow : LayoutElement { diff --git a/NAPS2.Lib/WinForms/MessageBoxErrorOutput.cs b/NAPS2.Lib/EtoForms/MessageBoxErrorOutput.cs similarity index 97% rename from NAPS2.Lib/WinForms/MessageBoxErrorOutput.cs rename to NAPS2.Lib/EtoForms/MessageBoxErrorOutput.cs index 68fdfaed7..af898a63a 100644 --- a/NAPS2.Lib/WinForms/MessageBoxErrorOutput.cs +++ b/NAPS2.Lib/EtoForms/MessageBoxErrorOutput.cs @@ -1,6 +1,6 @@ using Eto.Forms; -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; public class MessageBoxErrorOutput : ErrorOutput { diff --git a/NAPS2.Lib/WinForms/StubDialogHelper.cs b/NAPS2.Lib/EtoForms/StubDialogHelper.cs similarity index 95% rename from NAPS2.Lib/WinForms/StubDialogHelper.cs rename to NAPS2.Lib/EtoForms/StubDialogHelper.cs index 16d2ce949..34f44dee1 100644 --- a/NAPS2.Lib/WinForms/StubDialogHelper.cs +++ b/NAPS2.Lib/EtoForms/StubDialogHelper.cs @@ -1,4 +1,4 @@ -namespace NAPS2.WinForms; +namespace NAPS2.EtoForms; public class StubDialogHelper : DialogHelper { diff --git a/NAPS2.Lib/EtoForms/Ui/AboutForm.cs b/NAPS2.Lib/EtoForms/Ui/AboutForm.cs index 93d9290f5..bce80709e 100644 --- a/NAPS2.Lib/EtoForms/Ui/AboutForm.cs +++ b/NAPS2.Lib/EtoForms/Ui/AboutForm.cs @@ -1,5 +1,6 @@ using Eto.Drawing; using Eto.Forms; +using NAPS2.EtoForms.Layout; using NAPS2.Update; namespace NAPS2.EtoForms.Ui; diff --git a/NAPS2.Lib/EtoForms/Ui/DesktopCommands.cs b/NAPS2.Lib/EtoForms/Ui/DesktopCommands.cs index 7071ab081..0c1b1cd24 100644 --- a/NAPS2.Lib/EtoForms/Ui/DesktopCommands.cs +++ b/NAPS2.Lib/EtoForms/Ui/DesktopCommands.cs @@ -1,5 +1,5 @@ using Eto.Forms; -using NAPS2.WinForms; +using NAPS2.EtoForms.Desktop; namespace NAPS2.EtoForms.Ui; diff --git a/NAPS2.Lib/EtoForms/Ui/DesktopForm.cs b/NAPS2.Lib/EtoForms/Ui/DesktopForm.cs index fdf040b0c..8949d8ca6 100644 --- a/NAPS2.Lib/EtoForms/Ui/DesktopForm.cs +++ b/NAPS2.Lib/EtoForms/Ui/DesktopForm.cs @@ -1,9 +1,9 @@ using System.Collections.Immutable; using System.Threading; using Eto.Forms; +using NAPS2.EtoForms.Desktop; using NAPS2.ImportExport.Images; using NAPS2.Scan; -using NAPS2.WinForms; namespace NAPS2.EtoForms.Ui; diff --git a/NAPS2.Lib/EtoForms/Ui/EditProfileForm.cs b/NAPS2.Lib/EtoForms/Ui/EditProfileForm.cs index 31b8e5924..80c89dc30 100644 --- a/NAPS2.Lib/EtoForms/Ui/EditProfileForm.cs +++ b/NAPS2.Lib/EtoForms/Ui/EditProfileForm.cs @@ -1,5 +1,6 @@ using Eto.Drawing; using Eto.Forms; +using NAPS2.EtoForms.Layout; using NAPS2.Scan; using NAPS2.Scan.Exceptions; using NAPS2.Scan.Internal; diff --git a/NAPS2.Lib/EtoForms/Ui/ProfilesForm.cs b/NAPS2.Lib/EtoForms/Ui/ProfilesForm.cs index fe690e898..adca090c3 100644 --- a/NAPS2.Lib/EtoForms/Ui/ProfilesForm.cs +++ b/NAPS2.Lib/EtoForms/Ui/ProfilesForm.cs @@ -1,5 +1,6 @@ using Eto.Drawing; using Eto.Forms; +using NAPS2.EtoForms.Layout; using NAPS2.ImportExport.Profiles; using NAPS2.Scan; using NAPS2.Serialization; diff --git a/NAPS2.Lib/EtoForms/Ui/ProgressForm.cs b/NAPS2.Lib/EtoForms/Ui/ProgressForm.cs index 4e75295c9..069252ecb 100644 --- a/NAPS2.Lib/EtoForms/Ui/ProgressForm.cs +++ b/NAPS2.Lib/EtoForms/Ui/ProgressForm.cs @@ -1,6 +1,7 @@ using System.ComponentModel; using Eto.Drawing; using Eto.Forms; +using NAPS2.EtoForms.Layout; namespace NAPS2.EtoForms.Ui; diff --git a/NAPS2.Lib/EtoForms/Ui/SelectDeviceForm.cs b/NAPS2.Lib/EtoForms/Ui/SelectDeviceForm.cs index 3bb2a4898..b5b0ea0de 100644 --- a/NAPS2.Lib/EtoForms/Ui/SelectDeviceForm.cs +++ b/NAPS2.Lib/EtoForms/Ui/SelectDeviceForm.cs @@ -1,5 +1,6 @@ using Eto.Drawing; using Eto.Forms; +using NAPS2.EtoForms.Layout; using NAPS2.Scan; namespace NAPS2.EtoForms.Ui; diff --git a/NAPS2.Lib/ImportExport/AutoSaver.cs b/NAPS2.Lib/ImportExport/AutoSaver.cs index 34e0c52a8..9e662d770 100644 --- a/NAPS2.Lib/ImportExport/AutoSaver.cs +++ b/NAPS2.Lib/ImportExport/AutoSaver.cs @@ -1,7 +1,7 @@ +using NAPS2.EtoForms; using NAPS2.ImportExport.Images; using NAPS2.ImportExport.Pdf; using NAPS2.Scan; -using NAPS2.WinForms; namespace NAPS2.ImportExport; diff --git a/NAPS2.Lib/Modules/CommonModule.cs b/NAPS2.Lib/Modules/CommonModule.cs index 9589a4e68..2493c6365 100644 --- a/NAPS2.Lib/Modules/CommonModule.cs +++ b/NAPS2.Lib/Modules/CommonModule.cs @@ -1,4 +1,5 @@ -using NAPS2.ImportExport; +using NAPS2.EtoForms; +using NAPS2.ImportExport; using NAPS2.ImportExport.Email; using NAPS2.ImportExport.Email.Mapi; using NAPS2.ImportExport.Images; @@ -10,7 +11,6 @@ using NAPS2.Remoting.Worker; using NAPS2.Scan; using NAPS2.Scan.Internal; using NAPS2.Unmanaged; -using NAPS2.WinForms; using Ninject; using Ninject.Modules; using ILogger = NAPS2.Logging.ILogger; diff --git a/NAPS2.Lib/Modules/ConsoleModule.cs b/NAPS2.Lib/Modules/ConsoleModule.cs index 6465fda31..024008967 100644 --- a/NAPS2.Lib/Modules/ConsoleModule.cs +++ b/NAPS2.Lib/Modules/ConsoleModule.cs @@ -1,7 +1,7 @@ using NAPS2.Automation; +using NAPS2.EtoForms; using NAPS2.ImportExport.Pdf; using NAPS2.Scan; -using NAPS2.WinForms; using Ninject.Modules; namespace NAPS2.Modules; diff --git a/NAPS2.Lib/NinjectFormFactory.cs b/NAPS2.Lib/NinjectFormFactory.cs index f9375e36d..606b84220 100644 --- a/NAPS2.Lib/NinjectFormFactory.cs +++ b/NAPS2.Lib/NinjectFormFactory.cs @@ -1,5 +1,4 @@ using NAPS2.EtoForms; -using NAPS2.WinForms; using Ninject; namespace NAPS2; diff --git a/NAPS2.Lib/Update/UpdateOperation.cs b/NAPS2.Lib/Update/UpdateOperation.cs index 04eeea386..f3680bdee 100644 --- a/NAPS2.Lib/Update/UpdateOperation.cs +++ b/NAPS2.Lib/Update/UpdateOperation.cs @@ -4,7 +4,7 @@ using System.Net; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Threading; -using NAPS2.WinForms; +using NAPS2.EtoForms.Desktop; namespace NAPS2.Update;