Closed gcasa closed 3 months ago
Here is the browser with an item-based delegate on mac...
Here is the browser with an item-based delegate on gnustep...
And, of course, here is Gorm to demonstrate that the previous implementation still works...
I am going to do some cleanup, also there are some trivial changes needed to support loading an NSViewController if one is necessary for the title view, etc.
I believe that support for the following delegate methods should be left for a separate PR:
- (BOOL) browser: (NSBrowser *)browser
shouldEditItem: (id)item;
- (id) browser: (NSBrowser *)browser
setObjectValue: (id)object
forItem: (id)item;
- (NSViewController *) browser: (NSBrowser *)browser
previewViewControllerForLeafItem: (id)item;
- (NSViewController *) browser: (NSBrowser *)browser
headerViewControllerForItem: (id)item;
- (void) browser: (NSBrowser *)browser
didChangeLastColumn: (NSInteger)oldLastColumn
toColumn: (NSInteger)column;
As they might require significant changes to how NSBrowser is implemented. I am researching this now to see if it's possible in the current implementation.
The code to call the delegate method
- (NSViewController *) browser: (NSBrowser *)browser
headerViewControllerForItem: (id)item;
has been implemented. The rest will have to wait for a separate PR as the ones involved in editing will require a more substantial change. The other two are not strictly necessary as GS doesn't currently support column re-arrangement in NSBrowser and the leaf preview is optional.
@fredkiefer Please review when possible. GC
Multiple selection works just as on macOS: For comparison:
I think that this code will work in the most common case. I am unsure whether it is overall the correct solution. It might well be that I am missing some concept here.
I am actually unsure how it's not the correct solution.
Also... 1) what is the complex case here? 2) even if it does only handle the "simple case" it is infinitely better to be able to do that than to handle NONE of them that use this type of delegate.
I am going to enhance the test to see if I can address any of the other possible use-cases.
@fredkiefer I have added extra data to the test. I believe that the changes I have made should cover most, if not all cases. Please take a look.
@fredkiefer Are there any additional changes you feel are necessary here?
@fredkiefer The behavior here matches that on macOS. Do you have any final review comments?
As you can see from the above it does seem to function properly. The _itemForColumn: method gets the list for the current column based on the previous column's selection. So given this, I believe it is okay to merge. I am going to do that.
As you can see from the above it does seem to function properly. The _itemForColumn: method gets the list for the current column based on the previous column's selection. So given this, I believe it is okay to merge. I am going to do that.
In the discussion before this one, which you marked as resolved you wrote:
The idea is to find the item that needs to be loaded for a given column. When multiple items are selected it will show nothing on macOS. I will make changes to make this code behave similarly.
I don't see in the code how the case of multiple selection gets handled in this way. This is a minor issue, so merging was fine, still it would have been nice to get a real answer to this question.
As you can see from the above it does seem to function properly. The _itemForColumn: method gets the list for the current column based on the previous column's selection. So given this, I believe it is okay to merge. I am going to do that.
In the discussion before this one, which you marked as resolved you wrote:
The idea is to find the item that needs to be loaded for a given column. When multiple items are selected it will show nothing on macOS. I will make changes to make this code behave similarly.
I don't see in the code how the case of multiple selection gets handled in this way. This is a minor issue, so merging was fine, still it would have been nice to get a real answer to this question.
I apologize. If you run the test and select two things in a column the column next to it shows nothing. This is the correct behavior. I will take a look and provide a better explanation of this. I am not in front of my computer right now.
The purpose of this branch is to add the NSBrowserDelegate methods defined in the documentation for macOS 10.6+ here...
https://developer.apple.com/documentation/appkit/nsbrowserdelegate/1407572-browser?language=objc
The test for this branch is here...
https://github.com/gcasa/NSBrowser_test