Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated object inspector settings #871

Merged
merged 5 commits into from
Sep 6, 2020
Merged

updated object inspector settings #871

merged 5 commits into from
Sep 6, 2020

Conversation

Barsonax
Copy link
Member

No description provided.

@ilexp ilexp linked an issue Jul 14, 2020 that may be closed by this pull request
@ilexp ilexp added this to the 4.0 milestone Jul 14, 2020
@ilexp ilexp added Editor Area: Duality editor or support libraries Plugin Area: Misc. core / editor plugins Task ToDo that's neither a Bug, nor a Feature labels Jul 14, 2020
@@ -53,9 +54,36 @@ public bool EmptySelection
public ObjectInspector(int runtimeId)
{
this.InitializeComponent();
this.buttonLock.CheckedChanged += (sender, args) => this.UserSettings.Locked = this.buttonLock.Checked;
Copy link
Member Author

Choose a reason for hiding this comment

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

The winforms designer is not working for me anymore so I added the changed handler myself here.

Not exactly sure why its not working anymore on visual studio 16.6.5.

Copy link
Member

Choose a reason for hiding this comment

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

Since the designers failure is not "by design" (ha.. sorry 😅), but will likely be fixed in some future version, I'd prefer to put the event registration line manually into the proper spot inside InitializeComponent and make the registered method an actual named method in the class following the naming scheme. That way, the designer will pick it up without issues once it starts working again.

@Barsonax Barsonax requested review from ilexp and SirePi August 6, 2020 13:24
Copy link
Member

@ilexp ilexp left a comment

Choose a reason for hiding this comment

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

Requested a few style changes.

Comment on lines 28 to 32
public ObjectInspectorState UserSettings
{
get { return this.userSettings; }
set { this.userSettings = value; }
}
Copy link
Member

Choose a reason for hiding this comment

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

Style: This property should follow the grouping of the others, i.e. not have a newline following it.

@@ -28,7 +23,13 @@ public partial class ObjectInspector : DockContent
private ObjectSelection.Category displayCat = ObjectSelection.Category.None;

private ExpandState gridExpandState = new ExpandState();

private ObjectInspectorState userSettings;
Copy link
Member

Choose a reason for hiding this comment

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

Local style: Either remove the table-like alignment from all the fields, or make the new field align with the existing ones, as to not introduce inconsistency.

@@ -53,9 +54,36 @@ public bool EmptySelection
public ObjectInspector(int runtimeId)
{
this.InitializeComponent();
this.buttonLock.CheckedChanged += (sender, args) => this.UserSettings.Locked = this.buttonLock.Checked;
Copy link
Member

Choose a reason for hiding this comment

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

Since the designers failure is not "by design" (ha.. sorry 😅), but will likely be fixed in some future version, I'd prefer to put the event registration line manually into the proper spot inside InitializeComponent and make the registered method an actual named method in the class following the naming scheme. That way, the designer will pick it up without issues once it starts working again.

@@ -30,7 +24,7 @@ internal static ObjectInspectorPlugin Instance

private List<ObjectInspector> objViews = new List<ObjectInspector>();
private bool isLoading = false;

private ObjectInspectorSettings userSettings;
Copy link
Member

Choose a reason for hiding this comment

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

Local style: Looks like the fields are meant to be laid out table-style, but the usage of inline tabs for alignment messes it up. Can you do a drive-by fix here and either remove the alignment from all the fields, or fix it by using inline-spaces? If you do the latter, make sure to also include the new field.

@@ -30,7 +24,7 @@ internal static ObjectInspectorPlugin Instance

private List<ObjectInspector> objViews = new List<ObjectInspector>();
private bool isLoading = false;

private ObjectInspectorSettings userSettings;
Copy link
Member

Choose a reason for hiding this comment

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

Style: Please do an explicit value assignment to null for consistency and readability reasons.

}
protected override void LoadUserData(XElement node)

Copy link
Member

Choose a reason for hiding this comment

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

Style: Remove the newline here to keep the current member grouping in place, or (if changing the group layout) keep together SaveUserData and LoadUserData in the same group.


public class ObjectInspectorState
{
private int id;
Copy link
Member

Choose a reason for hiding this comment

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

Style: Please group all the fields and all the properties separately, as seen here.

public List<ObjectInspectorState> ObjectInspectors { get; set; } = new List<ObjectInspectorState>();
}

public class ObjectInspectorState
Copy link
Member

Choose a reason for hiding this comment

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

Class and public properties need XML docs! 🙂

Copy link
Member

@ilexp ilexp left a comment

Choose a reason for hiding this comment

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

Implemented the requested changes myself due to the time constraints you mentioned on your side, and also fixed a bug in the multi-window scenario where IDs weren't yet used as needed to support this. Should be ready for merge now.

@ilexp ilexp merged commit b45a25c into AdamsLair:master Sep 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Editor Area: Duality editor or support libraries Plugin Area: Misc. core / editor plugins Task ToDo that's neither a Bug, nor a Feature
Development

Successfully merging this pull request may close these issues.

Refactor/rethink how duality handles settings
2 participants