Commit Graph
647 Commits
Author SHA1 Message Date
Aparajita Fishman 2b23374ec7 New: CPAlert supports custom didEnd selector or block.
Previously, unless you were using a sheet alert, there was no way to set a custom dismissal handler for an alert. In Cocoa alerts are synchronous, in Cappuccino they are asynchronous, which meant that a single dismissal handler had to handle all possible non-sheet alerts.

This commit adds several methods which add two ways to specify a custom dismissal handler: via delegate/selector, and via a block (function). The new methods are:

setDidEndSelector:
runModalWithDidEndBlock:
beginSheetModalForWindow:didEndBlock:

Note that didEnd blocks are transient and take precedence over didEnd selectors.

The CPAlertTest demo was updated to fix some bugs and added the ability to run the tests using blocks.
2013-07-29 13:06:57 -04:00
Alexander Ljungberg 757c79d15c Refactor, restructure and simplify copy and paste handling.
This change brings nearly all copy and paste related into a single, self-contained class. This new class is still somewhat coupled to CPPlatformWindow+DOM.j in the sense that it's highly specific and meant to be called in a very specialised way. Despite this, it's still a significant decoupling and the new code is more readable and easier to follow.
2013-06-17 00:17:00 +01:00
Alexander Ljungberg 8dd252eee1 Cleanup: TableTest/Editing. 2013-06-16 13:23:22 +01:00
Alexander Ljungberg 9d435e0f8a Test: include an image in Copy and Paste test.
Image copy and paste to and from the system clipboard is not available in Cappuccino today. However, the image in the collection view can be used to test internal Cappuccino copy and paste (using Edit > Copy, Edit > Paste from the Cappuccino menu).
2013-06-15 17:53:17 +01:00
Alexander Ljungberg a4aed913d7 Test: new copy and paste manual test.
This test makes it easy to test copy and paste both inside a Cappuccino app, and externally to and from other Cappuccino instances in other browser, or other applications, when using a text field or a collection view as the source/destination.
2013-06-14 14:27:40 +01:00
Alexander Ljungberg df7a6930c2 Test: expose a problem with - CPTabView insertTabViewItem:atIndex.
Refs #1920, #1921.
2013-06-12 12:31:30 +01:00
Alexander Ljungberg 45c75235a5 Merge pull request #1898 from ahankinson/fix-issue1396
Fixed: CPTokenField sends focus and blur notifications
2013-06-12 12:07:02 +01:00
Antoine Mercadal 8f17f904f2 Merge pull request #1935 from Dogild/CGPath
Fixed: CGPath is wrong when creating an arc
2013-05-29 10:11:39 -07:00
Aparajita Fishman 3159021d27 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.
2013-05-25 19:11:27 -04:00
Alexandre Wilhelm 8b7eb1815d Removed unused code 2013-05-24 13:40:46 -07:00
Alexandre Wilhelm cb187c3e8f Added tests 2013-05-24 11:53:47 -07:00
Alexandre Wilhelm a79ac2e9e4 Removed unused code 2013-05-23 14:11:03 -07:00
Alexandre Wilhelm b5df5f730b 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
2013-05-23 14:07:04 -07:00
Antoine Mercadal d8c8694c0d nib2cib the xib 2013-05-21 15:27:45 -07:00
Alexandre Wilhelm 9d76ab70fe Changed image for lineal gradient 2013-05-20 21:54:04 -07:00
Alexandre Wilhelm 22d66438fb Added test for linear/radial gradient 2013-05-20 19:08:44 -07:00
Alexandre Wilhelm 54dd027c15 Removes previous test 2013-05-20 19:06:08 -07:00
Alexandre Wilhelm ad33411ec6 New: CGContextDrawRadialGradient support
Canvas supports CGContextDrawRadialGradient as in cocoa. The CGGradientDrawingOptions is not actually supported.

Test app in Tests/Manual/CGCanvasContext
2013-05-20 15:08:46 -07:00
Alexander Ljungberg 48be680fde Test: clean up and fix minor errors. 2013-05-09 11:32:09 -07:00
Antoine Mercadal e0d33a8e3f Merge branch 'SheetToolBar' of https://github.com/Dogild/cappuccino into pr-1919 2013-05-06 13:29:09 -07:00
Antoine Mercadal f8513eae26 Merge pull request #1903 from Dogild/CPDateFormatterSupport
New: Added support for CPTimeZone and CPDateFormatter
2013-05-06 13:11:36 -07:00
Alexandre Wilhelm 30e9389a92 Updated test 2013-04-30 15:25:23 -07:00
Alexandre Wilhelm 7477294648 Added test for toolbar sheet 2013-04-30 14:39:31 -07:00
Alexander Ljungberg 72455f43d4 Test: expose child window level crash bug if present.
This manual test exposes the bug addressed by issue #1911.
2013-04-30 00:57:42 +01:00
Christophe Serafin 88a247c107 merged sources and show shouldReorderColumn usage in TableCibTest example 2013-04-17 01:57:07 +02:00
Alexandre Wilhelm a8aeb8addb Added CPTimeZone test 2013-04-16 15:21:30 -07:00
Alexandre Wilhelm f39e224c48 Updated manual example 2013-04-15 16:33:00 -07:00
Alexandre Wilhelm 0bbaec0829 New: Added support for CPTimeZone and CPDateFormatter
- Added support for CPDateFormatter in Foundation
- Added support for CPTimeZone in Foundation
- Added support fo CPDateFormatter in nib2cib

