mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
feature(Launcher): enable scroll for tabs in title bar
This commit is contained in:
parent
5066b974a1
commit
6d54207b50
4 changed files with 140 additions and 111 deletions
|
@ -2,7 +2,10 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<Geometry x:Key="Icon.Git">M1004.824 466.4L557.72 19.328c-25.728-25.76-67.488-25.76-93.28 0L360.568 123.2l78.176 78.176c12.544-5.984 26.56-9.376 41.376-9.376 53.024 0 96 42.976 96 96 0 14.816-3.36 28.864-9.376 41.376l127.968 127.968c12.544-5.984 26.56-9.376 41.376-9.376 53.024 0 96 42.976 96 96s-42.976 96-96 96-96-42.976-96-96c0-14.816 3.36-28.864 9.376-41.376L521.496 374.624a88.837 88.837 0 0 1-9.376 3.872v266.976c37.28 13.184 64 48.704 64 90.528 0 53.024-42.976 96-96 96s-96-42.976-96-96c0-41.792 26.72-77.344 64-90.528V378.496c-37.28-13.184-64-48.704-64-90.528 0-14.816 3.36-28.864 9.376-41.376l-78.176-78.176L19.416 464.288c-25.76 25.792-25.76 67.52 0 93.28l447.136 447.072c25.728 25.76 67.488 25.76 93.28 0l444.992-444.992c25.76-25.76 25.76-67.552 0-93.28z</Geometry>
|
<Geometry x:Key="Icon.Git">M1004.824 466.4L557.72 19.328c-25.728-25.76-67.488-25.76-93.28 0L360.568 123.2l78.176 78.176c12.544-5.984 26.56-9.376 41.376-9.376 53.024 0 96 42.976 96 96 0 14.816-3.36 28.864-9.376 41.376l127.968 127.968c12.544-5.984 26.56-9.376 41.376-9.376 53.024 0 96 42.976 96 96s-42.976 96-96 96-96-42.976-96-96c0-14.816 3.36-28.864 9.376-41.376L521.496 374.624a88.837 88.837 0 0 1-9.376 3.872v266.976c37.28 13.184 64 48.704 64 90.528 0 53.024-42.976 96-96 96s-96-42.976-96-96c0-41.792 26.72-77.344 64-90.528V378.496c-37.28-13.184-64-48.704-64-90.528 0-14.816 3.36-28.864 9.376-41.376l-78.176-78.176L19.416 464.288c-25.76 25.792-25.76 67.52 0 93.28l447.136 447.072c25.728 25.76 67.488 25.76 93.28 0l444.992-444.992c25.76-25.76 25.76-67.552 0-93.28z</Geometry>
|
||||||
<Geometry x:Key="Icon.Submodule">M557.696 545.347L789.873 402.66c23.998-14.999 31.297-46.496 16.398-70.493-14.798-23.798-45.995-31.197-69.993-16.699L506.501 456.555 277.123 315.37c-24.098-14.798-55.595-7.3-70.493 16.799-14.799 24.097-7.3 55.594 16.798 70.493l231.778 142.586V819.12c0 28.297 22.897 51.195 51.195 51.195 28.297 0 51.195-22.898 51.195-51.195V545.347h0.1zM506.5 0l443.356 255.975v511.95L506.501 1023.9 63.144 767.925v-511.95L506.5 0z</Geometry>
|
<Geometry x:Key="Icon.Submodule">M557.696 545.347L789.873 402.66c23.998-14.999 31.297-46.496 16.398-70.493-14.798-23.798-45.995-31.197-69.993-16.699L506.501 456.555 277.123 315.37c-24.098-14.798-55.595-7.3-70.493 16.799-14.799 24.097-7.3 55.594 16.798 70.493l231.778 142.586V819.12c0 28.297 22.897 51.195 51.195 51.195 28.297 0 51.195-22.898 51.195-51.195V545.347h0.1zM506.5 0l443.356 255.975v511.95L506.501 1023.9 63.144 767.925v-511.95L506.5 0z</Geometry>
|
||||||
|
|
||||||
|
<Geometry x:Key="Icon.ScrollLeft">M753.613 996.727L269.38 511.505 754.602 27.272z</Geometry>
|
||||||
|
<Geometry x:Key="Icon.ScrollRight">M270.387 27.273L754.62 512.495 269.398 996.728z</Geometry>
|
||||||
|
|
||||||
<Geometry x:Key="Icon.Minimize">F1M0,6L0,9 9,9 9,6 0,6z</Geometry>
|
<Geometry x:Key="Icon.Minimize">F1M0,6L0,9 9,9 9,6 0,6z</Geometry>
|
||||||
<Geometry x:Key="Icon.Maximize">F1M0,0L0,9 9,9 9,0 0,0 0,3 8,3 8,8 1,8 1,3z</Geometry>
|
<Geometry x:Key="Icon.Maximize">F1M0,0L0,9 9,9 9,0 0,0 0,3 8,3 8,8 1,8 1,3z</Geometry>
|
||||||
<Geometry x:Key="Icon.Restore">F1M0,10L0,3 3,3 3,0 10,0 10,2 4,2 4,3 7,3 7,6 6,6 6,5 1,5 1,10z M1,10L7,10 7,7 10,7 10,2 9,2 9,6 6,6 6,9 1,9z</Geometry>
|
<Geometry x:Key="Icon.Restore">F1M0,10L0,3 3,3 3,0 10,0 10,2 4,2 4,3 7,3 7,6 6,6 6,5 1,5 1,10z M1,10L7,10 7,7 10,7 10,2 9,2 9,6 6,6 6,9 1,9z</Geometry>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<Description>OpenSource GIT client for Windows</Description>
|
<Description>OpenSource GIT client for Windows</Description>
|
||||||
<Copyright>Copyright © sourcegit 2020. All rights reserved.</Copyright>
|
<Copyright>Copyright © sourcegit 2020. All rights reserved.</Copyright>
|
||||||
<ApplicationManifest>App.manifest</ApplicationManifest>
|
<ApplicationManifest>App.manifest</ApplicationManifest>
|
||||||
<Version>1.4</Version>
|
<Version>1.5</Version>
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
|
|
@ -43,132 +43,140 @@
|
||||||
|
|
||||||
<Grid Grid.Row="0">
|
<Grid Grid.Row="0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition x:Name="openedTabsColumn" Width="*"/>
|
||||||
|
<ColumnDefinition Width="32"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<!-- Tabs -->
|
<!-- Tabs -->
|
||||||
<TabControl
|
<ScrollViewer x:Name="openedTabsScroller" Grid.Column="0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled">
|
||||||
x:Name="openedTabs"
|
<TabControl x:Name="openedTabs" Padding="0" ItemsSource="{Binding ElementName=me, Path=Tabs}" SizeChanged="OpenedTabsSizeChanged">
|
||||||
Grid.Column="0"
|
<TabControl.Style>
|
||||||
Padding="0"
|
<Style TargetType="{x:Type TabControl}">
|
||||||
ItemsSource="{Binding ElementName=me, Path=Tabs}">
|
<Setter Property="Template">
|
||||||
<TabControl.Style>
|
<Setter.Value>
|
||||||
<Style TargetType="{x:Type TabControl}">
|
<ControlTemplate TargetType="{x:Type TabControl}">
|
||||||
<Setter Property="Template">
|
<Grid KeyboardNavigation.TabNavigation="Local" Height="32">
|
||||||
<Setter.Value>
|
<StackPanel Orientation="Horizontal"
|
||||||
<ControlTemplate TargetType="{x:Type TabControl}">
|
x:Name="HeaderPanel"
|
||||||
<Grid KeyboardNavigation.TabNavigation="Local" Height="32">
|
Grid.Row="0"
|
||||||
<StackPanel Orientation="Horizontal"
|
Margin="6,4,0,0"
|
||||||
x:Name="HeaderPanel"
|
IsItemsHost="True"
|
||||||
Grid.Row="0"
|
KeyboardNavigation.TabIndex="1"
|
||||||
Margin="6,4,0,0"
|
Background="Transparent" />
|
||||||
IsItemsHost="True"
|
</Grid>
|
||||||
KeyboardNavigation.TabIndex="1"
|
</ControlTemplate>
|
||||||
Background="Transparent" />
|
</Setter.Value>
|
||||||
</Grid>
|
</Setter>
|
||||||
</ControlTemplate>
|
</Style>
|
||||||
</Setter.Value>
|
</TabControl.Style>
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
</TabControl.Style>
|
|
||||||
|
|
||||||
<TabControl.ItemContainerStyle>
|
<TabControl.ItemContainerStyle>
|
||||||
<Style TargetType="{x:Type TabItem}">
|
<Style TargetType="{x:Type TabItem}">
|
||||||
<Setter Property="AllowDrop" Value="True"/>
|
<Setter Property="AllowDrop" Value="True"/>
|
||||||
<Setter Property="IsSelected" Value="{Binding IsActive, Mode=TwoWay}"/>
|
<Setter Property="IsSelected" Value="{Binding IsActive, Mode=TwoWay}"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="{x:Type TabItem}">
|
<ControlTemplate TargetType="{x:Type TabItem}">
|
||||||
<Grid x:Name="Container" Opacity=".7" Height="28" WindowChrome.IsHitTestVisibleInChrome="True">
|
<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 x:Name="BG" Background="Transparent" BorderThickness="0" BorderBrush="{StaticResource Brush.BG3}" CornerRadius="4,4,0,0">
|
||||||
<Border.Effect>
|
<Border.Effect>
|
||||||
<DropShadowEffect ShadowDepth="2" Direction="90" Color="Black" Opacity=".3"/>
|
<DropShadowEffect ShadowDepth="2" Direction="90" Color="Black" Opacity=".3"/>
|
||||||
</Border.Effect>
|
</Border.Effect>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Path
|
<Path
|
||||||
x:Name="CornerLeft"
|
x:Name="CornerLeft"
|
||||||
Width="4"
|
Width="4"
|
||||||
Height="4"
|
Height="4"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Margin="-4,0,0,0"
|
Margin="-4,0,0,0"
|
||||||
Data="M 0,4 L 4,4 4,0 C 4,0 4,4 0,4 Z"
|
Data="M 0,4 L 4,4 4,0 C 4,0 4,4 0,4 Z"
|
||||||
Fill="Transparent"/>
|
Fill="Transparent"/>
|
||||||
|
|
||||||
<Path
|
<Path
|
||||||
x:Name="CornerRight"
|
x:Name="CornerRight"
|
||||||
Width="4"
|
Width="4"
|
||||||
Height="4"
|
Height="4"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Margin="0,0,-4,0"
|
Margin="0,0,-4,0"
|
||||||
Data="M 0,0 L 0,4 4,4 C 4,4 0,4 0,0 Z"
|
Data="M 0,0 L 0,4 4,4 C 4,4 0,4 0,0 Z"
|
||||||
Fill="Transparent"/>
|
Fill="Transparent"/>
|
||||||
|
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
x:Name="ContentSite"
|
x:Name="ContentSite"
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Center"
|
VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||||
TextElement.Foreground="{DynamicResource Brush.FG}"
|
TextElement.Foreground="{DynamicResource Brush.FG}"
|
||||||
TextElement.FontWeight="Bold"
|
TextElement.FontWeight="Bold"
|
||||||
ContentSource="Header"
|
ContentSource="Header"
|
||||||
Margin="4,0"
|
Margin="4,0"
|
||||||
RecognizesAccessKey="True" />
|
RecognizesAccessKey="True" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="IsSelected" Value="True">
|
<Trigger Property="IsSelected" Value="True">
|
||||||
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.BG1}"/>
|
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.BG1}"/>
|
||||||
<Setter TargetName="BG" Property="BorderThickness" Value="1,1,1,0"/>
|
<Setter TargetName="BG" Property="BorderThickness" Value="1,1,1,0"/>
|
||||||
<Setter TargetName="Container" Property="Opacity" Value="1"/>
|
<Setter TargetName="Container" Property="Opacity" Value="1"/>
|
||||||
<Setter TargetName="CornerLeft" Property="Fill" Value="{StaticResource Brush.BG1}"/>
|
<Setter TargetName="CornerLeft" Property="Fill" Value="{StaticResource Brush.BG1}"/>
|
||||||
<Setter TargetName="CornerRight" Property="Fill" Value="{StaticResource Brush.BG1}"/>
|
<Setter TargetName="CornerRight" Property="Fill" Value="{StaticResource Brush.BG1}"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<MultiTrigger>
|
<MultiTrigger>
|
||||||
<MultiTrigger.Conditions>
|
<MultiTrigger.Conditions>
|
||||||
<Condition Property="IsSelected" Value="False"/>
|
<Condition Property="IsSelected" Value="False"/>
|
||||||
<Condition Property="IsMouseOver" Value="True"/>
|
<Condition Property="IsMouseOver" Value="True"/>
|
||||||
</MultiTrigger.Conditions>
|
</MultiTrigger.Conditions>
|
||||||
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.BG5}"/>
|
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.BG5}"/>
|
||||||
</MultiTrigger>
|
</MultiTrigger>
|
||||||
</ControlTemplate.Triggers>
|
</ControlTemplate.Triggers>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
<EventSetter Event="MouseMove" Handler="TabsMouseMove"/>
|
<EventSetter Event="MouseMove" Handler="TabsMouseMove"/>
|
||||||
<EventSetter Event="Drop" Handler="TabsDrop"/>
|
<EventSetter Event="Drop" Handler="TabsDrop"/>
|
||||||
</Style>
|
</Style>
|
||||||
</TabControl.ItemContainerStyle>
|
</TabControl.ItemContainerStyle>
|
||||||
|
|
||||||
<TabControl.ItemTemplate>
|
<TabControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Horizontal" Margin="6,0">
|
<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}"/>
|
<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"/>
|
<TextBlock Grid.Column="1" Text="{Binding Title}" Foreground="{StaticResource Brush.FG}" Margin="8,0,0,0"/>
|
||||||
<Button x:Name="Closer" Margin="8,0,0,0" Grid.Column="2" Click="CloseRepo" ToolTip="CLOSE">
|
<Button x:Name="Closer" Margin="8,0,0,0" Grid.Column="2" Click="CloseRepo" ToolTip="CLOSE">
|
||||||
<Path Width="8" Height="8" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Close}"/>
|
<Path Width="8" Height="8" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Close}"/>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<DataTemplate.Triggers>
|
<DataTemplate.Triggers>
|
||||||
<DataTrigger Binding="{Binding Repo}" Value="{x:Null}">
|
<DataTrigger Binding="{Binding Repo}" Value="{x:Null}">
|
||||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Git}"/>
|
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Git}"/>
|
||||||
<Setter TargetName="Icon" Property="Fill" Value="#FFF05133"/>
|
<Setter TargetName="Icon" Property="Fill" Value="#FFF05133"/>
|
||||||
<Setter TargetName="Closer" Property="Visibility" Value="Collapsed"/>
|
<Setter TargetName="Closer" Property="Visibility" Value="Collapsed"/>
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</DataTemplate.Triggers>
|
</DataTemplate.Triggers>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</TabControl.ItemTemplate>
|
</TabControl.ItemTemplate>
|
||||||
</TabControl>
|
</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 -->
|
<!-- Window Command -->
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Column="1"
|
Grid.Column="2"
|
||||||
Margin="32,0,0,0"
|
Margin="32,0,0,0"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Top"
|
|
||||||
Height="32"
|
Height="32"
|
||||||
WindowChrome.IsHitTestVisibleInChrome="True">
|
WindowChrome.IsHitTestVisibleInChrome="True">
|
||||||
<Button Click="ShowPreference" Width="24" ToolTip="PREFERENCE">
|
<Button Click="ShowPreference" Width="24" ToolTip="PREFERENCE">
|
||||||
|
|
|
@ -191,5 +191,23 @@ namespace SourceGit.UI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region TAB_SCROLL
|
||||||
|
private void OpenedTabsSizeChanged(object sender, SizeChangedEventArgs e) {
|
||||||
|
if (openedTabs.ActualWidth > openedTabsColumn.ActualWidth) {
|
||||||
|
openedTabsOpts.Visibility = Visibility.Visible;
|
||||||
|
} else {
|
||||||
|
openedTabsOpts.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ScrollToLeft(object sender, RoutedEventArgs e) {
|
||||||
|
openedTabsScroller.LineLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ScrollToRight(object sender, RoutedEventArgs e) {
|
||||||
|
openedTabsScroller.LineRight();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue