style<*>: remove Waiting panel; adjustment for high dpi screens;

This commit is contained in:
leo 2021-04-02 22:45:19 +08:00
parent 762e51de74
commit fa3ff6f2db
16 changed files with 79 additions and 103 deletions

View file

@ -411,9 +411,6 @@
<sys:String x:Key="Text.Conflict.Revert">Revert merge request detected! Press 'Abort' to restore original HEAD</sys:String>
<sys:String x:Key="Text.Conflict.Merge">Merge request detected! Press 'Abort' to restore original HEAD</sys:String>
<sys:String x:Key="Text.Waiting.UpdateSubmodule">WAITING SUBMOUDLE UPDATE COMPLETE...</sys:String>
<sys:String x:Key="Text.Waiting.Staging">WAITING STAGE COMPLETE...</sys:String>
<sys:String x:Key="Text.NotConfigured">Git has NOT been configured.\nPlease to go [Preference] and configure it first.</sys:String>
<sys:String x:Key="Text.PathNotFound">Path[{0}] not exists!</sys:String>
<sys:String x:Key="Text.MissingBash">Can NOT locate bash.exe. Make sure bash.exe exists under the same folder with git.exe</sys:String>

View file

@ -411,9 +411,6 @@
<sys:String x:Key="Text.Conflict.Revert">检测到回滚提交冲突!</sys:String>
<sys:String x:Key="Text.Conflict.Merge">检测到分支合并冲突!</sys:String>
<sys:String x:Key="Text.Waiting.UpdateSubmodule">等待子模块更新完成...</sys:String>
<sys:String x:Key="Text.Waiting.Staging">等待暂存完成 ...</sys:String>
<sys:String x:Key="Text.NotConfigured">GIT尚未配置。请打开【偏好设置】配置GIT路径。</sys:String>
<sys:String x:Key="Text.PathNotFound">路径({0})不存在或不可读取!</sys:String>
<sys:String x:Key="Text.MissingBash">无法找到bash.exe请确保其在git.exe同目录中</sys:String>

View file

@ -14,7 +14,7 @@
</WindowChrome.WindowChrome>
<!-- Window Layout -->
<Border BorderBrush="{StaticResource Brush.Border0}" BorderThickness="1">
<Border Background="{StaticResource Brush.Border0}" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="32"/>

View file

@ -14,7 +14,7 @@
</WindowChrome.WindowChrome>
<!-- Window Content -->
<Border BorderBrush="{StaticResource Brush.Border0}">
<Border BorderBrush="{StaticResource Brush.Border0}" Background="{StaticResource Brush.Border0}">
<!-- Fix Maximize BUG -->
<Border.Style>
<Style TargetType="{x:Type Border}">

View file

@ -26,12 +26,11 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Toolbar -->
<Grid Grid.Row="0" Panel.ZIndex="100">
<Border Grid.Row="0" Panel.ZIndex="100" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1">
<Grid Background="{StaticResource Brush.Window}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
@ -106,15 +105,13 @@
</Button>
</StackPanel>
</Grid>
</Grid>
<Rectangle Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="1" Fill="{StaticResource Brush.Border0}"/>
</Border>
<!-- Main body -->
<Grid Grid.Row="2">
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" MinWidth="200" MaxWidth="300"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition Width="1" MaxWidth="1"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
@ -436,7 +433,11 @@
<Path Width="14" Height="14" Data="{StaticResource Icon.Submodule}"/>
</Button>
<Button Grid.Column="3" Click="UpdateSubmodule" ToolTip="{StaticResource Text.Dashboard.Submodules.Update}">
<Path Width="14" Height="14" Data="{StaticResource Icon.Loading}"/>
<Path x:Name="iconUpdateSubmodule" Width="14" Height="14" Data="{StaticResource Icon.Loading}" RenderTransformOrigin=".5,.5">
<Path.RenderTransform>
<RotateTransform Angle="0"/>
</Path.RenderTransform>
</Path>
</Button>
</Grid>
</ToggleButton>
@ -480,7 +481,7 @@
</Grid>
<!-- Splitter -->
<GridSplitter Grid.Column="1" Width="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>
<!-- Right -->
<Grid Grid.Column="2">

View file

