-
Notifications
You must be signed in to change notification settings - Fork 103
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
Add new 10.6 delegate methods to NSBrowserDelegate #281
Conversation
…performLoadOfColumn
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:
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. |
…d, call method to get a view controller from the delegate
The code to call the delegate method
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
if (matrix != nil) | ||
{ | ||
NSArray *selectedCells = [matrix selectedCells]; | ||
if (selectedCells != nil && [selectedCells count] > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole logic of this method seems strange to me. What is your intention here?
This will work for some very common cases, for example when a new column needs to be loaded because we double click on an item in the column before. But I am not sure that every time we need to load a new column there is always exactly one item selected in the previous column.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation does not match the description you give above. For multiple selections the first gets used.
I am actually unsure how it's not the correct solution. |
Also...
|
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just fix these minor issues and then the code should be ready for a merge.
if (matrix != nil) | ||
{ | ||
NSArray *selectedCells = [matrix selectedCells]; | ||
if (selectedCells != nil && [selectedCells count] > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation does not match the description you give above. For multiple selections the first gets used.
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:
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. |
-browser:selectRow:inColumn: [NSMatrix-selectCellAtRow:column:]</p> | ||
*/ | ||
- (void) selectRow: (NSInteger)row inColumn: (NSInteger)column | ||
- (void) selectRow: (NSInteger)row inColumn: (NSInteger)column |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fredkiefer I believe this is the method where a multiple selection causes the last column to be unloaded. The method you commented on earlier is responsible for getting the selection of the previous column so that the current column knows what to display (based on the children it retrieves).
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