style<Repository>: arrange buttons in Repository's tool bar

This commit is contained in:
leo 2024-02-21 10:12:52 +08:00
parent 57c4a8394c
commit dbd91c9b58
2 changed files with 57 additions and 69 deletions

View file

@ -294,10 +294,6 @@ namespace SourceGit.ViewModels {
SearchedCommits = visible; SearchedCommits = visible;
} }
public void ExitSearchMode() {
IsSearching = false;
}
public void SetWatcherEnabled(bool enabled) { public void SetWatcherEnabled(bool enabled) {
if (_watcher != null) _watcher.SetEnabled(enabled); if (_watcher != null) _watcher.SetEnabled(enabled);
} }

View file

@ -25,6 +25,13 @@
<Button Classes="icon_button" Width="32" Command="{Binding OpenInTerminal}" ToolTip.Tip="{DynamicResource Text.Repository.Terminal}"> <Button Classes="icon_button" Width="32" Command="{Binding OpenInTerminal}" ToolTip.Tip="{DynamicResource Text.Repository.Terminal}">
<Path Width="13" Height="13" Data="{StaticResource Icons.Terminal}"/> <Path Width="13" Height="13" Data="{StaticResource Icons.Terminal}"/>
</Button> </Button>
<ToggleButton Width="32"
Background="Transparent"
IsChecked="{Binding IsSearching, Mode=TwoWay}"
ToolTip.Tip="{DynamicResource Text.Repository.Search}">
<Path Width="14" Height="14" Data="{StaticResource Icons.Search}"/>
</ToggleButton>
</StackPanel> </StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal"> <StackPanel Grid.Column="1" Orientation="Horizontal">
@ -53,13 +60,9 @@
VerticalAlignment="Center" VerticalAlignment="Center"
Fill="{DynamicResource Brush.Border2}"/> Fill="{DynamicResource Brush.Border2}"/>
<ToggleButton Width="32" <Button Classes="icon_button" Width="32" Margin="16,0,0,0" Click="OpenGitFlowMenu" ToolTip.Tip="{DynamicResource Text.GitFlow}">
Margin="16,0,0,0" <Path Width="12" Height="12" Data="{StaticResource Icons.Flow}"/>
Background="Transparent" </Button>
IsChecked="{Binding IsSearching, Mode=TwoWay}"
ToolTip.Tip="{DynamicResource Text.Repository.Search}">
<Path Width="14" Height="14" Data="{StaticResource Icons.Search}"/>
</ToggleButton>
</StackPanel> </StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0"> <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0">
@ -70,10 +73,6 @@
IsVisible="{Binding SelectedViewIndex, Converter={x:Static c:IntConverters.IsZero}}" IsVisible="{Binding SelectedViewIndex, Converter={x:Static c:IntConverters.IsZero}}"
ToolTip.Tip="{DynamicResource Text.Histories.DisplayMode}"/> ToolTip.Tip="{DynamicResource Text.Histories.DisplayMode}"/>
<Button Classes="icon_button" Width="32" Command="{Binding Cleanup}" ToolTip.Tip="{DynamicResource Text.Repository.Clean}">
<Path Width="14" Height="14" Data="{StaticResource Icons.Clean}"/>
</Button>
<Button Classes="icon_button" Width="32" Command="{Binding OpenConfigure}" ToolTip.Tip="{DynamicResource Text.Repository.Configure}"> <Button Classes="icon_button" Width="32" Command="{Binding OpenConfigure}" ToolTip.Tip="{DynamicResource Text.Repository.Configure}">
<Path Width="15" Height="15" Data="{StaticResource Icons.Settings1}"/> <Path Width="15" Height="15" Data="{StaticResource Icons.Settings1}"/>
</Button> </Button>
@ -92,7 +91,12 @@
<!-- Left Normal Mode --> <!-- Left Normal Mode -->
<Grid Grid.Column="0" RowDefinitions="28,Auto,28,Auto,28,*,28,Auto,28,Auto" Margin="0,0,0,4" IsVisible="{Binding !IsSearching}"> <Grid Grid.Column="0" RowDefinitions="28,Auto,28,Auto,28,*,28,Auto,28,Auto" Margin="0,0,0,4" IsVisible="{Binding !IsSearching}">
<!-- WorkingCopy --> <!-- WorkingCopy -->
<TextBlock Grid.Row="0" Classes="group_header_label" Text="{DynamicResource Text.Repository.Workspace}"/> <Grid Grid.Row="0" ColumnDefinitions="*,Auto">
<TextBlock Grid.Column="0" Classes="group_header_label" Text="{DynamicResource Text.Repository.Workspace}"/>
<Button Grid.Column="1" Classes="icon_button" Width="14" Margin="8,0" Command="{Binding Cleanup}" ToolTip.Tip="{DynamicResource Text.Repository.Clean}">
<Path Width="12" Height="12" Data="{StaticResource Icons.Clean}"/>
</Button>
</Grid>
<ListBox Grid.Row="1" Classes="page_switcher" Background="Transparent" SelectedIndex="{Binding SelectedViewIndex, Mode=TwoWay}"> <ListBox Grid.Row="1" Classes="page_switcher" Background="Transparent" SelectedIndex="{Binding SelectedViewIndex, Mode=TwoWay}">
<ListBox.ItemsPanel> <ListBox.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
@ -141,12 +145,9 @@
</ListBox> </ListBox>
<!-- Local Branches --> <!-- Local Branches -->
<Grid Grid.Row="2" ColumnDefinitions="*,Auto,Auto"> <Grid Grid.Row="2" ColumnDefinitions="*,Auto">
<TextBlock Grid.Column="0" Classes="group_header_label" Text="{DynamicResource Text.Repository.LocalBranches}"/> <TextBlock Grid.Column="0" Classes="group_header_label" Text="{DynamicResource Text.Repository.LocalBranches}"/>
<Button Grid.Column="1" Classes="icon_button" Width="14" Margin="8,0" Click="OpenGitFlowMenu" ToolTip.Tip="{DynamicResource Text.GitFlow}"> <Button Grid.Column="1" Classes="icon_button" Width="14" Margin="0,0,6,0" Command="{Binding CreateNewBranch}" ToolTip.Tip="{DynamicResource Text.Repository.NewBranch}">
<Path Width="12" Height="12" Data="{StaticResource Icons.Flow}"/>
</Button>
<Button Grid.Column="2" Classes="icon_button" Width="14" Margin="0,0,6,0" Command="{Binding CreateNewBranch}" ToolTip.Tip="{DynamicResource Text.Repository.NewBranch}">
<Path Width="12" Height="12" Data="{StaticResource Icons.Branch.Add}"/> <Path Width="12" Height="12" Data="{StaticResource Icons.Branch.Add}"/>
</Button> </Button>
</Grid> </Grid>
@ -345,61 +346,52 @@
<!-- Left Search Mode --> <!-- Left Search Mode -->
<Grid Grid.Column="0" RowDefinitions="32,*" IsVisible="{Binding IsSearching}"> <Grid Grid.Column="0" RowDefinitions="32,*" IsVisible="{Binding IsSearching}">
<!-- Search --> <!-- Search -->
<Grid Grid.Row="0" ColumnDefinitions="Auto,*" Margin="4,2"> <Grid Grid.Row="0" Margin="4,2">
<Button Grid.Column="0" <TextBox Grid.Column="1"
Classes="icon_button" Padding="22,0"
Width="32" FontSize="12"
Command="{Binding ExitSearchMode}"> Height="24"
<Path Width="16" Height="16" Data="{StaticResource Icons.Goback}"/> Background="{DynamicResource Brush.Contents}"
BorderBrush="{DynamicResource Brush.Border2}"
BorderThickness="1"
CornerRadius="12"
Watermark="{DynamicResource Text.Repository.SearchTip}"
Text="{Binding SearchCommitFilter, Mode=TwoWay}"
KeyDown="OnSearchKeyDown"/>
<Path Width="14" Height="14"
Margin="6,0,0,0"
Fill="{DynamicResource Brush.FG2}"
Data="{StaticResource Icons.Search}"
HorizontalAlignment="Left"/>
<Button Classes="icon_button"
Width="16"
Margin="0,0,6,0"
Command="{Binding ClearSearchCommitFilter}"
IsVisible="{Binding SearchCommitFilter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
HorizontalAlignment="Right">
<Path Width="14" Height="14"
Margin="0,1,0,0"
Fill="{DynamicResource Brush.FG1}"
Data="{StaticResource Icons.Clear}"/>
</Button> </Button>
<Grid Grid.Column="1">
<TextBox Grid.Column="1"
Padding="22,0"
FontSize="12"
Height="24"
Background="{DynamicResource Brush.Contents}"
BorderBrush="{DynamicResource Brush.Border2}"
BorderThickness="1"
CornerRadius="12"
Watermark="{DynamicResource Text.Repository.SearchTip}"
Text="{Binding SearchCommitFilter, Mode=TwoWay}"
KeyDown="OnSearchKeyDown"/>
<Path Width="14" Height="14"
Margin="6,0,0,0"
Fill="{DynamicResource Brush.FG2}"
Data="{StaticResource Icons.Search}"
HorizontalAlignment="Left"/>
<Button Classes="icon_button"
Width="16"
Margin="0,0,6,0"
Command="{Binding ClearSearchCommitFilter}"
IsVisible="{Binding SearchCommitFilter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
HorizontalAlignment="Right">
<Path Width="14" Height="14"
Margin="0,1,0,0"
Fill="{DynamicResource Brush.FG1}"
Data="{StaticResource Icons.Clear}"/>
</Button>
</Grid>
</Grid> </Grid>
<DataGrid Grid.Row="1" <DataGrid Grid.Row="1"
ItemsSource="{Binding SearchedCommits}" ItemsSource="{Binding SearchedCommits}"
SelectionMode="Single" SelectionMode="Single"
CanUserReorderColumns="False" CanUserReorderColumns="False"
CanUserResizeColumns="False" CanUserResizeColumns="False"
CanUserSortColumns="False" CanUserSortColumns="False"
IsReadOnly="True" IsReadOnly="True"
HeadersVisibility="None" HeadersVisibility="None"
Focusable="False" Focusable="False"
RowHeight="50" RowHeight="50"
BorderThickness="1" BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border2}" BorderBrush="{DynamicResource Brush.Border2}"
Background="{DynamicResource Brush.Contents}" Background="{DynamicResource Brush.Contents}"
Margin="4" Margin="4,0,4,4"
HorizontalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
SelectionChanged="OnSearchResultDataGridSelectionChanged"> SelectionChanged="OnSearchResultDataGridSelectionChanged">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTemplateColumn Width="*"> <DataGridTemplateColumn Width="*">