Skip to content

Commit

Permalink
Improved toolbars.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisellgren committed May 26, 2012
1 parent 07d04e7 commit 18c1488
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 15 deletions.
1 change: 1 addition & 0 deletions App.xaml
Expand Up @@ -22,6 +22,7 @@
<ResourceDictionary Source="Templates/AppTabItemTemplate.xaml"/> <ResourceDictionary Source="Templates/AppTabItemTemplate.xaml"/>
<ResourceDictionary Source="Templates/AppTabNew.xaml"/> <ResourceDictionary Source="Templates/AppTabNew.xaml"/>
<ResourceDictionary Source="Templates/AppTabNew.xaml"/> <ResourceDictionary Source="Templates/AppTabNew.xaml"/>
<ResourceDictionary Source="Styles/Separator.xaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>
Expand Down
16 changes: 13 additions & 3 deletions Git-GUI.csproj
Expand Up @@ -152,6 +152,7 @@
<DependentUpon>About.xaml</DependentUpon> <DependentUpon>About.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="AppTabDataTemplateSelector.cs" /> <Compile Include="AppTabDataTemplateSelector.cs" />
<Compile Include="Command.cs" />
<Compile Include="Configuration.cs" /> <Compile Include="Configuration.cs" />
<Compile Include="Converters\ExtensionToImageConverter.cs" /> <Compile Include="Converters\ExtensionToImageConverter.cs" />
<Compile Include="Converters\StatusGridGroupToColorConverter.cs" /> <Compile Include="Converters\StatusGridGroupToColorConverter.cs" />
Expand All @@ -178,7 +179,7 @@
<Compile Include="UserControls\Panel.xaml.cs"> <Compile Include="UserControls\Panel.xaml.cs">
<DependentUpon>Panel.xaml</DependentUpon> <DependentUpon>Panel.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UserControls\PromptDialog.xaml.cs"> <Compile Include="UserControls\Dialogs\PromptDialog.xaml.cs">
<DependentUpon>PromptDialog.xaml</DependentUpon> <DependentUpon>PromptDialog.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UserControls\StatusGrid.xaml.cs"> <Compile Include="UserControls\StatusGrid.xaml.cs">
Expand Down Expand Up @@ -257,6 +258,10 @@
<Page Include="Styles\Panel.xaml"> <Page Include="Styles\Panel.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Styles\Separator.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\TextBlock.xaml"> <Page Include="Styles\TextBlock.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -307,7 +312,7 @@
<Page Include="UserControls\Panel.xaml"> <Page Include="UserControls\Panel.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="UserControls\PromptDialog.xaml"> <Page Include="UserControls\Dialogs\PromptDialog.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
Expand Down Expand Up @@ -432,7 +437,9 @@
<ItemGroup> <ItemGroup>
<Resource Include="Resources\Icons\Unstage.png" /> <Resource Include="Resources\Icons\Unstage.png" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<Resource Include="Resources\Icons\Stash-24.png" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\Icons\OpenIgnoreEditor.png" /> <Resource Include="Resources\Icons\OpenIgnoreEditor.png" />
</ItemGroup> </ItemGroup>
Expand Down Expand Up @@ -461,6 +468,9 @@
<Resource Include="Resources\Icons\MinimizeWindow.png" /> <Resource Include="Resources\Icons\MinimizeWindow.png" />
<Resource Include="Resources\Icons\RestoreWindow.png" /> <Resource Include="Resources\Icons\RestoreWindow.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\Branch-24.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent> <PostBuildEvent>
Expand Down
17 changes: 17 additions & 0 deletions UserControls/LeftToolbar.xaml.cs
Expand Up @@ -12,6 +12,7 @@
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using GG.Models;


