Skip to content

Commit 1829344

Browse files
levinli303claude
andcommitted
Bubble OpenURL, GetInfo, ShowSubsystem events up to MainWindow
Remove fallback window creation from InfoControlStrip. All windows are now created by MainWindow with proper event wiring for time links. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 46db912 commit 1829344

23 files changed

Lines changed: 355 additions & 55 deletions

.DS_Store

8 KB
Binary file not shown.

.claude/commands/update-nuget.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Update all NuGet packages in packages.config files and the nuget patch files to their latest stable versions.
2+
3+
## Steps
4+
5+
1. Read all `packages.config` files (`CelestiaAppComponent/packages.config`, `CelestiaWinUI/packages.config`, `CelestiaComponent/packages.config`) to collect the current package IDs and versions.
6+
7+
2. For each unique package ID, fetch the latest stable version from NuGet:
8+
```
9+
https://api.nuget.org/v3-flatcontainer/{lowercase-package-id}/index.json
10+
```
11+
A stable version has no pre-release suffix (no `-preview`, `-experimental`, `-rtm`, etc.).
12+
13+
3. Compare current vs latest. Only proceed with packages where latest is strictly newer. Skip any package where the "latest" would be a downgrade.
14+
15+
4. Update the version strings in all three `packages.config` files.
16+
17+
5. Update the `.vcxproj` files (`CelestiaAppComponent/CelestiaAppComponent.vcxproj`, `CelestiaComponent/CelestiaComponent.vcxproj`, `CelestiaWinUI/CelestiaWinUI.vcxproj`) with the same version substitutions — these files contain package folder paths in `<Import>` and `<Error>` elements that must match the installed package versions.
18+
19+
6. Update the patch files `patches/nuget/nuget-x64.patch` and `patches/nuget/nuget-arm64.patch`:
20+
- Update the package folder path references (e.g. `Microsoft.WindowsAppSDK.WinUI.1.8.260204000``Microsoft.WindowsAppSDK.WinUI.1.8.260224000`)
21+
- Update `version="..."` attribute values in the packages.config context/added lines
22+
23+
7. Check `.github/workflows/build.yml` for any hardcoded package folder paths (e.g. `packages\Microsoft.Windows.SDK.BuildTools.10.0.26100.7463\bin\...`) and flag any that reference a package whose version was updated — but do NOT update them without user confirmation since the path structure may change between versions.
24+
25+
8. Report a summary of all version changes made, and note any packages skipped (pre-release only, or would be a downgrade).
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// CelestiaLogger.cpp
2+
//
3+
// Copyright (C) 2025, Celestia Development Team
4+
//
5+
// This program is free software; you can redistribute it and/or
6+
// modify it under the terms of the GNU General Public License
7+
// as published by the Free Software Foundation; either version 2
8+
// of the License, or (at your option) any later version.
9+
10+
#include "pch.h"
11+
#include "CelestiaLogger.h"
12+
#if __has_include("CelestiaLogger.g.cpp")
13+
#include "CelestiaLogger.g.cpp"
14+
#endif
15+
16+
#include "PathHelper.h"
17+
18+
static winrt::hstring logFilePath;
19+
20+
namespace winrt::CelestiaAppComponent::implementation
21+
{
22+
void CelestiaLogger::SetLogFilePath(hstring const& path)
23+
{
24+
logFilePath = path;
25+
}
26+
27+
void CelestiaLogger::Log(hstring const& message)
28+
{
29+
if (logFilePath.empty())
30+
return;
31+
32+
FILE* f = _wfopen(logFilePath.c_str(), L"a");
33+
if (f)
34+
{
35+
fprintf(f, "%ls\n", message.c_str());
36+
fclose(f);
37+
}
38+
}
39+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// CelestiaLogger.h
2+
//
3+
// Copyright (C) 2025, Celestia Development Team
4+
//
5+
// This program is free software; you can redistribute it and/or
6+
// modify it under the terms of the GNU General Public License
7+
// as published by the Free Software Foundation; either version 2
8+
// of the License, or (at your option) any later version.
9+
10+
#pragma once
11+
12+
#include "CelestiaLogger.g.h"
13+
14+
namespace winrt::CelestiaAppComponent::implementation
15+
{
16+
struct CelestiaLogger : CelestiaLoggerT<CelestiaLogger>
17+
{
18+
static void SetLogFilePath(hstring const& path);
19+
static void Log(hstring const& message);
20+
};
21+
}
22+
23+
namespace winrt::CelestiaAppComponent::factory_implementation
24+
{
25+
struct CelestiaLogger : CelestiaLoggerT<CelestiaLogger, implementation::CelestiaLogger>
26+
{
27+
};
28+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// CelestiaLogger.idl
2+
//
3+
// Copyright (C) 2025, Celestia Development Team
4+
//
5+
// This program is free software; you can redistribute it and/or
6+
// modify it under the terms of the GNU General Public License
7+
// as published by the Free Software Foundation; either version 2
8+
// of the License, or (at your option) any later version.
9+
10+
namespace CelestiaAppComponent
11+
{
12+
[default_interface]
13+
runtimeclass CelestiaLogger
14+
{
15+
static void SetLogFilePath(String path);
16+
static void Log(String message);
17+
}
18+
}

CelestiaWinUI/.DS_Store

16 KB
Binary file not shown.

CelestiaWinUI/BrowserItemUserControl.idl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ namespace CelestiaWinUI
2020
Microsoft.UI.Xaml.Interop.IBindableObservableVector RootItem{ get; };
2121

2222
event Windows.Foundation.EventHandler<InfoGetInfoArgs> GetInfo;
23+
event Windows.Foundation.EventHandler<InfoShowSubsystemArgs> ShowSubsystem;
24+
event Windows.Foundation.EventHandler<String> OpenURL;
2325
}
2426
}

