Commit Graph
49 Commits
Author SHA1 Message Date
Alexandre Wilhelm 655bc39d85 Fixed: blinking popover animation on Chrome and Opera
Previously, when opening a popover, the animation was blinking on Chrome and Opera.
To resolve (temporary I hope) this issue, we launch the last part of the animation at the beginning of the next runloop. We do that by wrapping the desired code in window.setTimeout(function(){},0).

A google chrome issue has been opened here : https://code.google.com/p/chromium/issues/detail?id=523044&thanks=523044&ts=1440095724
2015-08-20 11:36:57 -07:00
Antoine Mercadal 6d67d30aee NEW: Initial support for CPAppearance
This patch adds the `CPAppearance` class and uses it where needed.
There is nearly no impact, but in `_CPPopoverWindowView` where the
`CPPopoverAppearance` needs to be converted to a `CPAppearance` object

nib2cib support has also been added.

*This patch brings no new functionality.*
2015-08-13 19:56:10 -07:00
Alexandre Wilhelm fd068443aa Fixed: keyWindow and mainWindow did not work when jumping from window to window when popover were open
Previously, when jumping from a platformWindow to another platformWindow where popover where opened, the wrong windows became key and main. This things occurred weird behavior of the platformWindows.

Now, it works as in cocoa, canBecomKeyWindow, becomeKeyWindow, becomeMainWindow, resignKeyWindow and resignMainWindow are called in the good order.
2015-04-09 15:14:33 -07:00
Alexandre Wilhelm 769b379a8b Fixed: a CPPopover were closed when a click was made in another CPPlatformWindow 2015-04-07 17:39:35 -07:00
Martin Carlberg 03a6e6fc6a Fixed: Removed ivars that are already declared in superclass 2015-03-03 11:34:49 +01:00
Alexandre Wilhelm 6b235ab083 Fixed: CPPopover position does not update each time
Previously, when the frame of a superview of the targetedView would update, the popover did not update its position.
Now it does by observing each frame of each superviews of the targetedView.
2015-02-10 22:58:03 -08:00
Alexandre Wilhelm e49a9f1f06 Fixed: targetRect was assigned too late when displaying a popoverWindow. This var can be used before ordering the popoverWindow 2015-01-06 15:28:14 -08:00
Alexandre Wilhelm 0f5dd99167 Fixed: the method setContentSize: of the CPPopover did not take care about the rect given when displaying the popover 2015-01-06 15:20:02 -08:00
daboe01 2f9f3db198 remove accidental code duplication 2015-01-03 10:21:28 +01:00
daboe01 00ebc265d8 make _targetRect an ivar 2015-01-02 19:35:09 +01:00
daboe01 5995b42872 fixed: popover positioning 2014-12-25 17:37:18 +01:00
Alexandre Wilhelm b74d49b0bf Fixed: changed option for observer in _CPPopoverWindow.j 2014-12-08 15:54:25 -08:00
Alexandre Wilhelm 8b29369b7e Fixed: wrong option for the observer in _CPPopoverWindow
Previously the option of the observer in _CPPopoverWindow were set to 0, now it's set to CPKeyValueObservingOptionNew.

This PR fix also another issue, the popoverWindow registered the observer in the wrong order. It firstly observed the frame of the sender and then removed it directly. Now it register when ordering front the popover and remove it when closing the popover
2014-12-08 15:36:31 -08:00
Antoine Mercadal 608480c1d2 FIXED: popover window was not trapping next mouse event if delegate responds no to popoverShouldClose:
This patch fixes that by automatically trapping next mouse event if after a performClose, the popover is still visible
2014-10-01 14:48:47 -07:00
Antoine Mercadal 5979baa874 FIXED: - (BOOL)popoverShouldClose: was not called in transient and semi-transient mode
Previously, handlers of events that could make the popover to close were not calling CPPopover's performClose:. This patch ensure performClose: is called, and so delegates are consulted if the popover can be closed or not
2014-10-01 14:17:39 -07:00
Antoine Mercadal 55861a8f44 FIXED: transient popovers were not close with right click
This patch ensure that is a popover is transient and the user right clicks outside, it closes properly.
2014-08-11 12:46:09 -07:00
Alexandre Wilhelm 7890085c6c Fixed: CPPopover animation issue
Previously, when opening a popover after another one, the CPPopover was blurred.
This occurred due to some CSS Transitions specification :

"Since this specification does not define when a style change event occurs, and thus what changes to computed values are considered simultaneous, authors should be aware that changing any of the transition properties a small amount of time after making a change that might transition can result in behavior that varies between implementations, since the changes might be considered simultaneous in some implementations but not others."

