Commit Graph
1331 Commits
Author SHA1 Message Date
Alexander Ljungberg f2d9ef7720 Test: - CPPasteboard setString:forType: and stringForType:. 2013-05-14 14:40:41 -07:00
Alexander Ljungberg 9bde63923c Formatting: CPPredicateTest.
Refs #1914.
2013-05-13 22:27:39 -07:00
Alexander Ljungberg d7c676893d Merge pull request #1914 from mrcarlberg/predicate_expression_equals_nil
CPExpression and CPPredicate can't handle nil as argument in method isEqual:
2013-05-13 22:21:05 -07:00
Alexander Ljungberg 48be680fde Test: clean up and fix minor errors. 2013-05-09 11:32:09 -07:00
Aparajita Fishman 1f280b3985 New: CPNumberFormatter -localizedStringFromNumber:numberStyle:
Added unit test as well.
2013-05-06 17:45:16 -04: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
Martin Carlberg 8a94c33a64 New: Added test cases checking that a CPObject, CPExpression and CPPredicate is not equal nil.
CPExpression and CPPredicate can't handle nil as an argument to method isEqual:. These test cases checks that this is working.
2013-04-23 12:54:26 +02:00
Alexander Ljungberg 6048814635 Merge branch 'refs/heads/slevenbits-cpcolor-hsb-fix' 2013-04-21 15:03:53 +01:00
Alexander Ljungberg fe26e6cfe0 New: + CPException raise:format:.
This method allows the exception reason to be a formatted string with parameter replacement.
2013-04-21 14:56:57 +01:00
Alexander Ljungberg 3e35e3d8a8 Fixed: CPColorPicker not working with fixed CPColor colorWithHue: implementation. 2013-04-21 14:32:10 +01:00
Alexander Ljungberg 0c2abf3629 Test: new CPColor HSB tests. 2013-04-20 13:56:49 +01:00
aparajita 8f6efdaae0 Merge pull request #1902 from ahankinson/fix-issue1899
Fixed: Removing an item from a menu also removes its highlight state
2013-04-18 13:17:24 -07: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 28357bd57f Corrected bad test 2013-04-16 02:26:17 +02:00
Alexandre Wilhelm f39e224c48 Updated manual example 2013-04-15 16:33:00 -07:00
Alexandre Wilhelm 98a59c4700 Fixed small bus about timeZone 2013-04-15 16:20:02 -07:00
Alexandre Wilhelm 3497e36f23 Fixed bunch of bugs in CPDateFormatter with TimeZone 2013-04-15 14:25:30 -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 cc9ff15142 Fixed: Removing an item from a menu also removes its highlight state
Previously when a menu item was instantiated outside of the context of the menu itself, its highlight state was maintained even after it was removed from the menu. If the menu was dismissed with the item highlighted, and then the item was used in another menu (e.g., re-added to a context menu for a table row) it would appear highlighted, even though the menu highlight index was not set.

This commit ensures that when removing items from a menu that the highlight state of the underlying view is set to NO as well.

Tests for this behaviour are included as well.

Fixes #1899
2013-04-10 00:04:53 -04:00
Aparajita Fishman 04d6b34bfe Fixed: tests broke because of change in CGRect/CGSize/CGPoint description. 2013-04-06 08:49:33 -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
Tim Lewis bd6d2e71e7 Fixed: stringByTrimmingCharactersInSet not removing characters at end
If a string had characters from the set at both the start and end,
the end trim was one character less than required.
2013-03-21 13:44:00 +00: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 afd5925499 Fixed: _CG and _CP macros were confusing and could degrade performance
Previously, Cappuccino was using preprocessor macros internally for the CGPoint/Size/Rect/Inset/Affine functions, as well as for CPRange. These macros had the same name as the corresponding function, but began with _. The functions were actually defined using the macros.

The motivation behind using macros was to increase performance by reducing function calls. However, there were a number of problems with this approach:

- There was an artificial dichotomy between _CG macros and the corresponding CG functions. We never completely replaced CG function calls with _CG macros. In fact, they were often mixed up in the same file. There was an extra burden on the programmer to remember to use the macro instead of the function.
- If a method call was passed as an argument to a macro, performance could actually be significantly *worse* than a function call. For example, _CGGetRectMakeCopy([view frame]) would expand to `{ origin:{ x:[view frame].origin.x, y:[view frame].origin.y }, size:{ width:[view frame].size.width, height:[view frame].size.height } }`. So instead of a single objj_msgSend and a single simple function call, we ended up with 4 objj_msgSend calls, which are way more expensive than simple function calls.
- Because of this expansion problem, to use macros efficiently required us to remember to use variables for all macro parameters. This didn't happen, and shouldn't have to happen.
- Finally, with modern Javascript engines, function call overhead is so small that it really isn't worth using the macros.

This commit eliminates the _CGGeometry, CGAffineTransformation and CPRange macros and replaces them with function calls.

BREAKING CHANGE:
The macros are no longer available. They could only be used with compiled code, but if there is any user code that used them, they will have to be replaced with the corresponding functions.
2013-03-13 12:22:10 -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
Alexander Ljungberg abadc6298d Test: refactor token field test to not rely on ivars.
This will make it easier to extend the test with token fields in windows or popovers.
2013-03-10 22:44:07 +00:00
Alexander Ljungberg b53616ead3 New: @deref(<any idempotent expression>).
This change makes it possible to @deref any expression, such as a conditional expression, as long as the expression doesn't have side effects.

The reason not to allow dereferencing of expressions with side effects is that we might need to evaluate the expression twice in certain uses of deref, which is not obvious when you look at the deref operator in plain code.
2013-03-10 17:32:28 +00:00