Skip to content

Commit

Permalink
Dialogs layout alignment - FormStatus and descendants
Browse files Browse the repository at this point in the history
* Update `FormStatus` layout
* Update `FormProgress` layout
* Update `FormRemoteProgress` layout

Relates to #6183
  • Loading branch information
RussKie committed Jul 12, 2020
1 parent ed70cd8 commit 12c2310
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 103 deletions.
6 changes: 0 additions & 6 deletions GitUI/GitExtensionsDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions GitUI/HelperDialogs/FormProcess.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using GitCommands;
Expand Down Expand Up @@ -28,8 +28,8 @@ private protected FormProcess()
{
}

private FormProcess(ConsoleOutputControl outputControl, [CanBeNull] string process, ArgumentString arguments, string workingDirectory, string input, bool useDialogSettings)
: base(outputControl, useDialogSettings)
private FormProcess(GitUICommands commands, ConsoleOutputControl outputControl, [CanBeNull] string process, ArgumentString arguments, string workingDirectory, string input, bool useDialogSettings)
: base(commands, outputControl, useDialogSettings)
{
ProcessCallback = ProcessStart;
AbortCallback = ProcessAbort;
Expand All @@ -49,14 +49,14 @@ private FormProcess(ConsoleOutputControl outputControl, [CanBeNull] string proce
ConsoleOutput.DataReceived += DataReceivedCore;
}

public FormProcess(string process, ArgumentString arguments, string workingDirectory, string input, bool useDialogSettings)
: this(null, process, arguments, workingDirectory, input, useDialogSettings)
public FormProcess(GitUICommands commands, string process, ArgumentString arguments, string workingDirectory, string input, bool useDialogSettings)
: this(commands, outputControl: null, process, arguments, workingDirectory, input, useDialogSettings)
{
}

public static bool ShowDialog([CanBeNull] IWin32Window owner, string process, ArgumentString arguments, string workingDirectory, string input, bool useDialogSettings)
{
using (var formProcess = new FormProcess(process, arguments, workingDirectory, input, useDialogSettings))
using (var formProcess = new FormProcess(commands: null, process, arguments, workingDirectory, input, useDialogSettings))
{
formProcess.ShowDialog(owner);
return !formProcess.ErrorOccurred();
Expand All @@ -65,7 +65,7 @@ public static bool ShowDialog([CanBeNull] IWin32Window owner, string process, Ar

public static string ReadDialog([CanBeNull] IWin32Window owner, string process, ArgumentString arguments, string workingDirectory, string input, bool useDialogSettings)
{
using (var formProcess = new FormProcess(process, arguments, workingDirectory, input, useDialogSettings))
using (var formProcess = new FormProcess(commands: null, process, arguments, workingDirectory, input, useDialogSettings))
{
formProcess.ShowDialog(owner);
return formProcess.GetOutputString();
Expand Down
4 changes: 2 additions & 2 deletions GitUI/HelperDialogs/FormRemoteProcess.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Windows.Forms;
using GitCommands;
using GitCommands.Config;
Expand Down Expand Up @@ -37,7 +37,7 @@ private FormRemoteProcess()
}

public FormRemoteProcess([NotNull] GitUICommands commands, string process, ArgumentString arguments)
: base(process, arguments, commands?.Module?.WorkingDir, null, true)
: base(commands, process, arguments, commands?.Module?.WorkingDir, null, true)
{
Commands = commands ?? throw new ArgumentNullException(nameof(commands));
}
Expand Down
133 changes: 51 additions & 82 deletions GitUI/HelperDialogs/FormStatus.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions GitUI/HelperDialogs/FormStatus.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Threading;
Expand All @@ -10,7 +10,7 @@

namespace GitUI.HelperDialogs
{
public partial class FormStatus : GitExtensionsForm
public partial class FormStatus : GitExtensionsDialog
{
private readonly bool _useDialogSettings;

Expand All @@ -24,8 +24,8 @@ private protected FormStatus()
InitializeComponent();
}

public FormStatus([CanBeNull] ConsoleOutputControl consoleOutput, bool useDialogSettings)
: base(true)
public FormStatus(GitUICommands commands, [CanBeNull] ConsoleOutputControl consoleOutput, bool useDialogSettings)
: base(commands, enablePositionRestore: true)
{
_useDialogSettings = useDialogSettings;

Expand All @@ -44,11 +44,19 @@ public FormStatus([CanBeNull] ConsoleOutputControl consoleOutput, bool useDialog
KeepDialogOpen.Hide();
}

// work-around the designer bug that can't add controls to FlowLayoutPanel
ControlsPanel.Controls.Add(Abort);
ControlsPanel.Controls.Add(Ok);
ControlsPanel.Controls.Add(KeepDialogOpen);

Controls.SetChildIndex(ProgressBar, 1);
ProgressBar.Dock = DockStyle.Bottom;

InitializeComplete();
}

public FormStatus(Action<FormStatus> process, string text)
: this(new EditboxBasedConsoleOutputControl(), true)
: this(commands: null, new EditboxBasedConsoleOutputControl(), true)
{
ProcessCallback = process;
Text = text;
Expand Down
2 changes: 1 addition & 1 deletion GitUI/UserControls/RevisionGrid/RevisionGridControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2604,7 +2604,7 @@ private void LaunchRebase(string command)
LatestSelectedRevision.FirstParentId?.ToString(),
interactive: true, preserveMerges: false, autosquash: false, autoStash: true);

using (var formProcess = new FormProcess(null, rebaseCmd, Module.WorkingDir, null, true))
using (var formProcess = new FormProcess(UICommands, process: null, arguments: rebaseCmd, Module.WorkingDir, input: null, useDialogSettings: true))
{
formProcess.ProcessEnvVariables.Add("GIT_SEQUENCE_EDITOR", string.Format("sed -i -re '0,/pick/s//{0}/'", command));
formProcess.ShowDialog(this);
Expand Down

0 comments on commit 12c2310

Please sign in to comment.