Re: AutoSave for Windows

2016-11-22 Thread Andreas Mayer

> Am 22.11.2016 um 07:34 schrieb Gerriet M. Denkmann :
> 
> But now some obnoxious NSPersistentUIRestorer takes over:

The docs say window restoration uses the window's identifier. Is that one set 
properly for both windows?

You can find it in Xcode's identity inspector.



___

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: Flipped print previews

2016-11-22 Thread Jeff Evans
Thanks again Gary - but I looked into this by breaking at attempts to call 
setDisplayNeeded on the view, with no luck. Can't find anything in my code that 
is dirtying the view during the print draw.

However, another idea arises:
I am using this method to obtain the current CGContext  during all this drawing 
of various objects:

NSGraphicsContext* nsContext = [NSGraphicsContext currentContext];
CGContextRef currentCGContext = [nsContext CGContext];

I notice that during [printOperation runOperation] the nsContext returned is an 
NSPrintPreviewGraphicsContext*, which sounds right. But if, as is usually the 
case, the print preview draws reduced and mirrored, I force a redraw of the 
print preview by touching one of the dialog controls - and then I get a 
different NSPrintPreviewGraphicsContext*, and this one always works properly.

I should think that the graphics context would be the same for the initial draw 
and a subsequent refresh, so perhaps this is a hint. The two certainly behave 
differently. But why would the initial one be wrong?

Another hint is that sometimes the first attempt to print a file works shows a 
correct preview, while subsequent ones require the refresh to display properly. 
 More often the initial attempt is wrong. Don't you hate those problems that 
are not reliably repeatable? Yet that also should be a hint, if I could make 
sense of it.

Jeff


On Nov 20, 2016, at 11:43 PM, Gary L. Wade wrote:



I remembered seeing something like that in an app that had been doing some 
things deep with the drawRect: call that was causing the view to become dirty 
again. I fixed it by getting rid of that code. Try looking for something like 
that first.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/

> On Nov 20, 2016, at 9:33 PM, Jeff Evans  wrote:
> 
> p.s. As I was unclear: the image returns YES to flipped and draws on that 
> assumption, looking good. When I say the image in the print dialog is 
> "flipped" I mean that it is backwards - mirrored - the reverse of what it 
> should be - as if it were an unflipped view - until it is drawn a second time.
> 
> 
> I'm printing from a view-based OSX app (compiled for 10.11), and have found 
> it easy to print by creating a print operation from the view in question. The 
> view is flipped (that is, returns YES to IsFlipped) and looks good on screen. 
> The view creates a print operation this way:
> 
>   NSPrintOperation* printOp = [NSPrintOperationWithView: self printInfo: 
> [NSPrintInfo sharedPrintInfo]];
> 
>   //..then setting of margins, etc. in [printOp printInfo], then
> 
>   [printOp runOperation]
> 
>   Running the operation does the whole thing and creates a beautiful preview 
> of the page - 
> 
>   BUT not on the first draw. The initial image displayed in the print dialog 
> is flipped and often reduced to miniature. If you touch the pages-to-print 
> choice, or the All choice,  the preview image in the print dialog redraws and 
> redraws correctly. The actual print then works fine.
> 
>   This does make it more difficult print to pdf when the first draw is wrong, 
> since the pdf is also wrong on the first draw. But if I choose "view pdf in 
> preview" then all is well - it draws nicely and I can then use Preview's 
> export command to save it, or print.
> 
>   But this is no way to live. Don't want to have to tell customers to use a 
> work-around.
> 
>   There must be something that needs initializing that is corrected after 
> that first draw. Or is this just a glitch?
> 
> 
>   Thanks, Jeff
> 




--
If this email is spam, please report it to
https://support.onlymyemail.com/view/report_spam/MTAxOTYyOjE5NDI1ODMyNTY6amV2YW5zQGFycy1ub3ZhLmNvbTpkZWxpdmVyZWQ



___

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

CABasicAnimation in a view that's covered by another?

2016-11-22 Thread Eric E. Dolecki
I have a cross-fading album art thing happening. When I can see the
imageview it works fine, if it's totally covered by another view (a panel I
slide up), it seems to not change. Is this a known thing? Doesn't seem
right - I am trying to track down other related things to see.

