Re: PopUp menus in tables

2016-10-04 Thread Gary L. Wade
If you’re using a view-based table view (as all should be nowadays), and you 
have the popup button you clicked on, get the enclosing NSTableRowView and call 
rowForView:
--
Gary L. Wade
http://www.garywade.com/ 
> On Oct 4, 2016, at 4:03 PM, Steve Mills  wrote:
> 
>> On Oct 4, 2016, at 17:39, Frank D. Engel, Jr.  wrote:
>> 
>> Ok - wasn't aware of that one.
>> 
>> I tried it, but sadly get the same results.
> 
> Huh. I just used it the other day for handling right-clicks in tables and it 
> works correctly for that.
> 
> Steve via iPad
> 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: PopUp menus in tables

2016-10-04 Thread Steve Mills
> On Oct 4, 2016, at 17:39, Frank D. Engel, Jr.  wrote:
> 
> Ok - wasn't aware of that one.
> 
> I tried it, but sadly get the same results.

Huh. I just used it the other day for handling right-clicks in tables and it 
works correctly for that.

Steve via iPad


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: PopUp menus in tables

2016-10-04 Thread Frank D. Engel, Jr.

Ok - wasn't aware of that one.

I tried it, but sadly get the same results.


On 10/3/2016 23:17, Steve Mills wrote:

On Oct 3, 2016, at 18:29:34, Frank D. Engel, Jr.  wrote:

Does anyone know of a way to determine which row of the table the menu is being 
opened for, rather than the one that was selected before I tried to open it?

You need to use clickedRow.

--
Steve Mills
Drummer, Mac geek


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/fde101%40fjrhome.net

This email sent to fde...@fjrhome.net



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

PDFKit on 10.12

2016-10-04 Thread Jonathan Mitchell
PDFKit seems a bit disturbed on Sierra.
The 10.12 beta 3 seems to improve things but there are still some rendering 
stutters etc.

Has PDFKit been reworked - there doesn’t seem to be any mention of it in the 
release notes?
If so it might be a question of waiting for the internal gremlins to be hunted 
down rather than me wasting too much time on this.

Before 10.12 PDFPage -(void)drawWithBox:(PDFDisplayBox)box was called.

In 10.12 PDFPage -(void)drawWithBox:(PDFDisplayBox)box 
toContext:(CGContextRef)context was defined.

However, on 10.12.0 when printing NSPrintThumbnailView calls 
drawWithBox:(PDFDisplayBox)box inContext:(CGContextRef)context not toContext:.
My only solution here has been to override the private  PDFPage 
-(void)drawWithBox:(PDFDisplayBox)box inContext:(CGContextRef)context

In addition screen rendering seems to be suffering.
Rendering now has to target the CGContextRef given in PDFPage 
drawWithBox:toContext:

I render additional text onto the PDF using NSLayoutManager using a flipped 
NSGraphicsContext.

Pre 10.12 this worked fine. Now it is flakey - often I just get a PDFPage rect 
filled with red (printing seems okay).
Perhaps I am not handling the context correctly.

It would seem that the actual generation is now called on a background thread 
and that [NSGraphicsContext currentContext] can be nil.
I try to deal with this but all is still not quite what it was.

- (void)drawWithBox:(PDFDisplayBox)box inContext:(CGContextRef)context
{
[super drawWithBox:box inContext:context];
   
  BOOL hasInitialNSGraphicsContext = NO;

if ([NSGraphicsContext currentContext]) {
[NSGraphicsContext saveGraphicsState];
hasInitialNSGraphicsContext = YES;
}
else {
CGContextSaveGState(context);
}

// life is much easier if we use a flipped co-ordinate system.
// NSLayoutManager expects a flipped NSGraphicsContext to be present.
NSGraphicsContext *flippedGC = [NSGraphicsContext 
graphicsContextWithGraphicsPort:context flipped:YES];
[NSGraphicsContext setCurrentContext:flippedGC];

// define the flip transform
NSAffineTransform* xform = [NSAffineTransform transform];
[xform translateXBy:0.0 yBy:self.mediaBoxRect.size.height];
[xform scaleXBy:1.0 yBy:-1.0];
[xform concat];

// draw all map items
… do my drawing here

if (hasInitialNSGraphicsContext) {
[NSGraphicsContext restoreGraphicsState];
}
else {
CGContextRestoreGState(context);
}

}

Jonathan
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: MLMediaLibrary sometimes does not call my KVO

2016-10-04 Thread Gabriel Zachmann
> It’s very hard for a sandboxed app to get access to the internals of Photos 
> without using MLMediaLibrary, though not too difficult for non-sandboxed. 
> MLMediaLibrary was added because of this need.

I was wondering whether this API (Photos Framework aka PhotoKit) would be 
better suited :
  https://developer.apple.com/reference/photos?language=objc

According to the doc, it should be available on macOS 10.11+

Best regards, 
Gabriel.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com