-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Initial Port to Firemonkey #839
Conversation
Please understand that I cannot accept such a pull request just because it compiles. But I find it interesting to check what needs to be changed in order to get Virtual TreeView to work on FMX. Why is there as need for two conditional defines And I was wondering it is possible to change more code in a way that it compiles on both platforms instead of using |
I know but it do not only compiles, it does not break the current VCL code.
It is trivial choice. It is visualy distinctive when "$ifndef FMX" and "$ifdef FMX" is not so simple.
My purpose was to not break current VCL code. If we change HDC to TCanvas this can broke some applications which operate on HDC directly without Canvas. I remember that i have used it in some applications where i print something using VT but printing device have not supported Canvas. |
But why do these changes need to be in the master branch? When I took over the project several years ago it was a hell of I am neither convinced that it makes sense to have all this in a single source code, nor that this will finally work, because Virtual TreeView was built closely tied to VCL and Win32 API. Especially the painting and TBitmap related stuff could get difficult. FMX was not designed with this use case in mind.
But my aim is to have clean code from the beginning.
But a VCL canvas always has a HDC on that you can operate. But you can use the abstraction that TCanvas offers whenever you do not need to work on HDC, and use HDC when truly needed. We should also define an alias for Integer/Single instead having an $ifdef at each parameter. |
I do not suppose that dividing this by new branch do something useful. I am opposite, this will bring code maintenance to difficult level.
Painting is not the problem at all. I make painting of the tree itself as you can see if you run attached code. Tree is painting ok, nodes and its levels, buttons +/-.
Not so much as we can suppose. The hardest task will befull mouse support.
Code is quite clean. Look at Delphi source code - there is much more ifdefs and it is working ok.
look above about compatibility. It can be easly done but require that users must change their already compilable projects. If this is really acceptable we can go this way, but for me it is not required.
as previously about compatibility. But this can be done for variables inside procedures not expressed outside. Remember only about some warnings introduced. As you know sometimes some parameter is Integer other Cardinal. And calculation if changed, can generate warnings which should be "fixed". And as summary. I understand your worry. |
Why not add this to a public branch, so that anyone interested can benefit and contribute and wait till it matures and becomes working before merging it to the main branch. I would vote against merging into the main branch stuff that do not fully work. |
The longer this code will be in a separate branch, the more difficult it will be to merge, because it will be more and more forked. However, merging this now does not affect the functionality of VCL. Anyone who wants to test FMX will have to add the VT_FMX directive manually, for this reason, it will not be officially supported yet.. |
Sorry, but I think the opposite is true. It is a very uncommon approach.
I don't think the possibility of using Git branches prevented this.
I wasn't saying that it cannot work, it is just a difficult and time consuming to maintain. And I am doing this in my spare time, while Embarcadero gets money for the product.
Yes, for events this is a different story. But for many function I don't see a problem. It may not be popular among all users of VT, but I prefer a clean break if I get rewarded by by clean source code afterwards.
Yes, this is very annoying. While
No, you just need to regularly rebase the code to the latest code in master, in which I will make changes that make |
@livius2 If the FMX support is in a separate branch while it is being developed, you can always sync with the main branch from time to time. Look what happened to SynEdit. It used to be a flagship Delphi component. It tried to maintain compatibility with Kylix and all Delphi versions since version 3 or something. There are more IFDEFs than code lines. Kylix compatibility is still in, even though I do not think there is a single Kylix user in the word. And then people started putting half-baked functionality in. The current maintainer @CWBudde decided to include GDI+ support. Nice idea, but he lost interest and never completed the work. The non-working GDI+ support is in the master branch. The code has become incredibly complex and virtually unmaintainable. The story with VT was quite similar. Too many options, overly complex and hard to maintain. But @joachimmarder has done a great job by having a fresh start, focusing on compatibility with newer versions only, streamlining the code and resisting requests to add new options, new events or whatever. Great job. Don't spoil it. |
I am not totally opposite to have new branch. About Integer / Cardinal. I can change any place (excluding events) to have
Do you have better name for it? And Integer is enought? or it should be Int64? |
I like You will need patience with me, I will always seek for the cleanest solution. Git makes it relatively easy to keep this separated for a long time without going separate ways. I opened issue #841 for the most important changes. Let me know what I missed. |
I too. I only do not know what are the preferences here. We should determine who does what to not to duplicate the work. |
Yes, I would say it is a commonly agreed best practice to not have such monster units like
Yes. The points in #841 will be done in master branch. I will do them when I find time, I will also accept pull requests that focus exactly on one of these aspects, e.g. replacing |
Yes, but it hard to tell in advance if this will go smoothly or not. In any case please do this is an own commit / pull request. |
remove all ifdefs and replace it with TDimension except events. Make changes from HDC to TCanvas sometimes need tu use dummyCanvas
Ok, i have made changes.
|
added safer prevDC: HDC; when using dummyCanvas
move some specific function sto VirtualTrees.FMX - DrawTextW - GetTextExtentPoint32W - DrawEdge
fix introduced warnings
missed uses "FMX.Types"
Sorry, but these changes have been done in your branch. If I accept the PR now, I will get all the changes including all incomplete FMX stuff. As I wrote in an earlier comment the changes I suggested in #841 should be done in the master branch and should be one commit or PR per change. |
I see no benefit in merging any changes now. Why not delay merging until the FMX stuff becomes stable. You risk breaking existing code especially if you change the signature of events. Remember also that there are third party components descending from VT. |
I wanted to prevent a monster-merge. The non-breaking aspects could be done in advance and would so reduce the diff between both branches. But, yes, we don't need to hurry. If showstoppers come up, the changes would be of no benefit. |
You will not know whether showstoppers will arise or @livius2 loses interest or development stops for any reason, unless you wait for a stable FMX version to emerge. By that time the master branch will be unrecognizable for no reason. Your priority should be to preserve the integrity of the master branch on which many users depend. |
There is also a Lazarus port. I saw no requests to merge it with this project. How would you deal with such requests? |
Don't take me wrong. I can see the benefits of having VT available on MacOS or even Android. |
You can cherry-pick particular commits if you need it now on the master branch. @pyscripter If this new branch for FMX port will be finally commited into master i can also help with Lazarus. I suppose that some simple commits for Lazarus compatibility is the best way. |
code cleanup - removed unnescessary cast to integer not needed after TDimension introduced in the same time many ifdefs specific to VCL are not needed - fixed some comments positions
…ing) - VCL Fix - if handle was not allocated we got "Canvas does not allow drawing" for dummyCanvas - FMX Added header columns (header still is not drawed but cells are - FMX OnBeforePaintCell is working now
Do you think that merging is possible in near feature? |
Why exactly?
Currently the PR does not merge due to conflicts. It was hard work in the past years to get Virtual TreeView to a stable state and I have concerns that the FMX support that is work in progress may cause new problems, and that I need to deal with the merge problems you are currently dealing with. I would prefer to have this in a separate fork and to get both forks closer together smoothly, e.g. by using TDimension where necessary in the official branch, by merging VirtualTrees.FMX etc. |
When some change is in the master i must compare it to my already changed/different sources. But i understand that merging big change to source which work good is a risk task. |
Well, I fear this applies to both directions.
Me too. Is there any chance that you send a pull request for this? |
If you merge my changes, it is already merged with your code and you see only changes to this code.
I have TDimension changed VT but i do not know how to create pull request with this file. Any hint how to do this? |
I'm sorry, I am also not a Git expert. Maybe we can use cherry-picking to achieve this. |
I see no way to do this from my fork, also from new branch with only this change :/ I'm stuck. I see the way :) |
I just looked at some of your changes. The are breaking chnages, for example: |
* Eliminated some umlauts
it is known consequence of the change, but this make code much more understandable.
Same as above, but we can make some checks to prevent negative values. And remove then warnings.
Do you think about final merge or TDimension one? TDimenison have not ifdefs.
Float (Single) can not have default also in VCL.
this is your choice, but do you see more problems with TDimension introducing? |
Sure, but it is still a breking chnage as it changes the memory layout of the central data structure of Virtual TreeView. I guess someone would need to write new version of the reader and writer. If we would start on a blank piece of papier, there would be no question which type to use, but there is a lot of legacy code around. And users hate if we break their code.
Negative valuea are not the problem, seems tha previous developers have seen this quite pragmatic:
We cannot fix warnings in 3rd party code that is written against Virtual TreeView code. Anyway, I opened issue #892 for this specific topic.
No, I am talking about the huge number of other
No yet, but the two mentioned above are serious enough. |
We can include compatibility config ifdefs are not so bad as they looked |
They are bad, believe me. I had a lot of trouble with them. You simply can't be sure that every code path compiles or that they work as intended. If you have many of them, you need to check the cross product of them to be sure. |
Even though the current fork was sufficient for my purposes, I decided to get back into activity. Maybe we can do something useful for others. I will be uploading divided patches. And i will provide next patch after merging the previous one to gradually reconcile the code. I will add to the title [FMX port]. We will see how far it can be integrated. But I don't see an option without "ifdef" yet ;-) |
Hi,
this is realy big task but if you do not merge this i will continue it as separate repository.
And i suppose this will never go up because repos will continue go separate ways.
Description...
I use Inc and Dec overloads and make every call on INTEGER to have System.Inc, System.Dec.
This avoid many IFdefs and is cleaner way then declaring IncSingle and DecSingle.
The main purpose here was to do not break VCL - it should work unchanged.
This is initial port as is it have:
1. It compiles under FMX - this was main task of this pull request.
2. It draw tree nodes with apropiate levels
3. It draw buttons plus/minus.
No more functionality is working.
To make it fully live it must have:
To test FMX prot of VT - you must add in the e.g. Delphi project->Options->Conditional defines
VT_FMX
regards,
Karol Bieniaszewski
below FMX unit (Empty form) i create VT dynammicaly to test its functionality.