Commit Graph

53 Commits

Author SHA1 Message Date
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
Allan Odgaard
8fd7b82cbd Remove CocoaSTL.h include 2012-09-20 12:22:20 +02:00
Allan Odgaard
4532099359 Use Objective-C for…in instead of macro
This avoids having to use C++ iterators and we want to get rid of some of this Objective-C/C++ mixing for ARC and other reasons.
2012-09-20 12:22:19 +02:00
Ryan Maxwell
c24f365daa Use curly quotes in dialog text 2012-09-18 20:28:07 +02:00
Allan Odgaard
1fafbecd54 Remove Chinese translation
It’s not feasible to maintain the old-style xib translations while we work on the UI. We’ll soon move fully to constraint-based layout which should allow translations to be purely string-based.
2012-09-16 11:41:23 +02:00
Allan Odgaard
392c195077 fixup! Retina assets for the "Bundle Editor" window
The non-retina bundle icon lost its alpha mask.
2012-09-09 11:32:40 +02:00
Allan Odgaard
6477c32fda Expose gutterSettings when editing themes
Also fix the grammar used for theme and macro editing (meta.plist → source.plist).
2012-09-08 00:42:26 +02:00
Allan Odgaard
aa2b194341 Better ordering of keys when editing bundle items
This closes issue #338.
2012-09-03 21:52:44 +02:00
Jacob Bandes-Storch
dfdde3283f Use 64-bit: explicit visibility where required 2012-08-28 21:32:47 +02:00
Jacob Bandes-Storch
e3aa997b06 Use libc++: replace std::tr1 with std 2012-08-28 13:30:20 +02:00
Gerd Knops
e13f1ec13f Remember Bundle Editor column widths 2012-08-22 21:15:18 +02:00
Gerd Knops
d19e2fa49e BundleEditor: follow truncated names with ellipsis 2012-08-22 21:15:17 +02:00
Paul Wilde
edcaffed91 Retina assets for the "Bundle Editor" window 2012-08-19 21:13:25 +02:00
Gerd Knops
7aa70dd581 Bundle Editor: allow selection of disabled items
Previously disabled items could not be selected, and hence not be re-enabled.
2012-08-18 21:28:55 +02:00
Elia Schito
11e08b7ee8 Let the user resize bundle editor columns 2012-08-18 16:37:22 +02:00
Bo Xiao
96cb899b53 Initial commit of Simplified Chinese localization for xib files. 2012-08-14 21:29:51 +02:00