Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implement first version of New Tab page.

  • Loading branch information...
commit 89c7fb6a2a896d9a6206c2620afd12dd7df746b7 1 parent a0530b3
@kaisellgren authored
View
11 App.xaml
@@ -4,15 +4,12 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
+ <ResourceDictionary Source="Styles/Colors.xaml"/>
<ResourceDictionary Source="Styles/TabItem.xaml"/>
<ResourceDictionary Source="Styles/DataGrid.xaml"/>
<ResourceDictionary Source="Styles/LeftToolbar.xaml"/>
<ResourceDictionary Source="Styles/TopToolbar.xaml"/>
<ResourceDictionary Source="Styles/MainWindow.xaml"/>
- <ResourceDictionary Source="Templates/AppTabContentTemplate.xaml"/>
- <ResourceDictionary Source="Templates/AppTabItemTemplate.xaml"/>
- <ResourceDictionary Source="Templates/AppTabNew.xaml"/>
- <ResourceDictionary Source="Templates/AppTabNew.xaml"/>
<ResourceDictionary Source="Styles/NewTabButton.xaml"/>
<ResourceDictionary Source="Styles/Panel.xaml"/>
<ResourceDictionary Source="Styles/GridSplitter.xaml"/>
@@ -20,6 +17,12 @@
<ResourceDictionary Source="Styles/ChangesetHistoryDataGrid.xaml"/>
<ResourceDictionary Source="Styles/TreeView.xaml"/>
<ResourceDictionary Source="Styles/Button.xaml"/>
+ <ResourceDictionary Source="Styles/NewTabList.xaml"/>
+ <ResourceDictionary Source="Styles/TextBlock.xaml"/>
+ <ResourceDictionary Source="Templates/AppTabContentTemplate.xaml"/>
+ <ResourceDictionary Source="Templates/AppTabItemTemplate.xaml"/>
+ <ResourceDictionary Source="Templates/AppTabNew.xaml"/>
+ <ResourceDictionary Source="Templates/AppTabNew.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
View
10 DesignData/RecentRepositories.xaml
@@ -0,0 +1,10 @@
+<local:MainWindowViewModel xmlns:local="clr-namespace:GG"
+ xmlns:models="clr-namespace:GG.Models"
+ xmlns:sys="clr-namespace:System;assembly=mscorlib">
+ <local:MainWindowViewModel.RecentRepositories>
+ <local:RepositoryViewModel Name="git2" RepositoryFullPath="Z:/www/git2" />
+ <local:RepositoryViewModel Name="Linux Kernel" RepositoryFullPath="C:/Program Files (x86)/linux-stable" />
+ <local:RepositoryViewModel Name="test-repo" RepositoryFullPath="Z:/www/test-repo" />
+ <local:RepositoryViewModel Name="Symfony 2" RepositoryFullPath="C:/Program Files (x86)/symfony" />
+ </local:MainWindowViewModel.RecentRepositories>
+</local:MainWindowViewModel>
View
11 DesignData/SampleApplication.xaml
@@ -1,6 +1,11 @@
<local:MainWindowViewModel xmlns:local="clr-namespace:GG" xmlns:sys="clr-namespace:System;assembly=mscorlib">
<local:MainWindowViewModel.RepositoryViewModels>
- <local:RepositoryViewModel Name="Sample" RepositoryFullPath="Z:/www/git1">
+ <local:RepositoryViewModel Name="New Tab" NotOpened="True">
+ <local:RepositoryViewModel.Commits>
+ </local:RepositoryViewModel.Commits>
+ </local:RepositoryViewModel>
+
+ <local:RepositoryViewModel Name="Sample" RepositoryFullPath="Z:/www/git1" NotOpened="True">
<local:RepositoryViewModel.Commits>
<local:Commit AuthorEmail="foo@email" AuthorName="Foo" Date="12.12.2012" FormattedDate="One minute ago" Description="Foo" Hash="123" Source="asdasd">
<local:Commit.DisplayTags>
@@ -15,10 +20,6 @@
<local:Branch Name="master" Tip="0123asd" IsRemote="False" IsTracking="True" />
</local:RepositoryViewModel.Branches>
</local:RepositoryViewModel>
- <local:RepositoryViewModel Name="New Tab" NotOpened="True">
- <local:RepositoryViewModel.Commits>
- </local:RepositoryViewModel.Commits>
- </local:RepositoryViewModel>
</local:MainWindowViewModel.RepositoryViewModels>
<local:MainWindowViewModel.RecentRepositories>
View
42 Git-GUI.csproj
@@ -209,6 +209,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="DesignData\RecentRepositories.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -230,6 +234,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Styles\Colors.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Styles\DisplayTags.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -240,9 +248,17 @@
<Page Include="Styles\NewTabButton.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Styles\NewTabList.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Styles\Panel.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Styles\TextBlock.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Styles\TreeView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -319,7 +335,6 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
- <None Include="Git-GUI_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -353,9 +368,6 @@
<Resource Include="Resources\Icons\Git-GUI.ico" />
</ItemGroup>
<ItemGroup>
- <Resource Include="Resources\TabCloseButton.png" />
- </ItemGroup>
- <ItemGroup>
<Resource Include="Resources\Icons\Git-GUI.png" />
</ItemGroup>
<ItemGroup>
@@ -382,9 +394,6 @@
<Resource Include="Resources\Icons\Statistics.png" />
</ItemGroup>
<ItemGroup>
- <Resource Include="Resources\NewTabBackground.png" />
- </ItemGroup>
- <ItemGroup>
<Resource Include="Resources\Icons\Add.png" />
<Resource Include="Resources\Icons\Annotate.png" />
<Resource Include="Resources\Icons\Backout.png" />
@@ -442,6 +451,25 @@
<ItemGroup>
<Resource Include="Resources\Icons\OpenIgnoreEditor.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\Icons\Clone.png" />
+ <Resource Include="Resources\Icons\SVN.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\Icons\Open.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\Icons\GitHub.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\AbstractBackground.jpg" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\Icons\Recent.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\Icons\Cross.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
View
16 MainWindow.xaml
@@ -10,15 +10,15 @@
<KeyBinding Command="{Binding CloseTabCommand}" Key="W" Modifiers="Control" />
<KeyBinding Command="{Binding CreateTabCommand}" Key="T" Modifiers="Control" />
</Window.InputBindings>
-
+
<DockPanel Margin="0,-24,0,0" d:DataContext="{d:DesignData Source=./DesignData/SampleApplication.xaml}">
<TabControl x:Name="RepositoryTabs"
- d:LayoutOverrides="Margin"
- shell:WindowChrome.IsHitTestVisibleInChrome="True"
- Background="#e9e9e9"
- Padding="0"
- ItemsSource="{Binding RepositoryViewModels}"
- ItemTemplate="{StaticResource AppTabItemTemplate}"
- ContentTemplateSelector="{DynamicResource AppTabContentTemplateSelector}" />
+ d:LayoutOverrides="Margin"
+ shell:WindowChrome.IsHitTestVisibleInChrome="True"
+ Background="#e9e9e9"
+ Padding="0"
+ ItemsSource="{Binding RepositoryViewModels}"
+ ItemTemplate="{StaticResource AppTabItemTemplate}"
+ ContentTemplateSelector="{DynamicResource AppTabContentTemplateSelector}" />
</DockPanel>
</Window>
View
BIN  Resources/AbstractBackground.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/Icons/Clone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/Icons/Cross.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/Icons/GitHub.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/Icons/Open.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/Icons/Recent.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/Icons/SVN.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Resources/NewTabBackground.png
Deleted file not rendered
View
BIN  Resources/TabCloseButton.png
Deleted file not rendered
View
6 Styles/Colors.xaml
@@ -0,0 +1,6 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+ <Color x:Key="DefaultBackgroundColor" R="233" G="233" B="233" A="255" />
+ <SolidColorBrush x:Key="DefaultBackgroundBrush" Color="#e9e9e9" />
+</ResourceDictionary>
View
1  Styles/DataGrid.xaml
@@ -1,5 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="DataGridStyle" TargetType="{x:Type DataGrid}">
+ <Setter Property="Background" Value="{StaticResource DefaultBackgroundBrush}" />
<Setter Property="BorderBrush" Value="#bbb" />
<Setter Property="RowBackground" Value="#f9f9f9" />
<Setter Property="AlternatingRowBackground" Value="#f4f4f4" />
View
105 Styles/NewTabList.xaml
@@ -0,0 +1,105 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
+
+ <Style x:Key="NewTabGridViewScrollViewerStyle" TargetType="ScrollViewer">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="ScrollViewer">
+ <Grid Background="Transparent">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="Auto"/>
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="*"/>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+
+ <DockPanel Margin="{TemplateBinding Padding}">
+ <ScrollViewer DockPanel.Dock="Top" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Focusable="false">
+ <GridViewHeaderRowPresenter Margin="0" Columns="{Binding Path=TemplatedParent.View.Columns, RelativeSource={RelativeSource TemplatedParent}}"
+ ColumnHeaderContainerStyle="{Binding Path=TemplatedParent.View.ColumnHeaderContainerStyle, RelativeSource={RelativeSource TemplatedParent}}"
+ ColumnHeaderTemplate="{Binding Path=TemplatedParent.View.ColumnHeaderTemplate, RelativeSource={RelativeSource TemplatedParent}}"
+ ColumnHeaderTemplateSelector="{Binding Path=TemplatedParent.View.ColumnHeaderTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}"
+ AllowsColumnReorder="{Binding Path=TemplatedParent.View.AllowsColumnReorder, RelativeSource={RelativeSource TemplatedParent}}"
+ ColumnHeaderContextMenu="{Binding Path=TemplatedParent.View.ColumnHeaderContextMenu, RelativeSource={RelativeSource TemplatedParent}}"
+ ColumnHeaderToolTip="{Binding Path=TemplatedParent.View.ColumnHeaderToolTip, RelativeSource={RelativeSource TemplatedParent}}"
+ SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
+ </ScrollViewer>
+
+ <ScrollContentPresenter Name="PART_ScrollContentPresenter" KeyboardNavigation.DirectionalNavigation="Local"/>
+ </DockPanel>
+
+ <ScrollBar Name="PART_HorizontalScrollBar" Orientation="Horizontal" Grid.Row="1" Maximum="{TemplateBinding ScrollableWidth}" ViewportSize="{TemplateBinding ViewportWidth}" Value="{TemplateBinding HorizontalOffset}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
+ <ScrollBar Name="PART_VerticalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" ViewportSize="{TemplateBinding ViewportHeight}" Value="{TemplateBinding VerticalOffset}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
+ </Grid>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <Style x:Key="GridViewColumnHeaderGripper" TargetType="Thumb">
+ <Setter Property="Width" Value="0"/>
+ <Setter Property="Background" Value="{x:Null}"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type Thumb}">
+ <Border Padding="{TemplateBinding Padding}" Background="{x:Null}">
+ <Rectangle HorizontalAlignment="Center" Width="1" Fill="{TemplateBinding Background}"/>
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <Style x:Key="{x:Type GridViewColumnHeader}" TargetType="GridViewColumnHeader">
+ <Setter Property="Foreground" Value="#222" />
+ <Setter Property="HorizontalContentAlignment" Value="Left" />
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
+ <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
+ <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
+ <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
+ <Setter Property="Margin" Value="8,0,0,0" />
+ <Setter Property="Padding" Value="0" />
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="GridViewColumnHeader">
+ <Grid>
+ <Border Name="HeaderBorder" BorderThickness="0,0,0,1" Margin="0,0,0,4" BorderBrush="#999" Background="Transparent" Padding="0">
+ <ContentPresenter Name="HeaderContent" Margin="0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+ </Border>
+ <Thumb x:Name="PART_HeaderGripper" HorizontalAlignment="Right" Margin="0,0,-9,0" Style="{StaticResource GridViewColumnHeaderGripper}"/>
+ </Grid>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ <Setter Property="ContentTemplate">
+ <Setter.Value>
+ <DataTemplate>
+ <TextBlock Text="{Binding}" TextOptions.TextFormattingMode="Display" TextOptions.TextRenderingMode="ClearType" RenderOptions.ClearTypeHint="Enabled" />
+ </DataTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <Style x:Key="NewTabListViewStyle" TargetType="ListView">
+ <Setter Property="SnapsToDevicePixels" Value="true"/>
+ <Setter Property="OverridesDefaultStyle" Value="true"/>
+ <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
+ <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
+ <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="ListView">
+ <Border Name="Border" BorderThickness="0" Background="Transparent">
+ <ScrollViewer Style="{StaticResource NewTabGridViewScrollViewerStyle}">
+ <ItemsPresenter />
+ </ScrollViewer>
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+</ResourceDictionary>
View
20 Styles/TabItem.xaml
@@ -6,16 +6,28 @@
<Grid>
<Border Name="Border" BorderBrush="#666" BorderThickness="1,1,1,0" CornerRadius="8,8,0,0" Margin="-2,0,3,-1">
<DockPanel>
+ <DockPanel.Resources>
+ <Style TargetType="Button">
+ <Style.Triggers>
+ <Trigger Property="IsMouseOver" Value="False">
+ <Setter Property="Opacity" Value="0.5" />
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </DockPanel.Resources>
+
<TextBlock x:Name="TabItemText" FontSize="12" Foreground="#444" FontWeight="SemiBold" TextOptions.TextFormattingMode="Display" Padding="16 6 12 6" RenderOptions.ClearTypeHint="Enabled" TextOptions.TextRenderingMode="ClearType" SnapsToDevicePixels="True" UseLayoutRounding="True" RenderOptions.BitmapScalingMode="NearestNeighbor">
<ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Header"/>
</TextBlock>
- <Button Background="{x:Null}" BorderBrush="{x:Null}">
+
+ <Button BorderBrush="{x:Null}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.CloseTabCommand}">
<Button.Template>
<ControlTemplate TargetType="Button">
<ContentPresenter Content="{TemplateBinding Content}"/>
</ControlTemplate>
</Button.Template>
- <Image Source="../Resources/TabCloseButton.png" Width="8" Margin="0 2 8 0" />
+
+ <Image Source="../Resources/Icons/Cross.png" Stretch="None" Margin="0 2 8 0" />
</Button>
</DockPanel>
</Border>
@@ -43,8 +55,8 @@
<Setter TargetName="Border" Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
- <GradientStop Color="#fff" Offset="0.35"></GradientStop>
- <GradientStop Color="#e9e9e9" Offset="0.75"></GradientStop>
+ <GradientStop Color="#fff" Offset="0.35" />
+ <GradientStop Color="{StaticResource DefaultBackgroundColor}" Offset="0.75" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
View
8 Styles/TextBlock.xaml
@@ -0,0 +1,8 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+ <Style TargetType="TextBlock">
+ <Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
+ <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
+ <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
+ </Style>
+</ResourceDictionary>
View
2  Templates/AppTabContentTemplate.xaml
@@ -4,7 +4,7 @@
<!-- This is the content template for the application main tab control. -->
<DataTemplate x:Key="AppTabContentTemplate">
- <DockPanel>
+ <DockPanel Background="{StaticResource DefaultBackgroundBrush}">
<controls:MainMenu DockPanel.Dock="Top" Margin="4,4,0,0" />
<controls:TopToolbar DockPanel.Dock="Top" />
View
17 Templates/AppTabNew.xaml
@@ -4,13 +4,22 @@
<!-- This is the content template for the application main tab control when it's just opened. -->
<DataTemplate x:Key="AppTabNew">
- <Border BorderBrush="#e9e9e9" BorderThickness="4">
- <StackPanel>
+ <DockPanel>
+ <StackPanel Height="8" DockPanel.Dock="Top">
<StackPanel.Background>
- <ImageBrush ImageSource="../Resources/NewTabBackground.png" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,200,200"/>
+ <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
+ <GradientStop Color="#e9e9e9" Offset="0" />
+ <GradientStop Color="White" Offset="1" />
+ </LinearGradientBrush>
+ </StackPanel.Background>
+ </StackPanel>
+
+ <StackPanel DockPanel.Dock="Bottom">
+ <StackPanel.Background>
+ <ImageBrush ImageSource="../Resources/AbstractBackground.jpg" TileMode="None" />
</StackPanel.Background>
<controls:NewTabPage />
</StackPanel>
- </Border>
+ </DockPanel>
</DataTemplate>
</ResourceDictionary>
View
2  UserControls/ChangesetHistory.xaml
@@ -20,7 +20,7 @@
Grid.Row="0"
Loaded="OnDataContextChanged"
x:Name="ChangesetHistoryGrid"
- Style="{StaticResource ChangesetHistoryDataGridStyle}">
+ Style="{DynamicResource ChangesetHistoryDataGridStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Graph" Width="128">
View
2  UserControls/MainMenu.xaml
@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
-
+
<StackPanel>
<Menu VerticalAlignment="Top" Background="{x:Null}">
<MenuItem Header="_File">
View
72 UserControls/NewTabPage.xaml
@@ -4,29 +4,73 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" HorizontalAlignment="Center" VerticalAlignment="Center">
+
<DockPanel>
- <GroupBox Header="Recent repositories">
- <ListView ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.RecentRepositories}" MinWidth="250">
+ <StackPanel DockPanel.Dock="Top">
+ <WrapPanel Margin="0,32,0,24">
+ <Image Source="../Resources/Icons/Recent.png" Stretch="None" />
+ <TextBlock FontSize="15" FontWeight="SemiBold" VerticalAlignment="Center" Margin="4,0,0,0">Recent repositories:</TextBlock>
+ </WrapPanel>
+
+ <ListView MinWidth="250"
+ Margin="0,0,8,0"
+ HorizontalAlignment="Left"
+ d:DataContext="{d:DesignData Source=../DesignData/RecentRepositories.xaml}"
+ DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext}"
+ ItemsSource="{Binding RecentRepositories}"
+ Style="{DynamicResource NewTabListViewStyle}"
+ x:Name="RecentRepositoriesList">
<ListView.View>
<GridView>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" />
- <GridViewColumn Header="Path" DisplayMemberBinding="{Binding FullPath}" />
+ <GridViewColumn Header="Path" DisplayMemberBinding="{Binding RepositoryFullPath}" />
</GridView>
</ListView.View>
</ListView>
- </GroupBox>
-
- <StackPanel DockPanel.Dock="Right" Margin="32,0,0,0" HorizontalAlignment="Right">
- <Button Style="{DynamicResource NewTabButton}">
+ </StackPanel>
+
+ <WrapPanel DockPanel.Dock="Bottom" Margin="0,32,0,0">
+ <WrapPanel.Resources>
+ <Style TargetType="Button">
+ <Setter Property="Margin" Value="0,0,8,0" />
+ <Setter Property="Padding" Value="4" />
+ </Style>
+
+ <Style TargetType="Image">
+ <Setter Property="Margin" Value="0,0,4,0" />
+ </Style>
+ </WrapPanel.Resources>
+
+ <Button>
<DockPanel>
- <Image DockPanel.Dock="Left" Source="../Resources/Icons/Git-GUI.png" Width="32" Height="32" Margin="0,0,8,0" />
- <TextBlock VerticalAlignment="Center">Add Local Repository</TextBlock>
+ <Image DockPanel.Dock="Left" Source="../Resources/Icons/Open.png" Stretch="None" />
+ <TextBlock VerticalAlignment="Center">Open Local Repository</TextBlock>
</DockPanel>
</Button>
- <Button Style="{DynamicResource NewTabButton}">Clone Remote Repository</Button>
- <Button Style="{DynamicResource NewTabButton}">Create Local Repository</Button>
- <Button Style="{DynamicResource NewTabButton}">Clone SVN Repository</Button>
- <Button Style="{DynamicResource NewTabButton}">Create GitHub Repository</Button>
- </StackPanel>
+ <Button>
+ <DockPanel>
+ <Image DockPanel.Dock="Left" Source="../Resources/Icons/Add.png" Stretch="None" />
+ <TextBlock VerticalAlignment="Center">Create New Repository</TextBlock>
+ </DockPanel>
+ </Button>
+ <Button>
+ <DockPanel>
+ <Image DockPanel.Dock="Left" Source="../Resources/Icons/Clone.png" Stretch="None" />
+ <TextBlock VerticalAlignment="Center">Clone Repository</TextBlock>
+ </DockPanel>
+ </Button>
+ <Button>
+ <DockPanel>
+ <Image DockPanel.Dock="Left" Source="../Resources/Icons/SVN.png" Stretch="None" />
+ <TextBlock VerticalAlignment="Center">Clone SVN Repository</TextBlock>
+ </DockPanel>
+ </Button>
+ <Button>
+ <DockPanel>
+ <Image DockPanel.Dock="Left" Source="../Resources/Icons/GitHub.png" Stretch="None" />
+ <TextBlock VerticalAlignment="Center">Create GitHub Repository</TextBlock>
+ </DockPanel>
+ </Button>
+ </WrapPanel>
</DockPanel>
</UserControl>
View
29 ViewModels/MainWindowViewModel.cs
@@ -5,6 +5,7 @@
using System.Windows.Controls;
using System.Windows.Input;
using GG.Libraries;
+using GG.UserControls;
using GG.ViewModels;
namespace GG
@@ -35,14 +36,27 @@ public void Load()
RepositoryViewModel repo = new RepositoryViewModel { Name = "Git test repository", RepositoryFullPath = "Z:/www/test-repo" };
repo.Load();
- RepositoryViewModel repo2 = new RepositoryViewModel { Name = "New tab", RepositoryFullPath = null, NotOpened = true };
- repo2.Load();
-
RepositoryViewModels.Add(repo);
- RepositoryViewModels.Add(repo2);
+
+ TabControl tabControl = UIHelper.FindChild<TabControl>(Application.Current.MainWindow, "RepositoryTabs");
+ tabControl.SelectedIndex = 0;
// Add some "recent repositories".
RecentRepositories.Add(repo);
+
+ RecentRepositories.Add(new RepositoryViewModel
+ {
+ Name = "Symfony 2",
+ RepositoryFullPath = "C:/Program Files (x86)/symfony",
+ NotOpened = true
+ });
+
+ RecentRepositories.Add(new RepositoryViewModel
+ {
+ Name = "Linux Kernel",
+ RepositoryFullPath = "C:/Program Files (x86)/linux-stable",
+ NotOpened = true
+ });
}
#region Commands.
@@ -59,6 +73,9 @@ private void CloseTab(object action)
TabControl tabControl = UIHelper.FindChild<TabControl>(Application.Current.MainWindow, "RepositoryTabs");
ObservableCollection<RepositoryViewModel> repositories = tabControl.ItemsSource as ObservableCollection<RepositoryViewModel>;
repositories.Remove(tabControl.SelectedContent as RepositoryViewModel);
+
+ if (tabControl.Items.Count == 0)
+ CreateTab(new object());
}
/// <summary>
@@ -80,8 +97,10 @@ private void CreateTab(object action)
mainWindowViewModel.RepositoryViewModels.Add(repository);
tabControl.SelectedItem = repository;
+ ListView recentRepositoriesList = UIHelper.FindChild<ListView>(tabControl.Items[tabControl.SelectedIndex] as NewTabPage, "RecentRepositoriesList");
+ int f = 5;
}
#endregion
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.