mirror of
https://github.com/cyanfish/naps2.git
synced 2024-10-05 03:47:10 +03:00
Added functionality for appsettings.xml's DefaultProfileSettings.
As part of this change, the ScanSettings/ExtendedScanSettings duality has been removed. ExtendedScanSettings is used everywhere (with a new UseNativeUI property), except for some compatibility code inside ProfileManager. DriverName has also been moved from ScanDevice to ScanSettings.
This commit is contained in:
parent
bd2fe1d171
commit
57217d131e
@ -57,7 +57,7 @@ namespace NAPS2.Console
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
ScanSettings profile;
|
||||
ExtendedScanSettings profile;
|
||||
if (!GetProfile(out profile))
|
||||
{
|
||||
return;
|
||||
@ -163,7 +163,7 @@ namespace NAPS2.Console
|
||||
}
|
||||
}
|
||||
|
||||
private void PerformScan(ScanSettings profile)
|
||||
private void PerformScan(ExtendedScanSettings profile)
|
||||
{
|
||||
if (options.Verbose)
|
||||
{
|
||||
@ -195,7 +195,7 @@ namespace NAPS2.Console
|
||||
}
|
||||
}
|
||||
|
||||
private bool GetProfile(out ScanSettings profile)
|
||||
private bool GetProfile(out ExtendedScanSettings profile)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -39,6 +39,6 @@ namespace NAPS2.Config
|
||||
|
||||
public MessageBoxIcon StartupMessageIcon { get; set; }
|
||||
|
||||
public ScanSettings DefaultScanSettings { get; set; }
|
||||
public ExtendedScanSettings DefaultProfileSettings { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ namespace NAPS2.Config
|
||||
{
|
||||
public class ConfigManager<T> where T : class, new()
|
||||
{
|
||||
private readonly string primaryConfigPath;
|
||||
private readonly string secondaryConfigPath;
|
||||
protected readonly string primaryConfigPath;
|
||||
protected readonly string secondaryConfigPath;
|
||||
|
||||
private readonly Logger logger;
|
||||
|
||||
@ -58,7 +58,7 @@ namespace NAPS2.Config
|
||||
}
|
||||
}
|
||||
|
||||
public void Load()
|
||||
public virtual void Load()
|
||||
{
|
||||
config = null;
|
||||
TryLoadConfig(primaryConfigPath);
|
||||
@ -76,11 +76,17 @@ namespace NAPS2.Config
|
||||
{
|
||||
using (Stream strFile = File.Open(primaryConfigPath, FileMode.Create))
|
||||
{
|
||||
var serializer = new XmlSerializer(typeof(UserConfig));
|
||||
var serializer = new XmlSerializer(typeof(T));
|
||||
serializer.Serialize(strFile, config);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual T Deserialize(Stream configFileStream)
|
||||
{
|
||||
var serializer = new XmlSerializer(typeof(T));
|
||||
return (T)serializer.Deserialize(configFileStream);
|
||||
}
|
||||
|
||||
private void TryLoadConfig(string configPath)
|
||||
{
|
||||
config = null;
|
||||
@ -88,10 +94,9 @@ namespace NAPS2.Config
|
||||
{
|
||||
try
|
||||
{
|
||||
using (Stream strFile = File.OpenRead(configPath))
|
||||
using (Stream configFileStream = File.OpenRead(configPath))
|
||||
{
|
||||
var serializer = new XmlSerializer(typeof (T));
|
||||
config = (T)serializer.Deserialize(strFile);
|
||||
config = Deserialize(configFileStream);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -27,9 +27,9 @@ namespace NAPS2.Config
|
||||
{
|
||||
public interface IProfileManager
|
||||
{
|
||||
List<ScanSettings> Profiles { get; }
|
||||
List<ExtendedScanSettings> Profiles { get; }
|
||||
void Load();
|
||||
void Save();
|
||||
void SetDefault(ScanSettings defaultProfile);
|
||||
void SetDefault(ExtendedScanSettings defaultProfile);
|
||||
}
|
||||
}
|
||||
|
@ -24,22 +24,71 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using NAPS2.Scan;
|
||||
using NAPS2.Scan.Wia;
|
||||
using NLog;
|
||||
|
||||
namespace NAPS2.Config
|
||||
{
|
||||
public class ProfileManager : ConfigManager<List<ScanSettings>>, IProfileManager
|
||||
public class ProfileManager : ConfigManager<List<ExtendedScanSettings>>, IProfileManager
|
||||
{
|
||||
public ProfileManager(Logger logger)
|
||||
: base("profiles.xml", Paths.AppData, Paths.Executable, logger)
|
||||
{
|
||||
}
|
||||
|
||||
public List<ScanSettings> Profiles { get { return Config; } }
|
||||
public List<ExtendedScanSettings> Profiles { get { return Config; } }
|
||||
|
||||
public void SetDefault(ScanSettings defaultProfile)
|
||||
protected override List<ExtendedScanSettings> Deserialize(Stream configFileStream)
|
||||
{
|
||||
foreach (ScanSettings profile in Profiles)
|
||||
var serializer = new XmlSerializer(typeof(List<ExtendedScanSettings>));
|
||||
try
|
||||
{
|
||||
return (List<ExtendedScanSettings>)serializer.Deserialize(configFileStream);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
// Continue, and try to read using the old serializer now
|
||||
configFileStream.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
// For compatibility with profiles.xml from old versions, load ScanSettings instead of ExtendedScanSettings (which is used exclusively now)
|
||||
var deprecatedSerializer = new XmlSerializer(typeof(List<ScanSettings>));
|
||||
var profiles = (List<ScanSettings>)deprecatedSerializer.Deserialize(configFileStream);
|
||||
|
||||
// Okay, we've read the old version of profiles.txt. Since we're going to eventually change it to the new version, make a backup.
|
||||
File.Copy(primaryConfigPath, primaryConfigPath + ".bak", true);
|
||||
|
||||
return profiles.Select(profile =>
|
||||
{
|
||||
if (profile.DriverName == null && profile.Device != null)
|
||||
{
|
||||
// Copy the DriverName to the new property
|
||||
profile.DriverName = profile.Device.DriverName;
|
||||
// This old property is unused, so remove its value
|
||||
profile.Device.DriverName = null;
|
||||
}
|
||||
if (!(profile is ExtendedScanSettings))
|
||||
{
|
||||
// Everything should be ExtendedScanSettings now
|
||||
return new ExtendedScanSettings
|
||||
{
|
||||
Device = profile.Device,
|
||||
DriverName = profile.DriverName,
|
||||
DisplayName = profile.DisplayName,
|
||||
MaxQuality = profile.MaxQuality,
|
||||
IsDefault = profile.IsDefault,
|
||||
IconID = profile.IconID,
|
||||
// If the driver is WIA and the profile type is not Extended, that meant the native UI was to be used
|
||||
UseNativeUI = profile.DriverName == WiaScanDriver.DRIVER_NAME
|
||||
};
|
||||
}
|
||||
return (ExtendedScanSettings)profile;
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public void SetDefault(ExtendedScanSettings defaultProfile)
|
||||
{
|
||||
foreach (ExtendedScanSettings profile in Profiles)
|
||||
{
|
||||
profile.IsDefault = false;
|
||||
}
|
||||
|
@ -318,6 +318,9 @@
|
||||
<EmbeddedResource Include="WinForms\FEditScanSettings.de.resx">
|
||||
<DependentUpon>FEditScanSettings.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="WinForms\FEditScanSettings.en.resx">
|
||||
<DependentUpon>FEditScanSettings.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="WinForms\FEditScanSettings.es.resx">
|
||||
<DependentUpon>FEditScanSettings.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -39,6 +39,8 @@ namespace NAPS2.Scan
|
||||
PaperSource = ScanSource.Glass;
|
||||
}
|
||||
|
||||
public bool UseNativeUI { get; set; }
|
||||
|
||||
public ScanScale AfterScanScale { get; set; }
|
||||
|
||||
public int Brightness { get; set; }
|
||||
|
@ -36,7 +36,7 @@ namespace NAPS2.Scan
|
||||
/// This must be set before calling Scan.
|
||||
/// Some drivers may check for particular implementors and use further information than provided by IScanSettings.
|
||||
/// </summary>
|
||||
ScanSettings ScanSettings { set; }
|
||||
ExtendedScanSettings ScanSettings { set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the parent window used when creating dialogs. This must be set before calling PromptForDevice or Scan.
|
||||
|
@ -27,6 +27,6 @@ namespace NAPS2.Scan
|
||||
{
|
||||
public interface IScanPerformer
|
||||
{
|
||||
void PerformScan(ScanSettings scanSettings, IWin32Window dialogParent, IScanReceiver scanReceiver);
|
||||
void PerformScan(ExtendedScanSettings scanSettings, IWin32Window dialogParent, IScanReceiver scanReceiver);
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,10 @@ namespace NAPS2.Scan
|
||||
{
|
||||
public class ScanDevice
|
||||
{
|
||||
public ScanDevice(string id, string name, string driverName)
|
||||
public ScanDevice(string id, string name)
|
||||
{
|
||||
ID = id;
|
||||
Name = name;
|
||||
DriverName = driverName;
|
||||
}
|
||||
|
||||
public ScanDevice()
|
||||
@ -38,7 +37,12 @@ namespace NAPS2.Scan
|
||||
}
|
||||
|
||||
public string ID { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DEPRECATED! This property only exists for compatibility when reading profiles.xml from an older version.
|
||||
/// </summary>
|
||||
public string DriverName { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -41,9 +41,9 @@ namespace NAPS2.Scan
|
||||
this.errorOutput = errorOutput;
|
||||
}
|
||||
|
||||
public void PerformScan(ScanSettings scanSettings, IWin32Window dialogParent, IScanReceiver scanReceiver)
|
||||
public void PerformScan(ExtendedScanSettings scanSettings, IWin32Window dialogParent, IScanReceiver scanReceiver)
|
||||
{
|
||||
var driver = kernel.Get<IScanDriver>(scanSettings.Device.DriverName);
|
||||
var driver = kernel.Get<IScanDriver>(scanSettings.DriverName);
|
||||
driver.DialogParent = dialogParent;
|
||||
driver.ScanSettings = scanSettings;
|
||||
|
||||
|
@ -30,6 +30,8 @@ namespace NAPS2.Scan
|
||||
{
|
||||
public ScanDevice Device { get; set; }
|
||||
|
||||
public string DriverName { get; set; }
|
||||
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
public int IconID { get; set; }
|
||||
|
@ -37,13 +37,13 @@ namespace NAPS2.Scan.Stub
|
||||
DriverName = driverName;
|
||||
}
|
||||
|
||||
public ScanSettings ScanSettings { get; set; }
|
||||
public ExtendedScanSettings ScanSettings { get; set; }
|
||||
|
||||
public IWin32Window DialogParent { get; set; }
|
||||
|
||||
public ScanDevice PromptForDevice()
|
||||
{
|
||||
return new ScanDevice("test", "Test Scanner", DriverName);
|
||||
return new ScanDevice("test", "Test Scanner");
|
||||
}
|
||||
|
||||
public IEnumerable<IScannedImage> Scan()
|
||||
|
@ -30,10 +30,10 @@ namespace NAPS2.Scan.Twain
|
||||
internal class TwainApi
|
||||
{
|
||||
readonly IWin32Window parent;
|
||||
readonly ScanSettings settings;
|
||||
readonly ExtendedScanSettings settings;
|
||||
readonly Twain tw;
|
||||
|
||||
public TwainApi(ScanSettings settings, IWin32Window pForm)
|
||||
public TwainApi(ExtendedScanSettings settings, IWin32Window pForm)
|
||||
{
|
||||
parent = pForm;
|
||||
tw = new Twain();
|
||||
|
@ -35,7 +35,7 @@ namespace NAPS2.Scan.Twain
|
||||
get { return DRIVER_NAME; }
|
||||
}
|
||||
|
||||
public ScanSettings ScanSettings { get; set; }
|
||||
public ExtendedScanSettings ScanSettings { get; set; }
|
||||
|
||||
public IWin32Window DialogParent { get; set; }
|
||||
|
||||
@ -49,7 +49,7 @@ namespace NAPS2.Scan.Twain
|
||||
{
|
||||
string deviceId = TwainApi.SelectDeviceUI();
|
||||
string deviceName = deviceId;
|
||||
return new ScanDevice(deviceId, deviceName, DRIVER_NAME);
|
||||
return new ScanDevice(deviceId, deviceName);
|
||||
}
|
||||
catch (ScanDriverException)
|
||||
{
|
||||
|
@ -57,13 +57,11 @@ namespace NAPS2.Scan.Wia
|
||||
|
||||
private readonly Device device;
|
||||
|
||||
private readonly ScanSettings settings;
|
||||
private readonly ExtendedScanSettings settingsExt;
|
||||
private readonly ExtendedScanSettings settings;
|
||||
|
||||
public WiaApi(ScanSettings settings)
|
||||
public WiaApi(ExtendedScanSettings settings)
|
||||
{
|
||||
this.settings = settings;
|
||||
settingsExt = settings as ExtendedScanSettings;
|
||||
DeviceManager manager = new DeviceManagerClass();
|
||||
foreach (DeviceInfo info in manager.DeviceInfos)
|
||||
{
|
||||
@ -102,7 +100,7 @@ namespace NAPS2.Scan.Wia
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ScanDevice(d.DeviceID, GetDeviceName(d.DeviceID), WiaScanDriver.DRIVER_NAME);
|
||||
return new ScanDevice(d.DeviceID, GetDeviceName(d.DeviceID));
|
||||
}
|
||||
catch (COMException e)
|
||||
{
|
||||
@ -221,7 +219,7 @@ namespace NAPS2.Scan.Wia
|
||||
private void SetupItem(Item item)
|
||||
{
|
||||
int resolution = 0;
|
||||
switch (settingsExt.BitDepth)
|
||||
switch (settings.BitDepth)
|
||||
{
|
||||
case ScanBitDepth.Grayscale:
|
||||
SetItemIntProperty(item, 2, DATA_TYPE);
|
||||
@ -234,7 +232,7 @@ namespace NAPS2.Scan.Wia
|
||||
break;
|
||||
}
|
||||
|
||||
switch (settingsExt.Resolution)
|
||||
switch (settings.Resolution)
|
||||
{
|
||||
case ScanDpi.Dpi100:
|
||||
SetItemIntProperty(item, 100, VERTICAL_RESOLUTION);
|
||||
@ -263,20 +261,20 @@ namespace NAPS2.Scan.Wia
|
||||
break;
|
||||
}
|
||||
|
||||
Size pageSize = settingsExt.PageSize.ToSize();
|
||||
Size pageSize = settings.PageSize.ToSize();
|
||||
int pageWidth = pageSize.Width * resolution / 1000;
|
||||
int pageHeight = pageSize.Height * resolution / 1000;
|
||||
int horizontalSize = GetDeviceIntProperty(settingsExt.PaperSource == ScanSource.Glass ? HORIZONTAL_BED_SIZE : HORIZONTAL_FEED_SIZE);
|
||||
int horizontalSize = GetDeviceIntProperty(settings.PaperSource == ScanSource.Glass ? HORIZONTAL_BED_SIZE : HORIZONTAL_FEED_SIZE);
|
||||
|
||||
int verticalSize = GetDeviceIntProperty(settingsExt.PaperSource == ScanSource.Glass ? VERTICAL_BED_SIZE : VERTICAL_FEED_SIZE);
|
||||
int verticalSize = GetDeviceIntProperty(settings.PaperSource == ScanSource.Glass ? VERTICAL_BED_SIZE : VERTICAL_FEED_SIZE);
|
||||
|
||||
int pagemaxwidth = horizontalSize * resolution / 1000;
|
||||
int pagemaxheight = verticalSize * resolution / 1000;
|
||||
|
||||
int horizontalPos = 0;
|
||||
if (settingsExt.PageAlign == ScanHorizontalAlign.Center)
|
||||
if (settings.PageAlign == ScanHorizontalAlign.Center)
|
||||
horizontalPos = (pagemaxwidth - pageWidth) / 2;
|
||||
else if (settingsExt.PageAlign == ScanHorizontalAlign.Left)
|
||||
else if (settings.PageAlign == ScanHorizontalAlign.Left)
|
||||
horizontalPos = (pagemaxwidth - pageWidth);
|
||||
|
||||
pageWidth = pageWidth < pagemaxwidth ? pageWidth : pagemaxwidth;
|
||||
@ -285,13 +283,13 @@ namespace NAPS2.Scan.Wia
|
||||
SetItemIntProperty(item, pageWidth, HORIZONTAL_EXTENT);
|
||||
SetItemIntProperty(item, pageHeight, VERTICAL_EXTENT);
|
||||
SetItemIntProperty(item, horizontalPos, HORIZONTAL_START);
|
||||
SetItemIntProperty(item, settingsExt.Contrast, -1000, 1000, CONTRAST);
|
||||
SetItemIntProperty(item, settingsExt.Brightness, -1000, 1000, BRIGHTNESS);
|
||||
SetItemIntProperty(item, settings.Contrast, -1000, 1000, CONTRAST);
|
||||
SetItemIntProperty(item, settings.Brightness, -1000, 1000, BRIGHTNESS);
|
||||
}
|
||||
|
||||
private void SetupDevice()
|
||||
{
|
||||
switch (settingsExt.PaperSource)
|
||||
switch (settings.PaperSource)
|
||||
{
|
||||
case ScanSource.Glass:
|
||||
SetDeviceIntProperty(2, PAPER_SOURCE);
|
||||
@ -338,7 +336,7 @@ namespace NAPS2.Scan.Wia
|
||||
var wiaCommonDialog = new CommonDialogClass();
|
||||
|
||||
Items items = device.Items;
|
||||
if (settingsExt == null)
|
||||
if (settings.UseNativeUI)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -347,7 +345,7 @@ namespace NAPS2.Scan.Wia
|
||||
}
|
||||
catch (COMException e)
|
||||
{
|
||||
if ((uint) e.ErrorCode == UI_CANCELED)
|
||||
if ((uint)e.ErrorCode == UI_CANCELED)
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -357,23 +355,23 @@ namespace NAPS2.Scan.Wia
|
||||
SetupItem(items[1]);
|
||||
}
|
||||
var file =
|
||||
(ImageFile) wiaCommonDialog.ShowTransfer(items[1], "{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}", false);
|
||||
(ImageFile)wiaCommonDialog.ShowTransfer(items[1], "{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}", false);
|
||||
if (file == null)
|
||||
{
|
||||
// User cancelled
|
||||
return null;
|
||||
}
|
||||
|
||||
using (var stream = new MemoryStream((byte[]) file.FileData.get_BinaryData()))
|
||||
using (var stream = new MemoryStream((byte[])file.FileData.get_BinaryData()))
|
||||
{
|
||||
using (Image output = Image.FromStream(stream))
|
||||
{
|
||||
|
||||
double koef = 1;
|
||||
|
||||
if (settingsExt != null)
|
||||
if (!settings.UseNativeUI)
|
||||
{
|
||||
switch (settingsExt.AfterScanScale)
|
||||
switch (settings.AfterScanScale)
|
||||
{
|
||||
case ScanScale.OneToOne:
|
||||
koef = 1;
|
||||
@ -390,21 +388,21 @@ namespace NAPS2.Scan.Wia
|
||||
}
|
||||
}
|
||||
|
||||
double realWidth = output.Width/koef;
|
||||
double realHeight = output.Height/koef;
|
||||
double realWidth = output.Width / koef;
|
||||
double realHeight = output.Height / koef;
|
||||
|
||||
double horizontalRes = output.HorizontalResolution/koef;
|
||||
double verticalRes = output.VerticalResolution/koef;
|
||||
double horizontalRes = output.HorizontalResolution / koef;
|
||||
double verticalRes = output.VerticalResolution / koef;
|
||||
|
||||
using (var result = new Bitmap((int) realWidth, (int) realHeight))
|
||||
using (var result = new Bitmap((int)realWidth, (int)realHeight))
|
||||
using (Graphics g = Graphics.FromImage(result))
|
||||
{
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.DrawImage(output, 0, 0, (int) realWidth, (int) realHeight);
|
||||
g.DrawImage(output, 0, 0, (int)realWidth, (int)realHeight);
|
||||
|
||||
result.SetResolution((float) horizontalRes, (float) verticalRes);
|
||||
result.SetResolution((float)horizontalRes, (float)verticalRes);
|
||||
|
||||
ScanBitDepth bitDepth = settingsExt != null ? settingsExt.BitDepth : ScanBitDepth.C24Bit;
|
||||
ScanBitDepth bitDepth = settings.UseNativeUI ? ScanBitDepth.C24Bit : settings.BitDepth;
|
||||
return new ScannedImage(result, bitDepth, settings.MaxQuality);
|
||||
}
|
||||
}
|
||||
@ -412,11 +410,11 @@ namespace NAPS2.Scan.Wia
|
||||
}
|
||||
catch (COMException e)
|
||||
{
|
||||
if ((uint) e.ErrorCode == ERROR_OUT_OF_PAPER)
|
||||
if ((uint)e.ErrorCode == ERROR_OUT_OF_PAPER)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if ((uint) e.ErrorCode == ERROR_OFFLINE)
|
||||
else if ((uint)e.ErrorCode == ERROR_OFFLINE)
|
||||
{
|
||||
throw new DeviceOfflineException();
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ namespace NAPS2.Scan.Wia
|
||||
get { return DRIVER_NAME; }
|
||||
}
|
||||
|
||||
public ScanSettings ScanSettings { get; set; }
|
||||
public ExtendedScanSettings ScanSettings { get; set; }
|
||||
|
||||
public IWin32Window DialogParent { get; set; }
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace NAPS2.WinForms
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private ScanSettings SelectedProfile
|
||||
private ExtendedScanSettings SelectedProfile
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -64,7 +64,7 @@ namespace NAPS2.WinForms
|
||||
private void UpdateProfiles()
|
||||
{
|
||||
lvProfiles.Items.Clear();
|
||||
foreach (ScanSettings profile in profileManager.Profiles)
|
||||
foreach (var profile in profileManager.Profiles)
|
||||
{
|
||||
lvProfiles.Items.Add(profile.DisplayName, profile.IconID);
|
||||
if (profile.IsDefault)
|
||||
|
16
NAPS2/WinForms/FEditScanSettings.Designer.cs
generated
16
NAPS2/WinForms/FEditScanSettings.Designer.cs
generated
@ -100,9 +100,9 @@ namespace NAPS2.WinForms
|
||||
//
|
||||
// cmbSource
|
||||
//
|
||||
resources.ApplyResources(this.cmbSource, "cmbSource");
|
||||
this.cmbSource.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbSource.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.cmbSource, "cmbSource");
|
||||
this.cmbSource.Name = "cmbSource";
|
||||
//
|
||||
// btnOK
|
||||
@ -114,9 +114,9 @@ namespace NAPS2.WinForms
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
resources.ApplyResources(this.panel1, "panel1");
|
||||
this.panel1.Controls.Add(this.rdbConfig);
|
||||
this.panel1.Controls.Add(this.rdbNativeWIA);
|
||||
resources.ApplyResources(this.panel1, "panel1");
|
||||
this.panel1.Name = "panel1";
|
||||
//
|
||||
// rdbConfig
|
||||
@ -142,8 +142,8 @@ namespace NAPS2.WinForms
|
||||
//
|
||||
// cmbDepth
|
||||
//
|
||||
resources.ApplyResources(this.cmbDepth, "cmbDepth");
|
||||
this.cmbDepth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
resources.ApplyResources(this.cmbDepth, "cmbDepth");
|
||||
this.cmbDepth.FormattingEnabled = true;
|
||||
this.cmbDepth.Name = "cmbDepth";
|
||||
//
|
||||
@ -154,15 +154,15 @@ namespace NAPS2.WinForms
|
||||
//
|
||||
// cmbPage
|
||||
//
|
||||
resources.ApplyResources(this.cmbPage, "cmbPage");
|
||||
this.cmbPage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
resources.ApplyResources(this.cmbPage, "cmbPage");
|
||||
this.cmbPage.FormattingEnabled = true;
|
||||
this.cmbPage.Name = "cmbPage";
|
||||
//
|
||||
// cmbResolution
|
||||
//
|
||||
resources.ApplyResources(this.cmbResolution, "cmbResolution");
|
||||
this.cmbResolution.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
resources.ApplyResources(this.cmbResolution, "cmbResolution");
|
||||
this.cmbResolution.FormattingEnabled = true;
|
||||
this.cmbResolution.Name = "cmbResolution";
|
||||
//
|
||||
@ -225,8 +225,8 @@ namespace NAPS2.WinForms
|
||||
//
|
||||
// cmbAlign
|
||||
//
|
||||
resources.ApplyResources(this.cmbAlign, "cmbAlign");
|
||||
this.cmbAlign.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
resources.ApplyResources(this.cmbAlign, "cmbAlign");
|
||||
this.cmbAlign.FormattingEnabled = true;
|
||||
this.cmbAlign.Name = "cmbAlign";
|
||||
//
|
||||
@ -237,8 +237,8 @@ namespace NAPS2.WinForms
|
||||
//
|
||||
// cmbScale
|
||||
//
|
||||
resources.ApplyResources(this.cmbScale, "cmbScale");
|
||||
this.cmbScale.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
resources.ApplyResources(this.cmbScale, "cmbScale");
|
||||
this.cmbScale.FormattingEnabled = true;
|
||||
this.cmbScale.Name = "cmbScale";
|
||||
//
|
||||
@ -249,9 +249,9 @@ namespace NAPS2.WinForms
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
resources.ApplyResources(this.panel2, "panel2");
|
||||
this.panel2.Controls.Add(this.rdTWAIN);
|
||||
this.panel2.Controls.Add(this.rdWIA);
|
||||
resources.ApplyResources(this.panel2, "panel2");
|
||||
this.panel2.Name = "panel2";
|
||||
//
|
||||
// rdTWAIN
|
||||
|
@ -29,6 +29,7 @@ using NAPS2.Scan.Twain;
|
||||
using NAPS2.Scan.Wia;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using WIA;
|
||||
|
||||
namespace NAPS2.WinForms
|
||||
{
|
||||
@ -62,7 +63,7 @@ namespace NAPS2.WinForms
|
||||
get { return result; }
|
||||
}
|
||||
|
||||
public ScanSettings ScanSettings { get; set; }
|
||||
public ExtendedScanSettings ScanSettings { get; set; }
|
||||
|
||||
private string DeviceDriverName
|
||||
{
|
||||
@ -107,7 +108,7 @@ namespace NAPS2.WinForms
|
||||
e.Value = ((Enum)e.ListItem).Description();
|
||||
}
|
||||
|
||||
private void choose(string driverName)
|
||||
private void ChooseDevice(string driverName)
|
||||
{
|
||||
var driver = KernelManager.Kernel.Get<IScanDriver>(driverName);
|
||||
try
|
||||
@ -136,40 +137,29 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void btnChooseDevice_Click(object sender, EventArgs e)
|
||||
{
|
||||
choose(DeviceDriverName);
|
||||
ChooseDevice(DeviceDriverName);
|
||||
}
|
||||
|
||||
private void saveSettings()
|
||||
private void SaveSettings()
|
||||
{
|
||||
if (rdbNativeWIA.Checked)
|
||||
ScanSettings = new ExtendedScanSettings
|
||||
{
|
||||
ScanSettings = new ScanSettings
|
||||
{
|
||||
Device = CurrentDevice,
|
||||
DisplayName = txtName.Text,
|
||||
IconID = iconID,
|
||||
MaxQuality = cbHighQuality.Checked
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanSettings = new ExtendedScanSettings
|
||||
{
|
||||
Device = CurrentDevice,
|
||||
DisplayName = txtName.Text,
|
||||
IconID = iconID,
|
||||
MaxQuality = cbHighQuality.Checked,
|
||||
Device = CurrentDevice,
|
||||
DriverName = DeviceDriverName,
|
||||
DisplayName = txtName.Text,
|
||||
IconID = iconID,
|
||||
MaxQuality = cbHighQuality.Checked,
|
||||
UseNativeUI = rdbNativeWIA.Checked,
|
||||
|
||||
AfterScanScale = (ScanScale)cmbScale.SelectedIndex,
|
||||
BitDepth = (ScanBitDepth)cmbDepth.SelectedIndex,
|
||||
Brightness = trBrightness.Value,
|
||||
Contrast = trContrast.Value,
|
||||
PageAlign = (ScanHorizontalAlign)cmbAlign.SelectedIndex,
|
||||
PageSize = (ScanPageSize)cmbPage.SelectedIndex,
|
||||
Resolution = (ScanDpi)cmbResolution.SelectedIndex,
|
||||
PaperSource = (ScanSource)cmbSource.SelectedIndex
|
||||
};
|
||||
}
|
||||
AfterScanScale = (ScanScale)cmbScale.SelectedIndex,
|
||||
BitDepth = (ScanBitDepth)cmbDepth.SelectedIndex,
|
||||
Brightness = trBrightness.Value,
|
||||
Contrast = trContrast.Value,
|
||||
PageAlign = (ScanHorizontalAlign)cmbAlign.SelectedIndex,
|
||||
PageSize = (ScanPageSize)cmbPage.SelectedIndex,
|
||||
Resolution = (ScanDpi)cmbResolution.SelectedIndex,
|
||||
PaperSource = (ScanSource)cmbSource.SelectedIndex
|
||||
};
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
@ -186,7 +176,7 @@ namespace NAPS2.WinForms
|
||||
return;
|
||||
}
|
||||
result = true;
|
||||
saveSettings();
|
||||
SaveSettings();
|
||||
Close();
|
||||
}
|
||||
|
||||
@ -230,42 +220,33 @@ namespace NAPS2.WinForms
|
||||
|
||||
private void FEditScanSettings_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Don't trigger any onChange events
|
||||
suppressChangeEvent = true;
|
||||
|
||||
pctIcon.Image = ilProfileIcons.IconsList.Images[ScanSettings.IconID];
|
||||
txtName.Text = ScanSettings.DisplayName;
|
||||
CurrentDevice = ScanSettings.Device;
|
||||
iconID = ScanSettings.IconID;
|
||||
|
||||
var scanSettingsExt = ScanSettings as ExtendedScanSettings;
|
||||
|
||||
if (scanSettingsExt != null)
|
||||
{
|
||||
cmbSource.SelectedIndex = (int)scanSettingsExt.PaperSource;
|
||||
cmbDepth.SelectedIndex = (int)scanSettingsExt.BitDepth;
|
||||
cmbResolution.SelectedIndex = (int)scanSettingsExt.Resolution;
|
||||
txtContrast.Text = scanSettingsExt.Contrast.ToString("G");
|
||||
txtBrightness.Text = scanSettingsExt.Brightness.ToString("G");
|
||||
cmbPage.SelectedIndex = (int)scanSettingsExt.PageSize;
|
||||
cmbScale.SelectedIndex = (int)scanSettingsExt.AfterScanScale;
|
||||
cmbAlign.SelectedIndex = (int)scanSettingsExt.PageAlign;
|
||||
}
|
||||
cmbSource.SelectedIndex = (int)ScanSettings.PaperSource;
|
||||
cmbDepth.SelectedIndex = (int)ScanSettings.BitDepth;
|
||||
cmbResolution.SelectedIndex = (int)ScanSettings.Resolution;
|
||||
txtContrast.Text = ScanSettings.Contrast.ToString("G");
|
||||
txtBrightness.Text = ScanSettings.Brightness.ToString("G");
|
||||
cmbPage.SelectedIndex = (int)ScanSettings.PageSize;
|
||||
cmbScale.SelectedIndex = (int)ScanSettings.AfterScanScale;
|
||||
cmbAlign.SelectedIndex = (int)ScanSettings.PageAlign;
|
||||
|
||||
cbHighQuality.Checked = ScanSettings.MaxQuality;
|
||||
|
||||
if (CurrentDevice == null || CurrentDevice.DriverName != TwainScanDriver.DRIVER_NAME)
|
||||
{
|
||||
suppressChangeEvent = true;
|
||||
rdWIA.Checked = true;
|
||||
suppressChangeEvent = false;
|
||||
if (scanSettingsExt == null)
|
||||
rdbNativeWIA.Checked = true;
|
||||
else
|
||||
rdbConfig.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdTWAIN.Checked = true;
|
||||
rdbNativeWIA.Checked = true;
|
||||
}
|
||||
// The setter updates the driver selection checkboxes
|
||||
DeviceDriverName = ScanSettings.DriverName;
|
||||
|
||||
rdbNativeWIA.Checked = ScanSettings.UseNativeUI;
|
||||
rdbConfig.Checked = !ScanSettings.UseNativeUI;
|
||||
|
||||
// Start triggering onChange events again
|
||||
suppressChangeEvent = false;
|
||||
|
||||
UpdateEnabledControls();
|
||||
}
|
||||
|
205
NAPS2/WinForms/FEditScanSettings.en.resx
Normal file
205
NAPS2/WinForms/FEditScanSettings.en.resx
Normal file
@ -0,0 +1,205 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="pctIcon.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
|
||||
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAMdElEQVRoQ8VaeVDV1xW2sZppm6mxMU1T
|
||||
Y2K0M4lpTZo/ohkm6rhHnTTOmOqoE01GJzGTZoglU6NmXFFiXVFQkE1wjRuoaAwIIvDg8eA99l32Hdke
|
||||
8HjwePD1O/f3yKA1KQ9Jema+efyWe8537jn33OXHsKGQ/fv3f3z06NHbROThw4cjPD09Iw4cOBCxd+/e
|
||||
iD179kTs3r07wt3dPWLHjh2RW7Zsuf3GG2+scDT9/8vChQsX5efnW0Gx2+33obu7+78gcvv2bfvLL7+8
|
||||
2qHip5WDBw/+bdeuXb4bNmwI/OKLLwLc3NwC1q9fH+Dq6uq/bt06/0OHDlX09vYqYs7Itm3bKl1cXE4s
|
||||
WLDAf/78+QFz584NmDVrVsDMmTODpk6deuTFF1+cRvO/0FgMTkaSeEB6enpPS0sLfggdHR0OSs5JV1cX
|
||||
zGbzfbqam5vVb1NTE3Q6HejMMQcX52XSpEmzExISHOZ+XHp6epzGQOTatWuW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EWn9VWM3ABEHpAYP9EME2Fm9sgx2QJbED6L/c4G0GYjI
|
||||
Ucvq1auLSWvgG31uYjxkVyRRkKOOvk8/ZvPD0bfccEYslnbqbO6nxwxrewfMTWa0m9thbjFD5iHh4LQD
|
||||
Li4uHnLQJGeixcXFPwqJlBzGOiOyv5ajFGnbp6ekuAQ3km7gnOEcwpPDkV+Qj/KyclRVVWHVqlXOOyBf
|
||||
Z+SsRoz8LwiBgToh5KVj5JNSX/vK0kpcir2ENdFr4FnniY9MH2F3+G7UV9SjvLwc77//vnMOcB3uIec/
|
||||
olzq8P+CHPrKb01NjUq19vZ2dRgsJVCO5WVJIA5KSgjxvvf7UFlcCd9vffHMrWcwPns8ht0aBtcwV9SX
|
||||
1qOkhGV85UrnHTCZTOqkTMbCQCFpJx9CcnNz1bUQ7Xsm9/o/64+C/ALkZOVg6ZmleCHmBUy9NhUxhhgU
|
||||
F2op6rQDU6ZMcU9MTFTKs7Kyfhbk5uQiOz0b12OvIy4pDnk5WodIhLguSyWtgZfRsWPHLuReoFPCLWMh
|
||||
IyPjRyHvDAWys7KRl52HnOwcdS0RlG9mEydOlNPqFzR2A5PHGAXPyMhIFXLpiR/Cw3pT8CC5/nhYJzwI
|
||||
0SFfhNj78rHjH8RvFDMnZBw9Pzhv3rxEKjEtWrTI2IeFCxcqLFiwQOHtt99W4Lv3Ye7cucY5c+Z8j9mz
|
||||
Zxtnzpw5IMyYMcNE+3JS/RUxQTEahIwmphKziVk/M8SmC/EH4gf+6WPYsP8Ahkhq0SUlWhYAAAAASUVO
|
||||
RK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAFxcXPldXV6RYWFilV1dXpFZWVqRUVFSkVFRUpFRUVKRSUlKkUlJSpFRSVKRcVlymRkRGnQAA
|
||||
AC8AAAAAAAAAAI2NjcHm5ub/3t7e/97e3v/d3d3/3d3d/9/f3//f39//3Nzc/93c3f/Y2tj/pNKk/8rY
|
||||
yv9KSEqZAAAAAAAAAAChoaHN5+jo/+Hj5f/g4uT/6Orr//n6/P/+/////f////T29//l5un/097X/2vO
|
||||
bv+63Lr/ZWBlpAAAAAAAAAAAsLCwzf36+P/l1s//49TM/+ja0v/s39j/697Z/+ve2P/r3tf/5tjQ/+PU
|
||||
zP/t3t3//////2NjY6IAAAAAAAAAAKKjprLx18H/7MGL//XWpP/44rb/+enD//nt0f/568z/+ea7//bc
|
||||
rf/00Zz/57uL//Hl4P9KTE6DAAAAAAAAAABnaW1z8NfD//LIj//74bX//uvH///xzf//8MT//+2+//3n
|
||||
t//63qr/+NOZ/+q8i//a09D+ExYWQgAAAAAAAAAAMDQ0PuXXzv3uyJ3//ObF//zoyv/87ND//OvL//rg
|
||||
sv/316H/9s+W//PEhf/txZ//s7K03gAAABAAAAAAAAAAAAAPDxHOysjl5byb//zkw//75sn/++fM//vp
|
||||
z//758n/+N20//bTpP/uv4v/7s+2/4eKjLAAAAAAAAAAAAAAAAAAAAAAmpueqe7Lr//217P/++TI//vl
|
||||
yf/75sr/++bK//vlyv/85cr/7cSe/+nVyv9RU1V/AAAAAAAAAAAAAAAAAAAAAFhbXV7s3tX/5MOq/+fN
|
||||
t//nzrj/5865/+fOuP/nzbf/58y1/+XHsP/NysjtExMTMQAAAAAAAAAAAAAAAAAAAAAREREsu7y987Gx
|
||||
s/+kpKX/paWm/6Wlpv+lpab/paWm/6SjpP/Lzc//cnJzvAAAAAEAAAAAAAAAAAAAAAAAAAAAV1dXfNDQ
|
||||
0P+JiYr/iYmK/4qKi/+Kiov/ioqL/4qKi/+Hh4j/pqam/7e3t/YEBAQ4AAAAAAAAAAAAAAAAAAAAELCw
|
||||
sNm3t7f/mpqa/56env+enp7/np6e/56env+enp7/np6e/5qamv/S0tL/SUlJkwAAAAAAAAAAAAAAADo6
|
||||
Olb09PT/ra2t/6mpqf+oqKj/p6en/6enp/+np6f/p6en/6qqqv+lpaX/2dnZ/6qqqt8AAAAXAAAAAAAA
|
||||
AABLS0tT8/Pz/O7u7vzn5+f69PT0//j4+P/39/f/+Pj4//r6+v/s7Oz95OTk+vj4+P+enp7JAAAADQAA
|
||||
AAAAAAAAAAAAAZKSkiaNjY00c3NzMKampqHi4uLl2dnZ3tnZ2eDKysrbS0tLYUhISC1KSkozDQ0NEwAA
|
||||
AAAAAAAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIADAADAAwAAwAMAAMADAADAAwAAgAMAAIAB
|
||||
AACAAQAAgAMAAA==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
File diff suppressed because it is too large
Load Diff
@ -32,10 +32,12 @@ namespace NAPS2.WinForms
|
||||
public partial class FManageProfiles : Form
|
||||
{
|
||||
private readonly IProfileManager profileManager;
|
||||
private readonly AppConfigManager appConfigManager;
|
||||
|
||||
public FManageProfiles(IProfileManager profileManager)
|
||||
public FManageProfiles(IProfileManager profileManager, AppConfigManager appConfigManager)
|
||||
{
|
||||
this.profileManager = profileManager;
|
||||
this.appConfigManager = appConfigManager;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@ -47,7 +49,7 @@ namespace NAPS2.WinForms
|
||||
private void loadList()
|
||||
{
|
||||
lvProfiles.Items.Clear();
|
||||
foreach (ScanSettings profile in profileManager.Profiles)
|
||||
foreach (var profile in profileManager.Profiles)
|
||||
{
|
||||
lvProfiles.Items.Add(profile.DisplayName, profile.IconID);
|
||||
}
|
||||
@ -57,7 +59,7 @@ namespace NAPS2.WinForms
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var fedit = KernelManager.Kernel.Get<FEditScanSettings>();
|
||||
fedit.ScanSettings = new ExtendedScanSettings();
|
||||
fedit.ScanSettings = appConfigManager.Config.DefaultProfileSettings ?? new ExtendedScanSettings();
|
||||
fedit.ShowDialog();
|
||||
if (fedit.Result)
|
||||
{
|
||||
|
@ -33,12 +33,12 @@ namespace NAPS2.WinForms
|
||||
internal partial class FTwainGui : Form, IMessageFilter
|
||||
{
|
||||
private readonly List<IScannedImage> bitmaps;
|
||||
private readonly ScanSettings settings;
|
||||
private readonly ExtendedScanSettings settings;
|
||||
private bool activated;
|
||||
private bool msgfilter;
|
||||
private Twain tw;
|
||||
|
||||
public FTwainGui(ScanSettings settings)
|
||||
public FTwainGui(ExtendedScanSettings settings)
|
||||
{
|
||||
InitializeComponent();
|
||||
bitmaps = new List<IScannedImage>();
|
||||
|
@ -1,24 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<AppConfig>
|
||||
<AppConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<DefaultCulture></DefaultCulture>
|
||||
<StartupMessageTitle></StartupMessageTitle>
|
||||
<StartupMessageText></StartupMessageText>
|
||||
<StartupMessageIcon>Information</StartupMessageIcon>
|
||||
<DefaultScanSettings>
|
||||
<ExtendedScanSettings>
|
||||
<Device>
|
||||
<DriverName>wia</DriverName>
|
||||
</Device>
|
||||
<IconID>0</IconID>
|
||||
<MaxQuality>false</MaxQuality>
|
||||
<AfterScanScale>OneToOne</AfterScanScale>
|
||||
<Brightness>0</Brightness>
|
||||
<Contrast>0</Contrast>
|
||||
<BitDepth>C24Bit</BitDepth>
|
||||
<PageAlign>Left</PageAlign>
|
||||
<PageSize>Letter</PageSize>
|
||||
<Resolution>Dpi100</Resolution>
|
||||
<PaperSource>Glass</PaperSource>
|
||||
</ExtendedScanSettings>
|
||||
</DefaultScanSettings>
|
||||
<DefaultProfileSettings xsi:type="ExtendedScanSettings">
|
||||
<DriverName>wia</DriverName>
|
||||
<UseNativeUI>false</UseNativeUI>
|
||||
<IconID>0</IconID>
|
||||
<MaxQuality>false</MaxQuality>
|
||||
<AfterScanScale>OneToOne</AfterScanScale>
|
||||
<Brightness>0</Brightness>
|
||||
<Contrast>0</Contrast>
|
||||
<BitDepth>C24Bit</BitDepth>
|
||||
<PageAlign>Left</PageAlign>
|
||||
<PageSize>Letter</PageSize>
|
||||
<Resolution>Dpi100</Resolution>
|
||||
<PaperSource>Glass</PaperSource>
|
||||
</DefaultProfileSettings>
|
||||
</AppConfig>
|
||||
|
Loading…
Reference in New Issue
Block a user