Commit Graph

248 Commits

Author SHA1 Message Date
Allan Odgaard
a90acdcbe6 Use convenience methods to setup header/status bar backgrounds 2014-09-29 13:24:52 +02:00
Allan Odgaard
24bd3eee1d Let ProjectLayoutView setup height of file browser header 2014-09-29 13:03:45 +02:00
Allan Odgaard
6262e17159 Make file browser’s header view a public property
This allows users of the file browser to setup constraints involving the file browser header or change its (background) styling.
2014-09-29 13:02:15 +02:00
Allan Odgaard
72837ca7ac Use OakBackgroundFillView instead of OakGradientView 2014-09-29 13:02:15 +02:00
Allan Odgaard
cb463534b8 Make window key in actions that show file browser field editor
It is possible to bring up menus for inactive windows and e.g. select Rename or Duplicate.
2014-09-26 23:10:24 +02:00
Allan Odgaard
8224994f5d Convert dragged indexes to items when starting a drag operation
The indexes are not always valid when the drag ends because rows can have been expanded or (when dragging to another file browser) removed.
2014-09-15 12:42:02 +02:00
Allan Odgaard
c1d7484b7d Use typecast to ensure compiler finds the proper delegate method
Without it, it uses -[NSFileManager delegate] and complains that we are comparing id<NSFileManagerDelegate> with OFBOutlineView*.
2014-09-01 17:37:10 +02:00
Ronald Wampler
22cec6bb6b Do not use convertBaseToScreen: and convertScreenToBase:
These methods were deprecated in 10.7. Use `convertRectToScreen:` and `convertRectFromScreen:` instead. This is required for proper high resolution support.
2014-08-13 11:24:40 +02:00
Allan Odgaard
f370408910 File browser actions were disabled for broken symbolic links
This made it impossible to move a broken symbolic link to trash.
2014-07-05 21:33:29 +02:00
Allan Odgaard
e81286b0cd Remove unused include 2014-05-16 22:11:28 +07:00
Allan Odgaard
55b5b7a3dc Use path::escape when creating TM_SELECTED_FILES
In addition to being redundant, now that we have a global escape function, the custom shell escaping code had a bug when the path contained more than one apostrophe.
2014-04-30 12:09:47 +07:00
Ronald Wampler
fc5dcf4020 Prefer NULL to nop: in most cases
This change was prompted by the appearance of the `tabSizePopUp` button in the status bar. After dismissing the menu, the title would be disabled.

To ensure we do not have similar issues elsewhere, let's prefer the use of `NULL` to `nop:` when assigning the action for menu items unless we are sure that the menu item should always be disabled (e.g., the item is used as a label).
2014-04-30 12:09:47 +07:00
Allan Odgaard
6d77df7ac3 fixup! Remove trailing zeroes from numeric literals 2014-04-22 08:16:34 +07:00
Allan Odgaard
ae69d06c2c Use undo manager from file browser’s potential field editor
We override undo/redo for the file browser so that ⌘Z / ⇧⌘Z will only undo/redo file browser actions when it’s in the responder chain: b9fafd1495

This had the unfortunate side-effect of eclipsing the undo support of descendent views of the file browser, like the field editor used for renaming items.
2014-04-15 07:06:55 +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
69c83e56df The ‘const’ keyword should be to the right of its type
The standard doesn’t care which side the keyword is placed on, but placing it on the right makes it easier to read types.

E.g. reading “int const* const” from right to left we get “const pointer to const integer”.
2014-03-31 08:27:19 +07:00
Allan Odgaard
5f69ef31c7 Don’t use NS prefix for custom functions 2014-03-28 19:31:14 +07:00
Allan Odgaard
619a2cfec7 Change a few instances of floorf/fabsf → floor/fabs 2014-03-28 19:31:14 +07:00
Allan Odgaard
b9fafd1495 Use local undo manager for file browser
This ensures that ⌘Z / ⇧⌘Z are only targeting the file browser when it has focus.

