Commit Graph
10 Commits
Author SHA1 Message Date
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