Commit Graph

5248 Commits

Author SHA1 Message Date
Allan Odgaard
5166b6bfed Introduce constants for clipboard option names 2020-04-14 12:58:10 +07:00
Allan Odgaard
47d0345d5a Omit “default” options argument for clipboard_t::entry_t constructor 2020-04-14 12:58:10 +07:00
Allan Odgaard
a3aa7f3225 Make ‘options’ argument of clipboard_t::entry_t constructor be optional 2020-04-14 12:58:10 +07:00
Allan Odgaard
38305e7fc4 Fix code that should return NO when bundle install is in progress 2020-04-14 12:58:10 +07:00
Allan Odgaard
4a1e9113f3 Make file browser state API wrap the system UI restoration methods
This avoids duplicating code, although for compatibility with old saved state, we still can restore state from a dictionary.
2020-04-14 12:58:10 +07:00
Allan Odgaard
61ec959b37 Change data type of file browser state from dictionary to opaque object
This gives us more flexibility in how we wish to represent the state, although the state should be a property list object.
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
1e065153d6 Remove legacy API for observing changes to a single file
New code should use KEventManager instead of document::watch_server_t.
2020-04-14 12:58:10 +07:00
Allan Odgaard
386c1f53db Use KEventManager to observe the file backed by OakDocument
This should handle more edge-cases than the previous API, specifically renaming ancestors or moving files to trash (now treated as a delete).
2020-04-14 12:58:10 +07:00
Allan Odgaard
ac903a1fa8 Add API to observe changes to a single file
While in theory just a wrapper for VNODE events, there are some edge cases:

- Observe missing file: Report when created (observe all ancestors to know).
- Rename ancestor: Treat as rename (observe all ancestors to know).
- Move observed file to trash: Treat as delete (reported as rename).
- Rename file with symbolic link in path (e.g. /tmp): Preserve symbolic path.
- Delete observed file and write new one: Treat as a write (reported as delete).
- Rename observed file and write new one: Treat as a write (reported as rename).
- Change case of file: Tricky on case-insensitive but preserving file systems because newPath != oldPath but both exist, so it looks the same as “rename and write new file” (previous case) that should be reported as write.

There is also an issue observing a symbolic link, here we should really observe both the link itself (does it get renamed or deleted) but also the resolved path (does this file get updated).

Currently though this is NOT implemented.
2020-04-14 12:58:10 +07:00
Allan Odgaard
4013020b14 Use dot syntax for NSNumber’s boolValue property 2020-04-14 12:58:10 +07:00
Allan Odgaard
4f43bf497c Use the ‘console’ pool to run executables
This avoids output buffering so is necessary for executables that produce output without immediately terminating.
2020-04-14 12:58:10 +07:00
Allan Odgaard
9782343576 Make completion and quick open work out of the box for TextMate headers
Since we no longer have a shared directory for all the framework headers, we need to either explicitly list each header directory in the compiler flags (or TM_SYS_HEADER_PATH) for header completion and quick open to work, or we need to create a dummy directory with symbolic links.

Previously I was using the previous method, but include folder has to be created when building on a new system, and it doesn’t avoid having to update the symbolic links if we add/remove frameworks to the project, so listing them all in the .tm_properties, while not ideal, is a better solution.
2020-04-14 12:58:10 +07:00
Allan Odgaard
be29a7711a Export the SCMManager from FileBrowser framework
This should probably be its own framework, but nothing beyond the file browser is currently using the SCMManager.
2020-04-14 12:58:10 +07:00
Allan Odgaard
c7548d0bb4 Ensure we have a default include glob for file chooser
We setup a default in default.tmProperties but incase file chooser code is used outside of TextMate then no such default is found, and the file chooser defaults to excluding everything.
2020-04-14 12:58:10 +07:00
Allan Odgaard
e083ed4ce1 Add OakTabBarViewController to simplify using OakTabBarView
This is a subclass of NSTitlebarAccessoryViewController so it can be added directly to windows as an accessory view controller.

