Commit Graph

4691 Commits

Author SHA1 Message Date
Allan Odgaard
f920ff058a Tidy up main menu
This means remove unnecessary targets, unused tag values, empty submenus, and trailing separator items.
2018-04-30 15:30:48 +07:00
Allan Odgaard
8bda806ef9 Create dock menu in our application delegate 2018-04-30 15:30:48 +07:00
Allan Odgaard
87ad8f6559 Create main menu in our application delegate
The advantages are:

- More compatible with version control
- Easier to copy/paste menus and menu items between other projects
- Easier to setup menu delegates or obtain pointers to menu items
- We can use symbolic names when setting a menu item’s tag
- More transparent: We can read the declaration in a few minutes, use search, etc.

There are two disadvantage that I can think of:

1. We currently need to use private API to create the Open Recent submenu. Should this become a problem in a future macOS update, we can always create a single Open Recent menu in MainMenu.nib and use that when building our menu.

2. If you make a typo in the menu declaration then the compiler error will often just point to the first line of the declaration rather than the line with the incorrectly declared item. One can comment out sections to narrow it down, if many edits have been made since last compile.
2018-04-30 15:30:48 +07:00
Allan Odgaard
b8b46d1ae3 Add header for OakMainMenu (menu subclass) 2018-04-30 15:30:48 +07:00
Allan Odgaard
8ddfa9efe1 Identify Select Tab submenu by its menu title instead of pointer
This is an intermediary step to get rid of the outlets.
2018-04-30 15:30:48 +07:00
Allan Odgaard
bafe0e572b Rename ApplicationController → AppDelegate 2018-04-30 15:30:48 +07:00
Allan Odgaard
fa0e055755 Update main menu template to what’s included with Xcode 9.2 2018-04-30 15:30:48 +07:00
Allan Odgaard
82ac2daa85 Let our application delegate create the main menu 2018-04-30 15:30:48 +07:00
Allan Odgaard
6a0e3d8206 Add a menu builder framework
This allows a simple way to build menus in code which can then be used with pop-up buttons or even the main menu of an application.

For creating the main menu, this should be done in an applicationWillFinish: delegate method. If done later, the Open Recent menu will not work.

There is a MBDumpMenu function which will take a menu as argument and output the MBMenu structure required to build the menu in code.

Can be used like this:

    NSLog(@"\n%@", MBDumpMenu(NSApp.mainMenu));

Some caveats:

1. If you have alternate items *without key equivalents* then you need to ensure that `.modifierFlags` is set to include the modifier flags of the previous item plus an additional modifier key (the one to press to reveal this item).

2. The code does not know about outlets so check your MainMenu.nib in Xcode to see if you connect any outlets to menu items or submenus. If so, you can do `.ref = &menuItemOutlet` or `.submenuRef = &menuOutlet`. The former will store a pointer to the menu item in `menuItemOutlet` where the latter will store a pointer to the menu item’s submenu (and ensure a submenu gets created for this item, even if there are no submenu items defined).

3. The code will insert `«unknown»` for any unknown target or delegate, you will need to manually update this (but if you forget, it’ll result in a compiler error).
2018-04-30 15:30:48 +07:00
Allan Odgaard
677459aa22 Change behavior of shift page up/down sent to inactive table views
We now extend the selection to include the rows that we previously “jumped” over.
2018-04-25 22:28:33 +07:00
Allan Odgaard
8a0a50dad6 Consult table view’s delegate about which rows we can select 2018-04-25 22:07:50 +07:00
Allan Odgaard
7a61949c33 Auto-hide scrollbars
We already auto-hide them for majority of our scrollviews, but since they are hidden by default when using a trackpad, a few “new” scrollviews didn’t get this setting, and I hadn’t noticed.
2018-04-25 21:47:38 +07:00
Ronald Wampler
1b33f6e36d Always uppercase the encoding charset
Apple writes the encoding charset (e.g., com.apple.TextEncoding) in
all lowercase (at least since macOS 10.9); however, TextMate assumes that the
encoding will always be uppercase. So in order to avoid any issues with case
mismatches, when setting the charset, uppercase the given string.

