639 Commits

Author SHA1 Message Date
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
c2019e15a1 Use CGContext instead of graphicsPort 2020-05-13 18:50:02 +07:00
Allan Odgaard
9da2d327c9 Only use implicit animation to resize windows on 10.15 and later
This causes lots of visual glitches on macOS 10.14.
2020-05-10 21:41:12 +07:00
Allan Odgaard
0c49db9838 Prior to 10.15 a window’s screen property could be nil 2020-05-10 21:38:27 +07:00
Allan Odgaard
f8dd2ebae7 Find History: Change Find Next to “in Project” when holding down option 2020-05-10 20:07:31 +07:00
Allan Odgaard
c11828add9 Add an alternateAction property to OakPasteboardChooser
This is sent when the action button is triggered while option (⌥) is down (if there is a valid responder for the message).
2020-05-10 20:07:31 +07:00
Allan Odgaard
407aed195e Make sure window is within visible screen frame when resizing 2020-05-10 20:07:31 +07:00
Allan Odgaard
3c609e33d9 Move transitioning of view (animation) to stand-alone view controller
Also make the code slightly more general, for example support transitions to nil.
2020-05-10 20:07:31 +07:00
Allan Odgaard
caaa36161d Change most fprintf log statements to using os_log 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
05f711d256 Change a few NSLayoutConstraint instances to instead use layout anchors 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
485e9f947d Use slightly better frame color for shortcut recorder when in Dark Mode 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
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
19d2c96034 Don’t update text field when dismissing find history pop-up with escape 2020-04-22 12:31:42 +07:00
Allan Odgaard
f3a46a25d6 Move private instance variable to implementation file 2020-04-22 12:31:42 +07:00
Allan Odgaard
23d2de534b Use NSStackView to manage OakScopeBarViewController’s buttons 2020-04-17 19:19:53 +07:00
Allan Odgaard
ff22bb58fa Add allowsEmptySelection to ScopeBarViewController
Also change selectedIndex to NSUInteger as it will be NSNotFound when there is no selection.
2020-04-17 19:19:53 +07:00
Allan Odgaard
342e612505 Add controlSize to OakScopeBarViewController
Ideally this would be a view property, but the view controller only expose the content view, which is an NSView instance that does not support the property by default, so we would have to introduce a subclass for this.
2020-04-17 19:19:53 +07:00
Allan Odgaard
f8203bccfa Use columnWithIdentifier: instead of tableColumnWithIdentifier:
This simplifies the code.
2020-04-17 19:19:53 +07:00
Allan Odgaard
2bdce95293 Refactor OakScopeBarView to be a view controller subclass 2020-04-17 19:19:53 +07:00
Allan Odgaard
3a21cbfd85 Move Go To… menu updating and next/previous actions to ScopeBarView 2020-04-14 12:58:11 +07:00
Allan Odgaard
7d67bb7f80 Add preliminary UI for flagging clipboard history items 2020-04-14 12:58:11 +07:00
Allan Odgaard
b06c34eb0f Refactor helper method to only have a single point of return 2020-04-14 12:58:11 +07:00
Allan Odgaard
7e5daad0ad Add “flagged” property to OakPasteboardEntry
Flagged items will not be implicitly deleted when pruning history or removing all items.
2020-04-14 12:58:11 +07:00
Allan Odgaard
d6ce2e3abf Use tertiaryLabelColor for “replacement characters” in strings
This is instead of lightGrayColor which is not sensitive to light/dark mode.
2020-04-14 12:58:11 +07:00
Allan Odgaard
3eaaff7f47 Support selecting multiple items in pasteboard history dialogs
This can either be used to more easily delete multiple items, or for inserting/searching for multiple items.
2020-04-14 12:58:10 +07:00
Allan Odgaard
e0db2f5ec1 Make OakPasteboardEntry’s historyId public 2020-04-14 12:58:10 +07:00
Allan Odgaard
babb989288 Add pasteboard method to store multiple items
This is for multi-selecting items in the pasteboard chooser and they are stored as auto-generated items and with their history identifiers, so that we can treat them as multiple items.
2020-04-14 12:58:10 +07:00
Allan Odgaard
34eb6967c8 Use sqlite3 for clipboard history instead of CoreData
I was using the clipboard history as a testbed for CoreData but my conclusion is that it was not a good fit, and with the API we used now being deprecated, and the clipboard history needing various improvements, it’s easier just to replace the CoreData backend with sqlite3 and offers us more flexibility going forward.

With this re-implementation there is now support for storing multiple strings on the clipboard and the check to see if other applications changed the clipboard should work better (it appears that if an application is changing the clipboard while TextMate is active, sometimes the NSPasteboard’s changeCount is not updated).

It now also stores the history item’s row ID on the pasteboard, so if we select the non-latest history item and relaunch TextMate, it will no longer treat the current item on the pasteboard as a new item.
2020-04-14 12:58:10 +07:00
Allan Odgaard
d63f12993f Use class properties for general, find, and replace pasteboard instances 2020-04-14 12:58:10 +07:00
Allan Odgaard
2e1ed018d4 Query array controller directly for count of objects
The reason we were doing a fetch was because it may provide better performance, furthermore, the count returned by the array controller is count of filtered objects, so this change is a slight regression, should be addressed later.
2020-04-14 12:58:10 +07:00
Allan Odgaard
29f43d2385 Let OakPasteboard create NSArrayController used by clipboard history
Again to hide that we are backed by CoreData storage.
2020-04-14 12:58:10 +07:00
Allan Odgaard
de9c7811de Use filter predicate instead of fetch predicate for clipboard history
This is in anticipation of dropping the CoreData backend.
2020-04-14 12:58:10 +07:00
Allan Odgaard
883a45568f Fix clipboard history predicate string used for filtering 2020-04-14 12:58:10 +07:00
Allan Odgaard
623267ba98 Add API to remove all entries from OakPasteboard
This is one of several steps toward making CoreData an implementation details of OakPasteboard (which it is currently not).
2020-04-14 12:58:10 +07:00
Allan Odgaard
65a379ce71 Let Open With menu delegate respond to menuHasKeyEquivalent:forEvent:…
By implementing this, we avoid potentially updating the menu when pressing “menu keys”, which can be slow due to collecting information about system applications, such as supported file types, icon, and display name.

This would happen when opening the menu via the file browser’s action menu, and then using arrow keys in the text view. On my setup, moving the insertion point was slowed down noticeably.
2020-04-14 12:58:10 +07:00
Allan Odgaard
aa0c4af1eb Remove support for OakBackgroundFillViewStyleDarkDivider 2020-04-14 12:58:10 +07:00
Allan Odgaard
8548b7538d Remove support for OakBackgroundFillViewStyleDivider 2020-04-14 12:58:10 +07:00
Allan Odgaard
ac58ed4588 Remove OakCreateDividerImageView 2020-03-29 10:21:30 +07:00
Allan Odgaard
8059ca1fc1 Add helper to create NSBoxSeparator view 2020-03-20 16:18:12 +07:00
Allan Odgaard
a9c668ba39 Simplify NSAttributedString subclass used for menu titles
We now do all the work in NSMenuItem’s setActivationString: and no longer require subclassing the mutable versions of NSAttributedString.

It should now be more transparent what the code does and why it does it.
2019-12-28 09:54:18 +07:00