Commit Graph

119 Commits

Author SHA1 Message Date
Allan Odgaard
6245fa17d5 Introduce ‘reusable’ property to OakHTMLOutputView
This defaults to YES but can be set to NO if an output view should not be re-used (even though no command is currently running).
2016-10-03 22:05:39 +02:00
Allan Odgaard
a83912489c Require the 10.11 SDK to build TextMate 2016-09-30 12:46:59 +02:00
Allan Odgaard
010bb72375 Add ‘visible’ property to OakHTMLOutputView
This can be observed to learn when the view is hidden, either because the window it is in closes or when it is removed from its superview.
2016-09-27 21:51:55 +02:00
Allan Odgaard
406a804a3e Remove redundant intrinsicContentSize overload 2016-09-27 21:49:32 +02:00
Allan Odgaard
f0a2a70998 Change ‘isBusy’ setter to just ‘busy’
The getter is still ‘isBusy’.
2016-09-27 21:49:32 +02:00
Allan Odgaard
3cf916cf49 Rename loadHTMLString: method to setContent:
The previous name was inspired by WebView’s default API but it sounds like it is just the default implementation with a default baseURL: parameter, hence why I prefer to name it something different.
2016-09-27 21:36:26 +02:00
Allan Odgaard
9389fd9fc0 View Source now uses the frame title as document’s display name 2016-09-24 08:33:33 +02:00
Allan Odgaard
30f53b43f9 Let HTML output use OakDocumentController API 2016-09-24 08:33:33 +02:00
Allan Odgaard
51faf0ed3c Remove WebKit workaround that no longer seems necessary
The workaround was introduced in May 2005, so the underlying issue was probably addressed a long time ago :)
2016-09-17 07:22:41 +02:00
Allan Odgaard
553e89ceb6 Update include statements and link declarations 2016-09-11 12:47:39 +02:00
Allan Odgaard
6959ca68f3 Dismiss “Stop Command?” HTML output dialog if command exits by itself 2016-08-28 13:40:56 +02:00
Allan Odgaard
14782c0aea Remove old custom URL protocol 2016-08-28 13:32:49 +02:00
Allan Odgaard
1da89cc5a0 Check for ‘x-txmt’ prefix in URL scheme instead of exact match 2016-08-28 13:32:48 +02:00
Allan Odgaard
974db67258 Read isRunningCommand property instead of looking at URL scheme 2016-08-28 13:32:48 +02:00
Allan Odgaard
fce09a3edf Add mainFrameTitle property to OakHTMLOutputView 2016-08-28 13:32:48 +02:00
Allan Odgaard
b598252c58 Add commandIdentifier property to OakHTMLOutputView 2016-08-28 13:32:48 +02:00
Allan Odgaard
c99e65b17c Let OakHTMLOutputView handle the “Stop Task?” warning sheet
This also allows for the sheet to automatically close, should the command exit before the user selects an action.
2016-08-28 13:32:47 +02:00
Allan Odgaard
2c41cf8fa0 Remove unnecessary code 2016-08-28 13:32:47 +02:00
Allan Odgaard
926786c36c Use NSURLProtocol’s setProperty:forKey:inRequest: for associated data
This simplifies our code though it seems like the lifetime of the data is much longer than the request it is associated with.
2016-08-28 13:32:47 +02:00
Allan Odgaard
0319186e89 Introduce a pipe when writing to the HTML output view
This removes the command::runner_t dependency from our custom URL protocol.
2016-08-28 13:32:47 +02:00
Allan Odgaard
89c19eff61 Change ‘runningCommand’ getter to ‘isRunningCommand’ 2016-08-21 12:23:40 +02:00
Allan Odgaard
8679b5b869 Redirect protocol-relative URLs in HTML output to https
The problem is that HTML output is loaded from the x-txmt-command protocol, possibly with the “base URL” set to file://$TM_FILEPATH, so protocol-relative URLs like //example.org/main.css would be resolved as file://example.org/main.css.

We now try to detect these URLs (heuristically, since we only see the resolved URL) and (by default) redirect to https.

This commit checks for the presence of NSURLComponents which was introduced in Mac OS X 10.9. On 10.8 this commit has no effect.
2016-08-21 12:09:32 +02:00
Allan Odgaard
dbdfa3c6af Add identifying information to perror output 2016-08-21 12:09:30 +02:00
Allan Odgaard
383ac8c29d Remove tmColorWithCGColor: / tmCGColor (10.8) 2016-06-23 08:45:30 +02:00
Allan Odgaard
469fd74a7b Rely on ARC to manage GCD types (10.8) 2016-06-22 20:43:28 +02:00
Allan Odgaard
f5832c975f Add missing include statements 2016-06-22 18:31:49 +02:00
Allan Odgaard
417193e089 Update link dependencies for all targets
Some targets were including headers from frameworks not specified in their link dependencies. For a clean build this could cause an issue because the header was not available at the time of building the target.

