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

Fixes #3273 (Again). Updates FindDeepestView etc... to finish Adornment #3295

Merged
merged 68 commits into from
Mar 14, 2024

Conversation

tig
Copy link
Collaborator

@tig tig commented Mar 5, 2024

Fixes

NOTE: This PR was previously here. But that branch got wiped out accidentally:

Is dependent on

See also:

Proposed Changes/Todos

  • Modify FindDeepestView to return Margin, Padding, or Border if x/y match.
  • Add MouseEvent handling code to Adornment, Margin, Border, and Padding as appropriate (e.g. Adornment.MouseClick += Parent.SetFocus()).
  • Add more FindDeepestView unit tests to prove this change works.
  • Move drag support out of Toplevel into Adornment - Dragging margin or border drags the view.
  • Drag support is not quite right - dragging anywhere on border.Thickness SHOULD work, but only top does
  • Add support for Adornment.SubViews
  • Figure out place for adornments to add their own subviews: Override BeginInit, call base.BeginInit() and check that Parent is {}.
  • Add a prototype Close button to Border - Commented out
  • Build a POC to prove Line can work - Done and commented out
  • Subviews of Adornments that have positive Thickness don't render properly.
  • Subviews of Adornments with Key Bindings get invoked as expected (see Button In Padding in Adornments scenario)
  • Update unit test

Not for this PR, but needed

  • Focus on a Adornment.SubView is not working.
  • When a subview of an Adornment gets focus, Adornment.Parent should get focus.

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@tig
Copy link
Collaborator Author

tig commented Mar 9, 2024

Ok, I think I'm done with this...

I did some refactoring of Responder.cs, View.cs, and ViewLayout.cs in this that may cause merge hell for others. It was needed.

@tig
Copy link
Collaborator Author

tig commented Mar 9, 2024

@BDisp - You'll have some work to get to make the new ScrollBar work around mouse drag stuff, and maybe focus, but your job should be much easier now!

@tig
Copy link
Collaborator Author

tig commented Mar 9, 2024

ro4VjYV 1

@tig tig requested review from BDisp and dodexahedron March 9, 2024 18:10
@tig
Copy link
Collaborator Author

tig commented Mar 10, 2024

@BDisp My recommendation re: #3254 is:

  • Start with a fresh branch based on this branch (effectively abandoning Fixes #2489. Build scrolling into View. #3254).
    • git checkout tig-v2_3273_FOUND-finddeepestview git checkout -b v2_3295-Fixes-Add-Scrolling-To-View
  • Create a new "Scroll in View" Scenario based on Adornments.cs that can be used to experiment and test.
  • Create a new view ScrollBar. Make it just render something distinct; do not try to move old ScrollBarView code over yet.
  • Add public ScrollBar HoriztontalScrollBar and public ScrollBar VerticalScrollBar to View
  • Change Padding.BeginInit to Add(Parent.HoriztonalScrollBar, Parent.VerticalScrollBar)
  • Change Padding.LayoutStarted to position the scrollbars in Padding
  • Start testing/playing with ScrollBar.OnMouseClick to ensure it's working properly.

THEN, start moving ScrollBarView code over to ScrollBar.

This will ensure you are utilizing all the Adornment stuff I've finally gotten working (I think) correctly in this PR. This will also help find places where I got it wrong.

As you find issues, submit them as PRs to this branch.

@BDisp
Copy link
Collaborator

BDisp commented Mar 10, 2024

I agree with you said above, but I prefer you implement all that you've in the "todos" by yourself. There are another features I already added like ContentOffset, ContentSize, UseContentOffset and many of others changes for this really work. I'll merge your PR into mine and see how it'll work, but I don't feel like wasting a lot of time on this.

@tig
Copy link
Collaborator Author

tig commented Mar 10, 2024

I'm now on holiday. Unlikely I'll be able to spend any time on this for the next 7 days.

@BDisp
Copy link
Collaborator

BDisp commented Mar 10, 2024

No problem. There is no rush in this. Good holidays.

@tig tig requested a review from tznind March 11, 2024 00:09
@tig
Copy link
Collaborator Author

tig commented Mar 11, 2024

Can you please review this in the meantime?

@dodexahedron
Copy link
Collaborator

I'm now on holiday. Unlikely I'll be able to spend any time on this for the next 7 days.

Enjoy the break!

@tig tig merged commit a5b1d68 into gui-cs:v2_develop Mar 14, 2024
1 check passed
@tig tig deleted the v2_3273_FOUND_finddeepestview branch April 27, 2024 01:20
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.

None yet

3 participants