myfade = CABasicAnimation(keyPath: "contents")
myfade.duration = 0.4
myfade.fromValue = largeAlbumCover.image!.cgImage
myfade.toValue = artImage?.cgImage
myfade.delegate = self
largeAlbumCover.layer.add(myfade, forKey: "animateContents")
largeAlbumCover.image = artImage

Thanks,
Eric
___

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: NSComboBoxCell subclass pointers?

2016-11-22 Thread Robert Monaghan
Hi James,

Very clever way of getting the boundaries of each cell!
I was wondering if this was possible. I’ll take a shot at this and how far I 
get.
Thanks!

bob.


> On Nov 21, 2016, at 5:46 PM, James Walker  wrote:
> 
> On 11/20/2016 8:15 PM, Robert Monaghan wrote:
>> I have been working on a custom UI for my Cocoa application. By looking 
>> around the internet, I have managed to learn how to subclass a large number 
>> of UI objects on MacOSX. In many cases I could make the appearance work the 
>> way I want.
>> 
>> The last UI element that I am working on, is NSComboBoxCell. It appears to 
>> be a NSTextFieldCell with an NSButtonCell attached. It seems fairly easy to 
>> override
>> “drawWithFrame:inView"  and draw a replacement artwork. But there are a 
>> bunch of unknowns/pitfalls..
>> 
>> The part that I suspect that I have to subclass is the NSButtonCell that I 
>> believe is drawing the "Arrow Button”.
>> But how is this done, along side the NSTextField that makes up the 
>> NSComboBoxCell class? When I look at the NSComboBoxCell header files, I 
>> don’t see any obvious clues to figure out the geometry of the NSButtonCell, 
>> that is apparently being used alongside the NSTextField, itself.
>> 
>> Are there any ways to get to the NSButtonCell stored inside the 
>> NSComboBoxCell Object? (Ideally so that I can override and install my own 
>> NSButtonCell..)
> 
> In my NSComboBoxCell subclass, I figured out where the "button" part ought to 
> be as follows:
> 
> NSRect drawingRect = [self drawingRectForBounds: cellFrame];
> NSRect titleBounds = [self titleRectForBounds: drawingRect];
> NSRect buttonBounds = NSMakeRect( NSMaxX( titleBounds ),
>   NSMinY(drawingRect),
>   NSMaxX(drawingRect) - NSMaxX( titleBounds ),
>   NSHeight(drawingRect) );
> 
> And then I drew my own button content.
> ___
> 
> 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/bob%40gluetools.com
> 
> This email sent to b...@gluetools.com


___

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: AutoSave for Windows

2016-11-22 Thread Gerriet M. Denkmann

> On 22 Nov 2016, at 23:07,Andreas Mayer  wrote:
> 
>> Am 22.11.2016 um 07:34 schrieb Gerriet M. Denkmann :
>> 
>> But now some obnoxious NSPersistentUIRestorer takes over:
> 
> The docs say window restoration uses the window's identifier. Is that one set 
> properly for both windows?
> 
> You can find it in Xcode’s identity inspector.

No idea what “properly” does mean.

It was set for both windows to:
Identity
Identifier = Automatic

which I understood to mean “Xcode will do automatically the right thing for 
you”.

Seems I was wrong. I changed the Identifier to “F” resp. “P” and all this 
strange behaviour did disappear.

Thanks a lot for this suggestion. I would never have found this without your 
help!


Mit freundlichen Grüßen

Gerriet.


___

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: CABasicAnimation in a view that's covered by another?

2016-11-22 Thread David Duncan

> On Nov 22, 2016, at 7:26 AM, Eric E. Dolecki  wrote:
> 
> I have a cross-fading album art thing happening. When I can see the
> imageview it works fine, if it's totally covered by another view (a panel I
> slide up), it seems to not change. Is this a known thing? Doesn't seem
> right - I am trying to track down other related things to see.

What do you mean by “seems to not change”? Can you see the view through the 
panel you slide up? If not, how can you tell what is going on?

