370 Commits

Author SHA1 Message Date
Allan Odgaard
4b4e5fca8b Remove code required for compatibility with 10.10 and earlier 2019-10-07 21:28:16 +02:00
Allan Odgaard
8f685ff25c Use std::clamp instead of oak::cap (C++17) 2019-08-01 10:23:55 +02:00
Allan Odgaard
b176bf8f9a Use number formatter for count in Find All / Replace All status text
The Find dialog was already using number formatters, but the tool tips shown in the text view (when doing searches or replacements without going through the find dialog) were not.

This makes a difference when the count is > 999, as it will then format the number with thousand separators.
2019-07-14 11:26:31 +02:00
Allan Odgaard
dfd5f85fb5 Remove unnecessary Info.plist file from Find framework 2019-07-14 10:59:30 +02:00
Allan Odgaard
63e82b9bc0 Drop localization support in Find dialog
This was unnecessary indirection as we don’t generally lookup strings for the UI (so TextMate is not actually localizable) and the catalog for the strings we did look up was actually out of date.
2019-07-14 10:57:27 +02:00
Allan Odgaard
6b3c8747e7 Remove unused localization strings 2019-07-14 10:46:31 +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
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
5202dc34bd Revert "Let NSScrollView draw border above/below search results"
The scroll view’s border is black on 10.13.6 (and possibly earlier) which is undesired.

See https://lists.macromates.com/textmate/2018-December/040858.html

This reverts commit a0ac9c9a92.
2019-03-19 12:08:11 +07:00
Allan Odgaard
56f073a8ef Associate search results with the current find delegate
This fixes the problem where a folder search has been done and the dialog is later re-opened for another project (which will then take ownership) and then selecting one of the old search results: The “select match” is now sent to the project that was active, when the search was performed.
2018-12-06 22:00:26 +07:00
Allan Odgaard
1a1a910c92 Introduce find dialog delegate instead of using project identifier 2018-12-06 22:00:22 +07:00
Allan Odgaard
e9af090811 Make private function ‘static’ 2018-12-02 18:08:38 +07:00
Allan Odgaard
82593c8824 Use NSPasteboard’s writeObjects: when copying find in folder results
When requesting clipboard content using stringForType: then NSPasteboard will automatically join all strings using a newline character, so copied results will still paste as a “list” but applications that are aware of multiple pasteboard items could potentially do something different.
2018-11-21 16:24:51 +07:00
Allan Odgaard
f244e223fd Rename a few menu items 2018-11-20 22:21:50 +07:00
Allan Odgaard
79172d552e Set controlSize on NSControl instead of its cell 2018-11-17 20:20:55 +07:00
Allan Odgaard
36652c8afa Some changes for Find dialog’s status text on 10.14
The empty status text had a smaller fitting size than when it contained text, causing the UI to resize a few pixels. Fixed by setting the initial value of the button to a space.

The color of the text has been set to controlContentColor which is slightly dimmed (when used in this context), but which caused the text to be highlighted when clicked, even when there was no alternate title. Fixed by always setting the alternate title.

The size of the button is now set to a small button without making any font changes: This means the font is 12 point instead of 11 point, but with the slightly dimmed text color, I think this is appropriate.
2018-11-17 11:35:40 +07:00
Allan Odgaard
0df1795f27 Use isAccessibilityElement instead of accessibilityIsIgnored
The latter is deprecated starting with 10.10.
2018-11-15 23:10:25 +07:00
Allan Odgaard
a0ac9c9a92 Let NSScrollView draw border above/below search results
This requires clipping the left/right border of the scroll view (using a narrow superview), which is something I have avoided since Interface Builder has a warning about “view is clipping its content” and I seem to recall there being some issues with drawing focus ring around clipped views in the past, but as we are not using a xib nor drawing a focus ring around the NSScrollView being clipped, this approach should be OK.

The advantage is of course that we ensure system colors for the borders.
2018-11-15 12:18:13 +07:00
Allan Odgaard
c03b22b230 Use layout constraints for the centered small checkbox in search results
If creating the checkbox using the NSButton convenience constructor introduced in 10.13 then the existing code had the box sized incorrectly, so this commit is to make the code more robust against a future switch to the convenience constructors.
2018-11-15 11:36:40 +07:00
Allan Odgaard
1aa569cdf2 Draw a custom dash for removing find results and favorites
The NSImageNameRemoveTemplate looks bad in 10.14, and while there is some duplication in this commit, it’s so few lines that sharing this functionality would result in an increase of total number of lines.
2018-11-02 16:31:49 +07:00
Allan Odgaard
14ae6019bf Update all instances of accessibilitySetOverrideValue:forAttribute: 2018-11-02 08:40:39 +07:00
Allan Odgaard
6acbbca23c Use textColor and secondaryLabelColor for find in folder results 2018-10-30 15:31:48 +07:00
Allan Odgaard
9271a0cbb5 Use semantic color for image shown when holding command in find results
This required switching to using a block-based image as we cannot use adaptive colors when pre-rendering images.
2018-10-30 15:29:16 +07:00
Allan Odgaard
694fc2b4b4 Update document’s match captures from find dialog
If user does a “Find All” and selects one of the results, previously performing a replace would not use the captures from the selected result.
2018-10-29 11:48:44 +07:00
Ronald Wampler
e64b09b688 Introduce overloads for the new divider styles
Also, switch to use the new divider styles in most places. The remaining usage of the old "OakCreateLine" functions are in the OakChooser windows. These will be refactor for better dark mode support next.
2018-10-28 11:07:03 +07:00
Allan Odgaard
e6adecaf4e Allow setting default find in folder globs with defaultFindInFolderGlobs
This is an array, example of setting the list:

    defaults write com.macromates.TextMate defaultFindInFolderGlobs '( "{*,.tm_properties}", "*" )'