@ -9,6 +9,7 @@ using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Threading;
namespace SourceGit.UI {
@ -990,8 +991,12 @@ namespace SourceGit.UI {
AddSubmodule.Show(repo);
}
private void UpdateSubmodule(object sender, RoutedEventArgs e) {
Waiting.Show(repo, "Text.Waiting.UpdateSubmodule", () => repo.UpdateSubmodule());
private async void UpdateSubmodule(object sender, RoutedEventArgs e) {
DoubleAnimation anim = new DoubleAnimation(0, 360, TimeSpan.FromSeconds(1));
anim.RepeatBehavior = RepeatBehavior.Forever;
iconUpdateSubmodule.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, anim);
await Task.Run(() => repo.UpdateSubmodule());
iconUpdateSubmodule.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, null);
}
private void SubmoduleLostFocus(object sender, RoutedEventArgs e) {

View file

@ -15,7 +15,7 @@
</WindowChrome.WindowChrome>
<!-- Layout Window -->
<Border Background="{StaticResource Brush.Window}" BorderBrush="{StaticResource Brush.Border0}">
<Border Background="{StaticResource Brush.Border0}" BorderBrush="{StaticResource Brush.Border0}">
<!-- Fix Maximize BUG -->
<Border.Style>
<Style TargetType="{x:Type Border}">
@ -83,7 +83,7 @@
<!-- Body -->
<Border Grid.Row="1" ClipToBounds="True">
<Grid>
<Grid Background="{StaticResource Brush.Window}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="*"/>
@ -93,7 +93,7 @@
x:Name="commitList"
Margin="0,0,0,0"
Grid.Column="0"
Background="{StaticResource Brush.Window}"
Background="{StaticResource Brush.Contents}"
BorderThickness="0"
SelectionMode="Single"
SelectionChanged="CommitSelectionChanged">

View file

@ -14,8 +14,8 @@
</WindowChrome.WindowChrome>
<!-- Window Layout -->
<Border Background="{StaticResource Brush.Window}" BorderThickness="1" BorderBrush="{StaticResource Brush.Border0}">
<Grid>
<Border Background="{StaticResource Brush.Border0}" BorderThickness="1" BorderBrush="{StaticResource Brush.Border0}">
<Grid Background="{StaticResource Brush.Window}">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="32"/>
@ -61,7 +61,7 @@
</StackPanel>
<!-- File system tree -->
<Border Grid.Row="2" Margin="4" Background="{StaticResource Brush.Contents}" BorderBrush="{StaticResource Brush.Border1}" BorderThickness="1">
<Border Grid.Row="2" Margin="4" Background="{StaticResource Brush.Contents}" BorderBrush="{StaticResource Brush.Border2}" BorderThickness="1">
<TreeView x:Name="treePath" FontFamily="Consolas" PreviewMouseWheel="OnTreeMouseWheel" SelectedItemChanged="OnTreeSelectedChanged">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource Style.TreeView.ItemContainerStyle}">

View file

@ -15,16 +15,18 @@
</WindowChrome.WindowChrome>
<!-- Window Content -->
<Border Background="{StaticResource Brush.Window}">
<Border Background="{StaticResource Brush.Border0}" BorderBrush="{StaticResource Brush.Border0}">
<!-- Fix Maximize BUG -->
<Border.Style>
<Style TargetType="{x:Type Border}">
<Style.Triggers>
<DataTrigger Binding="{Binding WindowState, ElementName=me}" Value="Maximized">
<Setter Property="Margin" Value="6"/>
<Setter Property="BorderThickness" Value="0"/>
</DataTrigger>
<DataTrigger Binding="{Binding WindowState, ElementName=me}" Value="Normal">
<Setter Property="Margin" Value="0"/>
<Setter Property="BorderThickness" Value="1"/>
</DataTrigger>
</Style.Triggers>
</Style>
@ -188,7 +190,7 @@
<local:CommitViewer x:Name="commitViewer" Grid.Row="3" Background="{StaticResource Brush.CommitViewer}"/>
<!-- Options Bar -->
<Grid Grid.Row="5">
<Grid Grid.Row="5" Background="{StaticResource Brush.CommitViewer}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/>

View file

