mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-03 01:55:00 +00:00
refactor(*): re-arrange project
This commit is contained in:
parent
7558bbd4f2
commit
5ce9cffcee
140 changed files with 4980 additions and 5003 deletions
294
src/UI/Launcher.xaml
Normal file
294
src/UI/Launcher.xaml
Normal file
|
@ -0,0 +1,294 @@
|
|||
<Window x:Class="SourceGit.UI.Launcher"
|
||||
x:Name="me"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:source="clr-namespace:SourceGit"
|
||||
mc:Ignorable="d"
|
||||
MinWidth="800" MinHeight="600"
|
||||
Title="Source Git"
|
||||
Width="{Binding Source={x:Static source:App.Preference}, Path=UIMainWindowWidth, Mode=TwoWay}"
|
||||
Height="{Binding Source={x:Static source:App.Preference}, Path=UIMainWindowHeight, Mode=TwoWay}"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
|
||||
<!-- Enable WindowChrome Feature -->
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome UseAeroCaptionButtons="False" CornerRadius="0" CaptionHeight="32"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<!-- Window Layout -->
|
||||
<Border Background="{StaticResource Brush.BG1}">
|
||||
|
||||
<!-- Fix Maximize BUG -->
|
||||
<Border.Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding WindowState, ElementName=me}" Value="Maximized">
|
||||
<Setter Property="Margin" Value="6"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding WindowState, ElementName=me}" Value="Normal">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
|
||||
<!-- Window Content -->
|
||||
<Grid Background="{StaticResource Brush.BG6}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition x:Name="openedTabsColumn" Width="*"/>
|
||||
<ColumnDefinition Width="32"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Tabs -->
|
||||
<ScrollViewer x:Name="openedTabsScroller" Grid.Column="0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled">
|
||||
<TabControl x:Name="openedTabs" Padding="0" ItemsSource="{Binding ElementName=me, Path=Tabs}" SizeChanged="OpenedTabsSizeChanged">
|
||||
<TabControl.Style>
|
||||
<Style TargetType="{x:Type TabControl}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabControl}">
|
||||
<Grid KeyboardNavigation.TabNavigation="Local" Height="32">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
x:Name="HeaderPanel"
|
||||
Grid.Row="0"
|
||||
Margin="6,4,0,0"
|
||||
IsItemsHost="True"
|
||||
KeyboardNavigation.TabIndex="1"
|
||||
Background="Transparent" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</TabControl.Style>
|
||||
|
||||
<TabControl.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TabItem}">
|
||||
<Setter Property="AllowDrop" Value="True"/>
|
||||
<Setter Property="IsSelected" Value="{Binding IsActive, Mode=TwoWay}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabItem}">
|
||||
<Grid x:Name="Container" Opacity=".7" Height="28" WindowChrome.IsHitTestVisibleInChrome="True">
|
||||
<Border x:Name="BG" Background="Transparent" BorderThickness="0" BorderBrush="{StaticResource Brush.BG3}" CornerRadius="4,4,0,0">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect ShadowDepth="2" Direction="30" Color="Black" Opacity=".3"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
|
||||
<Path
|
||||
x:Name="CornerLeft"
|
||||
Width="4"
|
||||
Height="4"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="-4,0,0,0"
|
||||
Data="M 0,4 L 4,4 4,0 C 4,0 4,4 0,4 Z"
|
||||
Fill="Transparent"/>
|
||||
|
||||
<Path
|
||||
x:Name="CornerRight"
|
||||
Width="4"
|
||||
Height="4"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,-4,0"
|
||||
Data="M 0,0 L 0,4 4,4 C 4,4 0,4 0,0 Z"
|
||||
Fill="Transparent"/>
|
||||
|
||||
<ContentPresenter
|
||||
x:Name="ContentSite"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
TextElement.Foreground="{DynamicResource Brush.FG}"
|
||||
TextElement.FontWeight="Bold"
|
||||
ContentSource="Header"
|
||||
Margin="4,0"
|
||||
RecognizesAccessKey="True" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.BG1}"/>
|
||||
<Setter TargetName="BG" Property="BorderThickness" Value="1,1,1,0"/>
|
||||
<Setter TargetName="Container" Property="Opacity" Value="1"/>
|
||||
<Setter TargetName="CornerLeft" Property="Fill" Value="{StaticResource Brush.BG1}"/>
|
||||
<Setter TargetName="CornerRight" Property="Fill" Value="{StaticResource Brush.BG1}"/>
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsSelected" Value="False"/>
|
||||
<Condition Property="IsMouseOver" Value="True"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.BG5}"/>
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<EventSetter Event="MouseMove" Handler="TabsMouseMove"/>
|
||||
<EventSetter Event="Drop" Handler="TabsDrop"/>
|
||||
</Style>
|
||||
</TabControl.ItemContainerStyle>
|
||||
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" Margin="6,0">
|
||||
<Path Grid.Column="0" Width="14" Height="14" x:Name="Icon" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Git}"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Title}" Foreground="{StaticResource Brush.FG}" Margin="8,0,0,0" FontWeight="Bold">
|
||||
<TextBlock.ToolTip>
|
||||
<ToolTip Content="{Binding Tooltip}" FontWeight="Normal"/>
|
||||
</TextBlock.ToolTip>
|
||||
</TextBlock>
|
||||
<Button x:Name="Closer" Margin="8,0,0,0" Grid.Column="2" Click="CloseRepo">
|
||||
<Button.ToolTip>
|
||||
<ToolTip Content="CLOSE" FontWeight="Normal"/>
|
||||
</Button.ToolTip>
|
||||
<Path Width="8" Height="8" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Close}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Repo}" Value="{x:Null}">
|
||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Git}"/>
|
||||
<Setter TargetName="Icon" Property="Fill" Value="#FFF05133"/>
|
||||
<Setter TargetName="Closer" Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</TabControl.ItemTemplate>
|
||||
</TabControl>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Tab scroller -->
|
||||
<StackPanel x:Name="openedTabsOpts" Grid.Column="1" VerticalAlignment="Bottom" Orientation="Horizontal" Height="28" Margin="4,0,0,0" WindowChrome.IsHitTestVisibleInChrome="True">
|
||||
<Button Click="ScrollToLeft">
|
||||
<Path Width="10" Height="12" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.ScrollLeft}"/>
|
||||
</Button>
|
||||
<Button Click="ScrollToRight">
|
||||
<Path Width="10" Height="12" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.ScrollRight}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Window Command -->
|
||||
<StackPanel
|
||||
Grid.Column="2"
|
||||
Margin="32,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right"
|
||||
Height="32"
|
||||
WindowChrome.IsHitTestVisibleInChrome="True">
|
||||
<Button Click="ShowPreference" Width="24" ToolTip="PREFERENCE">
|
||||
<Path Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Preference}"/>
|
||||
</Button>
|
||||
<Rectangle Width="1" Height="18" Margin="6,0" VerticalAlignment="Center" Fill="{StaticResource Brush.Border1}"/>
|
||||
<Button Click="ShowAbout" Width="24" ToolTip="ABOUT">
|
||||
<Path Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Info}"/>
|
||||
</Button>
|
||||
<Rectangle Width="1" Height="18" Margin="6,0" VerticalAlignment="Center" Fill="{StaticResource Brush.Border1}"/>
|
||||
<Button Click="Minimize" Width="32" Style="{StaticResource Style.Button.HighlightHover}">
|
||||
<Path Style="{StaticResource Style.WindowControlIcon}" Data="{StaticResource Icon.Minimize}"/>
|
||||
</Button>
|
||||
<Button Click="MaximizeOrRestore" Width="32" Style="{StaticResource Style.Button.HighlightHover}">
|
||||
<Path>
|
||||
<Path.Style>
|
||||
<Style TargetType="{x:Type Path}" BasedOn="{StaticResource Style.WindowControlIcon}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding WindowState, ElementName=me}" Value="Maximized">
|
||||
<Setter Property="Data" Value="{StaticResource Icon.Restore}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding WindowState, ElementName=me}" Value="Normal">
|
||||
<Setter Property="Data" Value="{StaticResource Icon.Maximize}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Path.Style>
|
||||
</Path>
|
||||
</Button>
|
||||
<Button Click="Quit" Width="32">
|
||||
<Button.Style>
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource Style.Button.HighlightHover}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Red"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
|
||||
<Path Width="10" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Close}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- Pages -->
|
||||
<ItemsControl Grid.Row="1" ItemsSource="{Binding ElementName=me, Path=Tabs}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Grid/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="Bool2Visible"/>
|
||||
</ItemsControl.Resources>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl Content="{Binding Page}" Visibility="{Binding IsActive, Converter={StaticResource Bool2Visible}}"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<!-- Alerts -->
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
Margin="0,32,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Panel.ZIndex="100">
|
||||
<ItemsControl Margin="4" Width="300" Height="Auto" ItemsSource="{Binding Errors, ElementName=me}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid x:Name="item" Height="Auto" Width="300" Margin="0,8,0,0">
|
||||
<Border Background="{StaticResource Brush.BG1}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="8" ShadowDepth="2" Direction="270"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
|
||||
<Grid Margin="8">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="26"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Content="ERROR" FontWeight="DemiBold"/>
|
||||
<TextBlock Grid.Row="1" Margin="6,8" Text="{Binding}" Foreground="{StaticResource Brush.FG}" TextWrapping="Wrap"/>
|
||||
<Button
|
||||
Grid.Row="2"
|
||||
Margin="4,0"
|
||||
Click="RemoveError"
|
||||
Content="CLOSE"
|
||||
Style="{StaticResource Style.Button.AccentBordered}"
|
||||
BorderBrush="{StaticResource Brush.FG}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
Loading…
Add table
Add a link
Reference in a new issue