> 
>myfade = CABasicAnimation(keyPath: "contents")
>myfade.duration = 0.4
>myfade.fromValue = largeAlbumCover.image!.cgImage
>myfade.toValue = artImage?.cgImage
>myfade.delegate = self
>largeAlbumCover.layer.add(myfade, forKey: "animateContents")
>largeAlbumCover.image = artImage
> 
> Thanks,
> Eric
> ___
> 
> 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/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.com

--
David Duncan


___

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: CABasicAnimation in a view that's covered by another?

2016-11-22 Thread Eric E. Dolecki
If the panel is up covering the UIImageView and the cross-fade is called,
and I bring the panel back down, exposing the UIImageView, the cross-fade
did not take place, the image not updated. That's how I know.

If I time the crossfade on closing the panel... a 10th of a second after
the panel starts to move (thus exposing a tiny bit of the UIImageView
before the crossfade), it works. How strange is this?

On Tue, Nov 22, 2016 at 1:57 PM David Duncan  wrote:

>
> > On Nov 22, 2016, at 7:26 AM, Eric E. Dolecki  wrote:
> >
> > I have a cross-fading album art thing happening. When I can see the
> > imageview it works fine, if it's totally covered by another view (a
> panel I
> > slide up), it seems to not change. Is this a known thing? Doesn't seem
> > right - I am trying to track down other related things to see.
>
> What do you mean by “seems to not change”? Can you see the view through
> the panel you slide up? If not, how can you tell what is going on?
>
> >
> >myfade = CABasicAnimation(keyPath: "contents")
> >myfade.duration = 0.4
> >myfade.fromValue = largeAlbumCover.image!.cgImage
> >myfade.toValue = artImage?.cgImage
> >myfade.delegate = self
> >largeAlbumCover.layer.add(myfade, forKey:
> "animateContents")
> >largeAlbumCover.image = artImage
> >
> > Thanks,
> > Eric
> > ___
> >
> > 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/david.duncan%40apple.com
> >
> > This email sent to david.dun...@apple.com
>
> --
> David Duncan
>
>
___

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

Swift 3: How to Create CFArray of CGColors?

2016-11-22 Thread Charles Jenkins
I’m sure this will turn out to be elementary, but the Apple documentation
of CFArray is so EMPTY that I can’t seem to figure it out.

I have this line of code:

let gradient = CGGradient( colorsSpace: CGColorSpaceCreateDeviceRGB(),
colors: [ clearWhite.cgColor, clearWhite.cgColor,
clearWhite.blendedColorWithFraction(0.5, ofColor: white).cgColor,
white.cgColor ], locations: [0, 0.57, 0.93, 1])

The array of colors is no longer legal in Swift 3. I get an error
message—“Contextual type CFArray cannot be used with an array
literal”—which I think is saying I must pass a CFArray.

Despite Xcode crashing every few minutes while I’m typing, I was able to
create a CFMutableArray object, but then I get an error when trying to add
the colors because they aren’t unsafe pointers.

How can I convert my array to the needed CFArray?

-- 

Charles
___

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: Swift 3: How to Create CFArray of CGColors?

2016-11-22 Thread Eric Dolecki

http://stackoverflow.com/questions/39514375/cggradient-issues-with-swift-3
Get Outlook for iOS

_
From: Charles Jenkins 
Sent: Tuesday, November 22, 2016 7:18 PM
Subject: Swift 3: How to Create CFArray of CGColors?
To: Cocoa-Dev (Apple) 


I’m sure this will turn out to be elementary, but the Apple documentation
of CFArray is so EMPTY that I can’t seem to figure it out.

I have this line of code:

let gradient = CGGradient( colorsSpace: CGColorSpaceCreateDeviceRGB(),
colors: [ clearWhite.cgColor, clearWhite.cgColor,
clearWhite.blendedColorWithFraction(0.5, ofColor: white).cgColor,
white.cgColor ], locations: [0, 0.57, 0.93, 1])

The array of colors is no longer legal in Swift 3. I get an error
message—“Contextual type CFArray cannot be used with an array
literal”—which I think is saying I must pass a CFArray.

Despite Xcode crashing every few minutes while I’m typing, I was able to
create a CFMutableArray object, but then I get an error when trying to add
the colors because they aren’t unsafe pointers.

