Commit Graph

202 Commits

Author SHA1 Message Date
Allan Odgaard
166bfad140 Fix include paths 2014-03-07 00:10:35 +07:00
Allan Odgaard
6ded0873a3 Remove (somewhat) redundant code 2014-03-05 21:18:59 +07:00
Allan Odgaard
8e63d2729f Setting current pasteboard entry to itself lose auxiliary options
An example where this is desired is when doing a folder search for “foo”, then going to first match and using ⌘E to copy the match to the find pasteboard. This is effectively a no-op except for dropping the auxiliary options that contain other documents with matches (which is what causes ⌘G to advance to next document).
2014-03-05 21:18:59 +07:00
Allan Odgaard
c5c88843e8 Let OakFileIconImage be lazy wrt. stat’ing and obtaining SCM info
There are situations where we create an OakFileIconImage that won’t be drawn, for example when using it with an NSMenuItem. In that case, we previously paid a somewhat noticeable price in the initializer doing work that was not required.
2014-03-05 16:39:55 +07:00
Allan Odgaard
83aabbf53c Move properties from OakFileIconImageRep to OakFileIconImage 2014-03-05 16:39:55 +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
947b352952 Set pasteboard history search field to fire immediately 2014-03-04 10:40:05 +07:00
Allan Odgaard
a6f6185123 Add NSError info to crash report 2014-03-04 10:24:05 +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
d700447d8b Remove unused API 2014-03-02 21:10:15 +07:00
Allan Odgaard
0e0a6e0252 Fallback on system pasteboard when history is empty
This is for the next/previous methods, the method that returns current already would fallback on the system pasteboard.
2014-03-02 12:13:06 +07:00
Allan Odgaard
95508d9757 Add new pasteboard history browser 2014-03-02 12:12:57 +07:00
Allan Odgaard
7483829245 OakPasteboard: Setting currentEntry now updates system clipboard 2014-02-28 19:20:21 +07:00
Allan Odgaard
72f4811d0b Use @property with @dynamic for ‘primitiveOptions’ property 2014-02-28 19:18:28 +07:00
Allan Odgaard
c0c8a073b9 Avoid property access in fetch predicate 2014-02-28 14:33:20 +07:00
Allan Odgaard
79a47ee277 Don’t store pasteboard entries in an ordered collection
Instead we date stamp each entry and do a sorted fetch (with a limit of one) to find next/previous entry (when required).

The reason for moving away from an ordered collection is twofold, the main reason is that NSArrayController does not support ordered collections, so we lose one of the advantages of switching to CoreData. The secondary reason is that using an ordered collection requires that we use an index for “current item” (or maybe liberal use of indexOfObject:) and it’s problematic to ensure that the index is kept 100% in sync with the entries in the collection (especially with bindings and delayed actions).
2014-02-28 14:28:03 +07:00
Allan Odgaard
13e810e8be Add exception handler for NSManagedObjectContext’s save: method
If an exception is thrown, a dialog is shown. This isn’t very user friendly, but the goal is to call attention to the problem, as I wouldn’t expect any exceptions to be thrown by this method, but I have seen multiple “optimistic locking failure” exceptions despite single-app / single-thread access to the persistent store.
2014-02-27 12:36:33 +07:00
Allan Odgaard
1a4314fce2 Wrap initialize code in dispatch_once
This is only done for code where running it twice would actually cause a problem.

