Localized scan settings enum values.

This commit is contained in:
Ben Olden-Cooligan 2013-07-09 17:49:13 -04:00
parent 85b770e3ef
commit 1944aca36c
5 changed files with 523 additions and 27 deletions

View File

@ -0,0 +1,270 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18046
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace NAPS2.Lang.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class SettingsResources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal SettingsResources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NAPS2.Lang.Resources.SettingsResources", typeof(SettingsResources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Black &amp; White.
/// </summary>
internal static string BitDepth_1BlackAndWhite {
get {
return ResourceManager.GetString("BitDepth_1BlackAndWhite", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 24-bit Color.
/// </summary>
internal static string BitDepth_24Color {
get {
return ResourceManager.GetString("BitDepth_24Color", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Grayscale.
/// </summary>
internal static string BitDepth_8Grayscale {
get {
return ResourceManager.GetString("BitDepth_8Grayscale", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 100 dpi.
/// </summary>
internal static string Dpi_100 {
get {
return ResourceManager.GetString("Dpi_100", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 1200 dpi.
/// </summary>
internal static string Dpi_1200 {
get {
return ResourceManager.GetString("Dpi_1200", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 200 dpi.
/// </summary>
internal static string Dpi_200 {
get {
return ResourceManager.GetString("Dpi_200", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 300 dpi.
/// </summary>
internal static string Dpi_300 {
get {
return ResourceManager.GetString("Dpi_300", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 600 dpi.
/// </summary>
internal static string Dpi_600 {
get {
return ResourceManager.GetString("Dpi_600", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Center.
/// </summary>
internal static string HorizontalAlign_Center {
get {
return ResourceManager.GetString("HorizontalAlign_Center", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Left.
/// </summary>
internal static string HorizontalAlign_Left {
get {
return ResourceManager.GetString("HorizontalAlign_Left", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Right.
/// </summary>
internal static string HorizontalAlign_Right {
get {
return ResourceManager.GetString("HorizontalAlign_Right", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A3 (297x420 mm).
/// </summary>
internal static string PageSize_A3 {
get {
return ResourceManager.GetString("PageSize_A3", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A4 (210x297 mm).
/// </summary>
internal static string PageSize_A4 {
get {
return ResourceManager.GetString("PageSize_A4", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to A5 (148x210 mm).
/// </summary>
internal static string PageSize_A5 {
get {
return ResourceManager.GetString("PageSize_A5", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to US Legal (8.5x14 in).
/// </summary>
internal static string PageSize_Legal {
get {
return ResourceManager.GetString("PageSize_Legal", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to US Letter (8.5x11 in).
/// </summary>
internal static string PageSize_Letter {
get {
return ResourceManager.GetString("PageSize_Letter", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 1:1.
/// </summary>
internal static string Scale_1_1 {
get {
return ResourceManager.GetString("Scale_1_1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 1:2.
/// </summary>
internal static string Scale_1_2 {
get {
return ResourceManager.GetString("Scale_1_2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 1:4.
/// </summary>
internal static string Scale_1_4 {
get {
return ResourceManager.GetString("Scale_1_4", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 1:8.
/// </summary>
internal static string Scale_1_8 {
get {
return ResourceManager.GetString("Scale_1_8", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Duplex.
/// </summary>
internal static string Source_Duplex {
get {
return ResourceManager.GetString("Source_Duplex", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Feeder.
/// </summary>
internal static string Source_Feeder {
get {
return ResourceManager.GetString("Source_Feeder", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Glass.
/// </summary>
internal static string Source_Glass {
get {
return ResourceManager.GetString("Source_Glass", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,189 @@
<?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>
<data name="BitDepth_1BlackAndWhite" xml:space="preserve">
<value>Black &amp; White</value>
</data>
<data name="BitDepth_24Color" xml:space="preserve">
<value>24-bit Color</value>
</data>
<data name="BitDepth_8Grayscale" xml:space="preserve">
<value>Grayscale</value>
</data>
<data name="Dpi_100" xml:space="preserve">
<value>100 dpi</value>
</data>
<data name="Dpi_1200" xml:space="preserve">
<value>1200 dpi</value>
</data>
<data name="Dpi_200" xml:space="preserve">
<value>200 dpi</value>
</data>
<data name="Dpi_300" xml:space="preserve">
<value>300 dpi</value>
</data>
<data name="Dpi_600" xml:space="preserve">
<value>600 dpi</value>
</data>
<data name="HorizontalAlign_Center" xml:space="preserve">
<value>Center</value>
</data>
<data name="HorizontalAlign_Left" xml:space="preserve">
<value>Left</value>
</data>
<data name="HorizontalAlign_Right" xml:space="preserve">
<value>Right</value>
</data>
<data name="PageSize_A3" xml:space="preserve">
<value>A3 (297x420 mm)</value>
</data>
<data name="PageSize_A4" xml:space="preserve">
<value>A4 (210x297 mm)</value>
</data>
<data name="PageSize_A5" xml:space="preserve">
<value>A5 (148x210 mm)</value>
</data>
<data name="PageSize_Legal" xml:space="preserve">
<value>US Legal (8.5x14 in)</value>
</data>
<data name="PageSize_Letter" xml:space="preserve">
<value>US Letter (8.5x11 in)</value>
</data>
<data name="Scale_1_1" xml:space="preserve">
<value>1:1</value>
</data>
<data name="Scale_1_2" xml:space="preserve">
<value>1:2</value>
</data>
<data name="Scale_1_4" xml:space="preserve">
<value>1:4</value>
</data>
<data name="Scale_1_8" xml:space="preserve">
<value>1:8</value>
</data>
<data name="Source_Duplex" xml:space="preserve">
<value>Duplex</value>
</data>
<data name="Source_Feeder" xml:space="preserve">
<value>Feeder</value>
</data>
<data name="Source_Glass" xml:space="preserve">
<value>Glass</value>
</data>
</root>

View File

@ -120,6 +120,11 @@
<DesignTime>True</DesignTime>
<DependentUpon>LanguageResources.resx</DependentUpon>
</Compile>
<Compile Include="Lang\Resources\SettingsResources.Designer.cs">
<DependentUpon>SettingsResources.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Lang\Resources\MiscResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@ -131,6 +136,7 @@
<Compile Include="ScannedImageList.cs" />
<Compile Include="ScanPerformer.cs" />
<Compile Include="Scan\Exceptions\ScanDriverUnknownException.cs" />
<Compile Include="Scan\LocalizedDescriptionAttribute.cs" />
<Compile Include="Scan\Stub\StubScanDriver.cs" />
<Compile Include="Scan\Twain\DibUtils.cs" />
<Compile Include="Scan\Twain\TwainApi.cs" />
@ -262,6 +268,10 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>LanguageResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Lang\Resources\SettingsResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>SettingsResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Lang\Resources\MiscResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>MiscResources.Designer.cs</LastGenOutput>

View File

@ -23,6 +23,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using NAPS2.Lang.Resources;
namespace NAPS2.Scan
{
@ -47,72 +48,72 @@ namespace NAPS2.Scan
public enum ScanSource
{
[Description("Glass")]
[LocalizedDescription(typeof(SettingsResources), "Source_Glass")]
Glass,
[Description("Feeder")]
[LocalizedDescription(typeof(SettingsResources), "Source_Feeder")]
Feeder,
[Description("Duplex")]
[LocalizedDescription(typeof(SettingsResources), "Source_Duplex")]
Duplex
}
public enum ScanBitDepth
{
[Description("24-bit Color")]
[LocalizedDescription(typeof(SettingsResources), "BitDepth_24Color")]
C24Bit,
[Description("Grayscale")]
[LocalizedDescription(typeof(SettingsResources), "BitDepth_8Grayscale")]
Grayscale,
[Description("Black & White")]
[LocalizedDescription(typeof(SettingsResources), "BitDepth_1BlackAndWhite")]
BlackWhite
}
public enum ScanDpi
{
[Description("100 dpi")]
[LocalizedDescription(typeof(SettingsResources), "Dpi_100")]
Dpi100,
[Description("200 dpi")]
[LocalizedDescription(typeof(SettingsResources), "Dpi_200")]
Dpi200,
[Description("300 dpi")]
[LocalizedDescription(typeof(SettingsResources), "Dpi_300")]
Dpi300,
[Description("600 dpi")]
[LocalizedDescription(typeof(SettingsResources), "Dpi_600")]
Dpi600,
[Description("1200 dpi")]
[LocalizedDescription(typeof(SettingsResources), "Dpi_1200")]
Dpi1200
}
public enum ScanHorizontalAlign
{
[Description("Left")]
[LocalizedDescription(typeof(SettingsResources), "HorizontalAlign_Left")]
Left,
[Description("Center")]
[LocalizedDescription(typeof(SettingsResources), "HorizontalAlign_Center")]
Center,
[Description("Right")]
[LocalizedDescription(typeof(SettingsResources), "HorizontalAlign_Right")]
Right
}
public enum ScanScale
{
[Description("1:1")]
[LocalizedDescription(typeof(SettingsResources), "Scale_1_1")]
OneToOne,
[Description("1:2")]
[LocalizedDescription(typeof(SettingsResources), "Scale_1_2")]
OneToTwo,
[Description("1:4")]
[LocalizedDescription(typeof(SettingsResources), "Scale_1_4")]
OneToFour,
[Description("1:8")]
[LocalizedDescription(typeof(SettingsResources), "Scale_1_8")]
OneToEight
}
public enum ScanPageSize
{
[Description("A5 (148x210 mm)")]
A5,
[Description("A4 (210x297 mm)")]
A4,
[Description("A3 (297x420 mm)")]
A3,
[Description("US Legal (8.5x14 in)")]
[LocalizedDescription(typeof(SettingsResources), "PageSize_Letter")]
Letter,
[LocalizedDescription(typeof(SettingsResources), "PageSize_Legal")]
Legal,
[Description("US Letter (8.5x11 in)")]
Letter
[LocalizedDescription(typeof(SettingsResources), "PageSize_A5")]
A5,
[LocalizedDescription(typeof(SettingsResources), "PageSize_A4")]
A4,
[LocalizedDescription(typeof(SettingsResources), "PageSize_A3")]
A3
}
public static class ScanEnumExtensions

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Resources;
using System.Text;
namespace NAPS2.Scan
{
public class LocalizedDescriptionAttribute : DescriptionAttribute
{
private readonly string resourceName;
private readonly ResourceManager resourceManager;
public LocalizedDescriptionAttribute(Type resourceType, string resourceName)
{
this.resourceName = resourceName;
resourceManager = new ResourceManager(resourceType);
}
public override string Description
{
get { return resourceManager.GetString(resourceName); }
}
}
}