@ -6,7 +6,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:source="clr-namespace:SourceGit"
xmlns:local="clr-namespace:SourceGit.UI"
xmlns:helpers="clr-namespace:SourceGit.Helpers"
xmlns:converters="clr-namespace:SourceGit.Converters"
mc:Ignorable="d"
MinWidth="800" MinHeight="600"
@ -21,7 +20,7 @@
</WindowChrome.WindowChrome>
<!-- Window Layout -->
<Border BorderBrush="{StaticResource Brush.Border0}">
<Border BorderBrush="{StaticResource Brush.Border0}" Background="{StaticResource Brush.Border0}">
<!-- Fix Maximize BUG -->
<Border.Style>
@ -110,11 +109,11 @@
<TabControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="BG" MinWidth="80" Margin="8,0" Background="Transparent">
<Grid x:Name="BG" Margin="8,0" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" MinWidth="6"/>
<ColumnDefinition Width="4"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

View file

@ -18,7 +18,7 @@
</WindowChrome.WindowChrome>
<!-- Window Layout -->
<Border BorderBrush="{StaticResource Brush.Border0}" BorderThickness="1">
<Border Background="{StaticResource Brush.Border0}" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="1">
<Grid Background="{StaticResource Brush.Window}">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>

View file

@ -14,7 +14,7 @@
</WindowChrome.WindowChrome>
<!-- Window Layout -->
<Border BorderBrush="{StaticResource Brush.Border0}" BorderThickness="1">
<Border Background="{StaticResource Brush.Border0}" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="1">
<Grid Background="{StaticResource Brush.Window}">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>

View file

@ -1,9 +0,0 @@
<UserControl x:Class="SourceGit.UI.Waiting"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="160" d:DesignWidth="500" Height="200" Width="500">
<TextBlock x:Name="txtTip" Text="WAITING ..." HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Consolas" FontWeight="Bold" FontSize="16" Foreground="{StaticResource Brush.FG1}"/>
</UserControl>

View file

@ -1,41 +0,0 @@
using System;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace SourceGit.UI {
/// <summary>
/// General waiting dialog.
/// </summary>
public partial class Waiting : UserControl {
/// <summary>
/// Constructor.
/// </summary>
public Waiting() {
InitializeComponent();
}
/// <summary>
/// Show this dialog.
/// </summary>
/// <param name="repo"></param>
/// <param name="tip"></param>
/// <param name="job"></param>
public static void Show(Git.Repository repo, string tipKey, Action job) {
var dialog = new Waiting();
var tip = dialog.FindResource(tipKey) as string;
if (tip != null) dialog.txtTip.Text = tip;
var popup = repo.GetPopupManager();
popup?.Show(dialog);
popup?.Lock();
Task.Run(() => {
job.Invoke();
dialog.Dispatcher.Invoke(() => {
popup?.Close(true);
});
});
}
}
}

View file

@ -29,7 +29,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition Width="1" MaxWidth="1"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
@ -45,12 +45,12 @@
<Grid Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
@ -58,22 +58,29 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.ColumnSpan="6" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1"/>
<local:FilesDisplayModeSwitch
Grid.Column="0"
Mode="{Binding Source={x:Static source:App.Setting}, Path=UI.UnstageFileDisplayMode, Mode=TwoWay}"/>
<Label Grid.Column="1" Content="{StaticResource Text.WorkingCopy.Unstaged}" FontWeight="Bold" Foreground="{StaticResource Brush.FG2}"/>
<Button Grid.Column="3" Click="Stage" Margin="4,0" ToolTip="{StaticResource Text.WorkingCopy.Unstaged.Stage}" Background="Transparent">
<Path x:Name="iconStaging" Grid.Column="2" Visibility="Collapsed" Margin="8,0" Data="{StaticResource Icon.Loading}" RenderTransformOrigin=".5,.5">
<Path.RenderTransform>
<RotateTransform Angle="0"/>
</Path.RenderTransform>
</Path>
<Button Grid.Column="4" Click="Stage" Margin="4,0" ToolTip="{StaticResource Text.WorkingCopy.Unstaged.Stage}" Background="Transparent">
<Path Width="14" Height="14" Data="{StaticResource Icon.Down}" Opacity=".4"/>
</Button>
<Button Grid.Column="4" Click="StageAll" Margin="4,0" ToolTip="{StaticResource Text.WorkingCopy.Unstaged.StageAll}" Background="Transparent">
<Button Grid.Column="5" Click="StageAll" Margin="4,0" ToolTip="{StaticResource Text.WorkingCopy.Unstaged.StageAll}" Background="Transparent">
<Path Width="14" Height="14" Data="{StaticResource Icon.DoubleDown}" Opacity=".4"/>
</Button>
</Grid>
<Rectangle Grid.Row="1" HorizontalAlignment="Stretch" Height="1" Fill="{StaticResource Brush.Border0}"/>
<TreeView
Grid.Row="2"
Grid.Row="1"
x:Name="unstagedTree"
ItemsSource="{Binding ElementName=me, Path=UnstagedTreeData, IsAsync=True}"
Background="{StaticResource Brush.Contents}"
@ -205,7 +212,6 @@
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="1"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
@ -218,6 +224,8 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.ColumnSpan="5" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1"/>
<local:FilesDisplayModeSwitch
Grid.Column="0"
Mode="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Mode=TwoWay}"/>
@ -230,10 +238,8 @@
</Button>
</Grid>
<Rectangle Grid.Row="1" HorizontalAlignment="Stretch" Height="1" Fill="{StaticResource Brush.Border0}"/>
<TreeView
Grid.Row="2"
Grid.Row="1"
x:Name="stageTree"
ItemsSource="{Binding ElementName=me, Path=StagedTreeData, IsAsync=False}"
Visibility="{Binding Source={x:Static source:App.Setting}, Path=UI.StagedFileDisplayMode, Converter={StaticResource FilesDisplayModeToTree}}"
@ -360,7 +366,7 @@
</Grid>
<!-- Splitter -->
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>
<GridSplitter Grid.Column="1" Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="{StaticResource Brush.Border0}"/>
<!-- Right -->
<Grid Grid.Column="2" Margin="8">