The fix consists to access to a transform value of the style of the _DOMElement to force it to recalculate the values.

More information here : https://code.google.com/p/chromium/issues/detail?id=388082

Fixed #2143
Test app in Test/Manual/CPPopover
2014-08-04 10:55:29 -07:00
Antoine Mercadal a8b66abe15 Merge pull request #2151 from Dogild/EscapePanelRefac
Fixed: escape on a panel or popover breaks the key chain event
2014-07-09 14:12:50 -07:00
Antoine Mercadal 03c45a78a9 Merge branch 'popoverOpen' of https://github.com/Dogild/cappuccino into Dogild-popoverOpen 2014-07-09 14:06:12 -07:00
Alexandre Wilhelm 6574d4450f Fixed: style in _CPPopoverWindow 2014-07-07 20:55:48 -07:00
Alexandre Wilhelm d7f0ff84d6 Fixed: code style in CPPopover 2014-07-07 19:21:00 -07:00
Alexandre Wilhelm 5c66104d25 Fixed: methodsare public instead of private in CPPopover 2014-06-29 19:35:47 -07:00
Alexandre Wilhelm c642d76e91 Fixed: CPPopover doesn't handle semi-transient behavior 2014-06-29 19:17:56 -07:00
Alexandre Wilhelm 7de3022a4a Fixed: animation doesn't work as in cocoa 2014-06-27 13:50:16 -07:00
Alexandre Wilhelm c274f27810 Fixed: escape on a panel or popover breaks the key chain event
Previously when hitting escape on a CPPanel, the key chain event was broken.
Now when the user hit escape, cappuccino do the following process

- Check if the firstResponder or the chain of the nextResponder implement cancelOperation:
- If not, performKeyEquivalent on the firstResponder and so on
- If not, call the method cancel: on the firstResponder and the chain (not in the case of the CPPopover)

Previously, a complete: method was called if the user hit escape on a void window. This is not a feature of Cocoa, @apajarita or @aljunberg can you confirm that ?

This commit is related to the commit #2139
2014-06-25 18:08:26 -07:00
Antoine Mercadal f418f9de4c Merge pull request #2139 from Dogild/EscapePanel
Fixed: CPPanel and popover doesn't close when hitting escape
2014-06-24 17:45:27 -07:00
Alexandre Wilhelm f8457bd918 Fixed: _closeOnBlur in CPPopover doesn't need accessors 2014-06-24 17:22:09 -07:00
Alexandre Wilhelm b015a6ea6c Fixed: refactoring of the escape feature of the panel and popover 2014-06-24 17:18:13 -07:00
Alexandre Wilhelm 43ed8be114 Fixed: popoverWillShow called when the popover is opened
Previously, the delegate popoverWillShow was called even if the popover was already shown. This PR fix this issue.
Also, it was possible to launch several times the method orderFront of the _CPPopoverWindow from the CPPopover.
For example with a double click on a button. Now the _CPPopoverWindow has a var isOpening and nothing else is possible during the opening of the popover (not possible to close or to click somewhere else etc etc). This work as in Cocoa.

Test app in Tests/Manual/CPPopover/
2014-06-23 17:29:18 -07:00
Alexandre Wilhelm cd6ffba9ac Fixed: CPPanel and popover doesn't close when hitting escape
Previously, a panel or a popover didn't close when the user hit the key escape.
Now it does. The panel or the popover will close on the keyDown event as in cocoa.

Test app in Tests/Manual/CPPanelTest/ and Tests/Manual/CPPopoverTests

