Commit Graph

34 Commits

Author SHA1 Message Date
Allan Odgaard
48605ef4e9 The bundle selection menu now uses same appearance as the calling view
Only when there are no open windows, and the user is triggering the bundle item selection menu, will it default to the light aqua appearance.
2018-10-31 10:32:46 +07:00
Allan Odgaard
7cc017f343 Harmonize all implementations of sharedInstance 2016-09-19 12:54:19 +02:00
Allan Odgaard
a40efd3971 Support OakBundleManagerDisambiguateMenuFontSize
This was supported by TextMate 1.x and are also used by the menus brought up by the dialog plug-ins.
2014-10-02 11:03:40 +02:00
Allan Odgaard
9369777aee Hardcode small system font size as 11
This is because the small system font size is actually the tool tip font size which the user may increase (via the NSToolTipsFontSize defaults).
2014-09-30 17:05:53 +02:00
Allan Odgaard
72276ff644 Skip menu item separators with items from multiple bundles
The only example of this that I am aware of is ⌘Y when there is no version control system used for the current project: Here we get a menu with init/checkout/help items from some of the SCM bundles and it looked bad when TextMate would use separators for these items.
2014-09-08 20:37:20 +02: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
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
d311405af0 Harmonize code
We effectively do the same thing 5 different places, so good if the code is identical (incase it needs to be revised).
2013-08-09 22:20:23 +02:00
Allan Odgaard
4c24bd9c00 Avoid ref to static data when returning non-POD from Objective-C
Apparently clang (now?) support transferring non-POD types from and to Objective-C++ methods, eliminating the need for doing this by passing a (const) reference.
2013-05-09 15:16:33 +07:00
Allan Odgaard
3a75199e9d Use menu validation to update bundle menu item titles
This means we don’t need to know if there is a selection when creating the menu items and long-term it’ll be easier to introduce more complex updating, e.g. make the title a format string to allow referencing TM_DISPLAYNAME or disable the menu item if its requirements cannot be met.
2013-03-16 17:49:48 +01:00
Allan Odgaard
5caca35fc7 Use menu validation in OakShowMenuForBundleItems 2013-03-16 17:49:48 +01:00
Allan Odgaard
6ac4aab910 Use custom menu item title for key equivalents
The rendering doesn’t mimic the system 100%, for example the key equivalents are not centered on the split between modifiers and the key, nor are F-keys rendered using a smaller font / menu glyph.

On the plus side though, now all keys are rendered. Previously keys shared with other (non bundle) menu items would only be shown for one of the items sharing the key, and some keys would simply not be shown (e.g. ⌃#).

Also, bundle menu items no longer “eclipse” regular menu items, which could previously happen even when the bundle menu item wouldn’t fire (as it was scoped for something else than the current context).

Fixes #894.
2013-03-14 10:14:46 +01:00
Allan Odgaard
402e1f79b1 Use one bundle menu delegate for all menus
This avoids the problem of keeping the delegate retained while the menu is up (the menu item exists).
2013-02-12 20:11:50 +01:00
Allan Odgaard
71be61cbbb Enable ARC by default
We now explicitly disable it for targets that hasn’t yet been upgraded to ARC. This way, it’s easier to get an overview of which targets hasn’t yet been upgraded and ensures new targets has ARC enabled.
2012-12-19 19:42:36 +01:00
Allan Odgaard
596bd65140 ARC: Update BundleMenu framework 2012-09-24 20:58:42 +02:00
Allan Odgaard
b49e35ab6a Harmonize “perform bundle item” method naming
We now have:

 - performBundleItem:
 - performBundleItemWithUUIDString:
 - performBundleItemWithUUIDStringFrom:

I’m leaning toward changing the prefix, as ‘perform’ is mainly action methods invoked as a direct response to some user action (with that action part of the name), but haven’t found a better prefix yet.
2012-09-10 22:47:58 +02:00
Allan Odgaard
96ba797043 Show proxy item in menu when nothing matched
This way we can have “Lookup Word” in the Source menu being a proxy for “lookup.documentation” and simply rendered as disabled when the current language have no such functionality.
2012-09-07 16:18:03 +02:00
Allan Odgaard
2678358ff9 Encapsulate proxy expansion code
How a proxy items are expanded is not something user code should concern itself with.
2012-09-07 16:18:03 +02:00
Allan Odgaard
bfc3804520 Show matched items for proxies in menu
This means e.g. Bundles → SCM will show the SCM actions available in the current context.
2012-09-06 23:18:42 +02:00
Allan Odgaard
8cf6f94f13 Refactor OakShowMenuForBundleItems 2012-09-06 23:10:56 +02:00
Allan Odgaard
8f5ddc672f Move bundles pop-up menu to BundleMenu library 2012-09-06 23:10:56 +02:00
Allan Odgaard
cf5e9f1530 Leave autoenablesItems at its default value 2012-09-06 23:10:56 +02:00
Allan Odgaard
73d586c2ba Use helper for bundle item’s key equivalent
This is to allow a bundle item to display another key than the one assigned to the item, e.g. when the bundle item is matched by a proxy item it should show that item’s key equivalent.
2012-09-06 23:10:56 +02:00
Allan Odgaard
81de007bd4 Use new API for better bundle item display names 2012-09-04 20:34:54 +02:00
Allan Odgaard
17720e4d57 Don’t dispose bundle menus after close
Since we overload performKeyEquivalent: for the main menu to not search the bundle menus, there should no longer be a need to try and prevent the system from interpreting key equivalents for bundle menu items.
2012-09-04 19:22:52 +02:00
Jacob Bandes-Storch
dfdde3283f Use 64-bit: explicit visibility where required 2012-08-28 21:32:47 +02:00
Allan Odgaard
d255324966 fixup! Remove old tab trigger render code 2012-08-15 02:41:15 +02:00
Allan Odgaard
15afc1398b Revert "Draw tab triggers and key equivalents in menu"
Reverts 25071ce6e5
Reverts 757219b8f1
2012-08-14 20:55:53 +02:00
jtbandes
5aaebb9e25 Remove bundles.h dependency, re-add menu action 2012-08-13 22:06:32 -07:00
jtbandes
757219b8f1 fixup! Draw tab triggers and key equivalents in menu
Fix memory leak
2012-08-13 21:46:12 -07:00
jtbandes
25071ce6e5 Draw tab triggers and key equivalents in menu
The old techniques used to set key equivalents no longer work. Unfortunately, this technique is only a workaround and is not pixel-for-pixel identical due to the way NSMenuItem lays itself out when rendering a key equivalent; but I think it's the best that can be done for now.
2012-08-13 19:46:55 +02:00
Allan Odgaard
6c35a3314a Fix leaking bundle menu delegates 2012-08-13 00:39:10 +02:00
Elia Schito
b0018c2099 Extract Bundle menu to a framework 2012-08-12 23:56:19 +02:00