Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert ability for move and show/hide toolbars #8719

Merged
merged 2 commits into from Jan 18, 2021

Conversation

RussKie
Copy link
Member

@RussKie RussKie commented Jan 3, 2021

Due to discovered layout and placement instability of toolbars
reverting most of the functionality added in #8572.

Closes #8680


✒️ I contribute this code under The Developer Certificate of Origin.

@RussKie RussKie requested a review from pmiossec January 3, 2021 13:22
@ghost ghost assigned RussKie Jan 3, 2021
Copy link
Member

@gerhardol gerhardol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me

@codecov
Copy link

codecov bot commented Jan 3, 2021

Codecov Report

Merging #8719 (43cf6b5) into master (bd7c527) will increase coverage by 0.31%.
The diff coverage is 88.88%.

@@            Coverage Diff             @@
##           master    #8719      +/-   ##
==========================================
+ Coverage   55.78%   56.09%   +0.31%     
==========================================
  Files         900      900              
  Lines       65072    65099      +27     
  Branches    11745    11813      +68     
==========================================
+ Hits        36300    36518     +218     
+ Misses      25923    25666     -257     
- Partials     2849     2915      +66     
Flag Coverage Δ
production 43.22% <88.88%> (+0.42%) ⬆️
tests 94.81% <ø> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@pmiossec
Copy link
Member

pmiossec commented Jan 3, 2021

In my case, that doesn't solve the main problem I introduced with #8572, that is that the "Branch/filter" toolbar is displayed before the "Main" toolbar:

image

So, with this PR, this is somewhat worse because this layout is now no more changeable...

@RussKie Do you know where the toolbar positions are saved? I would like to see if the values are well saved...

@RussKie
Copy link
Member Author

RussKie commented Jan 3, 2021

Do you know where the toolbar positions are saved? I would like to see if the values are well saved...

I don't think this has anything to do with the saved data, as it is no longer used - I've removed all associated code.
This may be an artifact of changes in the designer though

@RussKie
Copy link
Member Author

RussKie commented Jan 7, 2021

@pmiossec I've run this on two different PCs and haven't observed any issues.
Are you having issues in a dev version launched from VS? Can you try run git clean -xdf and then .\build.cmd -launch and see if you still get issues?
The settings are stored in a local user config located somewhere like this: C:\Users\<user>\AppData\Local\Git_Extensions\GitExtensions.exe_Url_<some crazy string>\33.33.33.0\user.config but I don't believe it has any relevance now, as we no longer persist/load the data from it.

@pmiossec
Copy link
Member

pmiossec commented Jan 7, 2021

Are you having issues in a dev version launched from VS? Can you try run git clean -xdf and then .\build.cmd -launch and see if you still get issues?

Created a new worktree (so clean workspace) and I have this behavior (still the same):

bug_toolbar

The settings are stored in a local user config located somewhere like this: C:\Users<user>\AppData\Local\Git_Extensions\GitExtensions.exe_Url_\33.33.33.0\user.config but I don't believe it has any relevance now, as we no longer persist/load the data from it.

I will still have a look...

@pmiossec
Copy link
Member

pmiossec commented Jan 7, 2021

The settings are stored in a local user config located somewhere like this: C:\Users\AppData\Local\Git_Extensions\GitExtensions.exe_Url_\33.33.33.0\user.config but I don't believe it has any relevance now, as we no longer persist/load the data from it.

What didn't work:

  • removing this user.config file
  • removing the WindowPositions.xml file

But changing the DPI scale to 100% instead of 200% fix the toolbar positioning.
Another DPI scale problem 😭

@RussKie
Copy link
Member Author

RussKie commented Jan 7, 2021

So any latest build renders correctly on <200%, and incorrect on 200%?

@pmiossec
Copy link
Member

pmiossec commented Jan 7, 2021

So any latest build renders correctly on <200%, and incorrect on 200%?

No, it took me some time to find the reason, so I just had some time to test 100% and 200% (that I use every days) with the code corresponding to this PR.

I can just assert that every build since the introduction of the 2 toolbars (with this revert or not) display badly 200%.

So before merging this revert, we have to test different dpi scaling to better understand.

And if doesn't work, perhaps we will just have to revert the cut in 2 toolbars (until we find a fix)

@pmiossec
Copy link
Member

pmiossec commented Jan 8, 2021

Quick test: only 100% display toolbars well. 125%, 150%, 175%, 200% and 225% failed (and I stopped here)

@RussKie RussKie marked this pull request as draft January 9, 2021 01:35
@RussKie
Copy link
Member Author

RussKie commented Jan 9, 2021

I can repro the issue, thank you. Investigating

@RussKie
Copy link
Member Author

RussKie commented Jan 9, 2021

Pushed a possible workaround, please try it.

@RussKie
Copy link
Member Author

RussKie commented Jan 9, 2021

I can't seem to repro the issue in a standalone repro, so quite likely the origin of the bug is same as for #8572 and #8698.

@RussKie
Copy link
Member Author

RussKie commented Jan 9, 2021

It took me awhile, but I got a clean repro: https://github.com/RussKie/Test-ToolStripOrder

@RussKie
Copy link
Member Author

RussKie commented Jan 12, 2021

@pmiossec have had a chance to test?

@pmiossec
Copy link
Member

It took me awhile, but I got a clean repro: https://github.com/RussKie/Test-ToolStripOrder
@pmiossec have had a chance to test?

