429 Commits

Author SHA1 Message Date
Allan Odgaard
bdd894246b Find dialog’s “where” pop-up would not allow selecting leaf folders
Using the “where” pop-up to navigate to subfolders would only work when the item selected had a submenu.
2021-05-17 21:19:18 +02:00
Allan Odgaard
46469b765b Use getter syntax for property declaration 2021-04-23 08:28:00 +02:00
Allan Odgaard
a252e3b54d Do not rely on ‘parentItem’ NSMenu category extension
This is the only place we use the category extension, so let’s remove it as shared code.
2021-04-16 17:21:59 +02:00
Allan Odgaard
c7dd98ec01 Disable floating group rows in file browser + search results (macOS 11)
There appears to be a problem with floating views (in tables) on Big Sur, so this is an attempt of a temporary workaround. The visual look of group rows is currently not very good (on macOS 11).
2021-04-16 08:59:44 +02:00
Allan Odgaard
a8601fd9f7 Use NSTableViewStylePlain for file browser and search results
I am a little torn about this, as this is basically “revert Big Sur’s UI changes”, but I don’t think the new default look is appropriate for these lists.
2021-04-16 08:53:36 +02:00
Allan Odgaard
b3afd947cf Copying search results are again stored on clipboard as a single string
I have not found it advantageous to get multiple carets when pasting search results, on the contrary, if we have a significant number of results, the multiple carets may impact performance.

This reverts the change that was made in 82593c8824.
2020-09-18 09:27:18 +02:00
Allan Odgaard
e80ef1d0b7 Remove use of OBJC_WATCH_LEAKS 2020-06-05 21:22:50 +07:00
Allan Odgaard
c93030b385 Remove all debug output from custom log macros
This provided value during early development, but has been unused for years, and it would generate too much noise if converted to os_log.

So better to just remove it all and add os_log statements as needed.
2020-06-05 21:22:50 +07:00
Allan Odgaard
4ec10c0923 Don’t annotate types and classes with PUBLIC
This was required when we linked each framework as its own thing, which we do not do anymore, and if we do go back to this system, we can simply have symbols public by default.
2020-06-05 21:22:50 +07:00
Allan Odgaard
d500f6e53d Remove support for initial first responder in OakSetupKeyViewLoop 2020-05-25 12:47:47 +07:00
Allan Odgaard
58d1cce527 Do not rely on OakSetupKeyViewLoop to set initial first responder
We either set it explicitly or rely on automatic key view loop calculations.

As for the latter: When auto-layout was initially introduced, the automatic key view loop calculation broke, as it used the view frames before layout. It should have been fixed several OS versions ago though, so we can use it again, as long as we are not working with view-based table views.
2020-05-25 12:47:47 +07:00
Allan Odgaard
caedb11305 Add read/write subview property to OakTransitionViewController
This feels like a better API than the previous transitionToView: method.
2020-05-22 21:48:09 +07:00
Allan Odgaard
733ab302e2 Change variable name: observerId → token
Several places already used ‘token’ as the name for the result from NSNotificationCenter’s addObserver:… so this change is to be consistent.

While ‘token’ is less meaningful than ‘observerId’, the variable is only used with NSNotificationCenter API where the context makes it clear.
2020-05-22 21:48:09 +07:00
Allan Odgaard
43db695fd3 Update to use non-deprecated NSButtonType constant names 2020-05-22 21:48:09 +07:00
Allan Odgaard
25ff20fbb4 Avoid accessing the find results view until we really need it
This is to postpone constructing the view: It’s probably not costly to construct it before we need it, but everything adds up, and it just feels proper to avoid constructing the views of view controllers until as late as possible.
2020-05-17 08:15:55 +07:00
Allan Odgaard
d0fe8a0513 Do not create Find dialog until loadWindow is called 2020-05-17 08:15:55 +07:00
Allan Odgaard
2216df2c9b Fix vertical truncation of checkbox labels in find dialog
We now add some bottom padding to the containing grid view, as it may be oblivious to alignment rectangles, and would therefore snap to the bottom of the checkbox label’s alignment rectangle, clipping anything drawn outside of it.
2020-05-16 11:46:33 +07:00
Allan Odgaard
c5d58c4ac8 Improve API for adding a folder submenu 2020-05-16 07:12:01 +07:00
Allan Odgaard
fb165589c3 Change layout constraints to allow superview with zero width
I occasionally see log entries saying that the constraints cannot be resolved, and it appears to be because the superview has a width of zero.
2020-05-14 15:43:24 +07:00
Allan Odgaard
e62db9386e Call NSMenu’s numberOfItems instead of itemArray.count 2020-05-14 09:52:38 +07:00
Allan Odgaard
ad1cc8abd8 Deliver all NSUserDefaultsDidChangeNotification in main queue
This is easier than ensuring that we do not update user defaults from a background thread.
2020-05-14 09:52:38 +07:00
Allan Odgaard
8e6791324a Let app delegate handle workaround for “Move to Active Space” behavior
I don’t think the default behavior ever makes sense, so we are applying the change to all windows instead of handling it on a one-by-one basis.
2020-05-13 18:50:02 +07:00
Allan Odgaard
0caa4eb12a Improve the folder pop-up submenu for Find in Folder
The submenu now show the immediate children in the first submenu, with parents below these items, although without adding submenus to the parents.

