68 Commits

Author SHA1 Message Date
Allan Odgaard
f5832c975f Add missing include statements 2016-06-22 18:31:49 +02:00
Allan Odgaard
5d4a14e14b Bundle Editor: Set bundle item’s name as document’s custom name
This affects the name used for backup files and TM_DISPLAYNAME which could be used by some commands invoked from the bundle editor.
2016-06-17 17:42:57 +02:00
Allan Odgaard
e83fee564c Refactor: use emplace_back(…) instead of push_back(make_pair(…)) 2016-05-28 22:12:46 +02:00
Allan Odgaard
417193e089 Update link dependencies for all targets
Some targets were including headers from frameworks not specified in their link dependencies. For a clean build this could cause an issue because the header was not available at the time of building the target.

The updated link dependencies are also based on what a target’s tests require. Ideally tests would have separate link dependencies, but as we don’t want to maintain this manually, this will have to wait until the build system automatically handles link dependencies.

Currently the commit command uses constants from the CommitWindow framework but should actually not be linked with it. However, the optimizer will strip dead code, so it should not result in much if any difference in the resulting binary and does solve a build dependency issue.
2016-05-07 13:00:55 +02:00
Allan Odgaard
b55ef5b09a Save all xibs with Xcode 7.1 (7B91b)
This was done in an attempt to prevent the warning saying “This file is set to build for a version older than the project deployment target.”

Unfortunately saving all the xibs did not get rid of the warning, even though tehy are all set to have 10.7 as their build target.

The latest xib format does however remove about 10.000 lines of XML.
2015-10-26 23:26:17 +07:00
Allan Odgaard
60050cf026 Add Export Bundle… to bundle editor’s context menu 2015-08-08 11:35:23 +02:00
Allan Odgaard
40879d5683 Replace sizeofA macro with range-based for loop or std::begin/end 2015-03-05 16:38:09 +07:00
Allan Odgaard
b51f7f44af Rename bundles::item_t::full_name → name_with_bundle
Although not perfectly clear, it does better match what is actually returned from this member function.
2015-03-05 15:34:16 +07:00
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
5b39bdc98b Remove double semi-colons at end of line 2014-11-14 10:21:34 +01:00
Allan Odgaard
ffeb661d02 Remove method signature which is part of our SDK
Presumably this did not exist in the 10.6 SDK.
2014-11-14 10:19:35 +01:00
Allan Odgaard
ee1754f906 Don’t treat “Menu Actions” item in bundle editor as bundle proxy
Previously we would use the bundle’s icon for this item and enable the Show in Finder context menu. We now show a special menu icon for this item, this was mainly done so that we have a menu image to use in the Bundle Item Chooser.
2014-11-04 14:24:39 +01:00
Allan Odgaard
165000d00c Add “Show in Finder” context menu actions to bundle editor
When a default/pristine item has local changes, the Show in Finder menu item shows a submenu with all the paths.
2014-10-29 21:39:52 +01:00
Allan Odgaard
c0c193ce7f Update some ruby shebangs 2014-08-03 09:04:57 +02:00
Allan Odgaard
fef0ed8fc5 Use ruby18 shebang in bundle command template 2014-07-31 15:36:19 +02:00
Allan Odgaard
291dae476a Fix format string expansion for new bundles/bundle items
Iteration was unintentionally changed (in c2397484b8) to iterate over const references, which would prevent the referenced types to be updated.

The reason the compiler did not complain about it is due to the catch-all template function, indirectly changing visitation from non-const to const, and providing no-op visitation functions for the const types.

For this reason, I have replaced the template (member) function with functions for all types.
2014-03-23 22:47:16 +07:00
Allan Odgaard
b57463bd0c Add attr.bundle-editor.* scope to bundle editor
This allows us to limit or override things just for the bundle editor.
2014-03-13 17:25:29 +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
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
f56e6ae36a Fix potential out of range access 2013-08-30 12:30:33 +02:00
Allan Odgaard
896416c3e9 Check pointer is initialized before using it
I see a few crash reports that indicate this code is called without a valid ‘bundleItemContent’, though unsure how to reproduce.
2013-08-25 21:13:06 +02:00
Allan Odgaard
28594e0c18 Don’t pass NULL_STR to path::entries 2013-08-14 10:41:30 +02:00
Allan Odgaard
df42c5e638 When rescanning a non-existing bundle item path, rescan parent
For example when creating a new bundle (‘foo.tmBundle’) and then saving a new snippet in this bundle (‘bar.tmSnippet’) we may ask to rescan the ‘Snippets’ folder (in the bundle) before the bundle itself does a content (re)scan, which effectively makes the ‘Snippets’ rescan a no-op.