Yes, I reproduce with this repository

@RussKie
Copy link
Member Author

RussKie commented Jan 12, 2021 via email

@pmiossec

This comment has been minimized.

@RussKie

This comment has been minimized.

@RussKie RussKie marked this pull request as ready for review January 16, 2021 12:16
Copy link
Member

@pmiossec pmiossec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a new test, work as expected.

@pmiossec
Copy link
Member

2 things about the cutting of the toolbars.

  1. I find it strange to have the user scripts, that are added to the "Standard" toolbar, to be displayed before the "Filters" toolbar, like that:

image

I think we should create a new toolbar and display it after the 2 other toolbars to get something like that (so that we kept the toolbar layout in the current release):
image

  1. I don't really understand why this PR revert also the hiding of the toolbar that works well (now that we discovered what was the cause of the toolbar bad placement and that you provided a workaround).
    As you kept the cutting of the toolbar in 2 (i.e. that you didn't revert the whole development), perhaps we could at least kept one feature allowed by this cutting, no!?!

Please have a look at my branch that did this 2 things:

https://github.com/pmiossec/gitextensions/tree/new_toolbar_for_scripts

@RussKie
Copy link
Member Author

RussKie commented Jan 17, 2021

Please have a look at my branch that did this 2 things:

https://github.com/pmiossec/gitextensions/tree/new_toolbar_for_scripts

Thank you, works for me :)
Though the new toolbar must look the same as the other two:
image

Copy link
Member

@gerhardol gerhardol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

// 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(ToolStripScripts);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the order is left-to-right display order, should the order consistently be Filters, Sscripts, Main?

and I would prefer to remove/add button by button instead, splitting the toolbar is not adding much...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

splitting the toolbar is not adding much

It is adding if a) toolbar can be moved, and b) toolbars can be shown/hidden. "a" obviously doesn't work at this stage, but "b" is working just fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the order consistently be Filters, Sscripts, Main?

The order is: Main, Filters, Scripts.

@RussKie
Copy link
Member Author

RussKie commented Jan 18, 2021

  1. I don't really understand why this PR revert also the hiding of the toolbar that works well (now that we discovered what was the cause of the toolbar bad placement and that you provided a workaround).
    As you kept the cutting of the toolbar in 2 (i.e. that you didn't revert the whole development), perhaps we could at least kept one feature allowed by this cutting, no!?!

We also need to restore persistence of shown/hidden state as well.

Due to discovered layout and placement instability of toolbars
reverting most of the functionality added in gitextensions#8572.

Closes gitextensions#8680
@RussKie
Copy link
Member Author

RussKie commented Jan 18, 2021

Merging, we can deal with saving/restoring visibility of the toolbars separately.

@RussKie RussKie merged commit 9685011 into gitextensions:master Jan 18, 2021
@RussKie RussKie deleted the disable_toolbar_movement branch January 18, 2021 12:57
@RussKie RussKie added this to the 3.5 milestone Jan 26, 2021
RussKie added a commit to RussKie/gitextensions that referenced this pull request Jan 16, 2022
Reintroduce ability to move toolstrips (as proposed in gitextensions#8572).

This implementation is heavily influenced by the original implementation
ToolStripSettingsManager in Windows Forms, however we only track visibility
and location of each individual toolstrip. We're also only saving specified
toolstrips as opposed to saving all known toolstrips (which in various
situations results in terminal failures to restore toolstrips information).

There are two key changes:

1. Restore toolstrip locations after the form's geometry has been restored.
   This ensures the toolstrips can be placed at the same coords as they
   were saved.

2. Hosting ToolStripPanel's padding must be set to 0 before toolstrips'
   locations can be restored/saved. This mitigates dotnet/winforms#4449

Fixes gitextensions#8680
Reverts gitextensions#8719
RussKie added a commit to RussKie/gitextensions that referenced this pull request Jan 16, 2022
Reintroduce ability to move toolstrips (as proposed in gitextensions#8572).

This implementation is heavily influenced by the original implementation
ToolStripSettingsManager in Windows Forms, however we only track visibility
and location of each individual toolstrip. We're also only saving specified
toolstrips as opposed to saving all known toolstrips (which in various
situations results in terminal failures to restore toolstrips information).

There are two key changes:

1. Restore toolstrip locations after the form's geometry has been restored.
   This ensures the toolstrips can be placed at the same coords as they
   were saved.

2. Hosting ToolStripPanel's padding must be set to 0 before toolstrips'
   locations can be restored/saved. This mitigates dotnet/winforms#4449

Fixes gitextensions#8680
Reverts gitextensions#8719
RussKie added a commit to RussKie/gitextensions that referenced this pull request Jan 16, 2022
Reintroduce ability to move toolstrips (as proposed in gitextensions#8572).

This implementation is heavily influenced by the original implementation
ToolStripSettingsManager in Windows Forms, however we only track visibility
and location of each individual toolstrip. We're also only saving specified
toolstrips as opposed to saving all known toolstrips (which in various
situations results in terminal failures to restore toolstrips information).

There are two key changes:

1. Restore toolstrip locations after the form's geometry has been restored.
   This ensures the toolstrips can be placed at the same coords as they
   were saved.

2. Hosting ToolStripPanel's padding must be set to 0 before toolstrips'
   locations can be restored/saved. This mitigates dotnet/winforms#4449

Fixes gitextensions#8680
Reverts gitextensions#8719
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toolbar position is not saved or restored
3 participants