Fixed #1767
2014-06-18 16:29:13 -07:00
Antoine Mercadal f953b4dc0f FIXED: Warning when closing a popover for the first time
Previously, the _CPPopoverWindow was trying to remove itself as observer while it wasn't defined
as an observer. This would cause a warning. This patch encapsulates addObserver and removeObserver into methods
that actually check if it's already observing/not observing when trying to observe/not observe
2014-05-20 13:37:53 -07:00
Antoine Mercadal 584955caa8 FIXED: updateFrameWithSize: was always assuming the popver was open 2014-05-05 13:23:44 -07:00
Alexandre Wilhelm 9d694a1589 Fixed: setContentSize doesn't work when called several times
Previously when calling setContentSize several times, the final frame of the view was wrong.
I removed the animation as well. This doesn't work, and need a lot more of implementation.
2014-04-30 16:23:00 -07:00
Alexandre Wilhelm 4dadf0cb95 Fixed: CPPopover doesn't change his frame when with setContentSize
Previously when we changed the contentSize of an open popover, nothing happens.
Now, we the frame change and it's animated if needed
2014-04-30 15:38:13 -07:00
Antoine Mercadal 07f7ad0a05 FIXED: Crash when hit CMD+Z on a control in a CPPopover
Previously, there were collision in addition delegate bitmask identifiers between CPWindow and _CPPopoverWindow.
This patch fixes this collision
2014-04-23 11:28:41 -07:00
Antoine Mercadal 3e187df75b FIXED: CPPopover transitionend not correctly called in random cases with Chrome 34
There are some weird race conditions happening in Chrome 34 regarding the transitionend event. Setting the timeout to 10ms is not noticealble for the user, and seems to fix the issue.
2014-04-14 15:19:49 -07:00
Ashley Williams c5637ea29b Formatting: Fixed formatting in _CPPopoverWindow
Refs #2137
2014-03-24 05:08:36 -07:00
Ashley Williams be3c4abbce Fixed: CPPopover not closing in some browsers
In browsers without support for _DOMElement.removeEventListener CPPopover
throws an exception when closing, and the popover is not removed. This fix
checks for support implicitly using the _browserAnimates variable.
2014-03-23 21:05:56 -07:00
Martin Carlberg bb58a206a8 Fixed: Removed all warnings of conflicting return and parameter types caused by the new compiler 2013-08-12 16:46:14 +02:00
Aparajita Fishman 391ff7279d Fixed: capp_lint errors. 2013-05-16 15:02:45 -04:00
Aparajita Fishman dc96b3862b Fixed: popovers were not constrained to the usable content frame
Previously, popovers did not properly stay below the menu bar.

This commit ensures they stay within whatever is the usable content frame for the platform window.
2013-03-13 17:00:54 -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 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
Alexander Ljungberg ff15f11927 Fixed: transient popover windows would close on mouse interaction with certain controls.
Without this fix, a transient popover would close if the autocomplete menu of a token field contained in it was clicked.

This happened because the popover considered the click to be on a different window. Although not tested, it's likely the same thing would happen if the menu of a combo pop or a pop up button was clicked.

This fix makes it so that any child window of a popover can be clicked without the popover closing.
2013-03-10 22:48:26 +00:00
Alexander Ljungberg 4991913f45 Fixes #1716. Fixed: blurry popovers in Chrome. 2013-02-08 00:29:38 +00:00
Aparajita Fishman 0892ca1a2d Popovers should not overlap the menu bar
Also eliminated redundant code in CPMenu -menuBarHeight
2013-02-06 19:24:09 +08:00
Aparajita Fishman b7d1ccf9b6 Child window/popover fixes
- Added CPWindow -_parentWindowDidOrderInChild to notify a window when it is directly ordered in by a parent.
- Fixed observing of target view frame changes to work in all possible cases.
- Fixed typo in code introduced in last commit in CPApplication -sendEvent.
2013-01-28 12:36:59 +08:00
Aparajita Fishman fdbef474f0 Final fixes for popovers as child windows
- Fixed case where a dangling transition function was left when closing a popover.
- Fixed case where closing a popover, moving the target view, then reopening the same popover would not reposition the popover when resizing the target view's window.
- Optimized repositioning of popover on target view change.
- Implemented transitional popovers via trapped mouse down events.
- Implemented dequeue: argument of CPApplication -setTarget:selector:forNextEventMatchingMask:untilDate:inMode:dequeue: and -setCallback:forNextEventMatchingMask:untilDate:inMode:dequeue:.
- Fixed some child window behavior when ordering/closing.
- Eliminated no longer necessary window close notification in CPPopover.
- Fixed window title in theme so it doesn't dim when window is main but not key.
2013-01-28 09:32:37 +08:00
Aparajita Fishman c29a54e21a More work on child windows
- Popovers are implemented as child windows.
- Renamed _CPAttachedWindow/_CPAttachedWindowView to _CPPopoverWindow/_CPPopoverWindowView, since that is its only use.
- The default for CPView -acceptsFirstMouse is now NO, per Cocoa. Subclasses override this as necessary.
- _CPWindowView -hitTest returns self it the mouse is within a resize region, which may be outside the window's frame.
- Fixed an off by one bug in CPDomWindowLayer -insertWindow:atIndex:, where inserting a visible window behind a window it is already behind would cause it to move up one from its intended position.
- Updated the ChildWindows and CPPopover test apps.
2013-01-27 10:32:23 +08:00