Table percent widths and no widths

Radio buttons for pixels and percent
This commit is contained in:
David Gardiner 2016-02-20 17:37:19 +10:30
parent 266235baa9
commit 357f885b5e
14 changed files with 475 additions and 461 deletions

View File

@ -807,6 +807,7 @@
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Tables\HTMLTableColumn.cs" />
<Compile Include="Tables\PixelPercent.cs" />
<Compile Include="Tables\RowPropertiesForm.cs">
<SubType>Form</SubType>
</Compile>

View File

@ -117,14 +117,15 @@ namespace OpenLiveWriter.PostEditor.Tables
// groupBoxCells
//
this.groupBoxCells.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxCells.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.groupBoxCells.Controls.Add(this.verticalAlignmentControl);
this.groupBoxCells.Controls.Add(this.horizontalAlignmentControl);
this.groupBoxCells.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.groupBoxCells.Location = new System.Drawing.Point(0, 0);
this.groupBoxCells.Name = "groupBoxCells";
this.groupBoxCells.Size = new System.Drawing.Size(304, 136);
this.groupBoxCells.Size = new System.Drawing.Size(233, 108);
this.groupBoxCells.TabIndex = 2;
this.groupBoxCells.TabStop = false;
this.groupBoxCells.Text = "Cells";
@ -132,28 +133,28 @@ namespace OpenLiveWriter.PostEditor.Tables
// verticalAlignmentControl
//
this.verticalAlignmentControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.verticalAlignmentControl.Location = new System.Drawing.Point(15, 56);
| System.Windows.Forms.AnchorStyles.Right)));
this.verticalAlignmentControl.Location = new System.Drawing.Point(15, 60);
this.verticalAlignmentControl.Name = "verticalAlignmentControl";
this.verticalAlignmentControl.Size = new System.Drawing.Size(283, 21);
this.verticalAlignmentControl.Size = new System.Drawing.Size(212, 28);
this.verticalAlignmentControl.TabIndex = 1;
this.verticalAlignmentControl.VerticalAlignment = OpenLiveWriter.PostEditor.Tables.VerticalAlignment.Middle;
//
// horizontalAlignmentControl
//
this.horizontalAlignmentControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right)));
this.horizontalAlignmentControl.HorizontalAlignment = OpenLiveWriter.PostEditor.Tables.HorizontalAlignment.Left;
this.horizontalAlignmentControl.Location = new System.Drawing.Point(15, 25);
this.horizontalAlignmentControl.Name = "horizontalAlignmentControl";
this.horizontalAlignmentControl.Size = new System.Drawing.Size(283, 21);
this.horizontalAlignmentControl.Size = new System.Drawing.Size(212, 31);
this.horizontalAlignmentControl.TabIndex = 0;
//
// CellPropertiesControl
//
this.Controls.Add(this.groupBoxCells);
this.Name = "CellPropertiesControl";
this.Size = new System.Drawing.Size(304, 136);
this.Size = new System.Drawing.Size(239, 108);
this.groupBoxCells.ResumeLayout(false);
this.ResumeLayout(false);

View File

@ -3,7 +3,7 @@
<!--
Microsoft ResX Schema
Version 1.3
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
@ -14,16 +14,17 @@
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</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">this is my long string</data>
<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">
[base64 mime encoded serialized .NET Framework object]
<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">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
<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
@ -35,7 +36,7 @@
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
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:
@ -45,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -59,18 +60,37 @@
: 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" msdata:Ordinal="1" />
<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">
@ -89,78 +109,12 @@
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="groupBoxCells.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="groupBoxCells.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
<data name="groupBoxCells.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="groupBoxCells.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="groupBoxCells.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="groupBoxCells.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="verticalAlignmentControl.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="verticalAlignmentControl.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="verticalAlignmentControl.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="horizontalAlignmentControl.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="horizontalAlignmentControl.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="horizontalAlignmentControl.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>80</value>
</data>
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>(Default)</value>
</data>
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Name">
<value>CellPropertiesControl</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
</root>