See http://lists.macromates.com/textmate/2018-April/040602.html
2018-04-25 21:43:51 +07:00
Allan Odgaard
81b888d61e Checkin release notes for 2.0-rc.9 2018-04-25 21:43:51 +07:00
Allan Odgaard
c1bb559a38 Revert "Add ‘public.data’ to list of supported file types for QuickLook plug-in"
This causes TextMate’s QL generator to take over thumbnail generation of all binary files (without a dedicated QuickLook plug-in), for example disk image files.

There does not seem to be any way to dynamically opt out of thumbnail generation, it’s all or nothing, therefor we would either need to completely remove support for thumbnail generation or not support QuickLook previews for files without extension.

For now it’s the latter.

This reverts commit fd827fb817.
2018-04-25 21:43:51 +07:00
Allan Odgaard
494290cc19 Checkin release notes for 2.0-rc.8 2018-04-25 21:43:51 +07:00
Allan Odgaard
a843a02aa1 Revert "Specify ‘ns’ as a (link) dependency"
This reverts commit 75e8723e64.
2018-04-25 21:43:51 +07:00
Allan Odgaard
a232a1848b Update copyright to 2004-2018
We are back to showing a range motivated by a comment from @nanoant: 76cc25b2a6 (commitcomment-21502195)
2018-03-08 16:05:52 +07:00
Allan Odgaard
b828d5bfa9 Only use dirname_r and basename_r if on macOS 10.12
Not only do we test for the presence of these functions at runtime, but we do not use them at all, when building with the 10.11 SDK (or earlier).

This is because if we had to support building with an earlier SDK it is not enough to declare the prototypes, we also need to add the symbols as weak to the linker options.

Not using the functions does not remove crucial functionality.
2018-03-08 16:05:52 +07:00
Allan Odgaard
c9cc0c266d Disable exact rank calculation for large strings
The algorithm to calculate exact rank requires n × m storage which is stack allocated, so for large strings, we could blow the stack.

Rather than switch to dynamic allocation, we’re just foregoing the exact rank, since for large strings, it’s unlikely to be useful to try to calculate such a thing.
2018-03-08 16:05:52 +07:00
Jacob Carlborg
e3ded6e2f9 Add imported and exported type declarations for D
This will make the system properly recognize D source files.
2018-03-08 16:05:31 +07:00
Pravdomil
fd827fb817 Add ‘public.data’ to list of supported file types for QuickLook plug-in
This enables QuickLook preview for text files without extension such as README, LICENSE, etc.
2018-02-06 22:59:27 +07:00
Ryan Schmidt
bade4054dc Mark strong properties as strong
Versions of the OS X 10.11 SDK prior to 10.11.4 require this to
be done explicitly. This fixes the build on OS X 10.10 when
using the OS X 10.11 SDK from Xcode 7.2.1 and earlier.
2018-02-06 17:23:26 +07:00
Michael Sheets
0c8817e57a Fix generation of contribution page
Modern multimarkdown tends to convert the <% and %> tags into HTML when they
occur before or after an empty line. This would then break parsing with erb.
Remove all empty lines in the vicinity of these tags to prevent this problem.

Sent in by @neverpanic through @ryandesign
2018-02-06 17:20:17 +07:00
Paul Collins
108b99149c Handle rate-limiting when using GitHub’s API to obtain author emails 2018-02-06 17:14:40 +07:00
Paul Collins
d00a5cd4a0 Create credits database file’s enclosing directory as necessary 2018-02-06 17:11:31 +07:00
Ronald Wampler
9f2eb76223 Explicitly close OakChoiceMenu
On 10.13, just setting our instance of OakChoiceMenu to `nil` no longer seem to close our window.
2018-02-06 17:08:03 +07:00
Allan Odgaard
75e8723e64 Specify ‘ns’ as a (link) dependency
See http://lists.macromates.com/textmate/2017-November/040458.html
2017-11-16 10:06:39 +07:00
Allan Odgaard
4080334609 Fix bug in CommonAncestor function
When all paths had the same prefix as first item, the first item would be returned as the common ancestor even if the other paths were not children.

For example:

    /path/to/some_folder
    /path/to/some_folder_with_same_prefix

