Commit Graph

340 Commits

Author SHA1 Message Date
Allan Odgaard
bef21962c8 Changing font (Show Fonts) would fail when current font was ‘nil’ 2014-07-06 22:16:14 +02:00
Allan Odgaard
a5dd8cc2d7 Save white I-beam cursor image with LZW compression 2014-05-16 22:11:27 +07:00
Allan Odgaard
41e4ed2cc3 Save PDF images with Preview’s “Reduce File Size” quartz filter
This reduced the file size with more than 90%.

Since the PDF files are mapped into TextMate’s address space, it results in a reduction of memory usage.
2014-05-16 22:11:27 +07:00
Allan Odgaard
af3f4aaa33 Check result of most CF/CT ‘Create’ functions 2014-05-15 13:17:30 +07:00
Allan Odgaard
b8804d1164 Fix three memory leaks
One was per launch, one was per key event, and one was per (unique) line drawn.
2014-05-15 13:17:29 +07:00
Ronald Wampler
4c973385a8 Indent menu items in tabSizeMenu
This allow the check mark to be properly spaced with respect to its item.
2014-04-30 12:09:47 +07:00
Ronald Wampler
fc5dcf4020 Prefer NULL to nop: in most cases
This change was prompted by the appearance of the `tabSizePopUp` button in the status bar. After dismissing the menu, the title would be disabled.

To ensure we do not have similar issues elsewhere, let's prefer the use of `NULL` to `nop:` when assigning the action for menu items unless we are sure that the menu item should always be disabled (e.g., the item is used as a label).
2014-04-30 12:09:47 +07:00
Allan Odgaard
c272afaff2 Cleanup/harmonize whitespace
Leading indent should consist only of tabs, beyond that, only spaces should be used.
2014-04-25 16:55:31 +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
7c192f1e02 Let OakTextView handle cancelOperation: as complete:
This is only when caret is at a word, when not on a word, we do not respond to the cancelOperation: method. This way, pressing escape in a window where another responder implements cancel:/cancelOperation: (e.g. commit window) the key will be handled by the other responder (and presumably close the window).
2014-04-12 14:13:50 +07:00
Allan Odgaard
d1bce2ac4f Get rid of OakCreateViewWithColor 2014-04-12 11:23:07 +07:00
Allan Odgaard
bd74a16d96 Add API to hide status bar 2014-04-10 17:46:31 +07:00
Allan Odgaard
6d1da8ce97 Use bundle item’s effective name in error and cancel sheets
For example the bundle item “Execute Line / Selection” will (without a selection) show as “Execute Line” in the menu, and now also if the command causes the error sheet to appear or the user press ⌃C / ⌘. to prematurely kill it.
2014-04-09 15:15:36 +07:00
Allan Odgaard
b0864281ed Add “New Document” as output option for Filter Through Command 2014-04-08 15:43:19 +07:00
Allan Odgaard
6cc0108961 Rename document_t:{open,save} → document_t:sync_{open,save}
This makes it easier to search for code that use these functions.
2014-04-07 17:28:41 +07:00
Allan Odgaard
c7a211b2fd Let View → Wrap Column remember the last 5 values used 2014-04-06 19:36:09 +07:00
Allan Odgaard
b6b75227b3 Exception handler was overwriting crash report info 2014-04-02 14:02:28 +07:00
Allan Odgaard
5f94f460ee Post find feedback accessibility announcements 2014-04-01 14:23:31 +07:00
Boris Dušek
3c853dfa5e Use UI creation functions for accessibility in status bar 2014-04-01 14:03:29 +07:00
Allan Odgaard
69c83e56df The ‘const’ keyword should be to the right of its type
The standard doesn’t care which side the keyword is placed on, but placing it on the right makes it easier to read types.

E.g. reading “int const* const” from right to left we get “const pointer to const integer”.
2014-03-31 08:27:19 +07:00
Allan Odgaard
4f4fe38aec Use path::escape instead of local code 2014-03-29 18:58:53 +07:00
Allan Odgaard
6d6210e490 Use ‘assign’ instead of ‘weak’ when building for 10.7 2014-03-28 10:19:06 +07:00
Allan Odgaard
33178679c7 Scroll to caret failed if mouse button was pressed
We want to disable “make selection visible” when the user is drag-selecting, though the previous check was too broad and would disable it if user opened a document via double click (e.g. a find in folder result).
2014-03-27 07:53:55 +07:00
Allan Odgaard
247e866760 Going to symbol or bookmark will now center selection
Previously it would just make sure the selection was visible, so if the symbol was already visible, no scrolling/centering would take place.

For most actions we want to minimize scrolling since it makes it easier to keep track of the location in the document, but for the “Go to …” actions, we’re doing an absolute positioning rather than a relative jump, so it makes sense to always center.

