615 Commits

Author SHA1 Message Date
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
Allan Odgaard
464fdbfba4 Fix double height of menu items with custom shortcuts
Starting with macOS 10.15 the system will use new NSAttributedString API to obtain bounding rect, so we need to (also) overload this to return our fixed bounding rectangle.
2019-12-28 09:24:30 +07:00
Allan Odgaard
079377ed49 Require macOS 10.12 and remove compatibility checks 2019-10-07 21:28:16 +02:00
Allan Odgaard
7116dd777f Workaround for potential stall when calling mate with inactive TextMate
The issue appears to be that accessing the clipboard, as part of setting up a normal document window, will stall when trying to connect to the system’s clipboard server.

Here’s the relevant stack trace:

    -[OakPasteboard checkForExternalPasteboardChanges]
      -[NSPasteboard stringForType:]
        -[NSPasteboard _dataForType:securityScoped:]
          -[NSPasteboard _dataForType:index:usesPboardTypes:combinesItems:securityScoped:]
            -[NSPasteboard _dataWithoutConversionForTypeIdentifier:securityScoped:]
              CFPasteboardCopyData  (in CoreFoundation)
                ___onqueue_CFPasteboardRequestDataFromDaemon_block_invoke.341
                  usleep  (in libsystem_c.dylib)
                    nanosleep  (in libsystem_c.dylib)
                      __semwait_signal  (in libsystem_kernel.dylib)
2019-08-26 21:34:52 +02:00
Allan Odgaard
8f685ff25c Use std::clamp instead of oak::cap (C++17) 2019-08-01 10:23:55 +02:00
Allan Odgaard
acfee9901c Use ‘NSInteger’ for result of selectedRow (instead of legacy ‘int’ type) 2019-08-01 10:11:24 +02:00
Allan Odgaard
f47a7b5f53 Code to bump date in filename is no longer a testable separate function 2019-07-16 14:24:07 +02:00
Allan Odgaard
168915307d Assign small icon to sieve scripts (file browser etc.) 2019-07-13 08:23:06 +02:00
Allan Odgaard
8f3f3d9d16 Update deployment version for xibs to 10.12
This was done using search and replace. Presumably it should be done in Xcode so that it can adjust the xib for the new deployment target, otherwise what is the point of storing deployment version in the xib and provide it as a command line argument to the xib compiler as well (only to get a warning if the versions do not match)?
2019-07-07 18:03:30 +02:00
Allan Odgaard
1ef78b3af7 Rename symbols to what’s expected by the 10.14 SDK 2019-06-29 20:14:15 +02:00
Allan Odgaard
04c3ce2d73 Filter string was not cleared when closing pasteboard history
This was because our windowWillClose: delegate method was never called, as our object was no longer a window delegate, an issue introduced in 709570049f when the superclass was changed to NSWindowController and I erroneously assumed that the superclass would set itself as delegate.
2019-06-27 22:32:57 +02:00
Allan Odgaard
5aa58e5543 Do not include $APP_NAME in framework’s bundle identifier
Since we have multiple application targets, it doesn’t make sense with a global APP_NAME variable.

Though if building the frameworks as standalone bundles and embedding them in different applications, we may need some sort of unique component in the bundle identifier, but we currently do not do this (they are all statically linked, so the Info.plist is currently unused).
2019-06-26 23:32:54 +02:00
Allan Odgaard
da996b6542 Use “quote” include statements for framework’s own headers 2019-06-26 13:21:11 +02:00
DaeHyun Sung
66c96b8393 Fix typo in character set name: ‘Korean – {ISO-2022-JP → ISO-2022-KR}’ 2019-06-20 16:58:57 +02:00
Allan Odgaard
97fb1f07cd Only use checkbox convenience constructor on 10.14 or later
The button created on 10.12 or 10.13 has a “Button” label next to it when used in table views (as used in the Find in Project results and Commit sheet).
2019-02-13 18:57:44 +07:00
Ronald Wampler
e0ddc61794 OakSyntaxFormatter: Clean up font attributes
See https://lists.macromates.com/textmate/2019-January/040883.html.

The issue is caused by commit f850dbdbc7, which added support for font style changes. It did so by applying a single font across the entire string. But, in some cases not all characters (e.g., Chinese or Japanese characters) may be available for that font so these characters would not be rendered correctly while editing.
2019-02-13 18:47:54 +07:00
Allan Odgaard
8e2ccd0dff Convenience constructor for labels appear to not use controlTextColor
Issue: https://lists.macromates.com/textmate/2018-December/040853.html
2018-12-07 12:55:47 +07:00
Allan Odgaard
b8017b9f22 Do not set NSBackgroundStyleRaised for controls and text in status bars
It appears to be ignored on 10.14 but earlier versions of macOS rendered the elements with a shadow, which is probably not a good fit for our current design.
2018-12-06 22:00:22 +07:00
Allan Odgaard
5c2e646b3f Use fontAttributesInRange: instead of attributesAtIndex:effectiveRange:
Semantically this seems slightly more appropriate, and giving a range allows us to pass the strings length as the length of the range, instead of assuming that the string has a first character for which we can get attributes, although for an empty string, passing in a zero-length range *does* throw an exception, so we must only call this when we know the string is non-empty.
2018-12-05 21:16:54 +07:00
Allan Odgaard
fdc4dd3124 Do not request attributes for an empty NSAttributedString
This would throw an “out of bounds” exception.
2018-12-05 21:16:54 +07:00
Ronald Wampler
ca80254b80 Refactor finder tags to use catalog colors
Also, reworked the OFBFinderTagsChooser to have a similar look as on 10.14.
2018-12-05 21:16:54 +07:00
Allan Odgaard
f7eb32a83b New tool tip material was accidentally disabled in a previous commit
Commit in question: ae0fc82f87
2018-12-02 18:08:38 +07:00
Allan Odgaard
f850dbdbc7 Support font style changes in OakSyntaxFormatter 2018-11-22 16:38:23 +07:00
Allan Odgaard
4eafd59374 Let OakSyntaxFormatter use OakTheme
As the latter supports catalog colors, the styled string should automatically work in both light and dark mode.
2018-11-22 16:38:23 +07:00
Allan Odgaard
f244e223fd Rename a few menu items 2018-11-20 22:21:50 +07:00