6 changed files with 6 additions and 312 deletions
@ -1,175 +0,0 @@
@@ -1,175 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||
using System; |
||||
using System.ComponentModel.Design.Serialization; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace ICSharpCode.FormsDesigner.Gui.OptionPanels |
||||
{ |
||||
/// <summary>
|
||||
/// Options panel for localization model options.
|
||||
/// </summary>
|
||||
public class LocalizationModelOptionsPanel : XmlFormsOptionPanel |
||||
{ |
||||
public LocalizationModelOptionsPanel() |
||||
{ |
||||
} |
||||
|
||||
#region Windows Forms Designer code
|
||||
|
||||
void InitializeComponent() |
||||
{ |
||||
System.Windows.Forms.GroupBox modelGroupBox; |
||||
this.assignmentRadioButton = new System.Windows.Forms.RadioButton(); |
||||
this.reflectionRadioButton = new System.Windows.Forms.RadioButton(); |
||||
this.keepModelCheckBox = new System.Windows.Forms.CheckBox(); |
||||
modelGroupBox = new System.Windows.Forms.GroupBox(); |
||||
modelGroupBox.SuspendLayout(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// modelGroupBox
|
||||
//
|
||||
modelGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
||||
| System.Windows.Forms.AnchorStyles.Right))); |
||||
modelGroupBox.Controls.Add(this.assignmentRadioButton); |
||||
modelGroupBox.Controls.Add(this.reflectionRadioButton); |
||||
modelGroupBox.Location = new System.Drawing.Point(3, 3); |
||||
modelGroupBox.Name = "modelGroupBox"; |
||||
modelGroupBox.Size = new System.Drawing.Size(385, 166); |
||||
modelGroupBox.TabIndex = 0; |
||||
modelGroupBox.TabStop = false; |
||||
modelGroupBox.Text = "${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.LocalizationModelOpt" + |
||||
"ionsPanel.DefaultLocalizationModel}"; |
||||
//
|
||||
// assignmentRadioButton
|
||||
//
|
||||
this.assignmentRadioButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
||||
| System.Windows.Forms.AnchorStyles.Right))); |
||||
this.assignmentRadioButton.CheckAlign = System.Drawing.ContentAlignment.TopLeft; |
||||
this.assignmentRadioButton.Location = new System.Drawing.Point(6, 91); |
||||
this.assignmentRadioButton.Name = "assignmentRadioButton"; |
||||
this.assignmentRadioButton.Size = new System.Drawing.Size(373, 69); |
||||
this.assignmentRadioButton.TabIndex = 1; |
||||
this.assignmentRadioButton.TabStop = true; |
||||
this.assignmentRadioButton.Text = "${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.LocalizationModelOpt" + |
||||
"ionsPanel.AssignmentRadioButton}"; |
||||
this.assignmentRadioButton.TextAlign = System.Drawing.ContentAlignment.TopLeft; |
||||
this.assignmentRadioButton.UseVisualStyleBackColor = true; |
||||
//
|
||||
// reflectionRadioButton
|
||||
//
|
||||
this.reflectionRadioButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
||||
| System.Windows.Forms.AnchorStyles.Right))); |
||||
this.reflectionRadioButton.CheckAlign = System.Drawing.ContentAlignment.TopLeft; |
||||
this.reflectionRadioButton.Location = new System.Drawing.Point(6, 19); |
||||
this.reflectionRadioButton.Name = "reflectionRadioButton"; |
||||
this.reflectionRadioButton.Size = new System.Drawing.Size(373, 66); |
||||
this.reflectionRadioButton.TabIndex = 0; |
||||
this.reflectionRadioButton.TabStop = true; |
||||
this.reflectionRadioButton.Text = "${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.LocalizationModelOpt" + |
||||
"ionsPanel.ReflectionRadioButton}"; |
||||
this.reflectionRadioButton.TextAlign = System.Drawing.ContentAlignment.TopLeft; |
||||
this.reflectionRadioButton.UseVisualStyleBackColor = true; |
||||
//
|
||||
// keepModelCheckBox
|
||||
//
|
||||
this.keepModelCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
||||
| System.Windows.Forms.AnchorStyles.Right))); |
||||
this.keepModelCheckBox.CheckAlign = System.Drawing.ContentAlignment.TopLeft; |
||||
this.keepModelCheckBox.Location = new System.Drawing.Point(9, 175); |
||||
this.keepModelCheckBox.Name = "keepModelCheckBox"; |
||||
this.keepModelCheckBox.Size = new System.Drawing.Size(373, 95); |
||||
this.keepModelCheckBox.TabIndex = 1; |
||||
this.keepModelCheckBox.Text = "${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.LocalizationModelOpt" + |
||||
"ionsPanel.KeepModelCheckBox}"; |
||||
this.keepModelCheckBox.TextAlign = System.Drawing.ContentAlignment.TopLeft; |
||||
this.keepModelCheckBox.UseVisualStyleBackColor = true; |
||||
//
|
||||
// LocalizationModelOptionsPanel
|
||||
//
|
||||
this.Controls.Add(this.keepModelCheckBox); |
||||
this.Controls.Add(modelGroupBox); |
||||
this.Name = "LocalizationModelOptionsPanel"; |
||||
this.Size = new System.Drawing.Size(391, 300); |
||||
modelGroupBox.ResumeLayout(false); |
||||
this.ResumeLayout(false); |
||||
} |
||||
private System.Windows.Forms.CheckBox keepModelCheckBox; |
||||
private System.Windows.Forms.RadioButton reflectionRadioButton; |
||||
private System.Windows.Forms.RadioButton assignmentRadioButton; |
||||
|
||||
#endregion
|
||||
|
||||
public override void LoadPanelContents() |
||||
{ |
||||
base.LoadPanelContents(); |
||||
if (this.Controls.Count == 0) { |
||||
this.InitializeComponent(); |
||||
Translate(this); |
||||
} |
||||
|
||||
this.reflectionRadioButton.Checked = (DefaultLocalizationModel == CodeDomLocalizationModel.PropertyReflection); |
||||
this.assignmentRadioButton.Checked = !this.reflectionRadioButton.Checked; |
||||
this.keepModelCheckBox.Checked = KeepLocalizationModel; |
||||
} |
||||
|
||||
static void Translate(Control container) { |
||||
container.Text = StringParser.Parse(container.Text); |
||||
foreach (Control c in container.Controls) { |
||||
Translate(c); |
||||
} |
||||
} |
||||
|
||||
public override bool StorePanelContents() |
||||
{ |
||||
if (this.reflectionRadioButton.Checked) { |
||||
DefaultLocalizationModel = CodeDomLocalizationModel.PropertyReflection; |
||||
} else if (this.assignmentRadioButton.Checked) { |
||||
DefaultLocalizationModel = CodeDomLocalizationModel.PropertyAssignment; |
||||
} else { |
||||
MessageService.ShowError("One localization model must be selected!"); |
||||
return false; |
||||
} |
||||
|
||||
KeepLocalizationModel = this.keepModelCheckBox.Checked; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
|
||||
public const string DefaultLocalizationModelPropertyName = "FormsDesigner.DesignerOptions.DefaultLocalizationModel"; |
||||
public const string KeepLocalizationModelPropertyName = "FormsDesigner.DesignerOptions.KeepLocalizationModel"; |
||||
|
||||
const CodeDomLocalizationModel DefaultLocalizationModelDefaultValue = CodeDomLocalizationModel.PropertyReflection; |
||||
const bool KeepLocalizationModelDefaultValue = false; |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default localization model to be used by the Windows Forms designer.
|
||||
/// </summary>
|
||||
public static CodeDomLocalizationModel DefaultLocalizationModel { |
||||
get { return GetPropertySafe(DefaultLocalizationModelPropertyName, DefaultLocalizationModelDefaultValue); } |
||||
set { PropertyService.Set(DefaultLocalizationModelPropertyName, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the Windows Forms designer should keep the localization model of existing files.
|
||||
/// </summary>
|
||||
public static bool KeepLocalizationModel { |
||||
get { return GetPropertySafe(KeepLocalizationModelPropertyName, KeepLocalizationModelDefaultValue); } |
||||
set { PropertyService.Set(KeepLocalizationModelPropertyName, value); } |
||||
} |
||||
|
||||
static T GetPropertySafe<T>(string name, T defaultValue) |
||||
{ |
||||
if (PropertyService.Initialized) { |
||||
return PropertyService.Get<T>(name, defaultValue); |
||||
} else { |
||||
return defaultValue; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -1,123 +0,0 @@
@@ -1,123 +0,0 @@
|
||||
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<metadata name="modelGroupBox.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> |
||||
<value>False</value> |
||||
</metadata> |
||||
</root> |
||||
@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
|
||||
<gui:OptionPanel x:Class="ICSharpCode.FormsDesigner.Gui.OptionPanels.LocalizationOption" |
||||
<gui:OptionPanel x:Class="ICSharpCode.FormsDesigner.Gui.OptionPanels.LocalizationModelOptionsPanel" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:sd="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
Loading…
Reference in new issue