Add paste, and fix copy/drag for transformed images

This commit is contained in:
Ben Olden-Cooligan 2016-01-07 23:09:02 -05:00
parent 9b84ffd6d0
commit 31d7e520ec
15 changed files with 284 additions and 171 deletions

View File

@ -4,6 +4,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading;
using NAPS2.Config;
using NAPS2.Lang.Resources;
using NAPS2.Operation;
using NAPS2.Scan.Images;
@ -15,37 +16,46 @@ namespace NAPS2.ImportExport
public class DirectImportOperation : OperationBase
{
private readonly IScannedImageFactory scannedImageFactory;
private readonly IUserConfigManager userConfigManager;
private readonly ThreadFactory threadFactory;
private bool cancel;
private Thread thread;
public DirectImportOperation(IScannedImageFactory scannedImageFactory, ThreadFactory threadFactory)
public DirectImportOperation(IScannedImageFactory scannedImageFactory, IUserConfigManager userConfigManager, ThreadFactory threadFactory)
{
this.scannedImageFactory = scannedImageFactory;
this.userConfigManager = userConfigManager;
this.threadFactory = threadFactory;
ProgressTitle = MiscResources.ImportProgress;
AllowCancel = true;
}
public bool Start(DirectImageTransfer data, Action<IScannedImage> imageCallback)
public bool Start(DirectImageTransfer data, bool copy, Action<IScannedImage> imageCallback)
{
ProgressTitle = copy ? MiscResources.CopyProgress : MiscResources.ImportProgress;
Status = new OperationStatus
{
StatusText = copy ? MiscResources.Copying : MiscResources.Importing,
MaxProgress = data.ImageRecovery.Length
};
cancel = false;
thread = threadFactory.StartThread(() =>
{
try
Exception error = null;
foreach (var ir in data.ImageRecovery)
{
foreach (var ir in data.ImageRecovery)
try
{
using (var bitmap = new Bitmap(Path.Combine(data.RecoveryFolder, ir.FileName)))
{
var img = scannedImageFactory.Create(bitmap, ir.BitDepth, ir.HighQuality);
foreach (var transform in ir.TransformList)
{
img.AddTransform(transform);
}
img.SetThumbnail(img.RenderThumbnail(userConfigManager.Config.ThumbnailSize));
imageCallback(img);
Status.CurrentProgress++;
@ -56,12 +66,16 @@ namespace NAPS2.ImportExport
}
}
}
Status.Success = true;
catch (Exception ex)
{
error = ex;
}
}
catch (Exception ex)
if (error != null)
{
Log.ErrorException(string.Format(MiscResources.ImportErrorCouldNot, data.RecoveryFolder), ex);
Log.ErrorException(string.Format(MiscResources.ImportErrorCouldNot, data.RecoveryFolder), error);
}
Status.Success = true;
InvokeFinished();
});
return true;

View File

@ -88,7 +88,7 @@ namespace NAPS2.ImportExport.Images
return;
}
}
Status.StatusText = string.Format(MiscResources.Saving, Path.GetFileName(subFileName));
Status.StatusText = string.Format(MiscResources.SavingFormat, Path.GetFileName(subFileName));
Status.Success = TiffHelper.SaveMultipage(images, subFileName, j =>
{
Status.CurrentProgress = j;
@ -125,7 +125,7 @@ namespace NAPS2.ImportExport.Images
{
if (images.Count == 1)
{
Status.StatusText = string.Format(MiscResources.Saving, Path.GetFileName(subFileName));
Status.StatusText = string.Format(MiscResources.SavingFormat, Path.GetFileName(subFileName));
InvokeStatusChanged();
DoSaveImage(baseImage, subFileName, format);
}
@ -133,7 +133,7 @@ namespace NAPS2.ImportExport.Images
{
var fileNameN = fileNamePlaceholders.SubstitutePlaceholders(fileName, dateTime, true, i,
digits);
Status.StatusText = string.Format(MiscResources.Saving, Path.GetFileName(fileNameN));
Status.StatusText = string.Format(MiscResources.SavingFormat, Path.GetFileName(fileNameN));
InvokeStatusChanged();
DoSaveImage(baseImage, fileNameN, format);
}

View File

@ -44,7 +44,7 @@ namespace NAPS2.ImportExport
{
try
{
Status.StatusText = string.Format(MiscResources.Importing, Path.GetFileName(fileName));
Status.StatusText = string.Format(MiscResources.ImportingFormat, Path.GetFileName(fileName));
InvokeStatusChanged();
var images = scannedImageImporter.Import(fileName, (i, j) =>
{

View File

@ -57,7 +57,7 @@ namespace NAPS2.ImportExport.Pdf
var subFileName = fileNamePlaceholders.SubstitutePlaceholders(fileName, dateTime);
Status = new OperationStatus
{
StatusText = string.Format(MiscResources.Saving, Path.GetFileName(subFileName)),
StatusText = string.Format(MiscResources.SavingFormat, Path.GetFileName(subFileName)),
MaxProgress = images.Count
};
cancel = false;

View File

@ -249,6 +249,24 @@ namespace NAPS2.Lang.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Copying....
/// </summary>
internal static string Copying {
get {
return ResourceManager.GetString("Copying", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copy Progress.
/// </summary>
internal static string CopyProgress {
get {
return ResourceManager.GetString("CopyProgress", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Custom ({0}x{1} {2}).
/// </summary>
@ -387,9 +405,9 @@ namespace NAPS2.Lang.Resources {
/// <summary>
/// Looks up a localized string similar to {0} / {1} files.
/// </summary>
internal static string FilesProgress {
internal static string FilesProgressFormat {
get {
return ResourceManager.GetString("FilesProgress", resourceCulture);
return ResourceManager.GetString("FilesProgressFormat", resourceCulture);
}
}
@ -484,7 +502,7 @@ namespace NAPS2.Lang.Resources {
}
/// <summary>
/// Looks up a localized string similar to Importing {0}....
/// Looks up a localized string similar to Importing....
/// </summary>
internal static string Importing {
get {
@ -492,6 +510,15 @@ namespace NAPS2.Lang.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Importing {0}....
/// </summary>
internal static string ImportingFormat {
get {
return ResourceManager.GetString("ImportingFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Import Progress.
/// </summary>
@ -648,9 +675,9 @@ namespace NAPS2.Lang.Resources {
/// <summary>
/// Looks up a localized string similar to {0} / {1}.
/// </summary>
internal static string Progress {
internal static string ProgressFormat {
get {
return ResourceManager.GetString("Progress", resourceCulture);
return ResourceManager.GetString("ProgressFormat", resourceCulture);
}
}
@ -702,9 +729,9 @@ namespace NAPS2.Lang.Resources {
/// <summary>
/// Looks up a localized string similar to Saving {0}....
/// </summary>
internal static string Saving {
internal static string SavingFormat {
get {
return ResourceManager.GetString("Saving", resourceCulture);
return ResourceManager.GetString("SavingFormat", resourceCulture);
}
}

View File

@ -249,7 +249,7 @@
<data name="EstimatedDownloadSize" xml:space="preserve">
<value>Estimated download size: {0} MB</value>
</data>
<data name="FilesProgress" xml:space="preserve">
<data name="FilesProgressFormat" xml:space="preserve">
<value>{0} / {1} files</value>
</data>
<data name="SizeProgress" xml:space="preserve">
@ -339,10 +339,10 @@
<data name="NoDuplexSupport" xml:space="preserve">
<value>The selected scanner does not support using duplex. If your scanner is supposed to support duplex, try using a different driver.</value>
</data>
<data name="Progress" xml:space="preserve">
<data name="ProgressFormat" xml:space="preserve">
<value>{0} / {1}</value>
</data>
<data name="Importing" xml:space="preserve">
<data name="ImportingFormat" xml:space="preserve">
<value>Importing {0}...</value>
</data>
<data name="ImportProgress" xml:space="preserve">
@ -360,7 +360,16 @@
<data name="SavePdfProgress" xml:space="preserve">
<value>Save PDF Progress</value>
</data>
<data name="Saving" xml:space="preserve">
<data name="SavingFormat" xml:space="preserve">
<value>Saving {0}...</value>
</data>
<data name="Copying" xml:space="preserve">
<value>Copying...</value>
</data>
<data name="CopyProgress" xml:space="preserve">
<value>Copy Progress</value>
</data>
<data name="Importing" xml:space="preserve">
<value>Importing...</value>
</data>
</root>

View File

@ -217,6 +217,8 @@ namespace NAPS2.Scan.Images
public PatchCode PatchCode { get; set; }
public ImageFormat FileFormat { get { return baseImageFileFormat; } }
internal RecoveryIndexImage RecoveryIndexImage
{
get

View File

@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using NAPS2.Scan.Images.Transforms;
@ -82,5 +83,10 @@ namespace NAPS2.Scan.Images
/// Gets or sets the patch code associated with the scanned page.
/// </summary>
PatchCode PatchCode { get; set; }
/// <summary>
/// Gets the image's file format.
/// </summary>
ImageFormat FileFormat { get; }
}
}

View File

@ -128,5 +128,10 @@ namespace NAPS2.Scan.Images
}
public PatchCode PatchCode { get; set; }
public ImageFormat FileFormat
{
get { return baseImageFileFormat; }
}
}
}

View File

@ -8,10 +8,6 @@ namespace NAPS2.Scan.Images.Transforms
[Serializable]
public class CropTransform : Transform
{
public CropTransform()
{
}
public int Left { get; set; }
public int Right { get; set; }
public int Top { get; set; }

View File

@ -37,6 +37,7 @@ namespace NAPS2.WinForms
this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
this.btnZoomIn = new System.Windows.Forms.Button();
this.btnZoomOut = new System.Windows.Forms.Button();
this.btnZoomMouseCatcher = new System.Windows.Forms.Button();
this.thumbnailList1 = new NAPS2.WinForms.ThumbnailList();
this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.ctxView = new System.Windows.Forms.ToolStripMenuItem();
@ -101,7 +102,7 @@ namespace NAPS2.WinForms
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();
this.tsAbout = new System.Windows.Forms.ToolStripButton();
this.btnZoomMouseCatcher = new System.Windows.Forms.Button();
this.ctxPaste = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripContainer1.ContentPanel.SuspendLayout();
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
this.toolStripContainer1.SuspendLayout();
@ -144,6 +145,13 @@ namespace NAPS2.WinForms
this.btnZoomOut.UseVisualStyleBackColor = false;
this.btnZoomOut.Click += new System.EventHandler(this.btnZoomOut_Click);
//
// btnZoomMouseCatcher
//
this.btnZoomMouseCatcher.BackColor = System.Drawing.Color.White;
resources.ApplyResources(this.btnZoomMouseCatcher, "btnZoomMouseCatcher");
this.btnZoomMouseCatcher.Name = "btnZoomMouseCatcher";
this.btnZoomMouseCatcher.UseVisualStyleBackColor = false;
//
// thumbnailList1
//
this.thumbnailList1.AllowDrop = true;
@ -170,6 +178,7 @@ namespace NAPS2.WinForms
this.ctxSeparator1,
this.ctxSelectAll,
this.ctxCopy,
this.ctxPaste,
this.ctxSeparator2,
this.ctxDelete});
this.contextMenuStrip.Name = "contextMenuStrip";
@ -643,12 +652,11 @@ namespace NAPS2.WinForms
this.tsAbout.Padding = new System.Windows.Forms.Padding(10, 0, 10, 0);
this.tsAbout.Click += new System.EventHandler(this.tsAbout_Click);
//
// btnZoomMouseCatcher
// ctxPaste
//
this.btnZoomMouseCatcher.BackColor = System.Drawing.Color.White;
resources.ApplyResources(this.btnZoomMouseCatcher, "btnZoomMouseCatcher");
this.btnZoomMouseCatcher.Name = "btnZoomMouseCatcher";
this.btnZoomMouseCatcher.UseVisualStyleBackColor = false;
this.ctxPaste.Name = "ctxPaste";
resources.ApplyResources(this.ctxPaste, "ctxPaste");
this.ctxPaste.Click += new System.EventHandler(this.ctxPaste_Click);
//
// FDesktop
//
@ -739,6 +747,7 @@ namespace NAPS2.WinForms
private System.Windows.Forms.ToolStripSeparator ctxSeparator2;
private System.Windows.Forms.ToolStripMenuItem ctxDelete;
private System.Windows.Forms.Button btnZoomMouseCatcher;
private System.Windows.Forms.ToolStripMenuItem ctxPaste;
}
}

View File

@ -23,6 +23,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
@ -857,12 +858,12 @@ namespace NAPS2.WinForms
}
}
private void ImportDirect(DirectImageTransfer data)
private void ImportDirect(DirectImageTransfer data, bool copy)
{
var op = operationFactory.Create<DirectImportOperation>();
var progressForm = FormFactory.Create<FProgress>();
progressForm.Operation = op;
if (op.Start(data, ReceiveScannedImage))
if (op.Start(data, copy, ReceiveScannedImage))
{
progressForm.ShowDialog();
}
@ -1285,7 +1286,8 @@ namespace NAPS2.WinForms
private void contextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
if (!imageList.Images.Any())
ctxPaste.Enabled = CanPaste;
if (!imageList.Images.Any() && !ctxPaste.Enabled)
{
e.Cancel = true;
}
@ -1306,6 +1308,11 @@ namespace NAPS2.WinForms
CopyImages();
}
private void ctxPaste_Click(object sender, EventArgs e)
{
PasteImages();
}
private void ctxDelete_Click(object sender, EventArgs e)
{
Delete();
@ -1324,6 +1331,29 @@ namespace NAPS2.WinForms
}
}
private void PasteImages()
{
var ido = Clipboard.GetDataObject();
if (ido == null)
{
return;
}
if (ido.GetDataPresent(typeof(DirectImageTransfer).FullName))
{
var data = (DirectImageTransfer)ido.GetData(typeof(DirectImageTransfer).FullName);
ImportDirect(data, true);
}
}
private bool CanPaste
{
get
{
var ido = Clipboard.GetDataObject();
return ido != null && ido.GetDataPresent(typeof (DirectImageTransfer).FullName);
}
}
private static IDataObject GetDataObjectForImages(IEnumerable<IScannedImage> images, bool includeBitmap)
{
var imageList = images.ToList();
@ -1335,20 +1365,20 @@ namespace NAPS2.WinForms
if (includeBitmap)
{
var firstBitmap = imageList[0].GetImage();
var bitmapsExceptFirst = imageList.Select(x => x.GetImage()).Skip(1);
ido.SetData(DataFormats.Bitmap, true, firstBitmap);
const int maxRtfSize = 20 * 1000 * 1000;
var rtfEncodedImages = new StringBuilder();
rtfEncodedImages.Append("{");
rtfEncodedImages.Append(GetRtfEncodedImage(firstBitmap));
foreach (var bitmap in bitmapsExceptFirst)
rtfEncodedImages.Append(GetRtfEncodedImage(firstBitmap, imageList[0].FileFormat));
foreach (var img in imageList.Skip(1))
{
var bitmap = img.GetImage();
if (rtfEncodedImages.Length > maxRtfSize)
{
break;
}
rtfEncodedImages.Append(@"\par");
rtfEncodedImages.Append(GetRtfEncodedImage(bitmap));
rtfEncodedImages.Append(GetRtfEncodedImage(bitmap, img.FileFormat));
bitmap.Dispose();
}
rtfEncodedImages.Append("}");
@ -1358,11 +1388,11 @@ namespace NAPS2.WinForms
return ido;
}
private static string GetRtfEncodedImage(Image image)
private static string GetRtfEncodedImage(Image image, ImageFormat format)
{
using (var stream = new MemoryStream())
{
image.Save(stream, image.RawFormat);
image.Save(stream, format);
string hexString = BitConverter.ToString(stream.ToArray(), 0).Replace("-", string.Empty);
return @"{\pict\pngblip\picw" +
@ -1520,7 +1550,7 @@ namespace NAPS2.WinForms
}
else
{
ImportDirect(data);
ImportDirect(data, false);
}
}
else if (e.Data.GetDataPresent(DataFormats.FileDrop))

View File

@ -243,6 +243,15 @@
<data name="ctxCopy.Text" xml:space="preserve">
<value>Copy</value>
</data>
<data name="ctxPaste.ShortcutKeys" type="System.Windows.Forms.Keys, System.Windows.Forms">
<value>Ctrl+V</value>
</data>
<data name="ctxPaste.Size" type="System.Drawing.Size, System.Drawing">
<value>164, 22</value>
</data>
<data name="ctxPaste.Text" xml:space="preserve">
<value>Paste</value>
</data>
<data name="ctxSeparator2.Size" type="System.Drawing.Size, System.Drawing">
<value>161, 6</value>
</data>
@ -256,7 +265,7 @@
<value>Delete</value>
</data>
<data name="contextMenuStrip.Size" type="System.Drawing.Size, System.Drawing">
<value>165, 104</value>
<value>165, 148</value>
</data>
<data name="&gt;&gt;contextMenuStrip.Name" xml:space="preserve">
<value>contextMenuStrip</value>
@ -280,7 +289,7 @@
<value>thumbnailList1</value>
</data>
<data name="&gt;&gt;thumbnailList1.Type" xml:space="preserve">
<value>NAPS2.WinForms.ThumbnailList, NAPS2.Core, Version=4.4.1.27822, Culture=neutral, PublicKeyToken=null</value>
<value>NAPS2.WinForms.ThumbnailList, NAPS2.Core, Version=4.4.1.40447, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;thumbnailList1.Parent" xml:space="preserve">
<value>toolStripContainer1.ContentPanel</value>
@ -345,6 +354,66 @@
<data name="tStrip.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>None</value>
</data>
<data name="tStrip.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 0</value>
</data>
<data name="tStrip.Size" type="System.Drawing.Size, System.Drawing">
<value>1184, 54</value>
</data>
<data name="tStrip.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="tStrip.Text" xml:space="preserve">
<value>Main toolbar</value>
</data>
<data name="&gt;&gt;tStrip.Name" xml:space="preserve">
<value>tStrip</value>
</data>
<data name="&gt;&gt;tStrip.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tStrip.Parent" xml:space="preserve">
<value>toolStripContainer1.TopToolStripPanel</value>
</data>
<data name="&gt;&gt;tStrip.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;toolStripContainer1.TopToolStripPanel.Name" xml:space="preserve">
<value>toolStripContainer1.TopToolStripPanel</value>
</data>
<data name="&gt;&gt;toolStripContainer1.TopToolStripPanel.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripContainer1.TopToolStripPanel.Parent" xml:space="preserve">
<value>toolStripContainer1</value>
</data>
<data name="&gt;&gt;toolStripContainer1.TopToolStripPanel.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="&gt;&gt;toolStripContainer1.Name" xml:space="preserve">
<value>toolStripContainer1</value>
</data>
<data name="&gt;&gt;toolStripContainer1.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripContainer1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;toolStripContainer1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="tsScan.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsScan.Size" type="System.Drawing.Size, System.Drawing">
<value>58, 51</value>
</data>
<data name="tsScan.Text" xml:space="preserve">
<value>Scan</value>
</data>
<data name="tsScan.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsNewProfile.ImageScaling" type="System.Windows.Forms.ToolStripItemImageScaling, System.Windows.Forms">
<value>None</value>
</data>
@ -363,18 +432,6 @@
<data name="tsBatchScan.Text" xml:space="preserve">
<value>Batch Scan</value>
</data>
<data name="tsScan.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsScan.Size" type="System.Drawing.Size, System.Drawing">
<value>58, 51</value>
</data>
<data name="tsScan.Text" xml:space="preserve">
<value>Scan</value>
</data>
<data name="tsScan.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsProfiles.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -451,6 +508,18 @@
<data name="toolStripSeparator5.Size" type="System.Drawing.Size, System.Drawing">
<value>6, 54</value>
</data>
<data name="tsdSavePDF.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsdSavePDF.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 51</value>
</data>
<data name="tsdSavePDF.Text" xml:space="preserve">
<value>Save PDF</value>
</data>
<data name="tsdSavePDF.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsSavePDFAll.Size" type="System.Drawing.Size, System.Drawing">
<value>143, 22</value>
</data>
@ -472,16 +541,16 @@
<data name="tsPDFSettings.Text" xml:space="preserve">
<value>PDF Settings</value>
</data>
<data name="tsdSavePDF.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<data name="tsdSaveImages.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsdSavePDF.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 51</value>
<data name="tsdSaveImages.Size" type="System.Drawing.Size, System.Drawing">
<value>88, 51</value>
</data>
<data name="tsdSavePDF.Text" xml:space="preserve">
<value>Save PDF</value>
<data name="tsdSaveImages.Text" xml:space="preserve">
<value>Save Images</value>
</data>
<data name="tsdSavePDF.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<data name="tsdSaveImages.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsSaveImagesAll.Size" type="System.Drawing.Size, System.Drawing">
@ -505,16 +574,16 @@
<data name="tsImageSettings.Text" xml:space="preserve">
<value>Image Settings</value>
</data>
<data name="tsdSaveImages.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<data name="tsdEmailPDF.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsdSaveImages.Size" type="System.Drawing.Size, System.Drawing">
<value>88, 51</value>
<data name="tsdEmailPDF.Size" type="System.Drawing.Size, System.Drawing">
<value>76, 51</value>
</data>
<data name="tsdSaveImages.Text" xml:space="preserve">
<value>Save Images</value>
<data name="tsdEmailPDF.Text" xml:space="preserve">
<value>Email PDF</value>
</data>
<data name="tsdSaveImages.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<data name="tsdEmailPDF.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsEmailPDFAll.Size" type="System.Drawing.Size, System.Drawing">
@ -544,18 +613,6 @@
<data name="tsPdfSettings2.Text" xml:space="preserve">
<value>PDF Settings</value>
</data>
<data name="tsdEmailPDF.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsdEmailPDF.Size" type="System.Drawing.Size, System.Drawing">
<value>76, 51</value>
</data>
<data name="tsdEmailPDF.Text" xml:space="preserve">
<value>Email PDF</value>
</data>
<data name="tsdEmailPDF.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsdPrint.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
@ -571,6 +628,18 @@
<data name="toolStripSeparator4.Size" type="System.Drawing.Size, System.Drawing">
<value>6, 54</value>
</data>
<data name="tsdImage.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsdImage.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 51</value>
</data>
<data name="tsdImage.Text" xml:space="preserve">
<value>Image</value>
</data>
<data name="tsdImage.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsView.Size" type="System.Drawing.Size, System.Drawing">
<value>129, 22</value>
</data>
@ -616,16 +685,16 @@
<data name="tsReset.Text" xml:space="preserve">
<value>Reset</value>
</data>
<data name="tsdImage.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<data name="tsdRotate.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsdImage.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 51</value>
<data name="tsdRotate.Size" type="System.Drawing.Size, System.Drawing">
<value>65, 51</value>
</data>
<data name="tsdImage.Text" xml:space="preserve">
<value>Image</value>
<data name="tsdRotate.Text" xml:space="preserve">
<value>Rotate</value>
</data>
<data name="tsdImage.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<data name="tsdRotate.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsRotateLeft.ImageScaling" type="System.Windows.Forms.ToolStripItemImageScaling, System.Windows.Forms">
@ -661,18 +730,6 @@
<data name="customRotationToolStripMenuItem.Text" xml:space="preserve">
<value>Custom Rotation</value>
</data>
<data name="tsdRotate.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsdRotate.Size" type="System.Drawing.Size, System.Drawing">
<value>65, 51</value>
</data>
<data name="tsdRotate.Text" xml:space="preserve">
<value>Rotate</value>
</data>
<data name="tsdRotate.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsMove.Size" type="System.Drawing.Size, System.Drawing">
<value>96, 51</value>
</data>
@ -682,6 +739,18 @@
<data name="tsMove.TextSecond" xml:space="preserve">
<value>Move Down</value>
</data>
<data name="tsdReorder.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsdReorder.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 51</value>
</data>
<data name="tsdReorder.Text" xml:space="preserve">
<value>Reorder</value>
</data>
<data name="tsdReorder.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tsInterleave.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 22</value>
</data>
@ -712,6 +781,12 @@
<data name="toolStripSeparator1.Size" type="System.Drawing.Size, System.Drawing">
<value>187, 6</value>
</data>
<data name="tsReverse.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 22</value>
</data>
<data name="tsReverse.Text" xml:space="preserve">
<value>Reverse</value>
</data>
<data name="tsReverseAll.Size" type="System.Drawing.Size, System.Drawing">
<value>143, 22</value>
</data>
@ -724,24 +799,6 @@
<data name="tsReverseSelected.Text" xml:space="preserve">
<value>Selected ({0})</value>
</data>
<data name="tsReverse.Size" type="System.Drawing.Size, System.Drawing">
<value>190, 22</value>
</data>
<data name="tsReverse.Text" xml:space="preserve">
<value>Reverse</value>
</data>
<data name="tsdReorder.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsdReorder.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 51</value>
</data>
<data name="tsdReorder.Text" xml:space="preserve">
<value>Reorder</value>
</data>
<data name="tsdReorder.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="toolStripSeparator2.Size" type="System.Drawing.Size, System.Drawing">
<value>6, 54</value>
</data>
@ -836,54 +893,6 @@
<data name="tsAbout.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="tStrip.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 0</value>
</data>
<data name="tStrip.Size" type="System.Drawing.Size, System.Drawing">
<value>1184, 54</value>
</data>
<data name="tStrip.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="tStrip.Text" xml:space="preserve">
<value>Main toolbar</value>
</data>
<data name="&gt;&gt;tStrip.Name" xml:space="preserve">
<value>tStrip</value>
</data>
<data name="&gt;&gt;tStrip.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tStrip.Parent" xml:space="preserve">
<value>toolStripContainer1.TopToolStripPanel</value>
</data>
<data name="&gt;&gt;tStrip.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;toolStripContainer1.TopToolStripPanel.Name" xml:space="preserve">
<value>toolStripContainer1.TopToolStripPanel</value>
</data>
<data name="&gt;&gt;toolStripContainer1.TopToolStripPanel.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripContainer1.TopToolStripPanel.Parent" xml:space="preserve">
<value>toolStripContainer1</value>
</data>
<data name="&gt;&gt;toolStripContainer1.TopToolStripPanel.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="&gt;&gt;toolStripContainer1.Name" xml:space="preserve">
<value>toolStripContainer1</value>
</data>
<data name="&gt;&gt;toolStripContainer1.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripContainer1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;toolStripContainer1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -1188,7 +1197,7 @@
<value>tsMove</value>
</data>
<data name="&gt;&gt;tsMove.Type" xml:space="preserve">
<value>NAPS2.WinForms.ToolStripDoubleButton, NAPS2.Core, Version=4.4.1.27822, Culture=neutral, PublicKeyToken=null</value>
<value>NAPS2.WinForms.ToolStripDoubleButton, NAPS2.Core, Version=4.4.1.40447, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;tsdReorder.Name" xml:space="preserve">
<value>tsdReorder</value>
@ -1286,10 +1295,16 @@
<data name="&gt;&gt;tsAbout.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;ctxPaste.Name" xml:space="preserve">
<value>ctxPaste</value>
</data>
<data name="&gt;&gt;ctxPaste.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>FDesktop</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>NAPS2.WinForms.FormBase, NAPS2.Core, Version=4.4.1.27822, Culture=neutral, PublicKeyToken=null</value>
<value>NAPS2.WinForms.FormBase, NAPS2.Core, Version=4.4.1.40447, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

View File

@ -127,7 +127,7 @@ namespace NAPS2.WinForms
private void DisplayProgress()
{
labelTop.Text = string.Format(MiscResources.FilesProgress, filesDownloaded, filesToDownload.Count);
labelTop.Text = string.Format(MiscResources.FilesProgressFormat, filesDownloaded, filesToDownload.Count);
progressBarTop.Maximum = filesToDownload.Count * 1000;
// ReSharper disable once CompareOfFloatsByEqualityOperator
progressBarTop.Value = filesDownloaded * 1000 + (currentFileSize == 0 ? 0 : (int)(currentFileProgress / currentFileSize * 1000));

View File

@ -34,7 +34,6 @@ namespace NAPS2.WinForms
set
{
operation = value;
Text = operation.ProgressTitle;
operation.StatusChanged += operation_StatusChanged;
operation.Error += operation_Error;
operation.Finished += operation_Finished;
@ -74,6 +73,7 @@ namespace NAPS2.WinForms
.Activate();
loaded = true;
Text = operation.ProgressTitle;
DisplayProgress();
if (finished)
@ -99,7 +99,7 @@ namespace NAPS2.WinForms
}
else
{
labelNumber.Text = string.Format(MiscResources.Progress, Operation.Status.CurrentProgress, Operation.Status.MaxProgress);
labelNumber.Text = string.Format(MiscResources.ProgressFormat, Operation.Status.CurrentProgress, Operation.Status.MaxProgress);
progressBar.Style = ProgressBarStyle.Continuous;
progressBar.Value = Operation.Status.CurrentProgress;
progressBar.Maximum = Operation.Status.MaxProgress;