Updating ProjectBrowser

This commit is contained in:
2026-02-04 19:08:18 +09:00
parent 59991f47d5
commit eadd13931f
30 changed files with 382 additions and 139 deletions

View File

@@ -0,0 +1,23 @@
using Ghost.Editor.Core;
namespace Ghost.Editor.View.Controls;
internal partial class ProjectBrowser
{
[ContextMenuItem("project-browser", "Show in Explorer")]
private static void ShowInExplorer()
{
var path = LastFocused?.ViewModel.CurrentDirectoryPath;
if (!Directory.Exists(path))
{
return;
}
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo()
{
FileName = path,
UseShellExecute = true,
Verb = "open"
});
}
}

View File

@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<UserControl
x:Class="Ghost.Editor.Controls.ProjectBrowser"
x:Class="Ghost.Editor.View.Controls.ProjectBrowser"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:community="using:CommunityToolkit.WinUI.Controls"
xmlns:converter="using:Ghost.Editor.Utilities.Converters"
xmlns:ctc="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Ghost.Editor.Controls"
xmlns:ghost="using:Ghost.Editor.Core.Controls"
xmlns:local="using:Ghost.Editor.View.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:model="using:Ghost.Editor.Models"
xmlns:sys="using:System"
@@ -164,13 +165,13 @@
</MenuFlyout>
</Grid.ContextFlyout>
<ctc:ConstrainedBox Grid.Row="0" AspectRatio="1:1">
<community:ConstrainedBox Grid.Row="0" AspectRatio="1:1">
<Image HorizontalAlignment="Center">
<Image.Source>
<BitmapImage DecodePixelWidth="48" UriSource="{x:Bind Converter={StaticResource ExplorerItemToIconUriConverter}}" />
</Image.Source>
</Image>
</ctc:ConstrainedBox>
</community:ConstrainedBox>
<TextBlock
Grid.Row="1"
HorizontalAlignment="Center"
@@ -190,7 +191,7 @@
MinRowSpacing="4" />
</ItemsView.Layout>
<ItemsView.ContextFlyout>
<MenuFlyout>
<ghost:ContextFlyout Tag="project-browser">
<MenuFlyoutSubItem Text="Create">
<MenuFlyoutItem Text="Folder" />
<MenuFlyoutItem Text="Script" />
@@ -199,11 +200,8 @@
<MenuFlyoutItem Text="Volume Profile" />
</MenuFlyoutSubItem>
</MenuFlyoutSubItem>
<MenuFlyoutItem Text="Show in Explorer" />
<MenuFlyoutSeparator />
<MenuFlyoutItem Text="Refresh" />
<MenuFlyoutItem Text="Reimport All" />
</MenuFlyout>
</ghost:ContextFlyout>
</ItemsView.ContextFlyout>
</ItemsView>

View File

@@ -3,11 +3,18 @@ using Ghost.Editor.Models;
using Ghost.Editor.ViewModels.Controls;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
namespace Ghost.Editor.Controls;
namespace Ghost.Editor.View.Controls;
internal sealed partial class ProjectBrowser : UserControl
{
public static ProjectBrowser? LastFocused
{
get;
private set;
}
private readonly IInspectorService _inspectorService;
private bool _isUpdatingSelection = false;
@@ -25,6 +32,18 @@ internal sealed partial class ProjectBrowser : UserControl
Loaded += ProjectBrowser_Loaded;
Unloaded += ProjectBrowser_Unloaded;
GettingFocus += ProjectBrowser_GettingFocus;
}
private void ProjectBrowser_GettingFocus(UIElement sender, GettingFocusEventArgs args)
{
if (_isUpdatingSelection)
{
return;
}
LastFocused = this;
}
private void ProjectBrowser_Loaded(object sender, RoutedEventArgs e)

View File

@@ -4,7 +4,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:internal="using:Ghost.Editor.Controls.Internal"
xmlns:internal="using:Ghost.Editor.Controls"
xmlns:local="using:Ghost.Editor.View.Pages.EngineEditor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sg="using:Ghost.Editor.Core.SceneGraph"

View File

@@ -1,4 +1,4 @@
using Ghost.Editor.Controls.Internal;
using Ghost.Editor.Controls;
using Ghost.Editor.Core.Contracts;
using Ghost.Editor.Core.SceneGraph;
using Ghost.Editor.ViewModels.Pages.EngineEditor;

View File

@@ -4,7 +4,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:internal="using:Ghost.Editor.Controls.Internal"
xmlns:internal="using:Ghost.Editor.Controls"
xmlns:local="using:Ghost.Editor.View.Pages.EngineEditor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

View File

@@ -1,4 +1,4 @@
using Ghost.Editor.Controls.Internal;
using Ghost.Editor.Controls;
using Ghost.Editor.ViewModels.Pages.EngineEditor;
namespace Ghost.Editor.View.Pages.EngineEditor;

View File

@@ -4,7 +4,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:internal="using:Ghost.Editor.Controls.Internal"
xmlns:internal="using:Ghost.Editor.Controls"
xmlns:local="using:Ghost.Editor.View.Pages.EngineEditor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

View File

@@ -1,4 +1,4 @@
using Ghost.Editor.Controls.Internal;
using Ghost.Editor.Controls;
//using Ghost.Graphics.Contracts;
//using Microsoft.UI.Xaml;
//using Microsoft.UI.Xaml.Controls;

