Commit Graph

356 Commits

Author SHA1 Message Date
Allan Odgaard
7ebd14876c Introduce OakBackgroundFillView which replaces NSBox for dividers
This view has an active/inactive color or image. The latter is drawn as a pattern color (tiled image).
2014-09-25 19:33:17 +02:00
Allan Odgaard
bff8094976 Decrease minimum required width of document status bar 2014-09-19 11:40:29 +02:00
Allan Odgaard
8a87ee16e2 Only allow a single history window per clipboard type 2014-09-15 17:41:54 +02:00
Allan Odgaard
6bdad1733e Move handling of invisible character mapping to ng::context_t 2014-09-03 16:06:44 +02:00
Allan Odgaard
f0e5efd5ae Remove unnecessary typecasts 2014-09-03 15:21:56 +02:00
Allan Odgaard
6aaaaf7f26 NSImage: Use lockFocusFlipped: instead of deprecated setFlipped: 2014-09-01 17:37:10 +02:00
Boris Dušek
afb504b58d Do not use macros for accessibility constants
This improves the chance that someone googling for a certain accessibility
attribute or other accessibility constant in order to find inspiration how to
implement it will find our code in OakTextView. It also makes the code more
understandable for reading by someone else, and generally follows the way
others write accessibility code (including Apple in their code samples). It
does make the code more verbose, but I think that does not outweight the above
advantages.

Inspired by: googling and "githubbing" for NSAccessibilityLinkTextAttribute:
http://lists.apple.com/archives/accessibility-dev/2014/Aug/msg00016.html
2014-08-23 17:45:20 +02:00
Allan Odgaard
2f1c4c05c4 Do not use ‘timeIntervalSinceNow’ with dates in the past
We previously negated the result but now we instead ask for [[NSDate date] timeIntervalSinceDate:startDate].
2014-08-21 16:07:23 +02:00
Ronald Wampler
22cec6bb6b Do not use convertBaseToScreen: and convertScreenToBase:
These methods were deprecated in 10.7. Use `convertRectToScreen:` and `convertRectFromScreen:` instead. This is required for proper high resolution support.
2014-08-13 11:24:40 +02:00
Ronald Wampler
57f662c551 Do not use convertPointToBase: and convertPointFromBase:
These methods were deprecated in 10.7 and log warnings in the console when called. The documentation says to use `convertPointToBacking:` and `convertPointFromBacking:`, respectively, instead; however, these methods should not really be used in this case. We just want to store the top left position (point) of the OakChoiceMenu's frame in the OakDocumentView's coordinate systems so we can update its frame to the new position when OakDocumentView's bounds change. We do not need exact pixel alignment. The original choice to use the above deprecated methods was probably based on the use of `convertBaseToScreen:` and `convertScreenToBase:`, but these were also deprecated in 10.7. They can be replaced with the equivalent `convertRectToScreen:` and `convertRectFromScreen:`, respectively.

So instead, for this case, `convertRect:toView:` and `convertRect:fromView:` suffices and actually yields better tracking. (We could have used the corresponding "point" methods, as well, but we needed to convert the point to a NSRect to use `convertScreenFromRect:`, etc.)

With the original code, when the view bounds change, the position of the OakChoiceMenu would extend well below/above the placement of the caret.
2014-08-13 11:20:10 +02:00
Allan Odgaard
9dc869488b Use NSZeroSize instead of NSMakeSize(0, 0) 2014-08-13 11:19:49 +02:00
Allan Odgaard
bc65a57957 Use OakIsEmptyString where appropriate 2014-08-08 19:42:30 +02:00
Allan Odgaard
271608a7b0 Use NSTextInputContext instead of NSInputManager
The latter has been deprecated since 10.6 but hasn’t given any deprecation warnings (and it’s not like I’m eager to touch the NSTextInput protocol implementation, as I just barely understand how this stuff is supposed to work).
2014-08-07 12:03:21 +02:00
Allan Odgaard
2d09d503ee When clearing marked range, ensure pending range is also cleared
This fixes an issue with complex input managers.

Using Chinese pinyin input and entering ‘ci’ followed by ‘1’ to insert first glyph would insert the glyph (‘刺’) and then set the pending marked range (0-2), which would have caret end up in the middle of a multi-byte sequence.
2014-07-24 22:37:38 +02:00
Boris Dušek
7e01bab12a Optimize Zoom support a little bit
This makes Zoom support avoid doing all 2 conversions between UTF-8 to UTF-16,
and replaces call to rect_for_range with call to rect_at_index, which is
more efficient.

Note that this is a typical micro-optimization not resulting from any
actual performance measurement, but just from a desire to have a lean
code not doing redundant work.
2014-07-19 14:14:21 +02:00
Boris Dušek
17c5df94ca Fix textmate/bugs#5
When setSelectionString is called during editing of text (like inserting
or deleting a character), it catches layout in a semi-consistent state
where horizontal position of individual characters cannot be determined.
Therefore during such events, we cannot pass the correct screen position
to the call to UAZoomChangeFocus.

So let's do the UAZoomChangeFocus call after this iteration of run loop.
This ensures everything in layout that had to update has updated when
calling UAZoomChangeFocus, thus enabling us to provide correct horizontal
screen position.
2014-07-19 14:14:21 +02:00
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