For bookmarks, it’s only when choosing a specific bookmark from the Navigation menu that we center selection, not when using the next/previous bookmark actions.
2014-03-25 20:32:46 +07:00
Allan Odgaard
a052c81cfa Improve crash reporting for C++ exceptions from keyDown: 2014-03-25 20:32:46 +07:00
Allan Odgaard
90d1fd432d Non-local drags from TextMate now include NSDragOperationGeneric 2014-03-25 12:19:57 +07:00
Allan Odgaard
af0e6cc643 Change decltype(mapVariable)::value_type → auto (C++14) 2014-03-16 18:06:03 +07:00
Allan Odgaard
de99c053db Do not call unimplemented method on super
This was broken by commit 5edd3479ba.
2014-03-12 15:50:39 +07:00
Allan Odgaard
1183367694 fixup! Do “refresh” for actions which are no-op due to current state 2014-03-10 16:44:28 +07:00
Allan Odgaard
3786e0e823 Do “refresh” for actions which are no-op due to current state
For example when caret is at the beginning of the document, using “move left” would be a no-op and would cause “refresh” to be skipped, which meant if the caret was outside the visible area, no scroll would happen (to make it visible).
2014-03-09 17:13:57 +07:00
Allan Odgaard
337dc1a221 Update sizing code for snippet pop-up menu
We now rely on the table view to obtain the entries and setup the data cell, which should make the code easier to use for other table views with a different data source implementation.
2014-03-06 10:15:09 +07:00
Allan Odgaard
5e1f86a7c2 Setting disableIndentCorrections to ‘1’ was not treated as :true 2014-03-06 10:15:09 +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
be92d71c46 Allow disabling indent corrections when typing on empty lines
This is generally desired when the indent of a new line does not (necessarily) depend on lines above it, but where we otherwise do want indent corrections, e.g. HTML.
2014-03-02 20:06:31 +07:00
Allan Odgaard
a180c24539 Run will/did save and activate/deactivate callbacks in sequence
Previously only the most specialized callback(s) would run. For example creating a command scoped to “source” with “callback.document.will-save” for semantic class would never run for Ruby, Python, etc. because the Source bundle has a “Make Script Executable” callback scoped specifically to “source.ruby”, “source.python”, etc.
2014-03-02 13:15:34 +07:00
Allan Odgaard
e71be609e0 Use new pasteboard history browser
Closes #481
2014-03-02 12:13:06 +07:00
Allan Odgaard
1a4314fce2 Wrap initialize code in dispatch_once
This is only done for code where running it twice would actually cause a problem.

Dispatch_once is favored over a static boolean only because it seems to carry slightly more semantic information.
2014-02-26 19:36:54 +07:00
Allan Odgaard
362c18c3e0 Record current replace string as part of macro find action
Previously we would only record it if the user invoked a replace action from the find dialog, but the user may invoke “find” from the dialog and then subsequently “replace” via keyboard/menu (where we would not record the string).
2014-02-20 22:09:35 +07:00
Allan Odgaard
95b834ac0a Grammars with no root scope are no longer shown in the UI
Only injection grammars should have an empty root scope, and if so, it does not make sense to allow the user to pick it as document grammar.
2014-02-20 13:14:36 +07:00
Allan Odgaard
8c9ebc46ea Ignore caret’s “desired X” in positionForWindowUnderCaret:
For example if at column 60 on a line and moving up/down to a shorter line, we remember that column 60 is our desired column position. This would previously be used when returning a position for the caret, e.g. used with clipboard history pop-ups and bundle item disambiguation menus.
2014-02-19 15:41:48 +07:00
Allan Odgaard
fe1f50f279 Do not store captures (from regexp matches) on replace clipboard
Instead these are stored as an OakTextView property. This makes more sense since we only want to use the captures in the text view that created them.
2014-02-18 13:16:27 +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
b3d12b4364 Set explicit target for status bar menu items
These items were relying on “first responder” which only works when focus is in the document view (since that’s the object that implements the actions).

This would manifest itself by showing the items disabled when focus was in the file browser, and for the grammar pop-up, the selected item (after opening the menu) would not be reverted back to the actual selected grammar in the document view.

Closes #1213
2014-02-13 13:38:35 +07:00
Allan Odgaard
5edd3479ba Implement accessibilityIsAttributeSettable: for all attributes
Previously if using the Accessibility Inspector exceptions could be thrown.
2013-12-26 15:19:28 +07:00
Ronald Wampler
1f61b628b3 Use new safeObjectAtIndex method
Also removed the static SafeObjectAtIndex mehtod in OakTabBarView
2013-12-22 23:30:29 -05:00
Allan Odgaard
5faba29bb5 Fix value for AXSelectedText
We were grabbing a const reference to a reference into a temporary object (result of editor_t::ranges), so the range used was effectively a pointer to a destroyed object.
2013-12-21 11:13:15 +07:00