Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions scripts/implement.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Write-Host "Creating pull request..."
Run-Gh @(
"pr",
"create",
"--base", "ui-rewrite",
"--base", "main",
"--head", $BranchName,
"--title", "implementing $BranchName [$IssueNumber]",
"--body", "closes #$IssueNumber"
Expand All @@ -114,18 +114,18 @@ Run-Gh @(
)

# --------------------------------------------------
# 8. Switch back to ui-rewrite
# 8. Switch back to main
# --------------------------------------------------

Write-Host "Switching to ui-rewrite..."
Run-Git @("switch", "ui-rewrite")
Write-Host "Switching to main..."
Run-Git @("switch", "main")

# --------------------------------------------------
# 9. Get latest changes
# --------------------------------------------------

Write-Host "Pulling latest ui-rewrite..."
Run-Git @("pull", "origin", "ui-rewrite")
Write-Host "Pulling latest main..."
Run-Git @("pull", "origin", "main")

# --------------------------------------------------
# 10. Delete local feature branch
Expand All @@ -134,4 +134,4 @@ Run-Git @("pull", "origin", "ui-rewrite")
Write-Host ""
Write-Host "Successfully implemented issue #$IssueNumber." -ForegroundColor Green
Write-Host "Branch: $BranchName"
Write-Host "PR merged into: ui-rewrite"
Write-Host "PR merged into: main"
18 changes: 13 additions & 5 deletions src/TextForge.Desktop/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@
<StyleInclude Source="avares://Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml" />
</Application.Styles>
<Application.Resources>
<x:Double x:Key="SpacingXs">4</x:Double>
<x:Double x:Key="SpacingSm">8</x:Double>
<x:Double x:Key="SpacingMd">10</x:Double>
<x:Double x:Key="SpacingLg">12</x:Double>
<x:Double x:Key="SpacingXl">16</x:Double>
<!-- Primitive Double Tokens (Width, Height, Dimensions) -->
<x:Double x:Key="SpacingXsValue">4</x:Double>
<x:Double x:Key="SpacingSmValue">8</x:Double>
<x:Double x:Key="SpacingMdValue">10</x:Double>
<x:Double x:Key="SpacingLgValue">12</x:Double>
<x:Double x:Key="SpacingXlValue">16</x:Double>

<!-- Thickness Tokens (Padding, Margin) -->
<Thickness x:Key="SpacingXs">4</Thickness>
<Thickness x:Key="SpacingSm">8</Thickness>
<Thickness x:Key="SpacingMd">10</Thickness>
<Thickness x:Key="SpacingLg">12</Thickness>
<Thickness x:Key="SpacingXl">16</Thickness>

<Thickness x:Key="PaddingContainer">8</Thickness>
<Thickness x:Key="PaddingStatusBar">8,4</Thickness>
Expand Down
22 changes: 19 additions & 3 deletions src/TextForge.Desktop/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,26 @@ public partial class App : Application

public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
try
{
AvaloniaXamlLoader.Load(this);
}
catch (Exception ex)
{
Console.Error.WriteLine($"[App.Initialize] Failed to load App.axaml:\n{ex}");
throw;
}
}

public override void OnFrameworkInitializationCompleted()
{
var collection = new ServiceCollection();
try
{
var collection = new ServiceCollection();
collection.AddSingleton<IModulePaletteProvider, ModulePaletteService>();
collection.AddTransient<MainWindowViewModel>();
collection.AddTransient<MainWindow>();

Services = collection.BuildServiceProvider();

if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
Expand All @@ -36,5 +46,11 @@ public override void OnFrameworkInitializationCompleted()
}

base.OnFrameworkInitializationCompleted();
}
catch (Exception ex)
{
Console.Error.WriteLine($"[App.OnFrameworkInitializationCompleted] Failed to initialize application:\n{ex}");
throw;
}
}
}
42 changes: 38 additions & 4 deletions src/TextForge.Desktop/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,54 @@ namespace TextForge.Desktop;

