Skip to content

Commit

Permalink
Merge pull request #1092 from VladiStep/additionalNewTabs
Browse files Browse the repository at this point in the history
A possibility to open "General info" and "Global init" tabs as a new tab.
  • Loading branch information
Grossley authored Oct 31, 2022
2 parents dcc62ef + 7226c40 commit 892fa4f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
19 changes: 17 additions & 2 deletions UndertaleModTool/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@
<MenuItem Header="Copy name to clipboard" Click="MenuItem_CopyName_Click"/>
<MenuItem Header="Delete" Click="MenuItem_Delete_Click"/>
</ContextMenu>
<ContextMenu x:Key="StandaloneTabMenu">
<MenuItem Header="Open in new tab" Click="MenuItem_OpenInNewTab_Click"/>
</ContextMenu>

<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#D4D4D4"/>
<Style TargetType="{x:Type TreeViewItem}">
Expand All @@ -253,8 +256,20 @@
</Style>
</TreeView.Resources>
<TreeViewItem Header="Data" IsExpanded="True">
<TreeViewItem Header="General info" Visibility="{Binding GeneralInfo, Converter={StaticResource VisibleIfNotNull}}"/>
<TreeViewItem Header="Global init" Visibility="{Binding GlobalInitScripts, Converter={StaticResource VisibleIfNotNull}}"/>
<TreeViewItem Header="General info" Visibility="{Binding GeneralInfo, Converter={StaticResource VisibleIfNotNull}}" Tag="StandaloneTab">
<TreeViewItem.Style>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="ContextMenu" Value="{StaticResource StandaloneTabMenu}"/>
</Style>
</TreeViewItem.Style>
</TreeViewItem>
<TreeViewItem Header="Global init" Visibility="{Binding GlobalInitScripts, Converter={StaticResource VisibleIfNotNull}}" Tag="StandaloneTab">
<TreeViewItem.Style>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="ContextMenu" Value="{StaticResource StandaloneTabMenu}"/>
</Style>
</TreeViewItem.Style>
</TreeViewItem>
<TreeViewItem Header="Game End scripts" Visibility="{Binding GameEndScripts, Converter={StaticResource VisibleIfNotNull}}"/>
<TreeViewItem Header="Audio groups" ItemsSource="{Binding AudioGroups, Converter={StaticResource FilteredViewConverter}}" Visibility="{Binding AudioGroups, Converter={StaticResource VisibleIfNotNull}}">
<TreeViewItem.ItemTemplate>
Expand Down
3 changes: 2 additions & 1 deletion UndertaleModTool/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,8 @@ private void MainTree_MouseDown(object sender, MouseButtonEventArgs e)

item.IsSelected = true;

if (item.DataContext is not UndertaleResource)
if (item.DataContext is not UndertaleResource
&& (item.Tag as string) != "StandaloneTab")
return;

OpenInTab(Highlighted, true);
Expand Down

0 comments on commit 892fa4f

Please sign in to comment.