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 #2360 - v2 View re-architecture.. #2361

Merged
merged 85 commits into from
Apr 4, 2023
Merged

Conversation

tig
Copy link
Collaborator

@tig tig commented Feb 20, 2023

See: #2360

In this PR I have proven:

  • It is possible to refactor View to have a "real" Bounds where the Location part can be non-zero
  • A real "margin", "border", and "padding" thickness can be implemented that matches how these concepts work in HTML
  • The border can be drawn using LineCanvas
  • Borders can "autojoin" using LineCanvas such that SplitContainer is completely unnecessary.
  • 20/30% of the existing View, Toplevel, Window, and FrameView can be removed from the project.
  • It will be a massive breaking change, but porting apps to use the new architecture will be relatively easy, and will result in less code in apps.

See the latest v2 View Spec here:

https://github.com/tig/Terminal.Gui/blob/v2_view2_experiment/docfx/v2specs/View.md

Here's the latest GIF:
6Gfkfnc 1

@tig tig added this to the v2.0 milestone Feb 20, 2023
@tig
Copy link
Collaborator Author

tig commented Feb 21, 2023

I just integrated my View2 experiment into View directly.

While a bunch of stuff is broken (including a lot of unit tests), I'm now pretty confident this will all work and be worth it (I removed hundreds and hundreds of very complex lines of code from the project. Window and FrameView are now extremely simple etc...).

The old Border class still exists but is just there as a sort of compatibility layer for existing code; it doesn't actually do anything.

Fun stuff...

PeSSe4l 1

@BDisp
Copy link
Collaborator

BDisp commented Feb 21, 2023

I just integrated my View2 experiment into View directly.

Good choice.

While a bunch of stuff is broken (including a lot of unit tests), I'm now pretty confident this will all work and be worth it (I removed hundreds and hundreds of very complex lines of code from the project. Window and FrameView are now extremely simple etc...).

Well the unit tests may work differently but most of them must demonstrate more or less the identical result, with some adjustments.

The old Border class still exists but is just there as a sort of compatibility layer for existing code; it doesn't actually do anything.

I think this will confusing the users. The v2 is a breaking change version with more features, so we don't have to worry with backwards compatible. The border in the View class is working right as it should. If you want to help the users to use the new border concept maybe you can wrap all the properties, methods, etc. (Margin, BorderFrame, Padding, Thickness) in the Border.cs, because normally is where the users will search for border.

@BDisp
Copy link
Collaborator

BDisp commented Feb 21, 2023

@tig I played around the Borders scenarios and I changing the border style, border thickness, padding thickness, border brush, background color, effect 3D, well all of them and nothing changing. It's supposed to be like this?

@tig
Copy link
Collaborator Author

tig commented Feb 21, 2023

@tig I played around the Borders scenarios and I changing the border style, border thickness, padding thickness, border brush, background color, effect 3D, well all of them and nothing changing. It's supposed to be like this?

Yes because this is still just a proof of concept and not finished.

@tig
Copy link
Collaborator Author

tig commented Feb 21, 2023

If you have an urge to update one of the border scenarios to use the new architecture that would be appreciated.

More than likely you'll find stuff I'm doing that doesn't make sense. 😏

@tig tig marked this pull request as draft February 21, 2023 19:03
@tig
Copy link
Collaborator Author

tig commented Feb 21, 2023

If you have an urge to update one of the border scenarios to use the new architecture that would be appreciated.

More than likely you'll find stuff I'm doing that doesn't make sense. 😏

Make sure you read the spec (in docfx/articles/View.md)..

Its MOSTLY accurate relative to my vision . It contains some VERY CLEAR ERRORs and questions, but directionally paints the the vision.

@BDisp
Copy link
Collaborator

BDisp commented Mar 3, 2023

@tig this was done on the Border class.

imagem

@tig
Copy link
Collaborator Author

tig commented Mar 3, 2023

@tig this was done on the Border class.

Woot!

How did the port go?

It now needs UI to control View.Margin as well.

I'm confused about something tho: I thought I disabled the 3d effects in my prototype, but I see it working in the image you posted.

@BDisp
Copy link
Collaborator

BDisp commented Mar 3, 2023

This is only the Border without your API. It also has a margin which normally show the superview background color. The 3D effect will be draw on the margin.

@tig tig changed the title Fixes 2360 - Experiment in refactoring View for v2 Fixes 2360 - v2 View re-architecture Mar 3, 2023
@tig
Copy link
Collaborator Author

tig commented Apr 4, 2023

Woot!

This is ready, finally.

Search for "BUGBUG: v2" and you'll find places in both the core code where I hacked around something or disabled a unit test.

Just about everything works.

What's not done yet in the re-architecture is:

@tig tig marked this pull request as ready for review April 4, 2023 04:15
@tig tig merged commit 128473b into gui-cs:v2_develop Apr 4, 2023
@tig tig deleted the v2_view2_experiment branch April 3, 2024 01:48
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.

3 participants