Dispatch_once is favored over a static boolean only because it seems to carry slightly more semantic information.
2014-02-26 19:36:54 +07:00
Allan Odgaard
0663a39bcf Abort copy file if target is child of source 2014-02-26 08:29:42 +07:00
Allan Odgaard
3baea707e2 Fix typo 2014-02-23 08:33:38 +07:00
Allan Odgaard
60e8af92e4 Delay saving of pasteboard history by 30 seconds
Since we save the history during applicationWillTerminate: there is (in theory) no reason to periodically save the history, but in case of a crash or similar, we would not get to applicationWillTerminate:.
2014-02-22 15:51:45 +07:00
Allan Odgaard
9fcde0791e Add CoreData index to pasteboard entry content 2014-02-21 22:04:02 +07:00
Allan Odgaard
8b44ab2c41 Avoid duplicate entries on find/replace pasteboard 2014-02-21 21:36:13 +07:00
Allan Odgaard
8956207789 Avoid detached objects in core data store 2014-02-20 22:40:20 +07:00
Allan Odgaard
520084a08c Limit clipboard history to about 10,000 items
Once we reach the threshold we delete half the history to ensure a good amortized time complexity.
2014-02-20 10:34:49 +07:00
Allan Odgaard
b1ec5cf4c2 Use CoreData for storing clipboard history
Previously this was stored in NSUserDefaults. The problem with that approach is that if large items were stored in the history, it would cause slowdowns, presumably by periodic writing the entire user defaults to disk.
2014-02-19 15:34:07 +07:00
Allan Odgaard
59e27e5cbb Avoid direct instance variable access 2014-02-18 20:37:26 +07:00
Allan Odgaard
978b85cc1d Refactor OakPasteboard class
Remove logic from the setter methods and limit their use. This is in preparation for making the classes NSManagedObject subclasses where we prefer to use the generated accessor methods.
2014-02-18 17:42:01 +07:00
Allan Odgaard
57e8e37313 Rename NSReplacePboard → OakReplacePboard
We shouldn’t use Apple’s prefix for our own constants. The actual value of the constant hasn’t been renamed yet as this requires “migration” (renaming the key in user defaults).
2014-02-18 12:41:47 +07:00
Allan Odgaard
e80bf978ec Minor OakPasteboard(Entry) interface changes 2014-02-18 12:35:22 +07:00
Allan Odgaard
e5e4957e39 Limit explicit options stored on find clipboard
This is to get a “cleaner” history (saved on disk).
2014-02-18 11:57:12 +07:00
Allan Odgaard
a088336453 Ensure system clipboard is always updated 2014-02-18 11:56:32 +07:00
Allan Odgaard
82299a4f39 Move code from OakPasteboard instance to class object
This is in preparation of making the class an NSManagedObject subclass, so we want as little code there as possible.
2014-02-18 11:54:34 +07:00
Allan Odgaard
8ebbb338c2 Disallow creating OakPasteboardEntry outside OakPasteboard.mm
This is in preparation of adopting CoreData which will require a managed object context to create pasteboard entry objects.
2014-02-18 11:53:41 +07:00
Allan Odgaard
0da5fedf6c Do not add transient pasteboard items to history
See http://nspasteboard.org for details.
2014-02-18 11:53:20 +07:00
Allan Odgaard
5d08404136 Update OakPasteboard to use “new” Objective-C run-time features 2014-02-10 14:41:37 +07:00
Allan Odgaard
7a7107d69a Factor out OakScopeBarView 2014-02-06 20:20:55 +07:00
Adam Strzelecki
875a470cc1 Fix file browser height for tabs above document
This fixes regression caused by 1de5d90475 that
divider height and default compression priority disallowed expected height.
2014-01-09 14:34:30 +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
1f61b628b3 Use new safeObjectAtIndex method
Also removed the static SafeObjectAtIndex mehtod in OakTabBarView
2013-12-22 23:30:29 -05:00
Adam Strzelecki
2a6b37c1a3 Remember window zoom state and regular window frame
This fixed problem when closing TM2 with zoomed window, then unzooming window
after restart caused invalid window placement.
2013-12-03 09:50:39 +07:00
Allan Odgaard
6a0ab432cb Show warning if undo will delete non-empty document
Closes #1197
2013-11-15 13:53:04 +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
03c91f5ab7 Add assertion 2013-10-31 17:27:15 +01:00
Allan Odgaard
81006920c2 Simplify binding setup for encoding pop-up button 2013-10-06 23:09:12 +02:00
Allan Odgaard
a2131a6472 Add two-way binding support to OakEncodingPopUpButton
Previously binding to the view’s encoding property would not update the bound object when the view changed its value.
2013-10-04 16:53:50 +02:00
Allan Odgaard
72791ce406 Update last effective tab when number of tabs change
Closes #1120
2013-09-15 21:32:15 +02:00
Allan Odgaard
b4f7fc9a49 Remove unsupported encodings (libiconv v2.4.0) 2013-09-15 21:22:44 +02:00
Allan Odgaard
cf599498a9 Fix encoding names for Atari ST, GB_1988-80, and HZ-GB-2312 2013-09-15 21:22:44 +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