Here `/path/to/some_folder` was returned even though `/path/to` is the common ancestor.

The function is still not correct when all paths are actual descendants of first path, but since it’s only used for display purposes, and with “find in folder” (where paths shouldn’t overlap), I am not bothering with that issue.
2017-10-09 10:31:44 +02:00
Allan Odgaard
4268b57605 Use OakNotEmptyString convenience function 2017-10-09 10:28:30 +02:00
Allan Odgaard
06bd8b2be0 Add a ‘didUpdateFrom’ argument when relaunching during software update 2017-10-08 20:17:43 +02:00
Allan Odgaard
a8b7906a4b Do not hardcode bundle identifier in Caches path 2017-10-08 20:12:14 +02:00
Allan Odgaard
6893bceae6 Accept application/json for version update information 2017-10-08 19:54:32 +02:00
Allan Odgaard
75d4c29f11 Change etag network filter to a general header (capture) filter 2017-10-08 09:19:49 +02:00
Allan Odgaard
81d1f84a2c Change sw_update.cc → sw_update.mm 2017-10-08 09:13:03 +02:00
Allan Odgaard
eead4102dc Do not require that _app_path is setup when calling relaunch 2017-10-08 09:00:32 +02:00
Allan Odgaard
c6e07fadf3 Accept additional application arguments for relaunch API
This allows us to indicate to the new instance why it was launched.
2017-10-08 08:53:12 +02:00
Allan Odgaard
503d493f47 Move OakTabBarView into its own framework
The motivation is to get an OakAppKit that does not include hundres of image resources.
2017-10-07 13:58:35 +02:00
Jason Gavris
0a597f1505 Enable ThinLTO 2017-10-05 08:16:42 +02:00
Ronald Wampler
71aa9764af Add capnp include path for C++/Objective-C++ files
This is needed after commit 2748e12699.
2017-10-03 19:11:20 -04:00
Jake Kirshner
9f1cec343e Add basic touch-bar support 2017-10-03 21:56:54 +02:00
Allan Odgaard
f7f6444885 Only load charset (encoding) frequency database once
Previously this database was loaded each time a file of unknown encoding was read, which could add a significant overhead when using “find in folder” with a large database and many files with unknown encoding.
2017-10-03 09:43:43 +02:00
Allan Odgaard
7d38095532 Let EncodingWindowController accept NSData instead of char pointers 2017-10-03 09:43:43 +02:00
Allan Odgaard
2748e12699 Change encoding classifier language from C++ to Objective-C++ 2017-10-03 09:43:43 +02:00
Allan Odgaard
c57a70db83 Do not use NSOutlineView’s clickedRow for key events 2017-10-03 08:19:41 +02:00
Allan Odgaard
5fc61d0a34 Don’t use menuForEvent: when showing NSOutlineView’s menu using ⌥F2
The reason is that menuForEvent: will draw an outline around the items under the mouse, which can be incorrect when we use the keyboard.

While we can address it by creating a fake mouse event that points to the selection, this will fail when there is no selection, so I felt it was better to always forego it.
2017-10-03 08:18:05 +02:00
Allan Odgaard
5782569a1f Workaround for modified icons in the file chooser being pixelated
Comment also added to the source (since this workaround is not optimal, and I would like to find the correct solution):

If we use `self.size` for the off-screen image buffer then we get a scaled up 16×16 image in the file chooser (⌘T).

My theory is that when drawing the image, the image size is 16×16 but the graphics context uses a transformation so that each point is multiple pixels, which our off-screen image does not replicate.

I do not know how to get the actual “pixel size” of the destination, so using the largest image is a workaround and knowing the actual size could give a better result.
2017-10-02 20:53:05 +02:00
Allan Odgaard
ed6be1b35e Remove var-args constructor from string list transformer
Instead add constructor that takes a dictionary so that it can be used with values that are not consecutive and starting from zero.
2017-10-02 20:53:05 +02:00
Allan Odgaard
e804a57e04 Change name of property setter: isChecking → checking 2017-10-02 20:53:05 +02:00
Allan Odgaard
8d56ad455a Use NSBundle API instead of oak::application_t 2017-10-02 20:53:05 +02:00