View File

@@ -4,12 +4,12 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="using:CommunityToolkit.WinUI.Behaviors"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:controls1="using:Ghost.Editor.Controls"
xmlns:controls="using:Ghost.Editor.View.Controls"
xmlns:ctc="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ee="using:Ghost.Editor.View.Pages.EngineEditor"
xmlns:ghost="using:Ghost.Editor.Controls"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:internal="using:Ghost.Editor.Controls.Internal"
xmlns:local="using:Ghost.Editor.View.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winex="using:WinUIEx"
@@ -43,25 +43,25 @@
Grid.Row="1"
Padding="4,0,4,4"
Background="{ThemeResource AcrylicBackgroundFillColorBaseBrush}">
<controls:TabbedCommandBar>
<controls:TabbedCommandBar.MenuItems>
<controls:TabbedCommandBarItem Header="Home">
<ctc:TabbedCommandBar>
<ctc:TabbedCommandBar.MenuItems>
<ctc:TabbedCommandBarItem Header="Home">
<AppBarButton Label="Undo" />
<AppBarButton Label="Redo" />
<AppBarButton Label="Paste" />
</controls:TabbedCommandBarItem>
<controls:TabbedCommandBarItem Header="Home">
</ctc:TabbedCommandBarItem>
<ctc:TabbedCommandBarItem Header="Home">
<AppBarButton Label="Undo" />
<AppBarButton Label="Redo" />
<AppBarButton Label="Paste" />
</controls:TabbedCommandBarItem>
<controls:TabbedCommandBarItem Header="Home">
</ctc:TabbedCommandBarItem>
<ctc:TabbedCommandBarItem Header="Home">
<AppBarButton Label="Undo" />
<AppBarButton Label="Redo" />
<AppBarButton Label="Paste" />
</controls:TabbedCommandBarItem>
</controls:TabbedCommandBar.MenuItems>
</controls:TabbedCommandBar>
</ctc:TabbedCommandBarItem>
</ctc:TabbedCommandBar.MenuItems>
</ctc:TabbedCommandBar>
</Grid>
<!-- Editor -->
@@ -78,52 +78,52 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<internal:NavigationTabView
<ghost:NavigationTabView
Grid.Column="0"
Width="350"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<internal:NavigationTabView.TabItems>
<ghost:NavigationTabView.TabItems>
<ee:HierarchyPage Header="Hierarchy">
<ee:HierarchyPage.IconSource>
<FontIconSource Glyph="&#xE8A4;" />
</ee:HierarchyPage.IconSource>
</ee:HierarchyPage>
</internal:NavigationTabView.TabItems>
</internal:NavigationTabView>
</ghost:NavigationTabView.TabItems>
</ghost:NavigationTabView>
<internal:NavigationTabView Grid.Column="1">
<internal:NavigationTabView.TabItems>
<ghost:NavigationTabView Grid.Column="1">
<ghost:NavigationTabView.TabItems>
<ee:ScenePage Header="Scene">
<ee:ScenePage.IconSource>
<FontIconSource Glyph="&#xF159;" />
</ee:ScenePage.IconSource>
</ee:ScenePage>
</internal:NavigationTabView.TabItems>
</internal:NavigationTabView>
</ghost:NavigationTabView.TabItems>
</ghost:NavigationTabView>
<internal:NavigationTabView
<ghost:NavigationTabView
Grid.Column="2"
Width="350"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<internal:NavigationTabView.TabItems>
<ghost:NavigationTabView.TabItems>
<ee:InspectorPage Header="Inspector">
<ee:InspectorPage.IconSource>
<FontIconSource Glyph="&#xEC7A;" />
</ee:InspectorPage.IconSource>
</ee:InspectorPage>
</internal:NavigationTabView.TabItems>
</internal:NavigationTabView>
</ghost:NavigationTabView.TabItems>
</ghost:NavigationTabView>
</Grid>
<internal:NavigationTabView Grid.Row="1" Height="350">
<internal:NavigationTabView.TabItems>
<ghost:NavigationTabView Grid.Row="1" Height="350">
<ghost:NavigationTabView.TabItems>
<TabViewItem Header="Project">
<TabViewItem.IconSource>
<FontIconSource Glyph="&#xEC50;" />
</TabViewItem.IconSource>
<controls1:ProjectBrowser />
<controls:ProjectBrowser />
</TabViewItem>
<TabViewItem Header="Console">
<TabViewItem.IconSource>
@@ -131,8 +131,8 @@
</TabViewItem.IconSource>
<ee:ConsolePage />
</TabViewItem>
</internal:NavigationTabView.TabItems>
</internal:NavigationTabView>
</ghost:NavigationTabView.TabItems>
</ghost:NavigationTabView>
</Grid>
<!-- Status Bar -->

View File

@@ -1,7 +1,6 @@
using Ghost.Editor.Core;
using Microsoft.UI.Xaml;
using Windows.ApplicationModel;
using Windows.Storage;
using WinUIEx;
namespace Ghost.Editor.View.Windows;
@@ -20,7 +19,7 @@ internal sealed partial class SplashWindow : WindowEx
IsMinimizable = false;
ExtendsContentIntoTitleBar = true;
//this.CenterOnScreen(750, 400);
this.CenterOnScreen(750, 400);
}
private void MainGrid_Loaded(object sender, RoutedEventArgs e)