It is key/value bindings-compliant for its properties, which should be bound directly to an NSArrayController, which will make the tab bar view reflect the objects managed by this array controller, including updating the tab bar view when object properties such as title or modified state changes.
2020-04-14 12:58:10 +07:00
Allan Odgaard
43934ab9ed Do not export non-existing OakTabBarStyle.h header 2020-04-14 12:58:10 +07:00
Allan Odgaard
58c3c6957d Remove selectedTabItem and tabItems properties from OakTabBarView
Also make the OakTabItem interface private (implementation detail).
2020-04-14 12:58:10 +07:00
Allan Odgaard
6c692099ff Change OakTabBarView to use tab item’s identifier in drag’n’drop API
This is instead of passing instances of the “internal” OakTabItem class.
2020-04-14 12:58:10 +07:00
Allan Odgaard
3cde965415 Make OakTabBarView’s selectedTabIndex a r/w property but no KVO support
The property returns NSNotFound when there is no selection. This seems to be consistent with NSArrayController’s selectionIndex (but inconsistent with many other views, like NSTableView, which return -1 when there is no selection).
2020-04-14 12:58:10 +07:00
Allan Odgaard
e3bd910e8c Change type of tab identifier from NSString to NSUUID
While AppKit identifiers are generally strings, which have more flexibility, I think this is mainly because NSUUID was introduced later, and for tab items, identifiers must be unique, which is not enforced (or implied) when using strings.
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
67694d1b5a Use OakCreateNSBoxSeparator() in main (document) window 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
eccbb81e8a Constrain height of vertical dividers and remove intrinsic height
Previously some status bars could be compressed vertically because the dividers did not have a fixed height, so they were sized based on their intrinsic height.

With a fixed height the intrinsic height is redundant and previously it was simply hiding an issue with an under-constrained layout, so better just remove them.
2020-04-14 12:58:10 +07:00
Allan Odgaard
e490b86c47 Make horizontal dividers subviews of status bar (NSVisualEffectView)
This makes the color of the separator bar better adapt to the color of the status bar and should make things more consistent, as we already have separators inside visual effect views in various places.

Also adjust height of the vertical separators in status bars to only be 15 pixels so that we have equal padding above and below.
2020-03-29 10:23:42 +07:00
Allan Odgaard
07c8a76abd Use OakCreateNSBoxSeparator() for file browser’s actions view
This is instead of the more opaque OakCreateHorizontalLine(OakBackgroundFillViewStyleDivider).
2020-03-29 10:21:30 +07:00
Allan Odgaard
de5d1b5239 Use OakCreateNSBoxSeparator() for HTML output window
This is instead of the more opaque OakCreateHorizontalLine(OakBackgroundFillViewStyleDivider).
2020-03-29 10:21:30 +07:00
Allan Odgaard
7d0a1dea74 Use OakCreateNSBoxSeparator() for file browser view
This is instead of the more opaque OakCreateHorizontalLine(OakBackgroundFillViewStyleDivider).
2020-03-29 10:21:30 +07:00
Allan Odgaard
d7ec9e6690 Use OakCreateNSBoxSeparator() for live search and grammar installation
This is instead of the more opaque OakCreateHorizontalLine(OakBackgroundFillViewStyleDivider).
2020-03-29 10:21:30 +07:00
Allan Odgaard
ac36f84c4d Use OakCreateNSBoxSeparator() for search results
This is instead of the more opaque OakCreateHorizontalLine(OakBackgroundFillViewStyleDivider).
2020-03-29 10:21:30 +07:00
Allan Odgaard
be408c04cd Use OakCreateNSBoxSeparator() for commit window
This is instead of the more opaque OakCreateHorizontalLine(OakBackgroundFillViewStyleDivider).

