Merge pull request #833 from nvella/fix-828-new-page-dropdown
Make Page Parent drop-down fill horizontal space (fixes #828)
This commit is contained in:
commit
afb7f965ff
|
@ -34,15 +34,15 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
private void InitializeComponent()
|
||||
{
|
||||
this.table = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.labelPageOrder = new System.Windows.Forms.Label();
|
||||
this.categoryDropDown = new OpenLiveWriter.PostEditor.PostPropertyEditing.CategoryControl.CategoryDropDownControlM1();
|
||||
this.textTags = new OpenLiveWriter.Controls.AutoCompleteTextbox();
|
||||
this.datePublishDate = new OpenLiveWriter.PostEditor.PostPropertyEditing.PublishDateTimePicker();
|
||||
this.labelPageParent = new System.Windows.Forms.Label();
|
||||
this.comboPageParent = new OpenLiveWriter.PostEditor.PostPropertyEditing.PageParentComboBox();
|
||||
this.labelPageOrder = new System.Windows.Forms.Label();
|
||||
this.textPageOrder = new OpenLiveWriter.Controls.NumericTextBox();
|
||||
this.panelShadow = new System.Windows.Forms.Panel();
|
||||
this.linkViewAll = new System.Windows.Forms.LinkLabel();
|
||||
this.panelShadow = new System.Windows.Forms.Panel();
|
||||
this.table.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -76,17 +76,6 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
this.table.Size = new System.Drawing.Size(1090, 41);
|
||||
this.table.TabIndex = 0;
|
||||
//
|
||||
// labelPageOrder
|
||||
//
|
||||
this.labelPageOrder.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.labelPageOrder.AutoSize = true;
|
||||
this.labelPageOrder.Location = new System.Drawing.Point(753, 14);
|
||||
this.labelPageOrder.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelPageOrder.Name = "labelPageOrder";
|
||||
this.labelPageOrder.Size = new System.Drawing.Size(62, 13);
|
||||
this.labelPageOrder.TabIndex = 5;
|
||||
this.labelPageOrder.Text = "Page order:";
|
||||
//
|
||||
// categoryDropDown
|
||||
//
|
||||
this.categoryDropDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
|
@ -97,6 +86,7 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
this.categoryDropDown.Items.AddRange(new object[] {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""});
|
||||
this.categoryDropDown.Location = new System.Drawing.Point(8, 10);
|
||||
this.categoryDropDown.Margin = new System.Windows.Forms.Padding(0, 0, 8, 0);
|
||||
|
@ -119,7 +109,7 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
// datePublishDate
|
||||
//
|
||||
this.datePublishDate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.datePublishDate.Format = DateTimePickerFormat.Custom;
|
||||
this.datePublishDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
|
||||
this.datePublishDate.Location = new System.Drawing.Point(366, 10);
|
||||
this.datePublishDate.Margin = new System.Windows.Forms.Padding(0, 0, 8, 0);
|
||||
this.datePublishDate.Name = "datePublishDate";
|
||||
|
@ -141,7 +131,7 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
//
|
||||
// comboPageParent
|
||||
//
|
||||
this.comboPageParent.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.comboPageParent.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.comboPageParent.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.comboPageParent.FormattingEnabled = true;
|
||||
this.comboPageParent.IntegralHeight = false;
|
||||
|
@ -151,6 +141,17 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
this.comboPageParent.Size = new System.Drawing.Size(121, 20);
|
||||
this.comboPageParent.TabIndex = 4;
|
||||
//
|
||||
// labelPageOrder
|
||||
//
|
||||
this.labelPageOrder.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.labelPageOrder.AutoSize = true;
|
||||
this.labelPageOrder.Location = new System.Drawing.Point(753, 14);
|
||||
this.labelPageOrder.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelPageOrder.Name = "labelPageOrder";
|
||||
this.labelPageOrder.Size = new System.Drawing.Size(62, 13);
|
||||
this.labelPageOrder.TabIndex = 5;
|
||||
this.labelPageOrder.Text = "Page order:";
|
||||
//
|
||||
// textPageOrder
|
||||
//
|
||||
this.textPageOrder.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
|
@ -160,6 +161,23 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
this.textPageOrder.Size = new System.Drawing.Size(63, 20);
|
||||
this.textPageOrder.TabIndex = 6;
|
||||
//
|
||||
// linkViewAll
|
||||
//
|
||||
this.linkViewAll.ActiveLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(142)))), ((int)(((byte)(213)))));
|
||||
this.linkViewAll.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.linkViewAll.AutoSize = true;
|
||||
this.linkViewAll.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
|
||||
this.linkViewAll.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(142)))), ((int)(((byte)(213)))));
|
||||
this.linkViewAll.Location = new System.Drawing.Point(1038, 14);
|
||||
this.linkViewAll.Margin = new System.Windows.Forms.Padding(0, 0, 8, 0);
|
||||
this.linkViewAll.Name = "linkViewAll";
|
||||
this.linkViewAll.Size = new System.Drawing.Size(43, 13);
|
||||
this.linkViewAll.TabIndex = 7;
|
||||
this.linkViewAll.TabStop = true;
|
||||
this.linkViewAll.Text = "View all";
|
||||
this.linkViewAll.VisitedLinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(142)))), ((int)(((byte)(213)))));
|
||||
this.linkViewAll.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkViewAll_LinkClicked);
|
||||
//
|
||||
// panelShadow
|
||||
//
|
||||
this.panelShadow.BackColor = System.Drawing.Color.Transparent;
|
||||
|
@ -169,23 +187,6 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
this.panelShadow.Size = new System.Drawing.Size(1090, 4);
|
||||
this.panelShadow.TabIndex = 1;
|
||||
//
|
||||
// linkViewAll
|
||||
//
|
||||
this.linkViewAll.ActiveLinkColor = Color.FromArgb(85, 142, 213);
|
||||
this.linkViewAll.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.linkViewAll.AutoSize = true;
|
||||
this.linkViewAll.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
|
||||
this.linkViewAll.LinkColor = Color.FromArgb(85, 142, 213);
|
||||
this.linkViewAll.Location = new System.Drawing.Point(1038, 14);
|
||||
this.linkViewAll.Margin = new System.Windows.Forms.Padding(0, 0, 8, 0);
|
||||
this.linkViewAll.Name = "linkViewAll";
|
||||
this.linkViewAll.Size = new System.Drawing.Size(43, 13);
|
||||
this.linkViewAll.TabIndex = 7;
|
||||
this.linkViewAll.TabStop = true;
|
||||
this.linkViewAll.Text = "View all";
|
||||
this.linkViewAll.VisitedLinkColor = Color.FromArgb(85, 142, 213);
|
||||
this.linkViewAll.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkViewAll_LinkClicked);
|
||||
//
|
||||
// PostPropertiesBandControl
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
|
||||
|
|
|
@ -122,6 +122,17 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
base.OnLoad(args);
|
||||
|
||||
FixCategoryDropDown();
|
||||
FixPageParentDropDown();
|
||||
}
|
||||
|
||||
private void FixPageParentDropDown()
|
||||
{
|
||||
// For unknown reasons, the page parent drop down vertically misaligns at runtime
|
||||
// Force it to vertically align with the publish date picker on location change
|
||||
comboPageParent.LocationChanged += delegate
|
||||
{
|
||||
comboPageParent.Top = datePublishDate.Top;
|
||||
};
|
||||
}
|
||||
|
||||
private void FixCategoryDropDown()
|
||||
|
@ -202,9 +213,34 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
}
|
||||
}
|
||||
|
||||
private bool pageParentVisible = false;
|
||||
private bool PageParentVisible
|
||||
{
|
||||
set
|
||||
{
|
||||
labelPageParent.Visible = comboPageParent.Visible = pageParentVisible = value;
|
||||
if (value) {
|
||||
// Page Parent selection enabled, set Page Parent combo to fill
|
||||
table.ColumnStyles[COL_PAGEPARENT].SizeType = SizeType.Percent;
|
||||
table.ColumnStyles[COL_PAGEPARENT] = new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F);
|
||||
} else
|
||||
{
|
||||
// Page Parent selection disabled, reset column styles and sizing
|
||||
table.ColumnStyles[COL_PAGEPARENT].SizeType = SizeType.AutoSize;
|
||||
table.ColumnStyles[COL_PAGEPARENT] = new System.Windows.Forms.ColumnStyle();
|
||||
}
|
||||
ManageFillerVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
private void ManageFillerVisibility()
|
||||
{
|
||||
bool shouldShow = !categoryVisible && !tagsVisible;
|
||||
// Only show the filler if:
|
||||
// - Categories aren't visible
|
||||
// - Tags aren't visible
|
||||
// - And editing a Post (not a Page)
|
||||
|
||||
bool shouldShow = !categoryVisible && !tagsVisible && !pageParentVisible;
|
||||
table.ColumnStyles[COL_FILLER].SizeType = shouldShow ? SizeType.Percent : SizeType.AutoSize;
|
||||
}
|
||||
|
||||
|
@ -257,6 +293,9 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
linkViewAll.Visible = showViewAll;
|
||||
CategoryVisible = false;
|
||||
TagsVisible = false;
|
||||
|
||||
PageParentVisible = _clientOptions.SupportsPageParent;
|
||||
|
||||
Visible = showViewAll || _clientOptions.SupportsPageParent || _clientOptions.SupportsPageOrder;
|
||||
}
|
||||
else
|
||||
|
@ -278,6 +317,8 @@ namespace OpenLiveWriter.PostEditor.PostPropertyEditing
|
|||
CategoryVisible = _clientOptions.SupportsCategories;
|
||||
TagsVisible = showTags;
|
||||
|
||||
PageParentVisible = false;
|
||||
|
||||
linkViewAll.Visible = showViewAll;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,9 +112,9 @@
|
|||
<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>
|
||||
<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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
Loading…
Reference in New Issue