sealed class Program
{

// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
public static void Main(string[] args)
{
try
{
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
catch (Exception ex)
{
Console.Error.WriteLine($"[Startup Crash]: {ex}");
LogFatalException("Startup Crash in BuildAvaloniaApp", ex);
throw;
}
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
{
LogFatalException("AppDomain.CurrentDomain.UnhandledException", e.ExceptionObject as Exception);
};
System.Threading.Tasks.TaskScheduler.UnobservedTaskException += (sender, e) =>
{
LogFatalException("TaskScheduler.UnobservedTaskException", e.Exception);
e.SetObserved();
};
}
private static void LogFatalException(string source, Exception? ex)
{
string message = $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] FATAL ERROR in {source}:\n{ex}\n\n";
Console.Error.WriteLine(message);
try
{
System.IO.File.AppendAllText("crash.log", message);
}
catch
{
// Fail silently if disk write is prohibited
}
}

// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
#if DEBUG
#if DEBUG
.WithDeveloperTools()
#endif
#endif
.WithInterFont()
.LogToTrace();
}
51 changes: 34 additions & 17 deletions src/TextForge.Desktop/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,56 @@
x:CompileBindings="True"
Title="TextForge"
Width="1024" Height="768"
Focusable="True"
>
Focusable="True">

<Grid RowDefinitions="Auto, *, Auto">
<!-- Toolbar Zone - Height: Auto -->
<Border Grid.Row="0" Background="#2D2D2D" Padding="{StaticResource PaddingContainer}">
<TextBlock Text="[Toolbar Zone - Height: Auto]" Foreground="White" HorizontalAlignment="Center"/>
<Border Grid.Row="0" Background="#2D2D2D" Padding="{StaticResource SpacingMd}">
<TextBlock Text="[Toolbar Zone - Height: Auto]" Foreground="White"
HorizontalAlignment="Center" />
</Border>

<!-- Main Content Zone - Height: * -->
<Border Grid.Row="1" Background="#1E1E1E" Padding="{StaticResource SpacingMd}">
<Border Grid.Row="1" Background="#1E1E1E" Padding="{StaticResource SpacingMd}">
<Grid ColumnDefinitions="Auto, Auto, Auto, 4*, Auto, 6*">
<Border Grid.Column="0" Background="#333333" Width="48">
<TextBlock Text="Act" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="Act" Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>

<Border Grid.Column="1" Background="#252526" Width="200">
<TextBlock Text="[Sidebar / Drawer]" Foreground="Gray" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="[Sidebar / Drawer]" Foreground="Gray"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<GridSplitter Grid.Column="2" Width="{StaticResource SpacingXs}" Background="#3E3E42" ResizeDirection="Columns"/>

<GridSplitter Grid.Column="2"
Width="{StaticResource SpacingXsValue}" Background="#3E3E42"
ResizeDirection="Columns" />

<Border Grid.Column="3" Background="#1E1E1E" MinWidth="200">
<TextBlock Text="[Editor Panel - 4* Space]" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="[Editor Panel - 4* Space]"
Foreground="White" HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<GridSplitter Grid.Column="4" Width="{StaticResource SpacingXs}" Background="#3E3E42" ResizeDirection="Columns"/>

<GridSplitter Grid.Column="4"
Width="{StaticResource SpacingXsValue}" Background="#3E3E42"
ResizeDirection="Columns" />

<Border Grid.Column="5" Background="#252526" MinWidth="200">
<TextBlock Text="[Preview Panel - 6* Space]" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="[Preview Panel - 6* Space]"
Foreground="White" HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>

</Grid>
</Border>

<!-- Status Bar Zone - Height: Auto -->
<Border Grid.Row="2" Background="#007ACC" Padding="{StaticResource PaddingStatusBar}">
<TextBlock Text="{Binding StatusMessage}" Foreground="White" HorizontalAlignment="Center"/>
</Border>

<!-- Status Bar Zone - Height: Auto -->
<Border Grid.Row="2" Background="#007ACC" Padding="{StaticResource SpacingSm}">
<TextBlock Text="{Binding StatusMessage}" Foreground="White"
HorizontalAlignment="Center" />
</Border>
</Grid>
</Window>
Loading