namespace GG.UserControls namespace GG.UserControls
{ {
Expand All @@ -20,9 +21,25 @@ namespace GG.UserControls
/// </summary> /// </summary>
public partial class LeftToolbar : UserControl public partial class LeftToolbar : UserControl
{ {
public DelegateCommand DeleteBranchCommand { get; private set; }

public LeftToolbar() public LeftToolbar()
{ {
InitializeComponent(); InitializeComponent();

DeleteBranchCommand = new DelegateCommand(DeleteBranch);
}

/// <summary>
/// Deletes a branch.
/// </summary>
/// <param name="action"></param>
private void DeleteBranch(object action)
{
Branch branch = action as Branch;

// TODO: Needs confirmation.
branch.Delete();
} }


private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
Expand Down
1 change: 1 addition & 0 deletions UserControls/NewTabPage.xaml.cs
Expand Up @@ -13,6 +13,7 @@
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using GG.Libraries; using GG.Libraries;
using GG.UserControls.Dialogs;


namespace GG.UserControls namespace GG.UserControls
{ {
Expand Down
41 changes: 30 additions & 11 deletions UserControls/TopToolbar.xaml
@@ -1,10 +1,11 @@
<UserControl x:Class="GG.UserControls.TopToolbar" <UserControl x:Class="GG.UserControls.TopToolbar"
x:Name="TopToolbarUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="80" d:DesignWidth="605">


<StackPanel> <StackPanel>
<WrapPanel Style="{DynamicResource TopToolbarStyle}"> <WrapPanel Style="{DynamicResource TopToolbarStyle}">
Expand All @@ -15,34 +16,52 @@
<TextBlock>Settings</TextBlock> <TextBlock>Settings</TextBlock>
</StackPanel> </StackPanel>
</Button> </Button>

<Separator Width="30" Height="1" Style="{StaticResource VerticalSeparatorStyle}" />

<Button Command="{Binding Path=CreateBranchCommand, ElementName=TopToolbarUserControl}">
<StackPanel>
<Image Source="../Resources/Icons/Branch-24.png" Stretch="None" />
<TextBlock>Branch</TextBlock>
</StackPanel>
</Button>
<Button> <Button>
<StackPanel> <StackPanel>
<Image Source="../Resources/Icons/Fetch.png" Stretch="None" /> <Image Source="../Resources/Icons/Stash-24.png" Stretch="None" />
<TextBlock>Fetch</TextBlock> <TextBlock>Stash</TextBlock>
</StackPanel> </StackPanel>
</Button> </Button>
<Button> <Button>
<StackPanel> <StackPanel>
<Image Source="../Resources/Icons/Pull.png" Stretch="None" /> <Image Source="../Resources/Icons/Search.png" Stretch="None" />
<TextBlock>Pull</TextBlock> <TextBlock>Search</TextBlock>
</StackPanel> </StackPanel>
</Button> </Button>
<Button> <Button>
<StackPanel> <StackPanel>
<Image Source="../Resources/Icons/Push.png" Stretch="None" /> <Image Source="../Resources/Icons/Statistics.png" Stretch="None" />
<TextBlock>Push</TextBlock> <TextBlock>Statistics</TextBlock>
</StackPanel> </StackPanel>
</Button> </Button>

<Separator Width="30" Height="1" Style="{StaticResource VerticalSeparatorStyle}" />

<Button> <Button>
<StackPanel> <StackPanel>
<Image Source="../Resources/Icons/Search.png" Stretch="None" /> <Image Source="../Resources/Icons/Fetch.png" Stretch="None" />
<TextBlock>Search</TextBlock> <TextBlock>Fetch</TextBlock>
</StackPanel> </StackPanel>
</Button> </Button>
<Button> <Button>
<StackPanel> <StackPanel>
<Image Source="../Resources/Icons/Statistics.png" Stretch="None" /> <Image Source="../Resources/Icons/Pull.png" Stretch="None" />
<TextBlock>Statistics</TextBlock> <TextBlock>Pull</TextBlock>
</StackPanel>
</Button>
<Button>
<StackPanel>
<Image Source="../Resources/Icons/Push.png" Stretch="None" />
<TextBlock>Push</TextBlock>
</StackPanel> </StackPanel>
</Button> </Button>
</WrapPanel> </WrapPanel>
Expand Down
28 changes: 27 additions & 1 deletion UserControls/TopToolbar.xaml.cs
Expand Up @@ -12,6 +12,7 @@
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using GG.UserControls.Dialogs;


namespace GG.UserControls namespace GG.UserControls
{ {
Expand All @@ -20,9 +21,34 @@ namespace GG.UserControls
/// </summary> /// </summary>
public partial class TopToolbar : UserControl public partial class TopToolbar : UserControl
{ {
public DelegateCommand CreateBranchCommand { get; private set; }

public TopToolbar() public TopToolbar()
{ {
InitializeComponent(); InitializeComponent();

CreateBranchCommand = new DelegateCommand(CreateBranch);
}

/// <summary>
/// Creates a branch.
/// </summary>
/// <param name="action"></param>
private void CreateBranch(object action)
{
Console.WriteLine("foo");

var dialog = new PromptDialog
{
Title = "Creating a new branch",
Message = "Please give a name for your new branch:"
};

dialog.ShowDialog();

var name = dialog.DialogResult;

Console.WriteLine(name);
} }
} }
} }

0 comments on commit 18c1488

Please sign in to comment.