Commit Graph

86 Commits

Author SHA1 Message Date
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
Allan Odgaard
1f0e3db472 Remove trailing zeroes from numeric literals
I mainly dislike the trailing zeroes because CGFloat used to be a float but 1.0 is a double (1.0f would be a float). So better to under-specify and let the compiler figure out the proper type.
2014-04-14 14:26:52 +07:00
Allan Odgaard
39b94e6ac3 Harmonize whitespace and add trailing newline 2014-04-14 14:26:52 +07:00
Allan Odgaard
7d1ca99421 Disable plug-ins for HTML output WebView
Also switch about window’s web preferences to be set via identifier instead of manipulating the standard preferences.
2014-04-09 15:15:36 +07:00
Allan Odgaard
cccfd855ac Sanitize output from TextMate.system()
Since the API specifies an NSString we must expect valid UTF-8.
2014-04-01 16:01:19 +07:00
Allan Odgaard
b23163476f Add loadHTMLString: API to HTML output view
This replaces the current HTML shown without adding to the history and will preserve scroll position.
2014-03-29 18:58:52 +07:00
Allan Odgaard
5a8967e88e Implement delegate method for WebView load failures
This can happen if the WebView itself terminates the load, for example if window.close() is called from JavaScript.
2014-03-28 19:31:15 +07:00
Allan Odgaard
5f69ef31c7 Don’t use NS prefix for custom functions 2014-03-28 19:31:14 +07:00
Allan Odgaard
619a2cfec7 Change a few instances of floorf/fabsf → floor/fabs 2014-03-28 19:31:14 +07:00
Allan Odgaard
9a9614e264 Workaround for “format string is not a string literal” warning 2014-03-13 20:51:15 +07:00
Allan Odgaard
0cb5f297de Add comment to explain workaround for presumed WebKit bug
Since the code was written before open sourcing TextMate, the explanation was only to be found in a private commit log.
2014-03-09 10:01:52 +07:00
Allan Odgaard
a4ad676c37 Add debug output to WebView delegate 2014-03-09 10:01:51 +07:00
Allan Odgaard
50ab241838 Open new window for HTML output links with target="_blank"
Since switching to ARC we need to ensure the NSWindow is “over-retained” as we rely on “setReleasedWhenClosed:YES”.

Also add ability to close such windows from JavaScript.
2014-03-09 10:01:51 +07:00
Allan Odgaard
09e5d88437 Refactor OakHTMLOutputView 2014-03-09 10:01:51 +07:00
Allan Odgaard
1e11a30a53 Remove redundant storage keywords for @property
These were required prior to the new 64 bit run-time.
2014-03-05 16:39:54 +07:00
Allan Odgaard
c2397484b8 Use C++11 for loop
Majority of the edits done using the following ruby script:

    def update_loops(src)
      dst, cnt = '', 0

      block_indent, variable = nil, nil
      src.each_line do |line|
        if block_indent
          if line =~ /^#{block_indent}([{}\t])|^\t*$/
            block_indent = nil if $1 == '}'
            line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
              $1.to_s + variable + ($2 == "->" ? "." : "")
            end
          else
            block_indent = nil
          end
        elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
          block_indent, variable = $1, $2
          line = "#$1for(auto const& #$2 : #$3\n"
          cnt += 1
        end
        dst << line
      end
      return dst, cnt
    end

    paths.each do |path|
      src = IO.read(path)

      cnt = 1
      while cnt != 0
        src, cnt = update_loops(src)
        STDERR << "#{path}: #{cnt}\n"
      end

      File.open(path, "w") { |io| io << src }
    end
2014-03-03 10:34:13 +07:00
Allan Odgaard
57e8e37313 Rename NSReplacePboard → OakReplacePboard
We shouldn’t use Apple’s prefix for our own constants. The actual value of the constant hasn’t been renamed yet as this requires “migration” (renaming the key in user defaults).
2014-02-18 12:41:47 +07:00
Allan Odgaard
8ebbb338c2 Disallow creating OakPasteboardEntry outside OakPasteboard.mm
This is in preparation of adopting CoreData which will require a managed object context to create pasteboard entry objects.
2014-02-18 11:53:41 +07:00
Allan Odgaard
30802bf4c7 Guard against fileSystemRepresentation returning nil 2013-11-04 14:00:55 +01:00
Allan Odgaard
e4a5db0f3b Only first call to window.close() would have an effect
This is a workaround for https://bugs.webkit.org/show_bug.cgi?id=121232
2013-09-12 23:46:04 +02:00
Allan Odgaard
776a8d46d9 Fix window.close() for HTML output embedded in main window 2013-09-12 23:46:04 +02:00
Allan Odgaard
2f72f84ae5 Add leak watcher and some debug output 2013-09-12 23:46:04 +02:00
Allan Odgaard
3f055aa318 Clear all web view delegates during dealloc 2013-09-12 23:46:04 +02:00
Allan Odgaard
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
06f349507a Add a “did wrap” boolean to the OakFindProtocol API
This informs the “server” that searching wrapped around to find the match.
2013-07-23 22:45:52 +02:00
Jacob Bandes-Storch
b533df1a40 Bar button positioning tweaks 2013-07-21 13:42:43 +02:00
Allan Odgaard
3198a8cdb1 Use weak pointer for block-accessed run loop
I am seeing some crashes related to this code. My best guess is that a command execution (with exit handler) is created and then cancelled from JavaScript, which would invoke the cleanup block that uses the (now destroyed, but non-nilled) run loop.
2013-07-02 18:43:46 +02:00
Allan Odgaard
6b64f38053 Update dialog text 2013-06-19 11:55:32 +07:00
Allan Odgaard
1f893b5543 Stopping long lived TextMate.system() executions would crash 2013-06-19 11:55:32 +07:00
Allan Odgaard
4586bc2024 Fix async mode for TextMate.system (JS bridge)
In commit 03aea09148 we switched to properties for the mapped instance variables which meant they all got an underscore prefix and wasn’t seen from JavaScript.
2013-06-15 16:13:22 +07:00
Allan Odgaard
03aea09148 Use io::spawn instead of oak::command_t for TextMate.system
Like with snippets, we no longer support executing a shebang-script given “inline” — though this was never a documented feature and I am not aware of anything having made use of it.
2013-05-16 21:36:49 +07:00
Allan Odgaard
d7e54f88ea Use trackSwipeEventWithOptions:… for swipe gestures 2013-04-26 20:45:52 +07:00
Allan Odgaard
0bf02dbeff Move divider line functions to OakUIConstructionFunctions.h 2013-04-02 04:11:32 +07:00