Previously these keys would act on the file browser undo stack when a view without it’s own undo/redo stack had focus, e.g. HTML output view.
2014-03-26 15:30:36 +07:00
Allan Odgaard
764a8407e9 Use undo manager’s menu item titles in file browser action menu 2014-03-26 15:30:36 +07:00
Allan Odgaard
6535546c87 Use view’s undo manager rather than the window’s 2014-03-26 15:30:36 +07:00
Allan Odgaard
1a20f3a42d Set accessibility description when creating action buttons 2014-03-26 15:30:36 +07:00
Allan Odgaard
9ae2630607 Delete unused code 2014-03-26 15:30:35 +07:00
Ronald Wampler
f45cb07d52 Moved OakCreateActionPopUpButton method to OakUIConstructionFunctions.h
While code reuse is an added benefit, the main motivation was to fix the appearance of the action popup button in the Find window. The first (placeholder) item in the Find window's action button was assigned a nop action so that when the button was clicked and it's menu validated, the "action" image would always appear as disabled.
2014-03-25 16:51:40 -04:00
Allan Odgaard
8ecf92e893 Disambiguate display names for SCM data source
For example if multiple files with same base name are modified or untracked, then previously it wasn’t possible to tell them apart (other than using the tool tip which show full path).
2014-03-14 22:54:27 +07:00
Allan Odgaard
7131e82102 Set cell value to display name when editing a file URL
This is incase the item’s display name is different than the file’s display name, for example if the display name contains part of the path’s parent (to disambiguate it).
2014-03-14 22:54:27 +07:00
Allan Odgaard
f36a0af13d Change FSItem’s name → displayName 2014-03-14 22:54:27 +07:00
Allan Odgaard
66d1e9cad7 Remove (internal) “sort by type” file browser option 2014-03-14 22:54:27 +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
faedd67299 Move some user defaults keys to Preferences/Keys.h 2014-02-23 13:36:47 +07:00
Allan Odgaard
fbafcfb87e Ignore links when recursively expanding file browser items
Symbolic links can point to ancestor items and cause cycles, which would cause the (recursive) expansion to newer terminate.
2014-02-21 11:51:11 +07:00
Allan Odgaard
4015859bd3 Allow inline expansion of symbolic links (in file browser)
This is enabled by running: defaults write com.macromates.TextMate.preview allowExpandingLinks -bool YES
2014-02-21 11:48:34 +07:00
Allan Odgaard
d1260a28b6 Revealing an item in a file package may now change folder
Previously if opening e.g. /Applications/Mail.app/Contents/Info.plist and setting project folder to /Applications and asking to Go → Current Document then nothing would happen, as the current document would be a descendent of the current (project) folder but the file browser was unable to expand the Mail.app file package to actually reveal it.
2014-02-01 20:56:31 +07:00
Allan Odgaard
5edd3479ba Implement accessibilityIsAttributeSettable: for all attributes
Previously if using the Accessibility Inspector exceptions could be thrown.
2013-12-26 15:19:28 +07:00
Ronald Wampler
54de23f940 Ensure FSItem name property is not nil when setting menu title
We use to pass nil to NSMenuItem initWithTitle: when clicking the SCMFolders in
SCM Status (see commit e5841fe); however, we will *probably* never encounter
this now. But it might be useful, if custom data sources are implemented for the
file browser in the future.
2013-12-24 15:11:54 +07:00
Allan Odgaard
9f07942e09 Use dynamic menu titles for most toggle items
Closes #935
2013-12-12 13:36:16 +07:00
Allan Odgaard
3c99a69398 Only enable “file” services for file browser context menu
The services support in the file browser was mainly added to allow Quicksilver to grab the selection, I do not recall if this is why the selection was (also) made available as a regular string (in addition to the “file names pasteboard type”).
2013-11-28 13:48:03 +07:00
Ronald Wampler
e5841fe34f Add query component to scm URL
Previously when constructing a scm URL from a path, if scm was not enabled
we returned a file URL. This could result in some unexpected behavior.
For instance, when a directory was selected in the file browser,
activating "SCM Status" would just open the untracked directory.
This patch, insteads, adds a query to the scm URL that can be parsed to
determine how to handle the scm status request later on.
2013-11-28 13:48:03 +07:00
Allan Odgaard
1de5d90475 Set hugging priority for horizontal dividers
In the HTML output window’s status bar, the divider was taking up too much space (on 10.9).
2013-11-04 01:12:04 +01:00
Allan Odgaard
908ca3f5ab Allow zooming icon animation to be disabled
To disable, run the following in a terminal: defaults write com.macromates.TextMate.preview fileBrowserOpenAnimationDisabled -bool YES

Closes #109
2013-10-30 21:50:07 +01:00
Allan Odgaard
f943a6367a Remove disableHighlight property from NSCell subclass
The desired rendering can be achieved without adding code to NSCell
2013-10-27 11:27:47 +01:00
Allan Odgaard
4c40d6b6b9 Allow opening files by single-clicking text (rather than icon)
This is enabled via: defaults write com.macromates.TextMate.preview fileBrowserSingleClickToOpen -bool true

Closes #187
2013-10-26 12:57:38 +02:00
Allan Odgaard
44cdbc57c6 Move “click to open” logic to cell
This will make it easier to change the logic, since 3 different parts of the file browser depend on it: accepting first responder, selecting items, and single-clicking items.
2013-10-25 23:14:01 +02:00
Allan Odgaard
1d37649c10 Remove instance variables from interface 2013-10-24 21:10:20 +02:00
Ronald Wampler
08b0b5ba0b Let OakFinderLabelChooser draw and manage it's own title
This removes the need to create and manage a separate menu item
as a placeholder for the title of the color swatch in the file
browser action menu.
2013-09-12 23:13:57 +02: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
211770893e When in Favorites folder, change Add → Remove From Favorites
In practice it is possible to be in a parent of the Favorites folder and expand items so that the symbolic links in favorites can be selected, this commit does not handle that case, as we would then also need to handle the case where items both inside and outside the Favorites folder were selected (at the same time).

Users who do these things are probably aware of how symbolic links work, and can use “Move to Trash”.

Closes #1089
2013-08-26 11:48:41 +02:00