libs-gui
libs-gui copied to clipboard
Implement view based cells in NSTableView
The purpose of this PR is to add view-based support to NSTableView. The support done here will be basic. Support for NSOutlineView will come in a later PR.
@gcasa What is the progress on this? I want to use it for my port of GitUp.
@fredkiefer Does this need code review? It's been sitting here for over a year.
@ethanc8 Hello... currently, this is stalled... I am going to get back to it this week. I was side-tracked by the work I was doing for Keysight. I should have time to work on it now. So you should see some progress on it in the next few days.
Ok, thank you! What is the current progress, and is there anything I can do to help? I'm a bit busy now, and want to get finished with upstreaming and publishing my various other GNUstep-related projects first, but I might be able to take a look later on.
Ok, thank you! What is the current progress, and is there anything I can do to help? I'm a bit busy now, and want to get finished with upstreaming and publishing my various other GNUstep-related projects first, but I might be able to take a look later on.
I have written a test. I will share that in a bit and I am assessing the current state of the code for this in gui.
As for help you can take a look at the code and test and give me any feedback you might have.
Is it in a usable but not tested state? As in, is the main view-based cell functionality implemented, but we don't have test cases written and more obscure features are not implemented?
The test is here... https://github.com/gcasa/NSTableCellView_test
Is it in a usable but not tested state? As in, is the main view-based cell functionality implemented, but we don't have test cases written and more obscure features are not implemented?
That's what I am trying to assess... it's been a while since I looked at this code, so I need to get my bearings. I will test it and tell you as soon as I know.
Does buildtool deal with xcassets now? I see xcassets in the linked repo
Here's the diff: https://github.com/gnustep/libs-gui/compare/master...NSTableCellView_branch#files_bucket. It looks like we have mostly stubs so far.
This document would probably be useful (but you might have already seen it): https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TableView/Introduction/Introduction.html?language=objc#//apple_ref/doc/uid/10000026i
This might be useful for writing test cases or sample applications (how to make a view-based NSTableView without Interface Builder: https://stackoverflow.com/questions/19464136/view-based-nsoutlineview-without-nib)
Here are some info on how to make a view-based table view without Interface Builder (useful for testing our implementation):
- https://github.com/eonil/CocoaProgrammaticHowtoCollection/blob/master/ComponentUsages/NSTableViewExample/main.swift
- https://github.com/eonil/CocoaProgrammaticHowtoCollection/blob/master/ComponentUsages/OutlineViewExampleWithViewBasedTechnique/main.swift
- https://stackoverflow.com/questions/19464136/view-based-nsoutlineview-without-nib
I have created a branch of libs-gui on my fork with additional changes: https://github.com/ethanc8/libs-gui/tree/NSTableCellView_branch
We need to implement NSUserInterfaceItemIdentifucation protocol in the following classes, especially NSView, to allow NSTableView to recycle cell views: https://github.com/search?q=repo%3Aphracker%2FMacOSX-SDKs+path%3AMacOSX11.3.sdk%2FSystem%2FLibrary%2FFrameworks%2FAppKit.framework%2FVersions%2FC%2FHeaders+nsuserinterfaceitemidentification&type=code
@gcasa I have additional changes in my branch, which is now up-to-date with your recent commits, could you please quickly review them? Should I make a pull request against this PR (is that even possible)? https://github.com/ethanc8/libs-gui/tree/NSTableCellView_branch
If you have access to a macOS machine, could you also please test my testing code and attach a screenshot: https://github.com/ethanc8/TableViewPlaygrounds
This could help us determine what we need to do to get to the minimum implementation to display a very simple view-based table.
@gcasa I have additional changes in my branch, which is now up-to-date with your recent commits, could you please quickly review them? Should I make a pull request against this PR (is that even possible)? https://github.com/ethanc8/libs-gui/tree/NSTableCellView_branch
It's difficult to spot all of the changes since there are a lot of my changes mixed in.
If you have access to a macOS machine, could you also please test my testing code and attach a screenshot: https://github.com/ethanc8/TableViewPlaygrounds
This could help us determine what we need to do to get to the minimum implementation to display a very simple view-based table.
Yes. I will take a look at this.
It displays when I take the table out of the scroll view:
But when I put the table in the scroll view and the scroll view in the window, it's empty:
Also, I noticed that the state of the text fields that I put in the table view resets when I select a row in the view. I'll push my changes in a few minutes.
@gcasa I have additional changes in my branch, which is now up-to-date with your recent commits, could you please quickly review them? Should I make a pull request against this PR (is that even possible)? https://github.com/ethanc8/libs-gui/tree/NSTableCellView_branch
It's difficult to spot all of the changes since there are a lot of my changes mixed in.
Here is the diff between my branch and your branch: https://github.com/gnustep/libs-gui/compare/NSTableCellView_branch...ethanc8:libs-gui:NSTableCellView_branch
@gcasa I have additional changes in my branch, which is now up-to-date with your recent commits, could you please quickly review them? Should I make a pull request against this PR (is that even possible)? https://github.com/ethanc8/libs-gui/tree/NSTableCellView_branch
It's difficult to spot all of the changes since there are a lot of my changes mixed in.
Here is the diff between my branch and your branch: https://github.com/gnustep/libs-gui/compare/NSTableCellView_branch...ethanc8:libs-gui:NSTableCellView_branch
They look good. I think we can go ahead and merge your changes into my branch.
I can add you to the team if you can send an email to [email protected] to get a copyright assignment. Tell them you want to contribute past and future changes to the GNUstep project. Sign the document and return it.
Copy me at [email protected] and as soon as you make the request to them I can add you.
@gcasa I have additional changes in my branch, which is now up-to-date with your recent commits, could you please quickly review them? Should I make a pull request against this PR (is that even possible)? https://github.com/ethanc8/libs-gui/tree/NSTableCellView_branch
It's difficult to spot all of the changes since there are a lot of my changes mixed in.
Here is the diff between my branch and your branch: NSTableCellView_branch...ethanc8:libs-gui:NSTableCellView_branch
They look good. I think we can go ahead and merge your changes into my branch.
I can add you to the team if you can send an email to [email protected] to get a copyright assignment. Tell them you want to contribute past and future changes to the GNUstep project. Sign the document and return it.
Copy me at [email protected] and as soon as you make the request to them I can add you.
I believe there may be issues that may preclude that; I will contact you and the FSF employee at [email protected] so that we can continue this discussion privately.
If you can't sign a copyright assignment that is going to severely limit the volume of contributions that the project can accept from you. :/
It displays when I take the table out of the scroll view:
But when I put the table in the scroll view and the scroll view in the window, it's empty:
Also, I noticed that the state of the text fields that I put in the table view resets when I select a row in the view. I'll push my changes in a few minutes.
I am working through the issues with displaying views.
It displays when I take the table out of the scroll view:
But when I put the table in the scroll view and the scroll view in the window, it's empty:
Also, I noticed that the state of the text fields that I put in the table view resets when I select a row in the view. I'll push my changes in a few minutes.
I am working through the issues with displaying views.
Currently, the text fields' states are reset when the current row or a row above it has been selected.
The code is currently not in the state that it could be merged. Perhaps you should mark it as draft again?
True. Originally I was going to break it out so that just the view support was done and I decided to expand it to get the rest of the methods done. Moving it back to draft.
Hey guys, I thought I would mention this here as it seems the appropriate place to keep it in context.
On macOS XIB files are not directly read, they are "compiled" which means that, sometimes, they are decomposed into separate files. For instance, in the test for this change located here: https://github.com/gcasa/NSTableCellView_test ... there is a section called prototypeCellViews. If you look at how this is used in some places (like in @ethanc8 's example) there are places where the code explicitly loads a nib file based on the name given to the prototype cell that is created in InterfaceBuilder.
At compile time on the mac, this set of views is decomposed and separate NIB files are created to be read when needed. We are not doing this... we are reading the file directly, but we must ALSO simulate this behavior. This means that changes need to be made in the nib loading infrastructure to handle loading from a "cache" of sorts that resides in memory and we must check for the presence of the given data in the cache before going out to the file system. This complicates things a bit and I wanted to make you aware of it before I proceeded down this path so you would not wonder what the heck I was doing @fredkiefer.
Please feel free to add any comments, questions, etc on this as I could use the input. I want to make sure I do this right. The other possibility is to compile the XIB similarly to on macOS, except we would do it to .gorm files. We COULD do this, but it breaks our current approach of doing everything in place.
If you have access to a macOS machine, could you also please test my testing code and attach a screenshot: https://github.com/ethanc8/TableViewPlaygrounds This could help us determine what we need to do to get to the minimum implementation to display a very simple view-based table.
Yes. I will take a look at this.
@gcasa Have you had time to try this on a Mac? If so, could you please post the results here? It would be useful to see the differences in rendering. Specifically, can you try out this example: https://github.com/ethanc8/TableViewPlaygrounds/tree/master/ProgrammaticTableViewPlayground ?
Hey guys, I thought I would mention this here as it seems the appropriate place to keep it in context.
On macOS XIB files are not directly read, they are "compiled" which means that, sometimes, they are decomposed into separate files. For instance, in the test for this change located here: https://github.com/gcasa/NSTableCellView_test ... there is a section called prototypeCellViews. If you look at how this is used in some places (like in @ethanc8 's example) there are places where the code explicitly loads a nib file based on the name given to the prototype cell that is created in InterfaceBuilder.
At compile time on the mac, this set of views is decomposed and separate NIB files are created to be read when needed. We are not doing this... we are reading the file directly, but we must ALSO simulate this behavior. This means that changes need to be made in the nib loading infrastructure to handle loading from a "cache" of sorts that resides in memory and we must check for the presence of the given data in the cache before going out to the file system. This complicates things a bit and I wanted to make you aware of it before I proceeded down this path so you would not wonder what the heck I was doing @fredkiefer.
Please feel free to add any comments, questions, etc on this as I could use the input. I want to make sure I do this right. The other possibility is to compile the XIB similarly to on macOS, except we would do it to .gorm files. We COULD do this, but it breaks our current approach of doing everything in place.
I thought I had explicitly avoided using nibs in my example. Perhaps you are looking at one of the third-party examples that I copied into my repo because I planned on using them earlier? I do still think that it would be important to resolve this, as most real-world native Mac apps probably use XIBs. Also, do we compile XIBs, NIBs, GORM files, and storyboards at all, or does libs-gui just load them at runtime and process them internally?
But when I put the table in the scroll view and the scroll view in the window, it's empty: 