Test app in Tests/Manual/CPDateFormatter
UnitTest in Tests/Foundation/CPTimeZoneTest.j
UnitTest in Tests/Foundation/CPDateFormatterTest.j
2013-04-12 11:15:10 -07:00
Andrew Hankinson 6ef5b46dd6 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
2013-04-07 20:50:50 -04:00
Alexandre Wilhelm 1649ea64cc New: CPDatePicker Support
- Added CPDatePicker
- Added CPLocale
- nib2cib for CPDatePicker

Test app in Tests/Manual/CPDatePickerTest
2013-03-26 16:52:46 -07:00
Alexander Ljungberg 16134aa0de Test: dashed and phased CG strokes. 2013-03-20 15:27:48 +00:00
Andrew Hankinson d6545627aa Fixed: Allow Interface Builder to set CPComboBox enabled state
Previously, the enabled state of a CPComboBox could not be set in Interface Builder.

This commit allows Interface Builder to set the enabled state of a CPComboBox.

A modified test in Manual/CPComboBoxTest is included. This test simply adds a new disabled combo box to an existing window, and then checks to see if it is disabled, printing a descriptive message to the Javascript console.
2013-03-19 19:01:56 -04:00
Aparajita Fishman 5d2e4bf7cc Fixed: theme build failed
Previously CPTableView -_init was trying to reference a theme value, but that doesn't work because the theme creates a CPTableView and during that _init the theme value is not yet defined.

This commit uses lazy instantiation to avoid this problem.

Also, column selection was added to the CPDictionaryControllerTest to better visualize unfocused selection highlight colors.
2013-03-18 08:21:02 -04:00
Blair DuncanandAparajita Fishman fd20a8045e Fixed: table view selection color did not change when losing focus.
CPTableView has no focus ring, and currently gives no visual feedback of its firstResponder status. In Cocoa when the table view resigns firstResponder or its window loses key status, the selection color turns gray.

This commit sets the selection color to gray when a table view resign firstResponder or its window loses key status. A second window and a couple of textfields were added to the CPDictionaryControllerTest to demonstrate the changes.

Fixes #1839
2013-03-15 19:56:47 -04:00
cacaodevandAparajita Fishman 7225e7e038 New: deprecate -tableView:dataViewForTableColumn:row: and -outlineView:dataViewForTableColumn:item:
-tableView:dataViewForTableColumn:row: and -outlineView:dataViewForTableColumn:item: are deprecated in favor of ...viewForTableColumn:...

Using the previous delegate API and not caching the view with an identifier was degrading performance. With this change, developers are encouraged to use the new caching system and the CPTableView method -makeViewWithIdentifier:owner: to get the view.

Also fixed a condition where a view-based outline view was not always asking for the view from its delegate. In some circumstances, an outline view could be considered as view-based instead of cell-based.

Test for deprecated delegate methods in CPOutlineViewViewBasedCib and TableTest/ViewBased examples.

Fixes #1823
2013-03-15 08:16:02 -04:00
Aparajita Fishman d25ff21030 Fixed: _CPThemeAttribute _parentAttribute had confusing name
Previously _CPThemeAttribute had an ivar called _parentAttribute, which represented the attribute from the theme descriptor, as opposed to the attribute for a particular instance of a view.

This commit renames that ivar to _themeDefaultAttribute, so it is clearer where it gets its values.
2013-03-14 23:57:39 -04:00
Blair DuncanandAntoine Mercadal 21de08506c added in the xib that I modified for testing. 2013-03-14 13:49:42 -07:00
cacaodev c8b812bbb5 FIXED: A data view edited in a table view was duplicated after a reload.
Previously in CPTableTView, a view being edited was not cached when unloaded, for example when made invisible after scrolling or when calling -reloadData.
This situation was causing a duplicated view to be added at the same place when the data view was loaded again.
After this commit, edited data views are cached and resign their first responder status just before they are added to the queue because they can be reused at another place.

