47 Commits

Author SHA1 Message Date
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
f06f447ede Avoid referencing private types by using std::remove_pointer 2015-08-27 22:46:53 +02:00
Joachim Mårtensson
70893f4583 Use dense_hash_map for style cache 2015-05-09 21:24:38 +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
1d3ccb157a Use a std::string instead of scope_t as cache key
Since we do a lot of lookups the faster operator< of std::string improves performance slightly.
2014-09-16 14:13:06 +02:00
Allan Odgaard
539dee1486 Gutter view colors would be leaked when reloading themes 2014-05-17 13:21:53 +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
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
7d91fd8322 Allow fractional font sizes.
Closes #1125
2013-12-14 12:10:05 +07:00
Allan Odgaard
ff14e818bc Add gutter_styles_t::is_transparent 2013-11-03 20:37:48 +01:00
Allan Odgaard
1d0428383f Parse theme colors using 8-bit notation (#RGB)
This is to improve interoperability, as some themes (not produced by TextMate 1.x’s theme editor) use this shorter notation.
2013-10-31 17:27:15 +01:00
Allan Odgaard
798961da6b Handle themes with invalid foreground/background color
Fixes #1179
2013-10-31 17:27:14 +01: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
efe617b4bc Update testing system for theme framework 2013-07-26 13:53:58 +02:00
Allan Odgaard
4bae908d49 Move CGColorRef helper functions
These only have one user, so let’s make them private helper functions instead.
2013-02-20 12:54:26 +01:00
Allan Odgaard
d70ccc7cdf Allow theme colors to use the sRGB color profile
This is enabled by adding the following to your theme:

    colorSpaceName = sRGB;

The default color space used for themes is “Apple Generic RGB” which is a bad choice for interoperability with other software (e.g. exporting a theme to CSS, creating theme colors in Photoshop, and similar).

Related to issue #768.
2013-02-18 15:38:27 +01:00
Allan Odgaard
08534e737f Change gutter colors to CGColorRef 2013-02-18 15:38:27 +01:00
Allan Odgaard
deeff330ee Change cf::color_t → CGColorRef
This change is required to introduce support for different color profiles.
2013-02-18 15:38:27 +01:00
Allan Odgaard
b139ac5097 Change push_back → emplace_back (C++11)
This is mainly motivated by readability, so I only did a few select replacements.
2013-02-08 11:20:35 +01:00
Joachim Mårtensson
8de62bbc85 Don't mutate shared themes 2013-02-04 20:44:21 +01:00
Allan Odgaard
951fd53b30 Construct default theme from a dummy bundle item 2013-01-29 21:41:17 +01:00
Allan Odgaard
c8ab123aaf Move font name/size to theme_t
Since styles_for_scope effectively ignore the font parameters (and instead return styles based on the font parameters used when the cache entry was created) it is a better design to have theme_t own the font. This way, changing it can do the proper cache invalidation.

A minor downside is that we can now change the font of the theme without also changing the layout’s font, which wouldn’t cause proper layout invalidation — since layout_t owns theme_t though, users of a layout should always change font via layout_t (which will then change it in the theme).

Also, themes cannot be shared between views that wish to use different font settings.
2013-01-23 09:33:29 +01:00
Allan Odgaard
30c60ddc34 Accept scope_t instead of context_t
Since styles are applied to the actual content, we only have a single scope, not a left/right scope.
2013-01-23 08:19:39 +01:00
Joachim Mårtensson
2b51ca93bd Don’t use font name / size as key values in style cache
Font name and font size was being used in the cache key as a way to avoid having to do cache invalidation. This comes at a price of a 3X slow down. Instead clear the cache when font size/name changes. Excessive font name/size switching should be deterred IMO, why not with slowdowns? so no real downside. This does not affect themes setting font name/size, as they are handled by another mechanism.
2013-01-23 08:04:17 +01:00
Robert Hencke
7a9ff232fe Apply default gutter theme when no theme is active
Previously, if no themes were active, the gutter colors would
not be set.  This would, effectively, give you random gutter colors
on TextMate startup. (or, sometimes, a completely transparent gutter).
2012-10-24 21:07:21 +07:00
Allan Odgaard
b88ba4ff23 Extend theme_t’s public API 2012-09-10 22:47:57 +02:00
Allan Odgaard
7a67248dec No longer necessary to set all gutter colors
Previously all the colors were calculated so setting e.g. the icon color made it sort of necessary to also set the iconHover and iconPressed color.

Now the default icon hover and pressed colors are a potential user supplied icon color. Likewise, the default icon color is a potential user supplied foreground color, etc.
2012-09-08 01:02:47 +02:00
Allan Odgaard
aba449d171 Move gutter styles to own settings dictionary
This removes all the blending, the need to provide a scope selector to obtain them, and no longer taxes the general syntax highlight (by no longer having to carry around a dozen gutter styles per scope).
2012-09-08 00:40:08 +02:00
Dennis Vennink
f2f14dd48a Extended gutter theming support
The following four new keys have been added:

 - gutterIconsHover
 - gutterIconsPressed
 - gutterSelectionIconsHover
 - gutterSelectionIconsPressed
2012-09-07 21:21:35 +02:00
Allan Odgaard
8a7710e93e Use std::tuple instead of boost::tuple 2012-08-30 23:04:20 +02:00
Jacob Bandes-Storch
e3aa997b06 Use libc++: replace std::tr1 with std 2012-08-28 13:30:20 +02:00
Allan Odgaard
fc13d2021d Tweak gutter colors
Use the text foreground color for icons when the theme doesn’t provide a color and introduce ‘gutterSelectionIcons’ for the color of selected icons (defaults to selected foreground color).

Also changed the gutter selection border color to match the divider color (when it isn’t specified by the theme).
2012-08-26 18:52:25 +02:00
Dennis Vennink
6e02f55fff Add gutterSelectionBorder and gutterIcons theme keys 2012-08-26 18:26:34 +02:00
Allan Odgaard
846357c52f Code aesthetics 2012-08-25 21:04:22 +02:00
Allan Odgaard
8e1aa09d17 Colors are now transparent against background
Previously if the color for X (where X is e.g. foreground or invisibles) had an alpha value other than 1.0 (fully opaque) it would be blended against the less specifically scoped color for X rather than the background.

There was no real logic behind the previous design other than to treat all color blending the same and it would cause a problem for 1.x themes using transparency for selection or invisible characters.

Closes issue #285.
2012-08-25 20:56:36 +02:00
David Howden
b8b25a46c8 Extend gutter theming to selection foreground
New theme setting: gutterSelectionForeground
2012-08-23 14:42:11 +02:00
Joachim Mårtensson
ab310cbdab Use cf::color_t RGBA constructor when converting color_info_t 2012-08-22 17:06:56 +02:00
David Howden
f2dd19f2a3 Extend support for theming the gutter
New theme setting: gutterSelectionBackground
2012-08-22 15:10:21 +02:00
Jacob Bandes-Storch
8eb3dd0379 Calculate default gutter colors based on theme 2012-08-20 19:10:39 +02:00
Jacob Bandes-Storch
1c83eaa389 Add support for theming the gutter
Theme setting keys gutterForeground, gutterBackground, and gutterDivider
2012-08-20 19:01:56 +02:00
Allan Odgaard
699969695c Restructure code 2012-08-18 22:39:01 +02:00
Allan Odgaard
9d99e1c617 fixup! Represent font size using a CGFloat 2012-08-18 22:27:06 +02:00
Joachim Mårtensson
18eecca2ab Represent font size using a CGFloat
This applies to scoped font size settings and should be faster than the previous std::string based approach.
2012-08-18 16:28:47 +02:00
Joachim Mårtensson
ece7758e09 Represent theme colors as 4 doubles (RGBA)
This should be faster (and probably more precise) than the previous std::string based color manipulations.
2012-08-18 16:28:47 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00