View file

@ -338,7 +338,7 @@ namespace SourceGit.UI {
var stage = new MenuItem();
stage.Header = App.Text("FileCM.Stage");
stage.Click += (o, e) => {
Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(node.FilePath));
DoStage(node.FilePath);
e.Handled = true;
};
@ -410,7 +410,7 @@ namespace SourceGit.UI {
var stage = new MenuItem();
stage.Header = App.Format("FileCM.StageMulti", changes.Count);
stage.Click += (o, e) => {
Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(files.ToArray()));
DoStage(files.ToArray());
e.Handled = true;
};
@ -480,7 +480,7 @@ namespace SourceGit.UI {
var stage = new MenuItem();
stage.Header = App.Text("FileCM.Stage");
stage.Click += (o, e) => {
Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(change.Path));
DoStage(change.Path);
e.Handled = true;
};
@ -553,7 +553,7 @@ namespace SourceGit.UI {
var stage = new MenuItem();
stage.Header = App.Format("FileCM.StageMulti", changes.Count);
stage.Click += (o, e) => {
Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(files.ToArray()));
DoStage(files.ToArray());
e.Handled = true;
};
@ -614,12 +614,25 @@ namespace SourceGit.UI {
}
}
if (files.Count == 0) return;
Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(files.ToArray()));
if (files.Count > 0) DoStage(files.ToArray());
}
private void StageAll(object sender, RoutedEventArgs e) {
Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage());
DoStage();
}
private void DoStage(params string[] files) {
DoubleAnimation anim = new DoubleAnimation(0, 360, TimeSpan.FromSeconds(1));
anim.RepeatBehavior = RepeatBehavior.Forever;
iconStaging.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, anim);
iconStaging.Visibility = Visibility.Visible;
Task.Run(() => {
Repo.Stage(files);
Dispatcher.Invoke(() => {
iconStaging.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, null);
iconStaging.Visibility = Visibility.Collapsed;
});
});
}
#endregion
@ -964,7 +977,13 @@ namespace SourceGit.UI {
txtCommitMsg.GetBindingExpression(TextBox.TextProperty).UpdateSource();
if (Validation.GetHasError(txtCommitMsg)) return;
DoubleAnimation anim = new DoubleAnimation(0, 360, TimeSpan.FromSeconds(1));
anim.RepeatBehavior = RepeatBehavior.Forever;
iconCommiting.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, anim);
iconCommiting.Visibility = Visibility.Visible;
bool succ = await Task.Run(() => Repo.DoCommit(CommitMessage, amend));
iconCommiting.RenderTransform.BeginAnimation(RotateTransform.AngleProperty, null);
iconCommiting.Visibility = Visibility.Collapsed;
if (!succ) return;
ClearMessage();