How can I convert my array to the needed CFArray?

-- 

Charles
___

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/edolecki%40gmail.com

This email sent to edole...@gmail.com



___

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: Swift 3: How to Create CFArray of CGColors?

2016-11-22 Thread Quincey Morris
On Nov 22, 2016, at 16:17 , Charles Jenkins  wrote:
> 
> I have this line of code:
> 
> let gradient = CGGradient( colorsSpace: CGColorSpaceCreateDeviceRGB(),
> colors: [ clearWhite.cgColor, clearWhite.cgColor,
> clearWhite.blendedColorWithFraction(0.5, ofColor: white).cgColor,
> white.cgColor ], locations: [0, 0.57, 0.93, 1])
> 
> The array of colors is no longer legal in Swift 3. I get an error
> message—“Contextual type CFArray cannot be used with an array
> literal”—which I think is saying I must pass a CFArray.

The immediate problem is that the error message is spurious. Method 
“blendedColorWithFraction(:ofColor:)” has been renamed in Swift 3 to 
“blendedColor(withFraction:of:)”, so your array cannot be constructed as the 
desired type "[GCColor]".

The secondary problem is that “blendedColor(withFraction:of:)” returns an 
optional, so you need a “!” operator after it. 

The third problem is that you need “as CGArray”. There would have been a fix-it 
for this, if the first two problems had been fixed. The following code compiles 
in a (macOS) playground:

> import AppKit
> 
> let clearWhite = NSColor.white // or whatever
> let white = NSColor.white // or whatever
> 
> let colors = [ clearWhite.cgColor, clearWhite.cgColor,
>clearWhite.blended(withFraction: 0.5, of: white)!.cgColor,
>white.cgColor ]
> 
> let gradient = CGGradient( colorsSpace: CGColorSpaceCreateDeviceRGB(),
>colors: colors as CFArray, locations: [0, 0.57, 
> 0.93, 1])

I would expect the iOS version is the same, if that’s what you need.

For puzzling problems like this, I suggest “unrolling” the parameters like the 
above, specifying explicit type annotations if you’re not sure what types are 
being inferred.

___

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: CABasicAnimation in a view that's covered by another?

2016-11-22 Thread David Duncan

> On Nov 22, 2016, at 1:22 PM, Eric E. Dolecki  wrote:
> 
> If the panel is up covering the UIImageView and the cross-fade is called, and 
> I bring the panel back down, exposing the UIImageView, the cross-fade did not 
> take place, the image not updated. That's how I know.
> 
> If I time the crossfade on closing the panel... a 10th of a second after the 
> panel starts to move (thus exposing a tiny bit of the UIImageView before the 
> crossfade), it works. How strange is this?

Possible its a bug related to if the OS thinks that the image view needs to be 
drawn or not. If you give your panel alpha <1 does that resolve the issue as 
well? (If so, please file a bug).

> 
> On Tue, Nov 22, 2016 at 1:57 PM David Duncan  > wrote:
> 
> > On Nov 22, 2016, at 7:26 AM, Eric E. Dolecki  > > wrote:
> >
> > I have a cross-fading album art thing happening. When I can see the
> > imageview it works fine, if it's totally covered by another view (a panel I
> > slide up), it seems to not change. Is this a known thing? Doesn't seem
> > right - I am trying to track down other related things to see.
> 
> What do you mean by “seems to not change”? Can you see the view through the 
> panel you slide up? If not, how can you tell what is going on?
> 
> >
> >myfade = CABasicAnimation(keyPath: "contents")
> >myfade.duration = 0.4
> >myfade.fromValue = largeAlbumCover.image!.cgImage
> >myfade.toValue = artImage?.cgImage
> >myfade.delegate = self
> >largeAlbumCover.layer.add(myfade, forKey: "animateContents")
> >largeAlbumCover.image = artImage
> >
> > Thanks,
> > Eric
> > ___
> >
> > 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/david.duncan%40apple.com 
> > 
> >
> > This email sent to david.dun...@apple.com 
> 
> --
> David Duncan
> 

--
David Duncan

___

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