Should fix #1034
2013-08-14 10:41:30 +02:00
Allan Odgaard
8b32837a39 Force cache invalidation when deleting bundle items
This is to workaround missing fs-events. Ideally the bundle item itself would do the cache invalidation, since it’s complicated to deduce what paths need rescanning after a delete.
2013-07-21 22:54:12 +02:00
Allan Odgaard
60d07b061e Use ruby 1.8 in the shebang for new commands
Using the ruby found via PATH would require the command to be tested with ruby 1.8, 1.9, 2.0 and possibly alternative ruby implementations (rubinus, jruby, …) so best to be explicit about which version the command is written for.
2013-07-21 13:25:27 +02:00
Allan Odgaard
8b696444c6 Invalidate bundle item (disk) cache when saving in bundle editor
Normally the cache is automatically invalidated via fs-events, but that is sadly unreliable.

Should fix #1034.
2013-06-29 12:42:34 +02:00
Allan Odgaard
a2e7de29e7 Add missing include 2013-05-16 21:29:59 +07:00
Allan Odgaard
6e4926177e Provide symmetric content/set_content for document_t 2013-05-15 15:45:36 +07:00
Allan Odgaard
ce4ae62547 Change ‘variables_for_path’ API
We now accept the a directory in addition to the path. If a directory is provided, the path is only used to filter variables rooted at the directory.
2013-05-12 11:09:18 +07:00
Allan Odgaard
e49504a644 Remove unused member data 2013-05-06 14:51:32 +07:00
Allan Odgaard
26d3029ba0 Treat bundle items without path as modified
This allows us to create an in-memory bundle item, reveal in bundle editor, and have the bundle editor warn if the user doesn’t save.
2013-03-27 14:32:26 +01:00
Allan Odgaard
0f9b15b916 Show error when property list fails to parse 2013-03-17 15:44:07 +01:00
Allan Odgaard
5dcbbde817 Let user know if saving in bundle editor fails 2013-03-17 15:44:07 +01:00
Allan Odgaard
c459e0483f Remove compatibility check (10.5) 2013-03-04 13:33:38 +01:00
Allan Odgaard
2c6504b82f Use symbolic constants for binding properties 2013-03-03 15:53:05 +01:00
Allan Odgaard
06b60dc04e Show colorSpaceName entry in bundle editor
Also add this to the template for new themes (set to sRGB) and a default semantic class.
2013-02-18 15:38:27 +01:00
Allan Odgaard
785182c1b2 Enable bottom border for bundle editor window 2013-02-14 11:31:20 +01:00
Allan Odgaard
e047d458fd Fix crash in bundle editor
I have added a check to ensure we have the bundle item content (in addition to the bundle item) which fixes #774 although it is unclear to me how the bundle editor would end up in a state where it has a bundle item but no content for that item. There is a window in the setBundleItem: method where the bundle item content hasn’t yet been setup, but commitEditing is not called during that window.
2013-02-11 14:21:20 +01:00
Allan Odgaard
32fcb52c68 Workaround for clang linker warning
Using instances with static storage in Objective-C files result in the following warning (starting with clang 425.0.24):

ld: warning: direct access in […] to global weak symbol […] means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
2013-02-02 08:52:12 +01:00
Allan Odgaard
04b092afb1 Move static data out of headers
This is to satisfy clang (421.0.57).
2013-01-29 15:28:23 +01:00
Allan Odgaard
0b9e591b7d Bundle editor was holding an untitled counter
This meant after opening the bundle editor the next untitled document created would have a number prefix one higher than expected.
2013-01-11 23:23:41 +01:00
Allan Odgaard
47fa0f040c Use Objective-C literals for YES/NO 2013-01-02 01:46:48 +01:00
Allan Odgaard
9e332438e7 Use block-based alert API 2013-01-02 01:46:47 +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
Michael Sheets
8bdbeacfcd Add indentOnPaste to ordering in bundle editor 2012-12-14 18:03:37 +01:00
Adam Strzelecki
e5ac757fb6 Make command properties drawer shorter.
Re-layout input & output fields, so they don't enlarge whole drawer too much.
2012-11-12 13:28:34 +07:00
Allan Odgaard
91903319be ARC: Update BundleEditor framework 2012-11-12 13:28:34 +07:00
Allan Odgaard
0f3861fec7 Retire custom begin/endof functions
We can now use std::begin/end although for containers we explicitly call the member functions.
2012-09-20 12:22:21 +02:00