Also show ⌘↑ for the first parent, to improve discoverability of this key equivalent.
2020-05-13 18:50:02 +07:00
Allan Odgaard
01bf868832 Go back to visual formal language for laying out the Find dialog
Now that we use OakTransitionViewController for toggling the results view, using a stack view provides no real benefits, and are in some ways a little bit more opaque, for example the hugging priority weirdness and what width constraints are setup by the view.
2020-05-10 20:07:31 +07:00
Allan Odgaard
e9c4ea57dd Move initialization of view controllers from helper method to init
These view controllers are used in other methods, so we were basically relying on the order of which methods were called, which is not good design.
2020-05-10 20:07:31 +07:00
Allan Odgaard
3d1f4c82df Only install event monitor when results outline view is visible 2020-05-10 20:07:31 +07:00
Allan Odgaard
bd7e306b91 Use OakTransitionViewController to show/hide find results 2020-05-10 20:07:31 +07:00
Allan Odgaard
53da62f33d Fix issue with ⌘F not bringing find dialog to active space
The problem is that we use ⌘F and ⇧⌘F as key equivalents both in the Edit → Find submenu and in the “where” pop-up button’s menu, but as they previously had different action methods, the system would only allow the key to trigger one of these items (and remove the key from the other, as part of menu validation).

Normally not an issue, but when the find dialog is in another space, it appears menu validation would not update the Find → Edit submenu items to get the key equivalents, even though these would be “first responders”.

By using same action method for both Find → Edit submenu items and the “where” pop-up menu items, we avoid the key equivalents being removed from any of the two menus.
2020-05-10 20:07:31 +07:00
Allan Odgaard
9bfae1aada Use FFSearchTarget instead of find_tags enumeration
This avoids the need to map between the two enumeration constants, although we handle some of the constants before passing them to the find singleton, so the code has not yet been updated to remove the redundant mappings.
2020-05-10 20:07:31 +07:00
Allan Odgaard
09ee4d49a7 Use MBMenuBuilder to construct “where” pop-up menu in Find dialog 2020-05-10 20:07:31 +07:00
Allan Odgaard
83874a965c Use NSLayoutPriorityDefaultHigh-1 as hugging priority for stack views
When set to NSLayoutPriorityDefaultHigh then it is able to compress text fields. The text field does set content compression resistance to NSLayoutPriorityDefaultHigh, but for reasons I do not understand, this is not enough to keep it from being compressed by the stack view.

The reason I do not understand this is that even with a high hugging priority, we should not make views smaller than their fittingSize, but it appears the stack view will do that.

Only one stack view actually contained a text field, and we already used a priority lower than NSLayoutPriorityDefaultHigh, so this commit does not change anything, but to play it safe, we should probably avoid NSLayoutPriorityDefaultHigh for stack views.
2020-05-10 20:07:30 +07:00
Allan Odgaard
66c3e67e5b Ensure empty string is used when find dialog text field is empty
The system will return ‘nil’ for empty text field, which was causing the replace preview in the find dialog to not show any replacements, and if doing actual replacements, 0xFFFF would be inserted for replacements.
2020-05-04 19:20:04 +07:00
Allan Odgaard
cb4c12681e Use NSNotificationName as type of all our notification names 2020-05-04 19:20:04 +07:00
Allan Odgaard
f0b48ba736 Fix a few double trailing semi-colons 2020-05-04 19:20:04 +07:00
Allan Odgaard
244da7a269 Find in Folder: Allow navigating Recent Places with ⌘[ / ⌘]
The pop-up menu will show shortcut keys next to the items that the keys will trigger, although we are re-purposing File Browser → Back / Forward for these actions, so it is worth considering moving them to the View menu.
2020-04-30 13:28:24 +07:00
Allan Odgaard
a3c3296276 Find in Folder: Only add to “Recent Places” when a search is executed
Also add “file browser items” to Recent Places when a single folder is selected.
2020-04-30 13:28:24 +07:00
Allan Odgaard
e541250309 Add object type information when using OakHistoryList 2020-04-30 13:28:24 +07:00
Allan Odgaard
8aef07575c Use NSByteCountFormatter instead of text::format_size 2020-04-30 13:28:24 +07:00
Allan Odgaard
187522b6c4 Add missing implementation of isVisible property 2020-04-29 08:02:02 +07:00
Allan Odgaard
81553fc565 Don’t keep local copy of find/replace string in Find singleton
Instead we access the FFTextFieldViewController’s stringValue directly.
2020-04-29 08:02:02 +07:00
Allan Odgaard
795876cba3 Make FFTextFieldViewController’s stringValue a public property 2020-04-29 08:02:02 +07:00
Allan Odgaard
8e4f595785 Avoid setting nil as cell’s string value 2020-04-29 08:02:02 +07:00
Allan Odgaard
2ee95e5eba Remove booleans to track if find/replace strings have been updated 2020-04-29 08:02:02 +07:00
Allan Odgaard
5f3fb0672e Move handling of NSPopover to FFTextFieldViewController 2020-04-29 08:02:02 +07:00
Allan Odgaard
395dea49ab Let FFTextFieldViewController bind to NSTextField and update size
Contrary to a previous finding, the NSTextField doesn’t always resize when the content changes, and controlTextDidChange: is only sent when the string is edited by the user (via the field editor), so we must use bindings to be notified about *all* changes.
2020-04-29 08:02:02 +07:00
Allan Odgaard
05f711d256 Change a few NSLayoutConstraint instances to instead use layout anchors 2020-04-29 08:02:02 +07:00
Allan Odgaard
56f872432d Merge Find singleton with FindWindowController
Currently find window is created during initialization, we should delay that to be when first requested (loadWindow).

Furthermore, some code might be moved out of the FindWindowController, for example more logic related to search results might be moved to the search results view controller.
2020-04-29 08:02:02 +07:00
Allan Odgaard
445765237c Status string property wrappers no longer maintain their own copy 2020-04-29 08:02:02 +07:00
Allan Odgaard
7a30a3ed53 Use layout anchors to set fixed width/height of various views 2020-04-29 08:02:02 +07:00
Allan Odgaard
3f3277f747 Change how we setup grid view 2020-04-29 08:02:02 +07:00