2018-10-28 10:15:56 +07:00
Allan Odgaard
f6fa273912 Update coding style for where to place colon after dictionary keys
This follows the Swift style and also makes it possible to align dictionary values using TextMate’s Align Assignments command.
2018-10-07 09:54:45 +02:00
Allan Odgaard
e70791ee89 Rename a bunch of constants to fix deprecation warnings (10.12) 2018-06-16 22:55:30 +02:00
Allan Odgaard
2689f51a08 Enable horizontal scroll for project/folder search results 2018-06-11 15:29:43 +02:00
Allan Odgaard
5b8eea86cb Move “remove” button for search results to the left side
This is in preparation of horizontal scroll: When the table view is horizontally scrollable it is not obvious how we can place a right-aligned button in the group header.
2018-06-11 15:29:43 +02:00
Allan Odgaard
c11b81b9da Use MBCreateMenu for a few pop-up menus 2018-04-30 15:30:48 +07:00
Allan Odgaard
7a61949c33 Auto-hide scrollbars
We already auto-hide them for majority of our scrollviews, but since they are hidden by default when using a trackpad, a few “new” scrollviews didn’t get this setting, and I hadn’t noticed.
2018-04-25 21:47:38 +07:00
Allan Odgaard
4080334609 Fix bug in CommonAncestor function
When all paths had the same prefix as first item, the first item would be returned as the common ancestor even if the other paths were not children.

For example:

    /path/to/some_folder
    /path/to/some_folder_with_same_prefix

Here `/path/to/some_folder` was returned even though `/path/to` is the common ancestor.

The function is still not correct when all paths are actual descendants of first path, but since it’s only used for display purposes, and with “find in folder” (where paths shouldn’t overlap), I am not bothering with that issue.
2017-10-09 10:31:44 +02:00
Allan Odgaard
f30ce91455 Use triangular bullet (‣) instead of black small triangle (▸)
We were already using the triangular bullet in a few places, so I made it consistent. Semantically the small triangle might be more appropriate, because we do not use the glyph as a point marker, but I think the triangular bullet aligns better with the text (it’s raised above the baseline where the triangle seems to just touch the baseline).
2017-09-12 16:57:00 +02:00
Ronald Wampler
42654ff283 Use appropriate enum case for NSSavePanel and NSOpenPanel result (10.9) 2017-05-31 10:03:41 +02:00
Ronald Wampler
dedbc3fe4f Stop exporting scan_path.h
This header was removed in commit 2ffbfe02a5.
2016-12-05 12:00:12 -05:00
Allan Odgaard
5a5f5e8d75 Make folder search depth-first 2016-11-13 16:22:04 +07:00
Allan Odgaard
9d980a07df Remove NSPrincipalClass from framework bundles’s Info.plist
This is not something which is used anywhere and a few of the frameworks does not have a principal class.
2016-10-31 17:30:30 +07:00
Allan Odgaard
03d912e7c4 Bump date of find/replace pasteboard history items when they are used
Currently this bumping is limited to the Find dialog and happens when executing a search. Selecting from the Show Find History or subsequently using ⌘G, does not bump the date of the selected item (but probably should).
2016-10-10 22:37:12 +02:00
Allan Odgaard
1d7c168cb8 Rework logic for when search result selection should select in document
There are two issues here, one is that double-clicking a result sends both “selection did change”, “did single click” and “did double click” messages, which all should potentially select the result in the document, but this does introduce a bit of overhead, although I think this is insignificant.

The other issue is that a “single click” or “selection did change” shouldn’t select in the document when the user is selecting multiple items, which is useful for the various Copy actions.
2016-10-07 10:02:58 +02:00
Allan Odgaard
9fd239c78b Ensure we do not create zero-sized NSImage 2016-10-01 08:59:28 +02:00
Allan Odgaard
5f11d65308 Force find/replace text fields to recreate display string
The previous attempt does not work on macOS 10.12, presumably because the object value doesn’t actually change, despite the setter being invoked.
2016-09-30 14:10:39 +02:00
Allan Odgaard
e6f4f2dc40 Use atomic getter/setter to access lastDocumentPath
There was a race-condition since we update it in the background queue, where it could be released, and using it in the main queue does not retain it before use.
2016-09-29 09:56:50 +02:00
Allan Odgaard
4a260811ec Change URL scheme to https 2016-09-29 09:56:50 +02:00
Allan Odgaard
3c150d34aa Ensure we only remove observer that we previously added
We were previously assuming that the viewWillMoveToSuperview: was only called when moving to a view and then later when removed, but for 10.8.5 it appears that it might be called multiple times (with a nil superview), causing us to remove ourself as observer from something we didn’t observe.
2016-09-26 21:01:04 +02:00
Allan Odgaard
b0d2a93040 Fix placement of search results checkboxes 2016-09-26 11:14:23 +02:00
Allan Odgaard
9e949e3eda Use NSUUID for project identifier (instead of NSString) 2016-09-26 11:08:22 +02:00
Allan Odgaard
b1f92d1415 Skip work when regular expression property is set to its existing value 2016-09-26 08:09:58 +02:00
Allan Odgaard
12ca096ccb Enable syntax highlight for find and replace text fields
These use the source.regexp.oniguruma and textmate.format-string grammars respectively, both in the TextMate bundle.
2016-09-26 08:09:58 +02:00
Allan Odgaard
dc5028f039 Let text view and find window show documents using OakDocumentController 2016-09-24 08:33:33 +02:00