Test: Added a "reload data" button in ViewBasedCib example.
2013-03-14 19:28:45 +01:00
Aparajita Fishman 9a28beb6b5 Fixed: makeFirstResponder didn't work for token fields
A change had been made to CPTextField _becomeFirstKeyResponder that wasn't propagated to CPTokenField.
2013-03-13 19:46:43 -04:00
Aparajita Fishman facd97c09d Fixed: if orderOut: was not called for a popover, it would not detach from its parent
When a transient popover was closed by clicking, in some cases it would not detach from its parent, leaving it in the window list. This caused problems later on.

This commit ensures the popover is detached from its parent when it is ordered out.
2013-03-13 16:39:14 -04:00
Aparajita Fishman 07d35d606c Fixed: resize masks for a few views in AttachedSheet2 demo were not set
Previously they floated, now they are anchored.
2013-03-13 14:50:07 -04:00
Aparajita Fishman 10b588a19c Fixed: CPGraphicsTest window wouldn't fit in 15" screen
I'm happy for those who have 27" screens, but on my poor MPB 15" screen, the CPGraphicsTest window was too tall to see everything.

I split the window into two windows so everything can be seen.
2013-03-13 12:05:54 -04:00
Aparajita Fishman 843e5016e5 Fixed: modal sheet would appear briefly before animation
The AttachedSheet2 demo was calling runModalForWindow:, which caused the sheet to appear briefly as an application modal.

That call was removed, beginSheet: does everything.

Also:

- Wrapped _attachSheetWindow method into _attachSheet:modalDelegate: method.
- Just to be safe, in CPWindow -_sheetShouldAnimateIn:, the sheet is moved offscreen before being ordered front.
2013-03-13 11:51:27 -04:00
Aparajita Fishman 54bc851159 Fixed: missing theme image, window sizing/moving was broken.
After bbfaac5, all kinds of strange behavior occurred with window sizing and moving due to overzealous constraining.

Cocoa does not constrain the frame of hidden windows. When a hidden window is ordered in, it is constrained to the usable screen content rect. A visible window has its height constrained when its frame is set. Its origin is constrained such that a minimum margin at the left, right and top is visible, and the top is constrained to be below the menu bar.

This commit fixes a number of problems related to window moving and resizing that were introduced by bbfaac5:

- Sheets are not constrained at all.
- Moving a window does not constrain its size.

In addition, when a window is moved, tracking is relative to the initial click point, which provides proper behavior when the movement is constrained and the mouse keeps moving.
2013-03-12 21:49:15 -04:00
Alexander Ljungberg 7b11411b61 Merge branch 'refs/heads/slevenbits-popover-override-modality-fix' 2013-03-12 17:03:13 +00:00
Alexander Ljungberg 921b30a892 Merge branch 'refs/heads/slevenbits-popover-child-window-close-fix' 2013-03-12 17:02:57 +00:00
Alexander Ljungberg baa75a8b64 Merge branch 'master' of github.com:cappuccino/cappuccino 2013-03-12 16:56:23 +00:00
Aparajita Fishman 3af2314a70 Fixed: sheet resizing displayed incorrectly
Previously, when a sheet was resized, there were a number of problems:

- Sheets in Cocoa resize their width symmetrically, such that they always remain centered. This was not happening in Cappuccino.

- When a sheet is resized wider than its parent window, the shadow at the top of the sheet was growing wider than the bounds of the parent window's title bar, which makes no sense since the shadow is supposed to be cast by the title bar.

- Sheets had no top border, so when they were resized wider than the parent window, the top edge looked like it was cut off. In Cocoa, sheets have a top border that sits under the title bar of the parent window, and which is visible when the sheet is resized wider than the parent window.

This commit addresses these problems as follows:

- Sheet width is now resized symmetrically.

- Sheet resizing is pinned to the screen bounds.

- The top sheet shadow is pinned to the width of the parent window's content view.

- Sheets now have a top border.

In addition to these changes, a redundant sheet top shadow was eliminated from one of the _CPWindowView subclasses.

Fixes #1846
2013-03-12 10:20:14 -04:00
Alexander Ljungberg 969f56911a Test: popovers in attached sheet 2 test.
The popover test now added exposes a bug:

1. Click Modal Window to open a modal window.
2. Click Popover to open a popover.
3. Click on the first window.

It should not be possible to interact with this window since a modal window is open, but a bug in the modal event handling when transient popovers are open will allow the event to incorrectly pass through to the window.

AttachedSheet2 is turning into a complete window/modality/sheets/alerts/popover interaction test.
2013-03-11 12:58:36 +00:00
Alexander Ljungberg 09ea8c3241 Test: manual test for most token field behaviour when in a popover. 2013-03-10 22:49:09 +00:00