Skip to content

Commit

Permalink
Revert ability for move and show/hide toolbars
Browse files Browse the repository at this point in the history
Due to discovered layout and placement instability of toolbars
reverting most of the functionality added in gitextensions#8572.

Closes gitextensions#8680
  • Loading branch information
RussKie committed Jan 18, 2021
1 parent e0619e4 commit f5b4e7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 2 additions & 0 deletions GitUI/CommandsDialogs/FormBrowse.Designer.cs

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

29 changes: 13 additions & 16 deletions GitUI/CommandsDialogs/FormBrowse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ public FormBrowse([NotNull] GitUICommands commands, string filter, ObjectId sele

ManageWorktreeSupport();

WorkaroundToolbarLocationBug();

var toolBackColor = SystemColors.Window;
var toolForeColor = SystemColors.WindowText;
BackColor = toolBackColor;
Expand Down Expand Up @@ -312,6 +314,16 @@ public FormBrowse([NotNull] GitUICommands commands, string filter, ObjectId sele

return;

void WorkaroundToolbarLocationBug()
{
// Layout engine bug (?) which may change the order of toolbars
// if the 1st one becomes longer than the 2nd toolbar's Location.X
// the layout engine will be place the 2nd toolbar first
toolPanel.TopToolStripPanel.Controls.Clear();
toolPanel.TopToolStripPanel.Controls.Add(ToolStripFilters);
toolPanel.TopToolStripPanel.Controls.Add(ToolStripMain);
}

void FocusRevisionDiffFileStatusList()
{
if (!revisionDiff.Visible)
Expand Down Expand Up @@ -615,18 +627,7 @@ protected override void OnApplicationActivated()

protected override void OnLoad(EventArgs e)
{
// Removing the main menu before restoring the toolstrip layouts
// as it *does* randomly change the order of the defined items in the menu
Controls.Remove(mainMenuStrip);

toolPanel.TopToolStripPanel.SuspendLayout();
ToolStripManager.LoadSettings(this, "toolsettings");
toolPanel.TopToolStripPanel.ResumeLayout();

// Add the menu back
Controls.Add(mainMenuStrip);

_formBrowseMenus.CreateToolbarsMenus(ToolStripMain, ToolStripFilters);
_formBrowseMenus.CreateToolbarsMenus(ToolStripMain, ToolStripFilters, toolStripScripts);

HideVariableMainMenuItems();
RefreshSplitViewLayout();
Expand Down Expand Up @@ -689,10 +690,6 @@ protected override void OnActivated(EventArgs e)

protected override void OnFormClosing(FormClosingEventArgs e)
{
// Remove the main menu to prevent its state being persisted
Controls.Remove(mainMenuStrip);

ToolStripManager.SaveSettings(this, "toolsettings");
SaveApplicationSettings();

foreach (var control in this.FindDescendants())
Expand Down

0 comments on commit f5b4e7c

Please sign in to comment.