CelestiaWinUI/BrowserItemUserControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
</DataTemplate>
1919
</TreeView.ItemTemplate>
2020
</TreeView>
21-
<local:InfoControlStrip x:Name="ControlStrip" ShowsGetInfo="True" RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True"/>
21+
<local:InfoControlStrip x:Name="ControlStrip" ShowsGetInfo="True" RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" GetInfo="ControlStrip_GetInfo" ShowSubsystem="ControlStrip_ShowSubsystem"/>
2222
</RelativePanel>
2323
</UserControl>

CelestiaWinUI/BrowserItemUserControl.xaml.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,34 @@ namespace winrt::CelestiaWinUI::implementation
8282
{
8383
getInfoEvent.remove(token);
8484
}
85+
86+
event_token BrowserItemUserControl::OpenURL(Windows::Foundation::EventHandler<hstring> const& handler)
87+
{
88+
return openURLEvent.add(handler);
89+
}
90+
91+
void BrowserItemUserControl::OpenURL(event_token const& token) noexcept
92+
{
93+
openURLEvent.remove(token);
94+
}
95+
96+
event_token BrowserItemUserControl::ShowSubsystem(Windows::Foundation::EventHandler<CelestiaWinUI::InfoShowSubsystemArgs> const& handler)
97+
{
98+
return showSubsystemEvent.add(handler);
99+
}
100+
101+
void BrowserItemUserControl::ShowSubsystem(event_token const& token) noexcept
102+
{
103+
showSubsystemEvent.remove(token);
104+
}
105+
106+
void BrowserItemUserControl::ControlStrip_GetInfo(IInspectable const&, CelestiaWinUI::InfoGetInfoArgs const& args)
107+
{
108+
getInfoEvent(*this, args);
109+
}
110+
111+
void BrowserItemUserControl::ControlStrip_ShowSubsystem(IInspectable const&, CelestiaWinUI::InfoShowSubsystemArgs const& args)
112+
{
113+
showSubsystemEvent(*this, args);
114+
}
85115
}

CelestiaWinUI/BrowserItemUserControl.xaml.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,22 @@ namespace winrt::CelestiaWinUI::implementation
2525

2626
event_token GetInfo(Windows::Foundation::EventHandler<CelestiaWinUI::InfoGetInfoArgs> const& handler);
2727
void GetInfo(event_token const& token) noexcept;
28+
event_token ShowSubsystem(Windows::Foundation::EventHandler<CelestiaWinUI::InfoShowSubsystemArgs> const& handler);
29+
void ShowSubsystem(event_token const& token) noexcept;
30+
event_token OpenURL(Windows::Foundation::EventHandler<hstring> const& handler);
31+
void OpenURL(event_token const& token) noexcept;
32+
33+
void ControlStrip_GetInfo(Windows::Foundation::IInspectable const&, CelestiaWinUI::InfoGetInfoArgs const&);
34+
void ControlStrip_ShowSubsystem(Windows::Foundation::IInspectable const&, CelestiaWinUI::InfoShowSubsystemArgs const&);
2835

2936
private:
3037
CelestiaComponent::CelestiaAppCore appCore;
3138
CelestiaComponent::CelestiaRenderer renderer;
3239
bool preserveMargin;
3340
Microsoft::UI::Xaml::Interop::IBindableObservableVector rootItem{ nullptr };
3441
event<Windows::Foundation::EventHandler<CelestiaWinUI::InfoGetInfoArgs>> getInfoEvent;
42+
event<Windows::Foundation::EventHandler<CelestiaWinUI::InfoShowSubsystemArgs>> showSubsystemEvent;
43+
event<Windows::Foundation::EventHandler<hstring>> openURLEvent;
3544
};
3645
}
3746

0 commit comments

Comments
 (0)