Commit Graph

5368 Commits

Author SHA1 Message Date
Allan Odgaard
cf5bce8bf0 Remove outlineView property from FFResultsViewController 2020-04-29 08:02:02 +07:00
Allan Odgaard
9980e9afda Refactor FindWindowController: Remove a lot of properties
The rule of thumb is that we only want to use a property for things that are set more than once (so we may want KVO), or part of public API.
2020-04-29 08:02:02 +07:00
Allan Odgaard
0ab5b06417 Set nextKeyView property for FFResultsViewController’s view
This allows using the root view in a key view loop, rather than needing to know which subview is appropriate.
2020-04-29 08:02:02 +07:00
Allan Odgaard
2112a26116 Let our table cell view observe all outline views for looser coupling
The motivation is not having to know about the interface of the view controller that creates the instance.

It does have performance disadvantages in that collapsing or expanding items in *any* outline view will now trigger notification callbacks for our table header cell views.

In practice though expanding/collapsing is not a common action, and the chance of this being done, while the find window has so many results as to impact performance, is probably small (it’s only the header cells that register for this notification).

That said, it would be good to find a better solution.
2020-04-29 08:02:02 +07:00
Allan Odgaard
191a435382 Move FindWindowController to Find singleton implementation file
These two classes should be merged.
2020-04-29 08:02:02 +07:00
Allan Odgaard
b5008a9849 Manually set the canEditGlob and canReplaceInDocument properties
This is so that properties bound to these will update immediately (before window resize).
2020-04-29 08:02:02 +07:00
Allan Odgaard
0ba3c2da18 Update find window title and “where” pop-up before resizing window
Ideally we would also change the enabled state of the “matching” text field, but this is currently handled via bindings, so we cannot fix that without either delaying resizing until next event loop cycle, or by manually updating the canEditGlob property.
2020-04-29 08:02:02 +07:00
Allan Odgaard
5d8c131a1a Animate resize of find window (and switch to using NSStackView) 2020-04-29 08:02:02 +07:00
Allan Odgaard
e3c3d6ecd1 Use a NSStackView for action buttons in find window 2020-04-29 08:02:02 +07:00
Allan Odgaard
f4e16da198 Use NSGridView to layout most controls in the find window 2020-04-29 08:02:02 +07:00
Allan Odgaard
12de85b5c0 Use NSStackView for find results
The motivation here is simply to get a view that can resize down to zero height.
2020-04-29 08:02:02 +07:00
Allan Odgaard
e5bfaecdb5 Use NSStackView for find window’s status bar and move to view controller
The main advantage is that we can let the stack view handle showing and hiding of the stop button and progress indicator.

The height of the status bar (text field) is now fixed at 16 pt. The reason we have to fix it is that we are using a button for the status bar (so that the user can click toggle between showing number of files and number of bytes searched), but a button with an empty string reports a different fittingSize than one with a non-empty string.

Therefore without a fixed height, we need to ensure status bar never gets set to an empty string, which we did before, but I think it is nicer to simply fix the height of the status bar.

Also because the progress indicator and stop buttons might actually be slightly taller than the status bar used to be.
2020-04-29 08:02:02 +07:00
Allan Odgaard
78f7fb9c6f Observe the view frame instead of window frame, to learn about changes
The window frame may change before the view has bene laid out to the new window size.
2020-04-29 08:02:02 +07:00
Allan Odgaard
decb7f96ee Set wantsLayer to YES for file browser header view
This is required on macOS 10.12.
2020-04-29 08:02:02 +07:00
Allan Odgaard
34bc5ea0fe Increase timeout for commands with HTML output from < 2 hours to FLT_MAX 2020-04-29 08:02:02 +07:00
Allan Odgaard
7321369b76 Instead of checking utf8::is_valid(str) we check if to_ns(str) fails
Since 2.0-rc.1 we have received 70 crash reports pointing to nil string being passed to the NSAttributedString initializer.

I’m almost inclined to think that NSString construction fails for other reasons than the data not being valid UTF-8, since both excerpt and replace string, are already passed as an NSString.

When to_ns fails we show a “Please file a bug report!” message on red background in the find window, since I would like to know why this situation arise.
2020-04-29 08:02:02 +07:00
Allan Odgaard
db2cbc3068 Accept std::string instead of NSString in attributed string builder
Since virtually all calls to ‘append’ wraps the std::string with ‘to_ns’, we might as well move the wrapping to the function, as this is not public API.
2020-04-29 08:02:02 +07:00
Allan Odgaard
71df4611ff text: We no longer need to link with the ‘crash framework’
This is since commit 82c4e272a4.
2020-04-29 08:02:02 +07:00
Allan Odgaard
1b09d05221 mate: We no longer need to link with the ‘cf’ framework
This is since commit a31dd336b4.
2020-04-29 08:02:02 +07:00
Allan Odgaard
633d5e4b89 Play sound when starting/stopping macro recording 2020-04-29 08:02:02 +07:00
Allan Odgaard
e397442196 Add OakSound constants for begin/end recording 2020-04-29 08:02:02 +07:00
Allan Odgaard
76e44830d8 Remove OakImage 2020-04-29 08:02:02 +07:00
Allan Odgaard
7723831d48 Use imageWithSize:flipped:drawingHandler: instead of OakImage
Also increase size of the badge to one third of the app icon (instead of a quarter).
2020-04-29 08:02:02 +07:00
Allan Odgaard
dedb182932 Remove humanReadableTimeElapsed NSDate category extension method
We still need this code when running on macOS before 10.15, but we only use the method in one place, so we have inlined the code.
2020-04-29 08:02:02 +07:00
Allan Odgaard
59ca4f35a4 Remove unused include 2020-04-29 08:02:02 +07:00
Allan Odgaard
e15798bac3 Use NSRelativeDateTimeFormatter when running on macOS 10.15 2020-04-29 08:02:02 +07:00
Allan Odgaard
e6ceaf86b4 Rework code that checks if ⌘[ / ⌘] should be text or navigation actions
The property is renamed from ‘currentResponderIsOakTextView’ to the more appropriate ‘keyWindowHasBackAndForwardActions’.

