Fixed CPDocumentController missing method currentDocument

In this commit I've added the currentDocument method to the document controller

Also removed the firstEligibleExistingWindowController method from CPDocument
It did nothing but add confusion as it was not used anywhere else in the frameworks.
And it is not in cocoa.
added missing methods to CPDocumentController

documentForWindow
hasEditedDocuments

both are in cocoa
Fixed: CPTokenField sends focus and blur notifications

This commit adds notifications for focus and blur on CPTokenField.

Attached is a modified Manual CPTokenFieldTest that observes these notifications.

Fixes #1396
Fixed: CGPath is wrong when creating an arc

Previously when creating a CGPath with an arc, the path was wrong. It added a line when it wasn't necessary and when it was necessary it added a line to a wrong point.
Now CGPath works like in cocoa (If the specified path already contains a subpath, Quartz implicitly adds a line connecting the subpath’s current point to the beginning of the arc. If the path is empty, Quartz creates a new subpath with a starting point set to the starting point of the arc.)

Test app in Tests/Manual/CGPath/AppController.j
Removed unused code
Added method CGPathContainsPoint
Added tests
Removed unused code
Changed clockWise to isClockWise
CPDatePicker fixes, optimizations, tweaks...

- CPImageInBundle() can't be used from a ThemeDescriptor. Replaced with PatternImage().
- DRY! Put clock image sizes in variables so they can be maintained in one place.
- When displayed from the theme showcase, the hand images in HandLayer -setImage: were still _CPCibCustomResources, not sure why. This condition is now explicitly handled by converting to the referenced image.
- Fixed a bug in _CPDatePickerClock -setEnabled where the sublayers would not update unless the event loop was pumped.
- Check for unchanged value in setters.
- Various code optimizations.
- Removed unnecessary method comments.
- Fixed typo in demo app.
Fixed: in some cases nib2cib would write to stdout, which wasn't captured by XcodeCapp.

Previously, only stderr was checked for response text. In some edge cases it would write an error message to stdout. In addition, the default error message provided when the return status was non-zero and the output was empty was implemented incorrectly.

Now all output from nib2cib is correctly captured.

Also updated help to indicate how to enable debug logging.
Merge pull request #1935 from Dogild/CGPath

Fixed: CGPath is wrong when creating an arc
Fixed: When selector is only a ':' in a send message statement the new compiler crashed.

The program below crashed on the last line with a 'null is not an object' error message. Also added a test case.

@implementation MyObject {
- (int):(int)a {
  return a;
}
@end
var a = [[MyObject alloc] init];
var b = [a:3];
Merge pull request #1937 from mrcarlberg/colon_selector

Fixed: When selector is only a ':' in a send message statement the new compiler crashed.
Fixed: CPCollectionView range bounds exception if shift key was held for first selection

Previously, if you held down the shift key while making the first selection in a CPCollectionView it would raise an exception claiming {-1, XXX} was out of range. This was because `firstIndex` returns CPNotFound (-1) if nothing is selected.

In Cocoa, holding down the shift key while making the initial selection behaves as if you made an initial selection.

This commit catches a CPNotFound and sets the first index to the index of the item under the mouse pointer.
Fixed: removeTableColumn does not removes column from tableColumns array

Previously the tableView didn't correctly remove a given tableColumn. It was removed in the method load (who is called by the layoutSubviews).
Now the tableColumns is removed before the layoutSubviews (as in cocoa).
It fixed also another problem, before this fixe it wasn't possible to remove all of the columns of a tableView (the last column was always displayed). This is fixed also

Fixes #1913

You can test that with the app of t00f
Fixed small bugs with _reloadAllRows
New: Added "Resources" directory to cap Framework template

Added a new folder "Resources" in Tools/capp/Resources/Templates/Framework/. As the folder is empty be default for frameworks it contains a .gitignore file to be able to add it to git.

Motivation is to prevent (spelling) mistakes when manually creating a Resource folder for Frameworks (e.g. "Ressources").
Fixed: Frameworks/Source directory was being copied to Build
Fixed: CPTableView Drag and drop in void causes a crash

Previously the drag and drop and multiple selection from a void cells caused an exception.
With this fix, you can start a drag/drop and a multiple selection from a empty row.

Fixes #1857