Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ protected override void OnValueChanged()
_checkBox.Checked = (bool)Value;
}

public sealed class Info(DesignerActionList list, DesignerActionPropertyItem item) : PropertyLineInfo(list, item)
public static StandardLineInfo CreateLineInfo(DesignerActionList list, DesignerActionPropertyItem item) => new Info(list, item);

private sealed class Info(DesignerActionList list, DesignerActionPropertyItem item) : PropertyLineInfo(list, item)
{
public override Line CreateLine(IServiceProvider serviceProvider, DesignerActionPanel actionPanel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ protected override bool ProcessDialogKey(Keys keyData)
}
}

public new sealed class Info(DesignerActionList list, DesignerActionPropertyItem item) : PropertyLineInfo(list, item)
public static new StandardLineInfo CreateLineInfo(DesignerActionList list, DesignerActionPropertyItem item) => new Info(list, item);

private sealed class Info(DesignerActionList list, DesignerActionPropertyItem item) : PropertyLineInfo(list, item)
{
public override Line CreateLine(IServiceProvider serviceProvider, DesignerActionPanel actionPanel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ private HeaderLine(IServiceProvider serviceProvider, DesignerActionPanel actionP

protected override Font GetFont() => new(ActionPanel.Font, FontStyle.Bold);

public new sealed class Info(DesignerActionList list, DesignerActionTextItem item) : StandardLineInfo(list)
public static new StandardLineInfo CreateLineInfo(DesignerActionList list, DesignerActionTextItem item) => new HeaderTextLineInfo(list, item);

private sealed class HeaderTextLineInfo(DesignerActionList list, DesignerActionTextItem item) : TextLineInfo(list, item)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the crux of the fix. HeaderInfo (formerly HeaderLine.Info) needs to be of type TextLineInfo (formerly TextLine.Info) because otherwise HeaderInfo.UpdateActionItem crashes as it cannot cast the LineInfo object

{
public override DesignerActionTextItem Item { get; } = item;
public override Line CreateLine(IServiceProvider serviceProvider, DesignerActionPanel actionPanel)
{
return new HeaderLine(serviceProvider, actionPanel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ protected override bool ProcessDialogKey(Keys keyData)
}
}

public sealed class Info(DesignerActionList list, DesignerActionMethodItem item) : StandardLineInfo(list)
public static StandardLineInfo CreateLineInfo(DesignerActionList list, DesignerActionMethodItem item) => new Info(list, item);
private sealed class Info(DesignerActionList list, DesignerActionMethodItem item) : StandardLineInfo(list)
{
public override DesignerActionMethodItem Item { get; } = item;
public override Line CreateLine(IServiceProvider serviceProvider, DesignerActionPanel actionPanel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ internal sealed override void UpdateActionItem(LineInfo lineInfo, ToolTip toolTi
}
}

public abstract class PropertyLineInfo(DesignerActionList list, DesignerActionPropertyItem item) : StandardLineInfo(list)
protected abstract class PropertyLineInfo(DesignerActionList list, DesignerActionPropertyItem item) : StandardLineInfo(list)
{
public override DesignerActionPropertyItem Item { get; } = item;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ public EditorLabelAccessibleObject(EditorLabel owner)
}
}

public sealed class Info(DesignerActionList list, DesignerActionPropertyItem item) : PropertyLineInfo(list, item)
public static StandardLineInfo CreateLineInfo(DesignerActionList list, DesignerActionPropertyItem item) => new Info(list, item);

private sealed class Info(DesignerActionList list, DesignerActionPropertyItem item) : PropertyLineInfo(list, item)
{
public override Line CreateLine(IServiceProvider serviceProvider, DesignerActionPanel actionPanel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,17 @@ protected virtual Font GetFont()

internal override void UpdateActionItem(LineInfo lineInfo, ToolTip toolTip, ref int currentTabIndex)
{
Info info = (Info)lineInfo;
_textItem = info.Item;
TextLineInfo textLineInfo = (TextLineInfo)lineInfo;
_textItem = textLineInfo.Item;
_label.Text = StripAmpersands(_textItem.DisplayName);
_label.Font = GetFont();
_label.TabIndex = currentTabIndex++;
toolTip.SetToolTip(_label, _textItem.Description);
}

public sealed class Info(DesignerActionList list, DesignerActionTextItem item) : StandardLineInfo(list)
public static StandardLineInfo CreateLineInfo(DesignerActionList list, DesignerActionTextItem item) => new TextLineInfo(list, item);

protected class TextLineInfo(DesignerActionList list, DesignerActionTextItem item) : StandardLineInfo(list)
{
public override DesignerActionTextItem Item { get; } = item;
public override Line CreateLine(IServiceProvider serviceProvider, DesignerActionPanel actionPanel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ private StandardLineInfo ProcessTaskItem(DesignerActionList list, DesignerAction
{
if (item is DesignerActionMethodItem methodItem)
{
return new MethodLine.Info(list, methodItem);
return MethodLine.CreateLineInfo(list, methodItem);
}
else if (item is DesignerActionPropertyItem pti)
{
Expand All @@ -675,37 +675,37 @@ private StandardLineInfo ProcessTaskItem(DesignerActionList list, DesignerAction
bool standardValuesSupported = pd.Converter.GetStandardValuesSupported(context);
if (pd.TryGetEditor(out UITypeEditor _))
{
return new EditorPropertyLine.Info(list, pti);
return EditorPropertyLine.CreateLineInfo(list, pti);
}
else if (pd.PropertyType == typeof(bool))
{
if (IsReadOnlyProperty(pd))
{
return new TextBoxPropertyLine.Info(list, pti);
return TextBoxPropertyLine.CreateLineInfo(list, pti);
}
else
{
return new CheckBoxPropertyLine.Info(list, pti);
return CheckBoxPropertyLine.CreateLineInfo(list, pti);
}
}
else if (standardValuesSupported)
{
return new EditorPropertyLine.Info(list, pti);
return EditorPropertyLine.CreateLineInfo(list, pti);
}
else
{
return new TextBoxPropertyLine.Info(list, pti);
return TextBoxPropertyLine.CreateLineInfo(list, pti);
}
}
else if (item is DesignerActionTextItem textItem)
{
if (item is DesignerActionHeaderItem)
{
return new HeaderLine.Info(list, textItem);
return HeaderLine.CreateLineInfo(list, textItem);
}
else
{
return new TextLine.Info(list, textItem);
return TextLine.CreateLineInfo(list, textItem);
}
}
else
Expand Down