Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
View
1 src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.addin
@@ -313,7 +313,6 @@
<OptionPanel id = "LocalizationModelOptions"
label = "${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.LocalizationModelOptionsPanel.PanelName}"
class = "ICSharpCode.FormsDesigner.Gui.OptionPanels.LocalizationModelOptionsPanel"/>
-
</OptionPanel>
</Path>
</AddIn>
View
15 src/AddIns/DisplayBindings/FormsDesigner/Project/FormsDesigner.csproj
@@ -85,7 +85,10 @@
<Compile Include="Src\Gui\ImageResourceEditorDialog.Designer.cs">
<DependentUpon>ImageResourceEditorDialog.cs</DependentUpon>
</Compile>
- <Compile Include="Src\Gui\OptionPanels\LocalizationModelOptionsPanel.cs" />
+ <Compile Include="Src\Gui\OptionPanels\LocalizationModelOptionsPanel.xaml.cs">
+ <DependentUpon>LocalizationModelOptionsPanel.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Src\SecondaryDisplayBinding.cs" />
<Compile Include="Src\DesignerViewContent.cs" />
<Compile Include="Src\FormKeyHandler.cs" />
@@ -142,9 +145,6 @@
<EmbeddedResource Include="Src\Gui\ImageResourceEditorDialog.resx">
<DependentUpon>ImageResourceEditorDialog.cs</DependentUpon>
</EmbeddedResource>
- <EmbeddedResource Include="Src\Gui\OptionPanels\LocalizationModelOptionsPanel.resx">
- <DependentUpon>LocalizationModelOptionsPanel.cs</DependentUpon>
- </EmbeddedResource>
<Compile Include="Src\Services\DesignerSerializationService.cs" />
</ItemGroup>
<ItemGroup>
@@ -169,6 +169,10 @@
<Private>False</Private>
</ProjectReference>
<Content Include="PostBuildEvent.proj" />
+ <ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj">
+ <Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project>
+ <Name>ICSharpCode.Core.Presentation</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj">
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project>
<Name>ICSharpCode.Core.WinForms</Name>
@@ -185,6 +189,9 @@
<Private>False</Private>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Page Include="Src\Gui\OptionPanels\LocalizationModelOptionsPanel.xaml" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<Import Project="PostBuildEvent.proj" />
</Project>
View
175 ...splayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/LocalizationModelOptionsPanel.cs
@@ -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;
- }
- }
- }
-}
View
123 ...layBindings/FormsDesigner/Project/Src/Gui/OptionPanels/LocalizationModelOptionsPanel.resx
@@ -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>
View
22 ...layBindings/FormsDesigner/Project/Src/Gui/OptionPanels/LocalizationModelOptionsPanel.xaml
@@ -0,0 +1,22 @@
+<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"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets">
+
+ <StackPanel>
+ <GroupBox Header="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.LocalizationModelOptionsPanel.DefaultLocalizationModel}">
+ <widgets:StackPanelWithSpacing SpaceBetweenItems="15">
+ <RadioButton Margin="5,5,0,5" x:Name="reflectionRadioButton"
+ Content="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.LocalizationModelOptionsPanel.DefaultLocalizationModel}"></RadioButton>
+ <RadioButton Margin="5,5,0,5" x:Name="assignmentRadioButton"
+ Content="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.LocalizationModelOptionsPanel.AssignmentRadioButton}"></RadioButton>
+ </widgets:StackPanelWithSpacing>
+ </GroupBox>
+
+ <CheckBox Margin="5,15,0,0" x:Name="keepModelCheckBox"
+ Content="{sd:Localize ICSharpCode.SharpDevelop.FormDesigner.Gui.OptionPanels.LocalizationModelOptionsPanel.KeepModelCheckBox }"></CheckBox>
+ </StackPanel>
+
+</gui:OptionPanel>
View
75 ...Bindings/FormsDesigner/Project/Src/Gui/OptionPanels/LocalizationModelOptionsPanel.xaml.cs
@@ -0,0 +1,75 @@
+/*
+ * Created by SharpDevelop.
+ * User: Peter Forstmeier
+ * Date: 28.02.2012
+ * Time: 20:08
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+using System;
+using System.ComponentModel.Design.Serialization;
+using ICSharpCode.Core;
+using ICSharpCode.SharpDevelop.Gui;
+
+namespace ICSharpCode.FormsDesigner.Gui.OptionPanels
+{
+ /// <summary>
+ /// Interaction logic for LocalizationOptionPanelXAML.xaml
+ /// </summary>
+ public partial class LocalizationModelOptionsPanel : OptionPanel
+ {
+ public const string DefaultLocalizationModelPropertyName = "FormsDesigner.DesignerOptions.DefaultLocalizationModel";
+ public const string KeepLocalizationModelPropertyName = "FormsDesigner.DesignerOptions.KeepLocalizationModel";
+
+ const CodeDomLocalizationModel DefaultLocalizationModelDefaultValue = CodeDomLocalizationModel.PropertyReflection;
+ const bool KeepLocalizationModelDefaultValue = false;
+
+ public LocalizationModelOptionsPanel()
+ {
+ InitializeComponent();
+ this.reflectionRadioButton.IsChecked = (DefaultLocalizationModel == CodeDomLocalizationModel.PropertyReflection);
+ this.assignmentRadioButton.IsChecked = !this.reflectionRadioButton.IsChecked;
+ this.keepModelCheckBox.IsChecked = KeepLocalizationModel;
+ }
+
+
+
+ public static CodeDomLocalizationModel DefaultLocalizationModel {
+ get { return GetPropertySafe(DefaultLocalizationModelPropertyName, DefaultLocalizationModelDefaultValue); }
+ set { PropertyService.Set(DefaultLocalizationModelPropertyName, value); }
+ }
+
+
+ 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;
+ }
+ }
+
+ public override bool SaveOptions()
+ {
+ if (this.reflectionRadioButton.IsChecked == true) {
+ DefaultLocalizationModel = CodeDomLocalizationModel.PropertyReflection;
+ } else if (this.assignmentRadioButton.IsChecked == true) {
+ DefaultLocalizationModel = CodeDomLocalizationModel.PropertyAssignment;
+ } else {
+ MessageService.ShowError("One localization model must be selected!");
+ return false;
+ }
+
+ KeepLocalizationModel = (this.keepModelCheckBox.IsChecked == true);
+
+ return true;
+
+ }
+ }
+}

No commit comments for this range

Something went wrong with that request. Please try again.