Some context menu changes for the main tree view#1973
Some context menu changes for the main tree view#1973LukeUniverse wants to merge 2 commits intoUnderminersTeam:masterfrom
Conversation
Discussed with some people in the discord server, and they encouraged me to make a PR, so uh, this is my attempt at that.
Adds a few things to the right click context menu of the treeview:
New items I added:
<Seperator/>
Move up to {Previous Section}
Move down to {Next Section}
<Seperator/>
Collapse all
Collapse {Current Section}
<Seperator/>
Add: {CurrentSection}
Where Current/Previous/Next Section is replaced with the text of the that section such as "Sounds" "Tile sets" "Sprites", etc etc.
oops this should have been with the previous check in
Miepee
left a comment
There was a problem hiding this comment.
Heads up: for GUI changes, screenshots are always nice to have :)
Also for the future, if you're doing just visual ordering, make these in seperate commits please so that it's easier to review
| <MenuItem Header="Move up to" Click="MenuItem_MoveUpTo_Click"/> | ||
| <MenuItem Header="Move down to" Click="MenuItem_MoveDownTo_Click"/> |
There was a problem hiding this comment.
What are these supposed to do?
|
Download the artifacts for this pull request here: GUI:
CLI: |
| if (Highlighted is UndertaleObject obj) | ||
| DeleteItem(obj); | ||
| } | ||
| //this 99% copied from the the Add_Click, so could probably have the fuctionality of it (and above) combined into one method that then gets called from both events) |
There was a problem hiding this comment.
please don't copy paste for 90%
Also because I cant find it right now, whats the difference between Add and AddType ?
| foreach (TreeViewItem treeItem in (MainTree.Items[0] as TreeViewItem).Items) | ||
| if (treeItem.Items.Contains(MainTree.SelectedItem)) | ||
| indexOfCurrentSelectionParent = (MainTree.Items[0] as TreeViewItem).Items.IndexOf(treeItem); |
There was a problem hiding this comment.
please refer to our code style
use braces
| foreach (TreeViewItem item in (MainTree.Items[0] as TreeViewItem).Items) | ||
| if (item.Items.Contains(MainTree.SelectedItem)) | ||
| item.IsExpanded = false; |
| foreach (TreeViewItem item in (MainTree.Items[0] as TreeViewItem).Items) | ||
| item.IsExpanded = false; |
| //LMM: Regarding the text changes, and visibility changes here... there is most likely better ways to do this, I'm not super familair with XAML though, and eh, this worked for me. | ||
| //other contributors could polish this up if need be :) |
There was a problem hiding this comment.
code style: please have a space after the // and start with an uppercase letter
What does LMM mean?
Also CC @VladiStep cause you probably know more xaml than anyone else on the dev team.
| foreach (TreeViewItem item in (MainTree.Items[0] as TreeViewItem).Items) | ||
| if (item.Items.Contains(MainTree.SelectedItem)) | ||
| indexOfCurrentSelectionParent = (MainTree.Items[0] as TreeViewItem).Items.IndexOf(item); | ||
|
|
| foreach (TreeViewItem treeItem in (MainTree.Items[0] as TreeViewItem).Items) | ||
| if (treeItem.Items.Contains(MainTree.SelectedItem)) | ||
| indexOfCurrentSelectionParent = (MainTree.Items[0] as TreeViewItem).Items.IndexOf(treeItem); |
| item.IsExpanded = false; | ||
| } | ||
|
|
||
| private void MenuItem_ContextMenuOpened(object sender, RoutedEventArgs e) |
There was a problem hiding this comment.
please double check codestyle in this whole function, not gonna point it out in every instance.
Added a few options to the right click context menu for the TreeView on the left hand side of the screen.
New items I added:
Move up to {Previous Section}
Move down to {Next Section}
Collapse all
Collapse {Current Section}
Add: {CurrentSection}
Where Current/Previous/Next Section is replaced with the text of the that section such as "Sounds" "Tile sets" "Sprites", etc etc.
I also rearranged the MenuItem_*** methods to be alphabetically ordered. Which has created some visual clutter in this Pr which I probably should have avoided >.< oops, hah. First time trying to do a PR on github, so I guess I'm learning. hah