The updated link dependencies are also based on what a target’s tests require. Ideally tests would have separate link dependencies, but as we don’t want to maintain this manually, this will have to wait until the build system automatically handles link dependencies.

Currently the commit command uses constants from the CommitWindow framework but should actually not be linked with it. However, the optimizer will strip dead code, so it should not result in much if any difference in the resulting binary and does solve a build dependency issue.
2016-05-07 13:00:55 +02:00
Allan Odgaard
b83f312e53 Remove dummy initializer method
With the 10.11 SDK we get a warning about this initializer not calling super, however, we do not intend for instances of this class to be created, which is why we had the dummy initializer.

We should remove this class entirely, as it’s a workaround for a problem that was fixed a long time ago, but I haven’t yet tested if there are still bundles using the (legacy) tm-file: URL scheme.
2015-11-20 13:33:01 +07:00
Ronald Wampler
3f5575cfe4 Directly convert the URL received from NSOpenPanel to a path
We call `fileURL` here but the method doesn't actually exists (it's actually a property with the getter `isFileURL`). The URLs we obtain from NSOpenPanel are paths so it's probably safe to get the path without checking if it's a proper file URL.
2015-09-21 09:50:49 -04:00
Ronald Wampler
f29ddf6500 Declare new protocols when building for 10.11
These were informal protocols prior to 10.11.
2015-09-21 09:50:20 -04:00
Ronald Wampler
d7121673ba Declare properties needsNewWebView and webView @dynamic
This suppress a warning with the latest version of clang shipped with Xcode 6.3.
2015-04-30 15:15:57 +02:00
Allan Odgaard
fca65bdd8b Handle unknown job identifiers in TextMate’s custom URL handler
Using a relative URL in a command with HTML output will be relative to our custom URL scheme which could result in stalling the output, as we did not handle “not found”, so WebKit would wait for data until a timeout.
2015-02-01 19:10:47 +07:00
Allan Odgaard
285fe6f907 Use NSInteger instead of int
The code is tightly coupled with Cocoa, so it makes sense to use the Cocoa type definitions.
2015-02-01 18:00:48 +07:00
Allan Odgaard
bf4cbd33fa Remove NSString* typecast when using to_s helper
This has a small run-time cost but source looks better and theoretically safer code.
2014-11-29 09:53:40 +07:00
Allan Odgaard
79eb970b9b Use NSIsEmptyRect instead of comparing with NSZeroRect 2014-11-17 00:04:34 +01:00
Allan Odgaard
7aea556533 Remove custom NSArray category
We only use the firstObject method which has existed since OS 10.6 (though wasn’t mentioned until the 10.9 FoundationKit release notes).
2014-11-05 10:58:29 +01:00
Allan Odgaard
b581e20ad9 Add wrapper for adding views with auto layout enabled 2014-11-05 00:09:37 +01:00
Allan Odgaard
1404d25145 Don’t assume our divider is an NSImageView 2014-10-18 12:38:24 +02:00
Allan Odgaard
4b34608636 Don’t specify bezel style for borderless image buttons
Also skip setting the template image property, since all the images have the ‘Template’ extension.
2014-10-13 23:20:24 +02:00
Allan Odgaard
a90acdcbe6 Use convenience methods to setup header/status bar backgrounds 2014-09-29 13:24:52 +02:00
Allan Odgaard
72837ca7ac Use OakBackgroundFillView instead of OakGradientView 2014-09-29 13:02:15 +02:00
Ronald Wampler
a627991ac3 HOBrowserView: Avoid calling super on key events
This workaround is to avoid a couple of undesired behaviors in the `HTMLOutputWindow` when the web page implements keyboard commands such as Git → Browse Annotated File (Blame). Namely, when using the keyboard commands, we would always receive an NSBeep. Also, fixed an issue when these key commands may conflict with menu keys. See comment in the commit for details.
2014-09-26 23:10:24 +02:00
Allan Odgaard
da669a482c Update documentation reference in comment 2014-09-19 07:37:15 +02:00
Allan Odgaard
73b21bd836 Move WebView related print support to OakHTMLOutputView 2014-09-10 14:02:08 +02:00
Allan Odgaard
707da020bb Ensure our HTML output view is first responder after load
When redirecting to a PDF file the PDFView (inside the WebView) is not made first responder (on 10.9, it might have worked on 10.8).
2014-09-10 13:46:39 +02:00
Allan Odgaard
f0e5efd5ae Remove unnecessary typecasts 2014-09-03 15:21:56 +02:00
Joachim Mårtensson
2eaa97b1dc Remove compiler error 2014-08-03 09:05:37 +02:00
Allan Odgaard
e81286b0cd Remove unused include 2014-05-16 22:11:28 +07:00
Allan Odgaard
7698ce2783 Show an error when WebKit fails to load the requested resource
WebKit will e.g. fail to load resources identified as application/octet-stream.
2014-04-28 18:23:51 +07:00
Allan Odgaard
6d77df7ac3 fixup! Remove trailing zeroes from numeric literals 2014-04-22 08:16:34 +07:00