Files
EonaCat.JavaDecompile/MainWindow.xaml
T
2026-07-04 20:24:40 +02:00

452 lines
26 KiB
XML

<Window x:Class="EonaCat.JavaDecompile.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:editor="clr-namespace:EonaCat.Editor.Core;assembly=EonaCat.Editor"
Title="EonaCat.JavaDecompile"
Height="760" Width="1360"
WindowStyle="None"
Background="Transparent"
AllowsTransparency="True"
ResizeMode="CanResizeWithGrip"
Drop="OnDropJar"
PreviewDragOver="OnPreviewDragOver"
AllowDrop="True"
FontFamily="Cascadia Code">
<Window.Resources>
<!-- ===== Palette (CRT / disassembler inspired) ===== -->
<SolidColorBrush x:Key="BgBase" Color="#0B0B0C"/>
<SolidColorBrush x:Key="BgPanel" Color="#141416"/>
<SolidColorBrush x:Key="BgPanelAlt" Color="#1A1A1D"/>
<SolidColorBrush x:Key="BgField" Color="#1D1D20"/>
<SolidColorBrush x:Key="BorderHair" Color="#26262A"/>
<SolidColorBrush x:Key="BorderHairLt" Color="#333338"/>
<SolidColorBrush x:Key="Amber" Color="#FFB020"/>
<SolidColorBrush x:Key="AmberDim" Color="#8A5A12"/>
<SolidColorBrush x:Key="AmberFaint" Color="#2A2114"/>
<SolidColorBrush x:Key="TextPrimary" Color="#E8E6E1"/>
<SolidColorBrush x:Key="TextDim" Color="#8B8B90"/>
<SolidColorBrush x:Key="TextFaint" Color="#565659"/>
<SolidColorBrush x:Key="StatusOk" Color="#6FCF97"/>
<SolidColorBrush x:Key="StatusWarn" Color="#FF5C5C"/>
<!-- ===== Window chrome buttons (min / max / close) ===== -->
<Style x:Key="ChromeBtn" TargetType="Button">
<Setter Property="Width" Value="42"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource TextDim}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FontFamily" Value="Cascadia Code"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Bg" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bg" Property="Background" Value="#1E1E21"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ChromeCloseBtn" TargetType="Button" BasedOn="{StaticResource ChromeBtn}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Bg" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bg" Property="Background" Value="#5A1F1F"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ===== Flat action button (Open JAR / toolbar) ===== -->
<Style x:Key="FlatAction" TargetType="Button">
<Setter Property="Background" Value="{StaticResource BgField}"/>
<Setter Property="Foreground" Value="{StaticResource TextPrimary}"/>
<Setter Property="BorderBrush" Value="{StaticResource BorderHairLt}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="12,0"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FontFamily" Value="Cascadia Code"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="B" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="{TemplateBinding Padding}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="B" Property="BorderBrush" Value="{StaticResource Amber}"/>
<Setter TargetName="B" Property="Background" Value="{StaticResource AmberFaint}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="B" Property="Background" Value="#332711"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ===== Ghost icon button (toolbar copy / wrap) ===== -->
<Style x:Key="GhostIconBtn" TargetType="Button">
<Setter Property="Width" Value="30"/>
<Setter Property="Height" Value="30"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="B" Background="{TemplateBinding Background}" CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="B" Property="Background" Value="{StaticResource BgField}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ===== Search / filter box ===== -->
<Style x:Key="SearchBox" TargetType="TextBox">
<Setter Property="Background" Value="{StaticResource BgField}"/>
<Setter Property="Foreground" Value="{StaticResource TextPrimary}"/>
<Setter Property="CaretBrush" Value="{StaticResource Amber}"/>
<Setter Property="BorderBrush" Value="{StaticResource BorderHairLt}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="8,0,28,0"/>
<Setter Property="Height" Value="30"/>
<Setter Property="FontFamily" Value="Cascadia Code"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border x:Name="B" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter TargetName="B" Property="BorderBrush" Value="{StaticResource AmberDim}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ===== TreeView theme ===== -->
<Style x:Key="AmberTreeItem" TargetType="TreeViewItem">
<Setter Property="Foreground" Value="{StaticResource TextPrimary}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="4,3"/>
<Setter Property="FontSize" Value="12.5"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<StackPanel>
<Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="3"
BorderThickness="0,0,0,0">
<Grid Margin="2,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ToggleButton x:Name="Expander"
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
ClickMode="Press" Width="16" Margin="2,0,2,0">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<TextBlock x:Name="Arrow" Text="&#9656;" Foreground="{StaticResource TextFaint}"
FontSize="10" RenderTransformOrigin="0.5,0.5"/>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Arrow" Property="Text" Value="&#9662;"/>
<Setter TargetName="Arrow" Property="Foreground" Value="{StaticResource Amber}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<ContentPresenter x:Name="Head" Grid.Column="1" ContentSource="Header"
VerticalAlignment="Center" Margin="2,4,0,4"/>
</Grid>
</Border>
<ItemsPresenter x:Name="Items" Margin="18,0,0,0"/>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="False">
<Setter TargetName="Items" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="HasItems" Value="False">
<Setter TargetName="Expander" Property="Visibility" Value="Hidden"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{StaticResource AmberFaint}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#1D1D20"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ===== Thin dark scrollbars ===== -->
<Style TargetType="ScrollBar">
<Setter Property="Width" Value="10"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollBar">
<Grid Background="Transparent">
<Track x:Name="PART_Track" IsDirectionReversed="True">
<Track.Thumb>
<Thumb>
<Thumb.Template>
<ControlTemplate TargetType="Thumb">
<Border Background="#3A3A3E" CornerRadius="4" Margin="2"/>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid Margin="14">
<Border x:Name="Root" CornerRadius="10" Background="{StaticResource BgBase}"
BorderBrush="{StaticResource BorderHair}" BorderThickness="1">
<Border.Effect>
<DropShadowEffect Color="#000000" Opacity="0.55" BlurRadius="28" ShadowDepth="6" Direction="270"/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="52"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
<RowDefinition Height="26"/>
</Grid.RowDefinitions>
<!-- ================= TITLE BAR ================= -->
<Grid Grid.Row="0" Background="{StaticResource BgPanel}" MouseDown="DragWindow">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="16,0,0,0">
<Image x:Name="IconLogo" Height="20" Width="20" Margin="0,0,10,0"/>
<TextBlock Text="EONACAT" Foreground="{StaticResource TextPrimary}" FontWeight="Bold" FontSize="13" VerticalAlignment="Center"/>
<TextBlock Text="/" Foreground="{StaticResource TextFaint}" Margin="6,0" VerticalAlignment="Center"/>
<TextBlock Text="JavaDecompile" Foreground="{StaticResource Amber}" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="18,0,0,0">
<Button Style="{StaticResource FlatAction}" Click="OpenJarClick">
<StackPanel Orientation="Horizontal">
<Image x:Name="IconFile" Width="14" Height="14" Margin="0,0,7,0"/>
<TextBlock Text="OPEN JAR" VerticalAlignment="Center"/>
</StackPanel>
</Button>
</StackPanel>
<!-- Breadcrumb of the currently viewed class -->
<TextBlock x:Name="BreadcrumbText"
Grid.Column="2"
Text="no file loaded"
Foreground="{StaticResource TextDim}"
FontSize="12"
VerticalAlignment="Center"
HorizontalAlignment="Center"
TextTrimming="CharacterEllipsis"/>
<StackPanel Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,6,0">
<Button Style="{StaticResource ChromeBtn}" Click="ToggleMaximize" Content="&#xE922;" FontFamily="Segoe MDL2 Assets" FontSize="11"/>
<Button Style="{StaticResource ChromeCloseBtn}" Click="CloseApp" Content="&#xE8BB;" FontFamily="Segoe MDL2 Assets" FontSize="11"/>
</StackPanel>
</Grid>
<Rectangle Grid.Row="1" Fill="{StaticResource BorderHair}"/>
<!-- ================= BODY ================= -->
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- ===== Sidebar ===== -->
<Grid Grid.Column="0" Background="{StaticResource BgPanel}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="10,10,10,8">
<TextBox x:Name="FilterBox" Style="{StaticResource SearchBox}" TextChanged="FilterBox_TextChanged"/>
<TextBlock Text="filter classes..." Foreground="{StaticResource TextFaint}"
FontSize="12" Margin="10,0,0,0" VerticalAlignment="Center" IsHitTestVisible="False">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding Text.Length, ElementName=FilterBox}" Value="0">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding Text.Length, ElementName=FilterBox}" Value="0" >
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
<Setter Property="Visibility" Value="Collapsed"/>
</Style>
</TextBlock.Style>
</TextBlock>
<Image x:Name="IconFilter" Height="13" Width="13"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,10,0" IsHitTestVisible="False"/>
</Grid>
<TreeView x:Name="JarTree" Grid.Row="1"
Background="Transparent"
BorderThickness="0"
Margin="4,0,0,6"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
Foreground="{StaticResource TextPrimary}"
FontSize="12.5"
ItemContainerStyle="{StaticResource AmberTreeItem}"
SelectedItemChanged="JarTree_SelectedItemChanged"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling"
ScrollViewer.CanContentScroll="True"
SnapsToDevicePixels="True"/>
</Grid>
<Rectangle Grid.Column="1" Fill="{StaticResource BorderHair}"/>
<!-- ===== Main viewer ===== -->
<Grid Grid.Column="2" Background="{StaticResource BgBase}">
<Grid.RowDefinitions>
<RowDefinition Height="42"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Toolbar -->
<Grid Grid.Row="0" Margin="14,0,10,0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Ellipse Width="7" Height="7" Fill="{StaticResource Amber}" VerticalAlignment="Center" Margin="0,0,9,0"/>
<TextBlock x:Name="ViewerTitleText" Text="Java Code / Resource View"
Foreground="{StaticResource TextPrimary}" FontWeight="SemiBold" FontSize="12.5" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
<Rectangle Grid.Row="1" Fill="{StaticResource BorderHair}"/>
<Grid Grid.Row="2">
<editor:TextEditor x:Name="CodeViewer"
ShowLineNumbers="True"
IsReadOnly="True"
FontFamily="Cascadia Code"
FontSize="13.5"
Foreground="{StaticResource TextPrimary}"
Background="{StaticResource BgBase}"
TextOptions.TextFormattingMode="Display"
LineNumbersForeground="{StaticResource AmberDim}"
BorderThickness="0"
Padding="14,10,10,10"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"/>
<Image x:Name="ImageViewer"
Stretch="Uniform"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- Empty state: signature "waiting cursor" -->
<StackPanel x:Name="EmptyState" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="drop a .jar or " Foreground="{StaticResource TextFaint}" FontSize="13"/>
<TextBlock Text="open one" Foreground="{StaticResource TextDim}" FontSize="13" TextDecorations="Underline"/>
<TextBlock Text=" to begin" Foreground="{StaticResource TextFaint}" FontSize="13" Margin="0,0,6,0"/>
<Rectangle x:Name="BlinkCaret" Width="8" Height="16" Fill="{StaticResource Amber}">
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.Loaded">
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetProperty="Opacity"
From="1" To="0" Duration="0:0:0.55" AutoReverse="True"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</StackPanel>
</Grid>
</Grid>
</Grid>
<!-- ================= STATUS BAR ================= -->
<Grid Grid.Row="3" Background="{StaticResource BgPanel}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="14,0,0,0" VerticalAlignment="Center">
<Ellipse x:Name="StatusDot" Width="6" Height="6" Fill="{StaticResource StatusOk}" VerticalAlignment="Center" Margin="0,0,7,0"/>
<TextBlock x:Name="StatusText" Text="Ready" Foreground="{StaticResource TextDim}" FontSize="11"/>
</StackPanel>
<TextBlock x:Name="ClassCountText" Grid.Column="1" Text="" Foreground="{StaticResource TextFaint}"
FontSize="11" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock x:Name="JarSizeText" Grid.Column="2" Text="" Foreground="{StaticResource TextFaint}"
FontSize="11" Margin="0,0,14,0" VerticalAlignment="Center"/>
</Grid>
</Grid>
</Border>
</Grid>
</Window>