Also use NSLayoutFormatAlignAllLeading with the visual format language instead of manually creating constraints for the dividers.
2020-03-29 10:21:30 +07:00
Allan Odgaard
33b615fd14 Let OFBHeaderView be NSVisualEffectView subclass with titlebar material
Previously it was a subclass of OakBackgroundFillView which adds the NSVisualEffectView as a subview, but this messes up compositing in some cases where an ancestor view is also an NSVisualEffectView, for example when placing the file browser in a “source list” split view item (using NSSplitViewController).

Also change the material to NSVisualEffectMaterialTitlebar. I think this looks better, as the previously used NSVisualEffectMaterialHeaderView does not look identical to other table view headers and only have very faint bottom border but very noticeable “within window” compositing.

A further advantage of changing to title bar material is that NSVisualEffectMaterialHeaderView requires macOS 10.14, so by using title bar material, we avoid having a different code path for users using older versions of macOS.
2020-03-29 10:21:30 +07:00
Allan Odgaard
ac58ed4588 Remove OakCreateDividerImageView 2020-03-29 10:21:30 +07:00
Allan Odgaard
e7ea79cffe Use OakCreateNSBoxSeparator() instead of OakCreateDividerImageView()
The latter is a wrapper around an NSBoxSeparator, only adding some size constraints.
2020-03-29 10:21:27 +07:00
Allan Odgaard
8059ca1fc1 Add helper to create NSBoxSeparator view 2020-03-20 16:18:12 +07:00
Allan Odgaard
7adf668773 Always setup file browser scroll view to inset content based on header
Previously we would only do this on macOS 10.14 and later, but as we now also use “within window” compositing for the header view prior to macOS 10.14, we should always inset the scroll view.

Furthermore, even without “within window” compositing, insetting the scroll view should not cause any issues, so the code was actually not required previously.
2020-03-20 16:18:12 +07:00
Allan Odgaard
3428c5cdfb Fix missing default folder location for new file browser windows 2020-03-20 15:06:23 +07:00
Allan Odgaard
0545f02620 Add support for NSRestorableState to FileBrowserViewController 2020-03-13 16:39:15 +07:00
Allan Odgaard
2410ba345f Refactoring: Move logic from FileBrowserView → FileBrowserViewController
This is to make it easier to support Cocoa’s native resume feature, as for this, we should keep all state in the controller, but also, the controller should be able to know if view state changes, for example expanded/selected items in the outline view, which require our controller to be the delegate.
2020-03-11 21:22:25 +07:00
Allan Odgaard
fa9e690309 Formatting: Align closing braces 2020-03-11 14:08:53 +07:00
Allan Odgaard
3ca83220bb Add URL property to FileBrowserViewController
This should be used instead of path, as we may display non-file URLs.
2020-03-11 13:35:04 +07:00
Allan Odgaard
66bfb817d6 Set NSWindowAnimationBehaviorDocumentWindow for our document window 2020-02-29 13:18:55 +07:00
Allan Odgaard
3d4b72c0ff Add own framework header paths to include path before third party
This is because third party framework headers are likely to be installed in directories with many other headers that can clash with some of our custom frameworks.

Closes #1441.
2020-02-28 12:54:02 +07:00
Andreas
5a58f05a1a Syntactic Typo 2020-02-28 12:54:02 +07:00
Allan Odgaard
2cb43a6ef3 Checkin release notes for 2.0.6 2020-02-28 12:54:02 +07:00
Allan Odgaard
dc185a42a3 Checkin release notes for 2.0.5 2020-02-28 12:54:02 +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
aeec0874b3 Fix warning about invalid ERB trim mode
We don’t care about the trim mode as nobody is reading the generated HTML, but we have to supply something, previously we enabled everything, which is now giving an error despite the documentation saying that trim mode can be “one or more of the following modifiers”:

	%  enables Ruby code processing for lines beginning with %
	<> omit newline for lines starting with <% and ending in %>
	>  omit newline for lines ending in %>
	-  omit blank lines ending in -%>

It would seem that ‘<>’ is mutually exclusive with ‘-’ so now we pass ‘%-’ for trim mode.
2019-12-26 23:20:48 +07:00