Furthermore, the menu items are found via indexOfItemWithTarget:andAction: instead of by title, although the title of the submenus for these menu items is still hardcoded.
2020-04-28 12:35:43 +07:00
Ronald Wampler
18c1c1dfeb Fix Previous/Next Bookmark action in OakTextView touch bar
performNavigateBookMarksSegmentAction → performNavigateBookmarksSegmentAction
2020-04-28 09:54:47 +07:00
Allan Odgaard
02a6128571 Change check for when ⌘[ / ⌘] should be Shift Left/Right or Back/Forward
The problem is that if shiftLeft:/shiftRight: exist after goBack:/goForward: in the responder chain, we would prefer the former. This can happen because main window is after the key window in the responder chain, so if the former contains an OakTextView, a potential responder in the key window would never be found.
2020-04-28 09:52:10 +07:00
Allan Odgaard
485e9f947d Use slightly better frame color for shortcut recorder when in Dark Mode 2020-04-28 09:52:10 +07:00
Allan Odgaard
f06161b395 Do not set content hugging and compression resistance for image button 2020-04-28 09:52:10 +07:00
Allan Odgaard
6e6dbd4a1e Ensure label colors are aligned between open and non-open files 2020-04-28 09:52:10 +07:00
Allan Odgaard
ce651e8acb Ensure labels are rendered as selected when table row is emphasized 2020-04-28 09:52:10 +07:00
Allan Odgaard
17aada3471 Let FileItemTableCellView give access to its close button via a property
This is simpler than having to proxy the action (and target) for the button.

Previously the button was created on demand, but now that we always create it (and hide it when not required), we might as well have users set action and target directly on the button instance.
2020-04-28 09:52:10 +07:00
Allan Odgaard
05a50a436b Use NSStackView for our file browser items
Minor downside is that labels for open and closed files are no longer aligned.

It would be nice to find a solution for that, but without dropping the stack view, as it saves us > 100 lines of code.
2020-04-28 09:52:10 +07:00
Allan Odgaard
19624f0fd8 Use NSStackView for tag buttons in file browser menu 2020-04-28 09:52:10 +07:00
Allan Odgaard
33424bfdf4 Improve how we check if notification is sent from one of our tag buttons 2020-04-28 09:52:10 +07:00
Allan Odgaard
d49ebcc6f8 Improve performance when showing clipboard history
Previously we fetched items row-by-row from the database, which could be slow even with only 500 entries.

We now fetch everything using a single query. Long-term though we may fetch the strings on-demand but with some prefetch, mainly just to avoid an issue if the user store hundred of megabytes in the clipboard history.
2020-04-28 09:52:10 +07:00
Allan Odgaard
4998092602 Improve calculation of pasteboard history pop-up position
The code did not handle nested views where frame coordinates must first be converted to the window’s coordinate system.
2020-04-28 09:52:10 +07:00
Allan Odgaard
d38688d0ff Revise some include statements 2020-04-25 23:11:32 +07:00
Allan Odgaard
d3a14a4012 Checkin release notes for 2.0.10 v2.0.10 2020-04-23 22:48:14 +07:00
Allan Odgaard
c7b4b09768 Workaround for potentially running bundle items from nested run loop 2020-04-23 22:41:34 +07:00
Allan Odgaard
6328ac68b5 Remove some migration code that should no longer be relevant 2020-04-23 12:25:11 +07:00
Allan Odgaard
b514114ec7 Access most system singletons using dot syntax
These are identified by having a prefix of shared, default, or standard in the class method.
2020-04-23 12:25:11 +07:00
Allan Odgaard
814a3c78b4 Access sharedInstance using dot syntax 2020-04-23 12:25:11 +07:00
Allan Odgaard
715d023673 Declare “sharedInstance” as a class property 2020-04-23 12:25:11 +07:00
Allan Odgaard
a426c140d1 Ensure pasteboard is not updated (redundantly) from history dialog 2020-04-23 12:25:11 +07:00
Allan Odgaard
14d5b68e1f Remove OakPasteboard’s auxiliaryOptionsForCurrent property 2020-04-23 12:25:11 +07:00
Allan Odgaard
3f8c6914af Move “documents with matches” property from OakPasteboard to Find class
Originally the idea was to store it with the current pasteboard item, so that updating the pasteboard would automatically clear the matches.

But since there is currently only one use-case for this feature, the Find class can simply register for a “pasteboard did change” notification (which it already does for other reasons), and clear the matches if the clipboard changes.

The only downside is that the text view cannot depend on the find framework, as the latter already depends on the former, but we can just import the Find interface, and assert that the class will be present at run-time.

Long-term though, we should refactor this, as we do need two-way communication between these frameworks, for example to make matches live or update the selected match in the Find window when advancing through them in the text view (with ⌘G).
2020-04-23 12:25:11 +07:00
Allan Odgaard
f0784d5995 Track if find/replace string changed and conditionally add to pasteboard
The problem with adding an unchanged string to the pasteboard is that it generates a notification which may trigger other components to drop auxiliary data related to the current pasteboard item, for example the magnifying glass icons in the gutter are cleared each time the find clipboard changes.
2020-04-23 12:25:11 +07:00