View File

@ -94,6 +94,7 @@ namespace OpenLiveWriter.PostEditor.Tables
/// </summary>
private void InitializeComponent()
{
OpenLiveWriter.PostEditor.Tables.CellProperties cellProperties1 = new OpenLiveWriter.PostEditor.Tables.CellProperties();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.cellPropertiesControl = new OpenLiveWriter.PostEditor.Tables.CellPropertiesControl();
@ -103,8 +104,9 @@ namespace OpenLiveWriter.PostEditor.Tables
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonOK.Location = new System.Drawing.Point(85, 112);
this.buttonOK.Location = new System.Drawing.Point(114, 158);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(105, 33);
this.buttonOK.TabIndex = 2;
this.buttonOK.Text = "OK";
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
@ -114,28 +116,32 @@ namespace OpenLiveWriter.PostEditor.Tables
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonCancel.Location = new System.Drawing.Point(166, 112);
this.buttonCancel.Location = new System.Drawing.Point(227, 158);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(105, 33);
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "Cancel";
//
// cellPropertiesControl
//
this.cellPropertiesControl.Location = new System.Drawing.Point(9, 8);
cellProperties1.BackgroundColor = null;
cellProperties1.HorizontalAlignment = OpenLiveWriter.PostEditor.Tables.HorizontalAlignment.Left;
cellProperties1.VerticalAlignment = OpenLiveWriter.PostEditor.Tables.VerticalAlignment.Middle;
this.cellPropertiesControl.CellProperties = cellProperties1;
this.cellPropertiesControl.Location = new System.Drawing.Point(13, 11);
this.cellPropertiesControl.Name = "cellPropertiesControl";
this.cellPropertiesControl.Size = new System.Drawing.Size(231, 97);
this.cellPropertiesControl.Size = new System.Drawing.Size(323, 139);
this.cellPropertiesControl.TabIndex = 4;
//
// CellPropertiesForm
//
this.AcceptButton = this.buttonOK;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(250, 143);
this.ClientSize = new System.Drawing.Size(345, 202);
this.Controls.Add(this.cellPropertiesControl);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Location = new System.Drawing.Point(0, 0);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "CellPropertiesForm";

View File

@ -3,7 +3,7 @@
<!--
Microsoft ResX Schema
Version 1.3
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
@ -14,16 +14,17 @@
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</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">this is my long string</data>
<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">
[base64 mime encoded serialized .NET Framework object]
<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">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
<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
@ -35,7 +36,7 @@
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
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:
@ -45,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -59,18 +60,37 @@
: 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" msdata:Ordinal="1" />
<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">
@ -89,69 +109,12 @@
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="buttonOK.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="buttonOK.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="buttonOK.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="buttonCancel.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="buttonCancel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="buttonCancel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="cellPropertiesControl.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="cellPropertiesControl.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="cellPropertiesControl.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>(Default)</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
<data name="$this.Name">
<value>CellPropertiesForm</value>
</data>
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>80</value>
</data>
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
</root>

View File

@ -98,6 +98,7 @@ namespace OpenLiveWriter.PostEditor.Tables
/// </summary>
private void InitializeComponent()
{
OpenLiveWriter.PostEditor.Tables.CellProperties cellProperties1 = new OpenLiveWriter.PostEditor.Tables.CellProperties();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBoxSize = new System.Windows.Forms.GroupBox();
this.columnWidthControl = new OpenLiveWriter.PostEditor.Tables.ColumnWidthControl();
@ -112,8 +113,9 @@ namespace OpenLiveWriter.PostEditor.Tables
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonCancel.Location = new System.Drawing.Point(169, 184);
this.buttonCancel.Location = new System.Drawing.Point(379, 201);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(105, 33);
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "Cancel";
//
@ -121,55 +123,59 @@ namespace OpenLiveWriter.PostEditor.Tables
//
this.groupBoxSize.Controls.Add(this.columnWidthControl);
this.groupBoxSize.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.groupBoxSize.Location = new System.Drawing.Point(9, 8);
this.groupBoxSize.Location = new System.Drawing.Point(13, 11);
this.groupBoxSize.Name = "groupBoxSize";
this.groupBoxSize.Size = new System.Drawing.Size(234, 66);
this.groupBoxSize.Size = new System.Drawing.Size(341, 79);
this.groupBoxSize.TabIndex = 0;
this.groupBoxSize.TabStop = false;
this.groupBoxSize.Text = "Size";
//
// columnWidthControl
//
this.columnWidthControl.ColumnWidth = 0;
this.columnWidthControl.Location = new System.Drawing.Point(15, 24);
this.columnWidthControl.Location = new System.Drawing.Point(21, 25);
this.columnWidthControl.Name = "columnWidthControl";
this.columnWidthControl.Size = new System.Drawing.Size(209, 23);
this.columnWidthControl.Size = new System.Drawing.Size(308, 36);
this.columnWidthControl.TabIndex = 0;
//
// label11
//
this.label11.Location = new System.Drawing.Point(1, 1);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(100, 23);
this.label11.TabIndex = 0;
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonOK.Location = new System.Drawing.Point(86, 184);
this.buttonOK.Location = new System.Drawing.Point(262, 201);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(105, 33);
this.buttonOK.TabIndex = 2;
this.buttonOK.Text = "OK";
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// cellPropertiesControl
//
this.cellPropertiesControl.Location = new System.Drawing.Point(9, 79);
cellProperties1.BackgroundColor = null;
cellProperties1.HorizontalAlignment = OpenLiveWriter.PostEditor.Tables.HorizontalAlignment.Left;
cellProperties1.VerticalAlignment = OpenLiveWriter.PostEditor.Tables.VerticalAlignment.Middle;
this.cellPropertiesControl.CellProperties = cellProperties1;
this.cellPropertiesControl.Location = new System.Drawing.Point(13, 113);
this.cellPropertiesControl.Name = "cellPropertiesControl";
this.cellPropertiesControl.Size = new System.Drawing.Size(234, 98);
this.cellPropertiesControl.Size = new System.Drawing.Size(243, 120);
this.cellPropertiesControl.TabIndex = 1;
//
// ColumnPropertiesForm
//
this.AcceptButton = this.buttonOK;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(253, 215);
this.ClientSize = new System.Drawing.Size(496, 245);
this.Controls.Add(this.cellPropertiesControl);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.groupBoxSize);
this.Controls.Add(this.buttonCancel);
this.Location = new System.Drawing.Point(0, 0);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ColumnPropertiesForm";

View File

@ -3,7 +3,7 @@
<!--
Microsoft ResX Schema
Version 1.3
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
@ -14,16 +14,17 @@
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</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">this is my long string</data>
<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">
[base64 mime encoded serialized .NET Framework object]
<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">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
<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
@ -35,7 +36,7 @@
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
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:
@ -45,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -59,18 +60,37 @@
: 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" msdata:Ordinal="1" />
<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">
@ -89,105 +109,12 @@
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="buttonCancel.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="buttonCancel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="buttonCancel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="groupBoxSize.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="groupBoxSize.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
<data name="groupBoxSize.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="groupBoxSize.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="groupBoxSize.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="groupBoxSize.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="columnWidthControl.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="columnWidthControl.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="columnWidthControl.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label11.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="label11.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label11.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="buttonOK.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="buttonOK.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="buttonOK.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="cellPropertiesControl.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="cellPropertiesControl.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="cellPropertiesControl.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>(Default)</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
<data name="$this.Name">
<value>ColumnPropertiesForm</value>
</data>
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>80</value>
</data>
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
</root>

View File

@ -32,7 +32,9 @@ namespace OpenLiveWriter.PostEditor.Tables
{
private OpenLiveWriter.Controls.NumericTextBox textBoxWidth;
private System.Windows.Forms.Label labelWidth;
private System.Windows.Forms.Label labelPixels;
private RadioButton rbPixels;
private RadioButton rbPercent;
/// <summary>
/// Required designer variable.
/// </summary>
@ -43,7 +45,7 @@ namespace OpenLiveWriter.PostEditor.Tables
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
this.labelWidth.Text = Res.Get(StringId.WidthLabel);
this.labelPixels.Text = Res.Get(StringId.pixels);
this.rbPixels.Text = Res.Get(StringId.pixels);
}
protected override void OnLoad(EventArgs e)
@ -53,12 +55,13 @@ namespace OpenLiveWriter.PostEditor.Tables
using (new AutoGrow(this, AnchorStyles.Right, false))
{
DisplayHelper.AutoFitSystemLabel(labelWidth, 0, int.MaxValue);
DisplayHelper.AutoFitSystemLabel(labelPixels, 0, int.MaxValue);
LayoutHelper.DistributeHorizontally(8, labelWidth, textBoxWidth, labelPixels);
DisplayHelper.AutoFitSystemRadioButton(rbPixels, 0, int.MaxValue);
DisplayHelper.AutoFitSystemRadioButton(rbPercent, 0, int.MaxValue);
LayoutHelper.DistributeHorizontally(8, labelWidth, textBoxWidth, rbPixels, rbPercent);
}
}
public int ColumnWidth
public PixelPercent ColumnWidth
{
get
{
@ -66,22 +69,36 @@ namespace OpenLiveWriter.PostEditor.Tables
{
try
{
return int.Parse(textBoxWidth.Text, CultureInfo.CurrentCulture);
var units = rbPercent.Checked ? PixelPercentUnits.Percentage : PixelPercentUnits.Pixels;
return new PixelPercent(textBoxWidth.Text, CultureInfo.CurrentCulture, units);
}
catch
{
return 0;
return new PixelPercent();
}
}
else
return 0;
return new PixelPercent();
}
set
{
if (value != 0)
textBoxWidth.Text = value.ToString(CultureInfo.CurrentCulture);
if (value.Units != PixelPercentUnits.Undefined)
{
textBoxWidth.Text = value.Value.ToString(CultureInfo.CurrentCulture);
}
else
{
textBoxWidth.Text = String.Empty;
}
if (value.Units == PixelPercentUnits.Percentage)
{
rbPercent.Checked = true;
}
else
{
rbPixels.Checked = true;
}
}
}
@ -92,20 +109,19 @@ namespace OpenLiveWriter.PostEditor.Tables
public bool ValidateInput(int maxValue)
{
int result;
if (textBoxWidth.Text == String.Empty || !Int32.TryParse(textBoxWidth.Text, out result))
if (!PixelPercent.CanParse(textBoxWidth.Text))
{
DisplayMessage.Show(MessageId.UnspecifiedValue, this, Res.Get(StringId.Width));
textBoxWidth.Focus();
return false;
}
else if (ColumnWidth <= 0)
else if (ColumnWidth.Units != PixelPercentUnits.Undefined && ColumnWidth.Value <= 0)
{
DisplayMessage.Show(MessageId.InvalidNumberPositiveOnly, FindForm(), Res.Get(StringId.Width));
textBoxWidth.Focus();
return false;
}
else if (maxValue > 0 && ColumnWidth >= maxValue)
else if (maxValue > 0 && ColumnWidth.Units != PixelPercentUnits.Undefined && ColumnWidth.Value >= maxValue)
{
DisplayMessage.Show(MessageId.ValueExceedsMaximum, FindForm(), maxValue, Res.Get(StringId.Width));
textBoxWidth.Focus();
@ -139,20 +155,12 @@ namespace OpenLiveWriter.PostEditor.Tables
/// </summary>
private void InitializeComponent()
{
this.textBoxWidth = new OpenLiveWriter.Controls.NumericTextBox();
this.labelWidth = new System.Windows.Forms.Label();
this.labelPixels = new System.Windows.Forms.Label();
this.rbPixels = new System.Windows.Forms.RadioButton();
this.rbPercent = new System.Windows.Forms.RadioButton();
this.textBoxWidth = new OpenLiveWriter.Controls.NumericTextBox();
this.SuspendLayout();
//
// textBoxWidth
//
this.textBoxWidth.Location = new System.Drawing.Point(72, 0);
this.textBoxWidth.MaxLength = 9;
this.textBoxWidth.Name = "textBoxWidth";
this.textBoxWidth.Size = new System.Drawing.Size(46, 20);
this.textBoxWidth.TabIndex = 2;
this.textBoxWidth.Text = "";
//
// labelWidth
//
this.labelWidth.FlatStyle = System.Windows.Forms.FlatStyle.System;
@ -162,27 +170,51 @@ namespace OpenLiveWriter.PostEditor.Tables
this.labelWidth.TabIndex = 0;
this.labelWidth.Text = "&Width:";
//
// labelPixels
// rbPixels
//
this.labelPixels.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.labelPixels.Location = new System.Drawing.Point(120, 3);
this.labelPixels.Name = "labelPixels";
this.labelPixels.Size = new System.Drawing.Size(63, 15);
this.labelPixels.TabIndex = 3;
this.labelPixels.Text = "pixels";
this.rbPixels.AutoSize = true;
this.rbPixels.Checked = true;
this.rbPixels.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.rbPixels.Location = new System.Drawing.Point(124, 3);
this.rbPixels.Name = "rbPixels";
this.rbPixels.Size = new System.Drawing.Size(67, 22);
this.rbPixels.TabIndex = 4;
this.rbPixels.TabStop = true;
this.rbPixels.Text = "pixels";
this.rbPixels.UseVisualStyleBackColor = true;
//
// rbPercent
//
this.rbPercent.AutoSize = true;
this.rbPercent.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.rbPercent.Location = new System.Drawing.Point(194, 3);
this.rbPercent.Name = "rbPercent";
this.rbPercent.Size = new System.Drawing.Size(80, 22);
this.rbPercent.TabIndex = 5;
this.rbPercent.Text = "percent";
this.rbPercent.UseVisualStyleBackColor = true;
//
// textBoxWidth
//
this.textBoxWidth.Location = new System.Drawing.Point(72, 0);
this.textBoxWidth.MaxLength = 9;
this.textBoxWidth.Name = "textBoxWidth";
this.textBoxWidth.Size = new System.Drawing.Size(46, 22);
this.textBoxWidth.TabIndex = 2;
//
// ColumnWidthControl
//
this.Controls.Add(this.labelPixels);
this.Controls.Add(this.rbPercent);
this.Controls.Add(this.rbPixels);
this.Controls.Add(this.textBoxWidth);
this.Controls.Add(this.labelWidth);
this.Name = "ColumnWidthControl";
this.Size = new System.Drawing.Size(348, 23);
this.Size = new System.Drawing.Size(284, 23);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
}

View File

@ -3,7 +3,7 @@
<!--
Microsoft ResX Schema
Version 1.3
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
@ -14,16 +14,17 @@
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</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">this is my long string</data>
<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">
[base64 mime encoded serialized .NET Framework object]
<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">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
<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
@ -35,7 +36,7 @@
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
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:
@ -45,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -59,18 +60,37 @@
: 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" msdata:Ordinal="1" />
<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">
@ -89,69 +109,12 @@
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="textBoxWidth.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="textBoxWidth.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="textBoxWidth.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="labelWidth.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="labelWidth.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="labelWidth.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="labelPixels.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="labelPixels.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="labelPixels.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>(Default)</value>
</data>
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>80</value>
</data>
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.Name">
<value>ColumnWidthControl</value>
</data>
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
</root>

View File

@ -36,11 +36,11 @@ namespace OpenLiveWriter.PostEditor.Tables
}
}
public int Width
public PixelPercent Width
{
get
{
return TableHelper.GetCellWidth(_baseCell);
return new PixelPercent((string) _baseCell.width); //TableHelper.GetCellWidth(_baseCell);
}
set
{
@ -245,13 +245,14 @@ namespace OpenLiveWriter.PostEditor.Tables
private class CellWidthProcessor : IColumnCellProcessor
{
private int _width;
public CellWidthProcessor(int width) { _width = width; }
private PixelPercent _width;
public CellWidthProcessor(PixelPercent width) { _width = width; }
public void ProcessCell(IHTMLTableCell cell)
{
if (_width > 0)
if (_width > 0 && _width.Units != PixelPercentUnits.Undefined)
{
cell.width = _width.ToString(CultureInfo.InvariantCulture);
}
else

View File

@ -0,0 +1,143 @@
using System;
using System.Diagnostics;
using System.Globalization;
namespace OpenLiveWriter.PostEditor.Tables
{
public enum PixelPercentUnits
{
Undefined,
Pixels,
Percentage
}
/// <summary>
/// Represents a value that can be a number of pixels or a percentage
/// </summary>
[DebuggerDisplay("{Value} {Units}")]
public struct PixelPercent
{
public PixelPercent(int value, PixelPercentUnits units) : this()
{
Units = units;
if (value < 0)
throw new ArgumentOutOfRangeException("value", value, "value must be greater than zero");
if (value > 100 && units == PixelPercentUnits.Percentage)
throw new ArgumentOutOfRangeException("value", value,
"value when percent must be less or equal to 100");
Value = value;
}
public PixelPercent(string text, IFormatProvider provider, PixelPercentUnits units)
{
if (string.IsNullOrEmpty(text))
{
Value = 0;
Units = PixelPercentUnits.Undefined;
}
else
{
var s = text.Trim();
Units = units;
var value = int.Parse(s, provider);
Value = value;
}
}
public PixelPercent(string text, IFormatProvider provider) : this()
{
if (string.IsNullOrEmpty(text))
{
Value = 0;
Units = PixelPercentUnits.Undefined;
}
else
{
var s = text.Trim();
var units = PixelPercentUnits.Pixels;
if (s.EndsWith("%"))
{
units = PixelPercentUnits.Percentage;
s = s.TrimEnd('%');
}
var value = int.Parse(s, provider);
Value = value;
Units = units;
}
}
public static bool CanParse(string text)
{
try
{
var p = new PixelPercent(text, CultureInfo.InvariantCulture);
return true;
}
catch (Exception)
{
return false;
}
}
public PixelPercent(string text) : this(text, CultureInfo.CurrentCulture)
{
}
public int Value { get; private set; }
public PixelPercentUnits Units { get; private set; }
public static PixelPercent operator / (PixelPercent left, int right)
{
if (right <= 0)
throw new InvalidOperationException("Can't divide PixelPercent by zero or negative numbers");
if (left.Units == PixelPercentUnits.Undefined)
throw new InvalidOperationException("Can't divide PixelPercent as it doesn't have an assigned value");
return new PixelPercent(left.Value / right, left.Units);
}
public static PixelPercent operator * (PixelPercent left, int right)
{
throw new NotImplementedException();
}
public static implicit operator int(PixelPercent value)
{
return value.Value;
}
public static implicit operator PixelPercent(int value)
{
return new PixelPercent(value, PixelPercentUnits.Pixels);
}
public override string ToString()
{
return ToString(CultureInfo.CurrentCulture);
}
public string ToString(IFormatProvider provider)
{
switch (Units)
{
case PixelPercentUnits.Percentage:
return String.Format(provider, "{0}%", Value);
case PixelPercentUnits.Pixels:
return String.Format(provider, "{0}", Value);
default:
return String.Empty;
}
}
}
}

View File

@ -38,7 +38,7 @@ namespace OpenLiveWriter.PostEditor.Tables
if (parentCellBlock is IHTMLTableCell)
{
int parentCellWidth = parentCellBlock.clientWidth != 0 ? parentCellBlock.clientWidth : parentCellBlock.scrollWidth;
parameters.Properties.Width = Math.Min(parameters.Properties.Width, parentCellWidth);
parameters.Properties.Width = Math.Min(parentCellWidth, parameters.Properties.Width);
}
}
@ -58,7 +58,19 @@ namespace OpenLiveWriter.PostEditor.Tables
tableHtml.Append("<tbody>\r\n");
// write cells
int columnWidth = parameters.Properties.Width / parameters.Columns;
string columnWidth = String.Empty;
switch (parameters.Properties.Width.Units)
{
case PixelPercentUnits.Pixels:
int width = parameters.Properties.Width / parameters.Columns;
columnWidth = string.Format(" width=\"{0}\"", width);
break;
case PixelPercentUnits.Percentage:
columnWidth = string.Format(" width=\"{0}%\"", 100 / parameters.Columns);
break;
}
for (int r = 0; r < parameters.Rows; r++)
{
tableHtml.Append("<tr>\r\n");
@ -67,12 +79,13 @@ namespace OpenLiveWriter.PostEditor.Tables
{
// add default alignment and width to each cell
string valign = " valign=\"top\""; // (more natural/expected behavior than middle)
tableHtml.AppendFormat("<td {0} width=\"{1}\"></td>\r\n", valign, columnWidth);
tableHtml.AppendFormat("<td {0}{1}></td>\r\n", valign, columnWidth);
}
tableHtml.Append("</tr>\r\n");
}
// end table
tableHtml.Append("</tbody>\r\n");
tableHtml.Append("</table>\r\n");
@ -447,22 +460,27 @@ namespace OpenLiveWriter.PostEditor.Tables
// get the existing width, calculate the delta, then spread
// the delta across all of the columns
int existingWidth = TableHelper.GetTableWidth(TableSelection.Table);
int changeInWidth = value.Width - existingWidth;
IHTMLTableRow firstRow = TableSelection.Table.rows.item(0, 0) as IHTMLTableRow;
if (firstRow.cells.length > 0)
var existingWidth = TableHelper.GetTableWidth(TableSelection.Table);
if (existingWidth.Units == PixelPercentUnits.Pixels)
{
int changePerColumn = changeInWidth / firstRow.cells.length;
int leftoverChange = changeInWidth % firstRow.cells.length;
foreach (IHTMLTableCell cell in firstRow.cells)
int changeInWidth = value.Width - existingWidth;
IHTMLTableRow firstRow = TableSelection.Table.rows.item(0, 0) as IHTMLTableRow;
if (firstRow.cells.length > 0)
{
HTMLTableColumn column = new HTMLTableColumn(TableSelection.Table, cell);
column.Width = column.Width + changePerColumn + leftoverChange;
leftoverChange = 0; // allocate only once
int changePerColumn = changeInWidth / firstRow.cells.length;
int leftoverChange = changeInWidth % firstRow.cells.length;
foreach (IHTMLTableCell cell in firstRow.cells)
{
HTMLTableColumn column = new HTMLTableColumn(TableSelection.Table, cell);
column.Width = column.Width + changePerColumn + leftoverChange;
leftoverChange = 0; // allocate only once
}
}
}
// also set the width of the whole table to match the columns
TableSelection.Table.width = value.Width;
TableSelection.Table.width = value.Width.ToString();
// update borders
TableHelper.UpdateDesignTimeBorders(TableSelection.Table);
@ -1326,12 +1344,7 @@ namespace OpenLiveWriter.PostEditor.Tables
}
private string _borderSize = String.Empty;
public int Width
{
get { return _width; }
set { _width = value; }
}
private int _width = 0;
public PixelPercent Width { get; set; }
}
public class CellProperties
@ -1377,12 +1390,8 @@ namespace OpenLiveWriter.PostEditor.Tables
public class ColumnProperties
{
public int Width
{
get { return _width; }
set { _width = value; }
}
private int _width = 0;
public PixelPercent Width { get; set; }
public CellProperties CellProperties
{

View File

@ -93,22 +93,22 @@ namespace OpenLiveWriter.PostEditor.Tables
}
}
public static int GetTableWidth(IHTMLTable table)
public static PixelPercent GetTableWidth(IHTMLTable table)
{
if (table.width != null)
{
try
{
return int.Parse(table.width.ToString(), CultureInfo.InvariantCulture);
return new PixelPercent(table.width.ToString(), CultureInfo.InvariantCulture);
}
catch
{
return 0;
return new PixelPercent();
}
}
else
{
return 0;
return new PixelPercent();
}
}
@ -132,8 +132,14 @@ namespace OpenLiveWriter.PostEditor.Tables
}
}
public static int GetTableLogicalEditingWidth(IHTMLTable table)
public static PixelPercent GetTableLogicalEditingWidth(IHTMLTable table)
{
// If percentage, then just keep that
var width = GetTableWidth(table);
if (width.Units == PixelPercentUnits.Percentage || width.Units == PixelPercentUnits.Undefined)
return width;
// value to return (default to zero)
int logicalWidth = 0;
@ -173,9 +179,9 @@ namespace OpenLiveWriter.PostEditor.Tables
public static void SynchronizeTableWidthForEditing(IHTMLTable table)
{
int logicalWidth = TableHelper.GetTableLogicalEditingWidth(table);
if (logicalWidth > 0)
table.width = logicalWidth;
var logicalWidth = TableHelper.GetTableLogicalEditingWidth(table);
if (logicalWidth > 0 && logicalWidth.Units != PixelPercentUnits.Undefined)
table.width = logicalWidth.ToString();
else
(table as IHTMLElement).removeAttribute("width", 0);
}

View File

@ -119,7 +119,9 @@ namespace OpenLiveWriter.PostEditor.Tables
TableCreationParameters creationParameters = CreateDefaultParameters();
numericTextBoxRows.Text = creationParameters.Rows.ToString(CultureInfo.CurrentCulture);
numericTextBoxColumns.Text = creationParameters.Columns.ToString(CultureInfo.CurrentCulture);
columnWidthControl.Text = creationParameters.Properties.Width.ToString(CultureInfo.CurrentCulture);
var width = creationParameters.Properties.Width;
columnWidthControl.Text = width.ToString(CultureInfo.CurrentCulture);
InitializeFormProperties(creationParameters.Properties);
// show the dialog
@ -376,7 +378,7 @@ namespace OpenLiveWriter.PostEditor.Tables
tableProperties.CellPadding = TableEditingSettings.DefaultCellPadding;
tableProperties.CellSpacing = TableEditingSettings.DefaultCellSpacing;
tableProperties.BorderSize = TableEditingSettings.DefaultBorderSize;
tableProperties.Width = TableEditingSettings.DefaultWidth;
tableProperties.Width = new PixelPercent();
// return default parameters
return new TableCreationParameters(
@ -479,7 +481,7 @@ namespace OpenLiveWriter.PostEditor.Tables
//
this.columnWidthControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.columnWidthControl.ColumnWidth = 0;
this.columnWidthControl.ColumnWidth = new PixelPercent();
this.columnWidthControl.ImeMode = System.Windows.Forms.ImeMode.Off;
this.columnWidthControl.Location = new System.Drawing.Point(16, 55);
this.columnWidthControl.Name = "columnWidthControl";