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;
}
public void ExitSearchMode() {
IsSearching = false;
}
public void SetWatcherEnabled(bool 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}">
<Path Width="13" Height="13" Data="{StaticResource Icons.Terminal}"/>
</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 Grid.Column="1" Orientation="Horizontal">
@ -53,13 +60,9 @@
VerticalAlignment="Center"
Fill="{DynamicResource Brush.Border2}"/>
<ToggleButton Width="32"
Margin="16,0,0,0"
Background="Transparent"
IsChecked="{Binding IsSearching, Mode=TwoWay}"
ToolTip.Tip="{DynamicResource Text.Repository.Search}">
<Path Width="14" Height="14" Data="{StaticResource Icons.Search}"/>
</ToggleButton>
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Click="OpenGitFlowMenu" ToolTip.Tip="{DynamicResource Text.GitFlow}">
<Path Width="12" Height="12" Data="{StaticResource Icons.Flow}"/>
</Button>
</StackPanel>
<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}}"
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}">
<Path Width="15" Height="15" Data="{StaticResource Icons.Settings1}"/>
</Button>
@ -92,7 +91,12 @@
<!-- 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}">
<!-- 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.ItemsPanel>
<ItemsPanelTemplate>
@ -141,12 +145,9 @@
</ListBox>
<!-- 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}"/>
<Button Grid.Column="1" Classes="icon_button" Width="14" Margin="8,0" Click="OpenGitFlowMenu" ToolTip.Tip="{DynamicResource Text.GitFlow}">
<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}">
<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.Branch.Add}"/>
</Button>
</Grid>
@ -345,61 +346,52 @@
<!-- Left Search Mode -->
<Grid Grid.Column="0" RowDefinitions="32,*" IsVisible="{Binding IsSearching}">
<!-- Search -->
<Grid Grid.Row="0" ColumnDefinitions="Auto,*" Margin="4,2">
<Button Grid.Column="0"
Classes="icon_button"
Width="32"
Command="{Binding ExitSearchMode}">
<Path Width="16" Height="16" Data="{StaticResource Icons.Goback}"/>
<Grid Grid.Row="0" Margin="4,2">
<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.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>
<DataGrid Grid.Row="1"
ItemsSource="{Binding SearchedCommits}"
SelectionMode="Single"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserSortColumns="False"
IsReadOnly="True"
HeadersVisibility="None"
Focusable="False"
RowHeight="50"
ItemsSource="{Binding SearchedCommits}"
SelectionMode="Single"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserSortColumns="False"
IsReadOnly="True"
HeadersVisibility="None"
Focusable="False"
RowHeight="50"
BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border2}"
Background="{DynamicResource Brush.Contents}"
Margin="4"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
Margin="4,0,4,4"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
SelectionChanged="OnSearchResultDataGridSelectionChanged">
<DataGrid.Columns>
<DataGridTemplateColumn Width="*">