Re: Best practice with NSProgressIndicator

2017-07-28 Thread Andreas Mayer

> Am 28.07.2017 um 17:57 schrieb Mark Allan :
> 
> Setting the max value to 100 and only updating 100 times (i.e. as a 
> percentage) seems too infrequent because the loop can iterate more than a 
> million times.

Just keep track of the time of the last update and do it every 0.1 seconds or 
so. Redrawing a progress bar 10 times a second shouldn't have any noticeable 
impact on the CPU and you'll still get a fluid (enough) animation.

While you could use a timer, that seems unnecessarily complicated.


Andreas
___

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 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: Problem with CAAnimation in a screensaver

2016-09-28 Thread Andreas Mayer

> Am 29.09.2016 um 01:01 schrieb Gabriel Zachmann :
> 
> Any ideas why that is?

The docs have example code on how to pause and resume an animation:

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreAnimation_guide/AdvancedAnimationTricks/AdvancedAnimationTricks.html

--
Listing 5-4  Pausing and resuming a layer’s animations
-(void)pauseLayer:(CALayer*)layer {
   CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() 
fromLayer:nil];
   layer.speed = 0.0;
   layer.timeOffset = pausedTime;
}
 
-(void)resumeLayer:(CALayer*)layer {
   CFTimeInterval pausedTime = [layer timeOffset];
   layer.speed = 1.0;
   layer.timeOffset = 0.0;
   layer.beginTime = 0.0;
   CFTimeInterval timeSincePause = [layer convertTime:CACurrentMediaTime() 
fromLayer:nil] - pausedTime;
   layer.beginTime = timeSincePause;
}
--



___

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: Best way to make a little piece of data persistent?

2016-09-28 Thread Andreas Mayer

> Am 29.09.2016 um 00:45 schrieb Gabriel Zachmann :
> 
> I need to make a few small pieces of data (an integer, a string, ...)
> persistent across different invocations of my screen saver.
> 
> That is, when the screen saver is about to quit, I need to save it,
> when it gets invoked the next time, I need to load it again.
> 
> What is the recommended (and easiest?) way to do that?

NSUserDefaults

___

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 - Notification leaks

2016-06-18 Thread Andreas Mayer
I have just migrated a project to Swift 3 which worked surprisingly well for 
the number of changes necessary.

After checking out the new memory graph (cool!) I noticed that I am leaking 
notifications. Example:

NSConcreteNotification 0x102c28600 {name = 
NSApplicationDidBecomeActiveNotification; object = }

The really bad thing is, some were keeping old windows in memory!


After changing back to NSNotification where possible, all is well again.

Leaking:

func windowDidBecomeKey(_ notification: Notification) {

Working:

func windowDidBecomeKey(_ notification: NSNotification) {


Block based observers do still leak though.


This is what it looks like:

http://www.harmless.de/images/other/Notification-Leak.png

(Is there a way to get a textual representation of that graph?)

And here the backtrace:

http://www.harmless.de/images/other/Notification-Leak-Backtrace.png

Just below that is my window's init call.

(I couldn't figure out how to copy the backtrace either.)


___

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: How to Truncate lines in NSScrollView/NSClipView/NSTextView Combo

2016-04-24 Thread Andreas Mayer

> Am 24.04.2016 um 17:15 schrieb Dave :
> 
> I have an NSTextView inside an NSScrollView. At present the Text Lines is 
> wrapped if they are longer than the Scroll View, I'd them to truncate. I had 
> thought I’d seen some properties somewhere for doing this but I can’t find 
> them in IB.

NSParagraphStyle lineBreakMode  seems to be what you are looking for.



___

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

Window Resizing

2016-04-17 Thread Andreas Mayer
Hi all,

I've got a borderless window which users should be able to partially move above 
the top of the screen frame.

By default, windows stop moving/resizing upwards just below the menu bar. Is 
there some way to change that?

I tried overriding -constrainFrameRect:toScreen: but that doesn't help.

Any ideas? Moving the window is easy enough but I'm not keen on reimplementing 
the resizing code. :-/


-Andreas
___

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: Getting key data out of the keychain

2016-01-01 Thread Andreas Mayer
Hello Marco,

> Am 31.12.2015 um 19:23 schrieb Marco S Hyman :
> 
> After much play, head scratching, and code that managed to add a bogus entry 
> to the keychain that couldn’t be deleted (time machine to the rescue) I came 
> up with one way to add an entry to the keychain and retrieve the entry: use 
> the Generic Password class.  In swift the code to fetch the password looked 
> like this -- password returned as NSData.

thanks, but that's not what I was looking for.

Actually, I am able to save and retrieve the key just fine. It's just that I 
only get a SecKeyRef, not the binary data.

The trick to put a valid key into the keychain is to use 
SecKeyGenerateSymmetric() and have it save the key in the keychain immediately. 
You will then be able to retrieve it normally using SecItemCopyMatching().
To have SecKeyGenerateSymmetric() put the key into the default keychain, add 
the attribute kSecAttrIsPermanent with a value of true.
Or you can add the kSecUseKeychain attribute and supply the keychain you want 
it to use.

For now, I decided to work around the key bytes extraction problem by using 
SecTransforms - which take a SecKeyRef - for encoding instead of CCCrypt().
The reason I went with CCCrypt() first is, that I had a problem with creating 
SHA1 hashes with SecTransform and running that parallel inside an NSOperation. 
My application actually locked up with dozens of those NSOperations waiting on 
some semaphore. So I had to use CommonCrypto for that.

I didn't run into any problems with the SecEncrypt/DecryptTransform.

Here is my code if anyone is interested:

static func encryptData(data: NSData, withKey key: SecKeyRef) throws -> 
NSData {
return try cryptData(data, withKey: key, transformCreate: 
SecEncryptTransformCreate)
}

static func decryptData(data: NSData, withKey key: SecKeyRef) throws -> 
NSData {
return try cryptData(data, withKey: key, transformCreate: 
SecDecryptTransformCreate)
}

static func cryptData(data: NSData, withKey key: SecKeyRef, 
transformCreate: (SecKey, UnsafeMutablePointer) -> 
SecTransform) throws -> NSData {
var result: NSData?
var transform: SecTransformRef?
var error: Unmanaged?

transform = transformCreate(key, )
if error != nil { let retainedError: ErrorType = 
error!.takeRetainedValue(); throw retainedError }

SecTransformSetAttribute(transform!, kSecPaddingKey, 
kSecPaddingPKCS7Key, );
if error != nil { let retainedError: ErrorType = 
error!.takeRetainedValue(); throw retainedError }

SecTransformSetAttribute(transform!, 
kSecTransformInputAttributeName,
data, );
if error != nil { let retainedError: ErrorType = 
error!.takeRetainedValue(); throw retainedError }

result = SecTransformExecute(transform!, ) as? NSData;
if error != nil { let retainedError: ErrorType = 
error!.takeRetainedValue(); throw retainedError }

return result!
}


But I *still* don't know how to get at the key bytes of a SecKeyRef. :P


Andreas
___

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

Getting key data out of the keychain

2015-12-31 Thread Andreas Mayer
I want to encrypt something inside my OS X application: So I thought I'd store 
the key inside the keychain.

After a *lot* of reading and tinkering I finally managed to create a new AES 
key and get it back out again (as a SecKeyRef).

Now I want to use it with CCCrypt()

That expects raw key data, not a SecKeyRef.

I tried to get the data by asking the keychain for a data blob with 
kSecReturnData.

And I do get back a CFDataRef. But it is 96 Bytes, which strikes me as odd for 
a 128 bit key. And the actual bytes don't seem to change much between different 
keys.


A bit more information:

I create the key using SecKeyGenerateSymmetric() and that seems to work fine as 
the key shows up in Keychain Access.

I get the key data out of the keychain using SecItemCopyMatching() which also 
seems to work fine. It's just that the data returned is not what I was 
expecting. Also, I'm using Swift, and working with C-APIs is quite terrible. 
After some research I came up with this code to get at the reference returned 
by the SecItemCopyMatching():

var temp: Unmanaged?
let status = withUnsafeMutablePointer() { 
SecItemCopyMatching(query, UnsafeMutablePointer($0)) }
if status == errSecSuccess {
result = temp!.takeRetainedValue()
}

As I said, that at least seems to work since I get the type of objects expected.
(A lot of seems, I realize. But clearly I'm missing something and I don't know 
what.)



So these are my questions:

I found a lot of code online that was promising, but nothing does quite what I 
need. Do I even have the right approach here?

Has anyone ever done this? Is there an easier method to get the actual bytes 
for an AES key out of a SecKeyRef?

Help!  :)


Andreas


___

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: Finder-like user interface?

2015-12-30 Thread Andreas Mayer

> Am 27.12.2015 um 23:45 schrieb SevenBits :
> 
> NSCollectionView appears to suffice, and I’ve used it before, but it simply 
> isn’t performant as it doesn’t reuse cells, 

NSCollectionView does reuse cells when you use the new API available in 10.11.

I find it quite performant. Would be even better if it did some predictive 
loading of cells. You know, loading cells that are just one row/column out of 
view. (I should file a feature request.)


Andreas
___

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: Unknown segue relationship: Prototype

2015-12-14 Thread Andreas Mayer

> Am 14.12.2015 um 10:48 schrieb Rick Mann :
> 
> Googling, this appeared to be a problem with Xcode 6b, but persists in 7.1 
> beta versions. I'm not sure if it's still a problem. Is there any way around 
> it?
> 
>   
> http://stackoverflow.com/questions/25123365/unknown-segue-relationship-prototype-with-nscollectionview
> 

I did what the answer on stackoverflow suggests (i.e. load the collection view 
from a nib and add it in code) and that works. Didn't really try anything else.


Andreas
___

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 - internal class conforming to public protocol

2015-11-25 Thread Andreas Mayer

> Am 25.11.2015 um 08:13 schrieb Marco S Hyman :
> 
> As I read that adopting a public protocol requires the methods that implement 
> the protocol to be public (but only those methods).

That's not how I read it. And it does not to work that way either. This 
compiles fine:

public protocol PublicProtocol {
func someFunction()
}

internal class SomeClass: PublicProtocol {
internal func someFunction() {
// implementation
}
}

I think it means you can't declare internal functions for a public protocol, 
whereas you can declare internal functions for a public class.

This does not compile:

public protocol OtherPublicProtocol {
internal func someFunction()
}

The compiler complains that "'internal' modifier cannot be used in protocols".


Andreas
___

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 - internal class conforming to public protocol

2015-11-25 Thread Andreas Mayer

> Am 25.11.2015 um 08:56 schrieb Quincey Morris 
> :
> 
>> That's explained in "Using Swift with Cocoa and Objective-C":
>> 
>> "The compiler does not automatically insert the @objc attribute for 
>> declarations marked with the private access-level modifier.”
> 
> That can’t be the full explanation, because the other private method doesn’t 
> produce an error, Roland said.

I can't replicate that behavior.

This doesn't work:

// Roland's protocol must be marked @objc since it has optional requirements.

@objc public protocol PublicProtocol {
func someFunction()
// ...
}

private class SomeClass: NSObject, PublicProtocol {
func someFunction() {
// implementation
}
}

Type 'SomeClass' does not conform to protocol 'PublicProtocol'
Fix-it: Candidate is not '@objc', but protocol requires it


Andreas
___

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 - internal class conforming to public protocol

2015-11-24 Thread Andreas Mayer


> if I define an internal class which implements a public protocol, who is able 
> to call the methods in that protocol? Anyone (it’s a public protocol), only 
> classes in the same framework or source file (the class is internal)?

If you declare it internal it's internal. Adopting a public protocol doesn't 
change that.

> In this instance I have an internal class implementing the CBCentralManager 
> protocol and yet if I supply this as a delegate, CoreBluetooth is able to 
> call those internal methods just fine. I suspect in this case it’s because 
> we’re actually in the ObjC world here (the protocol extends NSObjectProtocol) 
> and in the ObjC world if you can find it, you can call it.

Access levels are applied at compile time only. Once you get it to compile, the 
runtime will not care. Also, there are no restrictions in respect to passing 
parameters. As long as you have access to an entity, you can pass it to someone 
else; that's your responsibility.

>  The compiler messages don’t really help to figure out what the rules are, if 
> I have this

Swift error messages are still confusing sometimes. But in this case the 
compiler is pretty explicit about the problem.

> The last one I don’t get at all, why should making the class private stop the 
> methods being implicitly @objc? 

That's explained in "Using Swift with Cocoa and Objective-C":

"The compiler does not automatically insert the @objc attribute for 
declarations marked with the private access-level modifier."

It is not explained why, but I suspect it's because @objc adds the declaration 
to the dynamic runtime and makes it introspectable. If you explicitly mark 
something as private, you might not want that. (And there's no @not-objc 
modifier.) 


Andreas
___

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 - internal class conforming to public protocol

2015-11-24 Thread Andreas Mayer

> Am 24.11.2015 um 15:10 schrieb Roland King :
> 
> in this class, centralManagerDidUpdateState() is an internal function however 
> the compiler is happy that the class satisfies CBCentralManagerDelegate even 
> though that protocol is public and centralManagerDidUpdateState() is also 
> public. How can this be, how can an internal function make a class conform to 
> a public method on a public protocol. That function is required in the 
> protocol. 

Maybe I'm misunderstanding something, but I'm not sure why you think this 
should be a problem?

You can always make things more restrictive.

It's the other way around that is not allowed. Say, using an internal protocol 
to define a public class - that wouldn't work, since the user of the class 
might not have access to the internal protocol.

The Swift book says:


Guiding Principle of Access Levels

Access levels in Swift follow an overall guiding principle: No entity can be 
defined in terms of another entity that has a lower (more restrictive) access 
level.


(I had to find the online version, since iBooks doesn't let me copy from the 
Swift book. WTF?!)

> How can this be, how can an internal function make a class conform to a 
> public method on a public protocol. That function is required in the 
> protocol. 

It's fine because the class itself is internal. So there's no problem with 
centralManagerDidUpdateState() being internal too.

As you found out, that changes, when you make the class public. Because now the 
user of the class might not be able to access centralManagerDidUpdateState() if 
it's internal.

Disclaimer: I'm still learning Swift myself, so I might have everything totally 
wrong. ;)


Andreas


___

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: Full Screen and weird grey bar

2015-11-15 Thread Andreas Mayer

> Am 13.11.2015 um 14:00 schrieb Andreas Mayer <andr...@harmless.de>:
> 
> It must be something I'm doing; when I try it in split screen, only my half 
> will show the grey bar. :-/
> 
> Any idea what the problem could be?

Well, it was my fault and in hindsight I guess it should have been obvious.

I'm hiding the title bar when the mouse is not inside the window.
Apparently that doesn't work as you thought it might when in fullscreen mode.

So what looks like a grey bar overlaying the title bar, actually seems to be 
the title bar hiding. Only that the appearance is wrong and it doesn't reveal 
the window's content. It's probably some kind of bug; but since hiding the 
title bar in fullscreen is pointless anyway, I'll just refrain from doing so.


Regards,

Andreas
___

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

Full Screen and weird grey bar

2015-11-13 Thread Andreas Mayer
Hello,

I just implemented fullscreen behavior for one of my applications.

Moving the mouse to the top of the screen will show the menu bar with the 
window's title bar below, just like expected. But then the title bar is 
immediately overlaid by a blank grey bar:

http://harmless.de/images/other/bar1.png


When I move the mouse pointer about 15 pixel below that bar, it will vanish 
again and show the title bar beneath:

http://harmless.de/images/other/bar2.png

Moving the mouse upwards again will re-display the grey bar.


It must be something I'm doing; when I try it in split screen, only my half 
will show the grey bar. :-/

Any idea what the problem could be?


Regards,

Andreas
___

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: Can an use introspection to determine if its a production app from the App Store?

2014-10-31 Thread Andreas Mayer

 Am 31.10.2014 um 12:40 schrieb Charles Jenkins cejw...@gmail.com:
 
 optionals and named arguments could be deprecated and Swift would then be an 
 easier and better language to use.

Even though it doesn't look like it, I really hope you were joking ...


Andreas
___

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: Crash while resizing window

2014-09-28 Thread Andreas Mayer

Am 24.09.2014 um 18:57 schrieb Alex Zavatone z...@mac.com:

 Stupid question, but is r ins or your variables?  When the assertion is 
 thrown, what is r?

The debugger doesn't know anything about 'r'.

 There is a report on this on forums.codeblocks.org.  Google for cgregion.c.  
 There is a suggestion to go  to Settings - Editor - Code Completion - 
 Symbols Browser - Disable Symbols Browser.

If I understand correctly, Code::Blocks, that is the IDE of that name, has a 
bug that hits the same assertion and can be avoided by disabling the symbols 
browser of that IDE.

I'm not using Code::Blocks and there is no 'Settings' menu item in Xcode.

But thanks for the suggestion.


Andreas
___

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: Crash while resizing window

2014-09-28 Thread Andreas Mayer

Am 29.09.2014 um 02:22 schrieb Graham Cox graham@bigpond.com:

 A common cause of CG assertions on transforms is a 'Nan' or 'inf' value 
 ending up in the transform (these may not be discovered until some funciton 
 is called that uses the transform).

I just checked. The only parameter that's changing while rotating is the angle; 
and logging it, it seems perfectly fine.

But now I noticed that it seems to depend on the CIFilter that is attached to 
the layer.

Specifically, it is the Sepia filter that crashes. Other filters exhibit odd 
behavior, like ever more pixellated output.

Are there documented limitations in respect to CIFilters and transforms?

I'll try to detach the filter while rotating. But that seems an odd thing to 
have to do.

Agh. Now I get the same assertion on re-applying the filter.
It feels like I'm screwing up something basic. I just have no idea what. :-(


Andreas
___

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

Crash while resizing window

2014-09-24 Thread Andreas Mayer
Hi there.

I get an assertion failure while programmatically resizing a window:

Assertion failed: (r-shape != NULL), function assert_check_region, file 
Regions/CGRegion.c, line 28.

Anyone has any idea what might be wrong and what I can do about it?


I'll explain in more detail what I am doing here.

I have a somewhat intricate window and layer layout and I'm programmatically 
resizing the window according to user input. In effect I'm rotating the 
contents of the (borderless) window while resizing the window to fit the 
contents.

This actually works fine *most* of the time. I.e. I'm usually able to rotate 
the contents by 360 degrees several times before I hit the assertion above.


The last thing I'm calling is

   [self.window setFrame:newWindowFrame display:YES];

The newWindowFrame looks perfectly normal.

As for the stack trace, the last entry in the side bar is

  -[NSWindow _setFrameCommon:display:stackSize:]

There's more in the popup in the debugger toolbar; does anyone know how to copy 
that? Anyway, I made a screenshot.

Here are *some* of the more interesting entries:

  -[NSWindow _setFrameCommon:display:stackSize:]
   ...
  -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:]
  -[NSView _drawRect:clip:]
  CAViewDraw
  view_draw(_CAView*, double, CVTimeStamp const*, bool)
   ...
   some CA::OGL:: calls
   ...
  -[CIContext measureRequirementsOf:query::results:]
   ...
   some FETreeContext and FETreeNode calls
   ...
  FEAffineTreeNode::refactorTransforms_2(FETreeContext*, unsigned int, signed 
char)
  FEMultiSourceTreeNode::copyCustomDataFrom(FETreeContext*, 
FEMultiSourceTreeNode const*, unsigned int, CGAffineTransform const]
  FEAffineTreeNode::updateDOD(FETreeContext*)
  CGSGetRegionBounds
  CGRegionGetBoundingBox
  assert_check_region

So ... something to do with some affine transform? Yes, I'm using affine 
transforms to rotate the window contents, which is located in a CALayer.


I really hope someone has an idea what could be going wrong here because I'm 
kind of stumped right now.


Andreas
___

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

GIF frame duration

2014-03-25 Thread Andreas Mayer
I'm working with GIF animations.

To find out the delay between frames, there's NSBitmap's -valueForProperty: 
with a value of NSImageCurrentFrameDuration.
I.e. [bitmap valueForProperty:NSImageCurrentFrameDuration] should report the 
delay time for the current frame.

Now what I'm seeing is AppKit reporting a frame delay of 0.1 s for any value 
below 0.6 s.

This will result in many GIFs running slower than intended.

Questions:
1. Can anyone confirm this?
2. Does someone know a way to fix it? Maybe there's some threshold setting?

I worked around this problem by parsing the GIF on my own. But I'd rather not. 
:-/

(For reference, Safari and Quicklook seem to use a threshold setting of 0.2 s.
Only animations with a frame delay of 0.01 or zero will run with a delay of 
0.1.)


Andreas
___

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: GIF frame duration

2014-03-25 Thread Andreas Mayer

Am 25.03.2014 um 16:58 schrieb Andreas Mayer andr...@harmless.de:

 Now what I'm seeing is AppKit reporting a frame delay of 0.1 s for any value 
 below 0.6 s.

That's supposed to read 0.06 s, of course.

 Safari and Quicklook seem to use a threshold setting of 0.2 s.

And 0.02 s.


Andreas
___

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: GIF frame duration

2014-03-25 Thread Andreas Mayer

Am 25.03.2014 um 17:12 schrieb D. Felipe Torres warorf...@gmail.com:

 That is normal and documented behaviour for GIFs.
 
 Here are some links about it:

Yes, I've already read those pages.

I don't care at what speed the browsers play animated GIFs. I'm using a system 
framework to find out the values stored inside the GIF file. And what the 
system reports is wrong in some cases. If this behaviour of AppKit is 
documented somewhere, that would be helpful to know.

In my opinion, I should get the real value, even if it's zero. If I decide to 
use a certain threshold, I can do that by myself.

I was about to file a bug but thought I'd ask first, to make sure the problem 
ist not on my side and there isn't some obvious solution to the problem.


Andreas
___

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: GIF frame duration

2014-03-25 Thread Andreas Mayer

Am 25.03.2014 um 17:25 schrieb Kevin Meaney k...@yvs.eu.com:

 If AppKit is using CoreGraphics for reading/writing GIF files then you might 
 have hit the same issue I did.

Hm. Not sure. First, I'm not trying to write GIFs.
And I don't see any problems with delay times forced to multiples of 0.5s. 
0.27s, for instance, is reported as such.


Andreas
___

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: GIF frame duration

2014-03-25 Thread Andreas Mayer

Am 25.03.2014 um 18:24 schrieb Greg Parker gpar...@apple.com:

 NSImage is not describing the contents of the file. NSImage is describing the 
 contents of the image as AppKit will present it. 

That seems reasonable. I guess I'd have to complain about how AppKit will 
present animated GIFs then. ;)

 You may get better results by using CGImageSource and looking for 
 kCGImagePropertyGIFDelayTime and kCGImagePropertyGIFUnclampedDelayTime. 

I'll try that. Thanks. (And thanks to Diego, who essentially suggested the same 
thing.)


Andreas
___

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: GIF frame duration

2014-03-25 Thread Andreas Mayer
CGImageSource and kCGImagePropertyGIFUnclampedDelayTime is what I want.

Thanks again.


Andreas
___

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: CALayer autoresizing difficulties

2013-07-31 Thread Andreas Mayer

Am 31.07.2013 um 07:39 schrieb livinginlosange...@mac.com:

 [_playLayer setAutoresizingMask:kCALayerMinXMargin | kCALayerMaxXMargin | 
 kCALayerMinYMargin | kCALayerMaxYMargin];

 According to this code, the CALayer should be centered, and as the NSView's 
 bounds change, the CALayer's frame should adjust to stay centered in the view 
 while the layer's bounds don't change. However, my special CALayer's bounds 
 grow as I expand my main view.

I think it works exactly the opposite way.

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaViewsGuide/WorkingWithAViewHierarchy/WorkingWithAViewHierarchy.html#//apple_ref/doc/uid/TP40002978-CH4-SW12

(This is about views, not layers. But I'm pretty sure they didn't invert the 
logic for layers only.)

---
NSViewWidthSizable
If set, the view's width changes proportionally to the change in the 
superview's width. Otherwise, the view's width does not change relative to the 
superview's width.
---

Which makes sense since kCALayerNotSizable is zero.


Andreas
___

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: Leak when drawing too fast

2013-07-30 Thread Andreas Mayer

Am 26.07.2013 um 12:41 schrieb Uli Kusterer witness.of.teacht...@gmx.net:

 No no no! Don’t do both at the same time! The display link callback is called 
 exactly when you’re supposed to draw! 

Hm. So i remove drawRect: and call that in the callback instead?

 If you call setNeedsDisplay: there, you’ll be waiting until the next time *by 
 definition*.

In that case redraw would lag a bit behind, which wouldn't be a problem in my 
case. But the timers piling up suggests, that this is more of a fundamental 
mistake to make.

Thanks Uli. I might give this solution a try just to see if I can get it to 
work. :)


Andreas
___

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: Leak when drawing too fast

2013-07-30 Thread Andreas Mayer

Am 26.07.2013 um 12:41 schrieb Uli Kusterer witness.of.teacht...@gmx.net:

 Since I can use Core Animation, that is obviously the better solution. It 
 also makes my application look less power hungry - because now it is the 
 WindowServer doing the drawing and eating cpu. ;)
 
 Not sure I follow your reasoning here. The Window server only manages layers 
 and triggers redraws. The actual drawing is still done by Quartz in your 
 process.

Ops. Missed this.

I'm essentially just drawing once and then moving bitmaps around. Before, I was 
redrawing the bitmaps at their new positions manually, which wasn't too bad 
since the system seems to optimize that case already. Now the window server is 
doing the moving around. My CPU is down to around 1% most of the time while the 
window server's is up by about 3,5%.


Andreas
___

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: Leak when drawing too fast

2013-07-25 Thread Andreas Mayer
A followup:

Am 10.07.2013 um 02:10 schrieb Uli Kusterer witness.of.teacht...@gmx.net:

 I don’t think the timers leak. Instead, I think they probably just queue up 
 on the event loop because their fire interval is greater than that at which 
 you add new timers by calling setNeedsDisplay. Could that be it?

You are right, Uli. They get released when I stop the animation.

 FWIW, I remember hearing at some WWDC that MacOS X caps its drawing at a 
 certain frequency. I think it was either 60Hz or 60fps, not sure anymore. So 
 my guess is it’s not worth trying to draw any faster because the back buffer 
 is only flushed to the screen at this slower interval anyway.

I tried different ways to limit the drawing frequency but ended up with either 
timers piling up or jittery animation.

So I finally bit the bullet and moved to Core Animation. While that solved my 
problem - some issues notwithstanding - I'm still not sure how to draw at 
exactly the right frequency manually. Oh well ...


Andreas
___

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: Leak when drawing too fast

2013-07-25 Thread Andreas Mayer

Am 25.07.2013 um 19:36 schrieb Uli Kusterer witness.of.teacht...@gmx.net:

 Have you considered using a display link callback instead of a timer?

Yes. Moving to the display link callback was when I noticed the issue in the 
first place.

Calling -setNeedsDisplay: in the display link callback is too fast. It gives 
smooth animation but leads to timers piling up in the system.

Since I can use Core Animation, that is obviously the better solution. It also 
makes my application look less power hungry - because now it is the 
WindowServer doing the drawing and eating cpu. ;)


Andreas
___

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

Leak when drawing too fast

2013-07-08 Thread Andreas Mayer
This is on OS X 10.8.4.

I'm trying to animate something and draw as smoothly as possible.

While trying to utilize a display link callback I noticed a memory leak in my 
application.
After some experimentation I found out that this is not directly linked to the 
callback but instead also happens when I use a timer with a high enough firing 
rate to send -setNeedsDisplay:YES. (i.e. 0.03 seconds interval works fine, 0.01 
seconds interval leaks)

Here is an excerpt from Instruments:

#   Event Type  ∆ RefCt RefCt   Timestamp   Responsible Library 
Responsible Caller
Malloc/Autorelease (2)  +1  00:00.760.561   Foundation  
-[NSCFTimer initWithFireDate:interval:target:selector:userInfo:repeats:]
0Malloc +1  1   00:00.760.561   Foundation  -[NSCFTimer 
initWithFireDate:interval:target:selector:userInfo:repeats:]
1Autorelease00:00.760.564   AppKit  
_handleWindowNeedsDisplayOrLayoutOrUpdateConstraints
2   CFRetain+1  2   00:00.760.571   AppKit  __83-[NSWindow 
_postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208
CFRetain/CFRelease (6)  00:00.760.573   AppKit  
__83-[NSWindow 
_postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208
3CFRetain   +1  3   00:00.760.573   AppKit  __83-[NSWindow 
_postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208
4CFRetain   +1  4   00:00.760.576   AppKit  __83-[NSWindow 
_postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208
5CFRetain   +1  5   00:00.760.578   AppKit  __83-[NSWindow 
_postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208
11   CFRelease  -1  7   00:00.775.686   AppKit  _DPSNextEvent
12   CFRelease  -1  6   00:00.775.691   AppKit  _DPSNextEvent
13   CFRelease  -1  5   00:00.775.693   AppKit  _DPSNextEvent
6   CFRetain+1  6   00:00.768.177   AppKit  _DPSNextEvent
7   CFRetain+1  7   00:00.768.179   AppKit  _DPSNextEvent
Retain/Release (2)  00:00.768.184   Foundation  
__NSFireTimer
8Retain +1  8   00:00.768.184   Foundation  __NSFireTimer
9Release-1  7   00:00.775.681   Foundation  
__NSFireTimer
10  CFRetain+1  8   00:00.775.682   AppKit  _DPSNextEvent
14  CFRelease   -1  4   00:00.775.701   AppKit  _DPSNextEvent
15  CFRelease   -1  3   00:00.775.709   AppKit  _DPSNextEvent
16  CFRelease   -1  2   00:00.775.711   AppKit  _DPSNextEvent
17  CFRelease   -1  1   00:00.775.713   AppKit  _DPSNextEvent

It seems like when I call -setNeedsDisplay:YES the system is spawning a timer 
to do something later on and when those calls come in too fast, that timer is 
leaked.

Any idea what I could do about that?
(I tried calling -setNeedsDisplay:YES only if -needsDisplay is NO which didn't 
help.)

Is there a way I can draw as fast as possible without triggering this problem?


Andreas
___

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: Adding localization on Xcode 4.4

2012-08-20 Thread Andreas Mayer

Am 17.08.2012 um 18:59 schrieb Kelly Keenan kkee...@apple.com:

 You should add new localizations to your project the same way that you add a 
 new target by selecting the Project, going to the Info tab for the Project 
 (not the target), and adding a new Localization.  Adding a new localization 
 is really a project-wide function, not specific to a single file.  This way 
 you can localize all of your localizable resources at the same time instead 
 of doing them one file at a time.

In the info for one of my projects it says English  60 Files Localized;  
German  54 Files Localized.

So how to I localize the remaining 6 files?


Andreas
___

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: Apple Aperture-like look feel

2012-08-20 Thread Andreas Mayer

Am 17.08.2012 um 21:27 schrieb Nick eveningn...@gmail.com:

 Did Apple developers
 paint every dialog element manually? Are there some classes already
 available that would allow to theme up an app like this?

They are probably using lots of subclasses for the various controls.
Since Apple wrote the original drawing code in the first place, that doesn't 
seem that hard. Just quite a bit of work.


Andreas
___

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: PubSub Framework Alternative

2012-08-15 Thread Andreas Mayer

Am 12.08.2012 um 20:53 schrieb Seth Willits sli...@araelium.com:

 The problem I'm having right now is if I add a feed, remove that feed, then 
 add a new feed with the same URL, grabbing the entries throws assertions. 

Hm. I don't seem to have this problem. I guess I'd need to make sure that the 
old feed is actually deallocated. But I'm definitely removing it from PSClient.


Andreas
___

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: guidelines for icon design, that works well with Apple standard highlighting scheme

2012-08-02 Thread Andreas Mayer

Am 02.08.2012 um 10:58 schrieb Motti Shneor su...@bezeqint.net:

 I remember reading once, in an apple document, about the right way to make 
 an icon, that will enjoy apple-highlighting, by keeping some rules on the 
 icon images. 

Template Images?

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html#//apple_ref/occ/instm/NSImage/setTemplate:

There's a short paragraph on using templates in the OS X Human Interface 
Guidelines.


Andreas
___

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: Mountain Lion problems with orderFrontColorPanel:

2012-08-02 Thread Andreas Mayer

Am 03.08.2012 um 03:41 schrieb Graham Cox graham@bigpond.com:

 Has anyone else experienced issues with the Color Panel not showing in 
 Mountain Lion?

Working fine here. In a previously compiled application as well as in a newly 
compiled (on ML) one.

I'm not using orderFrontColorPanel: though. It's invoked by clicking a color 
well or explicitly with [[NSColorPanel sharedColorPanel] 
makeKeyAndOrderFront:self].

Deployment target is 10.6, SDK is latest.


Andreas
___

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: Segmented Control Appearance

2012-03-28 Thread Andreas Mayer

Am 29.03.2012 um 02:52 schrieb David Delmonte:

 Terminating app due to uncaught exception 'NSInvalidArgumentException', 
 reason: '-[_UIAppearance setTitleTextAttributes:]: unrecognized selector sent 
 to instance 0x7c957d20'
 
 
 I would appreciate any help in understanding what I'm doing wrong..

The correct method selector for UISegmentedControl  is  
setTitleTextAttributes:forState:

.
Andreas
___

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: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions

2012-03-27 Thread Andreas Mayer

Am 27.03.2012 um 13:47 schrieb Marco Tabini:

 When you save to a file format that supports metadata, like JPEG, some of the 
 metadata is stored there, while other is derived from the file name. So, for 
 example, if you were to save a PNG file to disk with an @2x suffix, upon 
 loading it with -imageNamed: UIImage would automatically know to set up the 
 resulting object as a 2x scale image.
 
 When the filename convention is not available, that metadata needs to be 
 saved somewhere—in your case, you derive it from the file size, which, as you 
 mention, is not very portable.

The documentation for UIImage -scale says:

If you load an image from a file whose name includes the @2x modifier, the 
scale is set to 2.0. If the filename does not include the modifier but is in 
the PNG or JPEG format and has an associated DPI value, a corresponding scale 
factor is computed and reflected in this property. 

So I would expect PNG images to retain their scale value when saved and loaded.

If this does not work, there seems to be a bug somewhere.
Ray, did you try to explicitly set the image's scale value before creating the 
PNG representation?

Something like this:

UIImage *newImage;
NSData *imageData;

UIGraphicsBeginImageContext(CGSizeMake(44.0, 44.0));
[selectedImage drawInRect:CGRectMake(0.0, 0.0, 44.0, 44.0)];
newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
newImage.scale = 2.0;  // ---

imageData = UIImagePNGRepresentation(newImage);


Andreas
___

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: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions

2012-03-27 Thread Andreas Mayer

Am 27.03.2012 um 17:31 schrieb Ray:

 So I would expect PNG images to retain their scale value when saved and 
 loaded.
 
 If this does not work, there seems to be a bug somewhere.
 Ray, did you try to explicitly set the image's scale value before creating 
 the PNG representation?
 
 Well, I don't save it to a file, but to a NSData property on a Core Data 
 managed object, and I use UIGraphicsBeginImageContextWithOptions, after which 
 newImage = UIGraphicsGetImageFromCurrentImageContext() will set the scale of 
 newImage appropriately (under retina to 2.0, I checked with setting a 
 breakpoint and looking at the scale variable of the image)... It is more that 
 the imageWithData class method on UIImage always will report a scale of 1.0

The scale value is the same as set in UIGraphicsBeginImageContextWithOptions(), 
as far as I can tell.
But it will be lost when creating PNG data and reading it again. (Since I don't 
see a way of creating a PNG file without using UIImagePNGRepresentation() it 
doesn't seem to matter if the data was saved to a file or not.)

So either imageWithData does not restore the scale from PNG data or 
UIImagePNGRepresentation() does not store it in the first place.

I see that as a bug, since the PNG format is able to hold that information.


Andreas
___

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: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions

2012-03-27 Thread Andreas Mayer

Am 27.03.2012 um 19:19 schrieb Ray:

 Edit: I just checked and they say they do this for compatibility reasons. 
 It's around the 9'40'' mark, session 134 - Optimize your iPhone App for the 
 Retina Display (WWDC 2010, I assume you have access)...

I'll check this out, thanks.


Andreas
___

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: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions

2012-03-27 Thread Andreas Mayer

Am 27.03.2012 um 19:29 schrieb David Duncan:

 Simplest solution is to save the scale along side the image itself 

That's what I just implemented. But I still think PNG images should retain the 
scale factor. Why saving that information elsewhere when the format explicitly 
supports this?


Andreas
___

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: Question about UIImage, scaling, and UIGraphicsBeginImageContextWithOptions

2012-03-27 Thread Andreas Mayer

Am 27.03.2012 um 20:13 schrieb David Duncan:

 Primarily because people abuse the resolution field, and as such it cannot be 
 trusted for this particular function. In a perfect world, we would only ever 
 see 72 (1x) or 144 (2x) in the resolution field, but instead the value tends 
 to be practically random.

Oh. OK. In that case, shouldn't the framework offer an image format, that works 
reliably?


Andreas
___

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: advice for creating these controls

2012-03-22 Thread Andreas Mayer

Am 22.03.2012 um 15:14 schrieb Rick C.:

 Just looking for an opinion what's the best way to create controls like this:
 
 http://cl.ly/191V3Z1C0m2k2U0V443x
 
 I initially assumed subclassing NSSegmentedControl, but then I was thinking 
 maybe I can just subclass NSButton and put them together.  

The first one looks like two controls next to each other. A button and a popup 
menu. Some subclassing is probably needed to get the right look.
The other two look like segmented controls, so it's probably best to subclass 
that. (Do you even need a subclass? Doesn't the Textured Square style do what 
you need?)

 Or maybe even make this out of a custom view?

You can, of course, create any control from scratch.


Andreas
___

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: advice for creating these controls

2012-03-22 Thread Andreas Mayer

Am 22.03.2012 um 16:22 schrieb Alex Zavatone:

   UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] 
 initWithItems:
   
 [NSArray arrayWithObjects:
   
 [UIImage imageNamed:@segment_check.png],
   
 [UIImage imageNamed:@segment_search.png],
   
 [UIImage imageNamed:@segment_tools.png],
   
 nil]];

You can do that in Interface Builder. No need for code.


Andreas
___

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: Here's a new idea... or maybe a really old one revisited

2012-03-22 Thread Andreas Mayer

Am 23.03.2012 um 01:09 schrieb William Squires:

 Marge takes over, and Xcode - having learned Marge's preferences for source 
 code formatting, reformats the .h and .m files from Bart's project so it's 
 nice and tidy according to Marge.

That's nice. Only I don't want it to reformat the files - I want it to just 
*display* it formatted the way I want.

At least until I actually change something.


Andreas
___

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: Changing the appearance of buttons

2011-11-09 Thread Andreas Mayer

Am 08.11.2011 um 22:40 schrieb Tom Jeffries:

 Mac.

You will have to use your own subclass of NSButton.

 If I need to create a new class, is there some example
 source code available?

http://www.harmless.de/cocoa-code.php#rollover



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: localization nib vs. xib in release build

2011-11-04 Thread Andreas Mayer

Am 04.11.2011 um 00:31 schrieb Alexander Reichstadt:

 What's unexpected are two things:
 - my app still launches in English
 - the English.lproj contains the nib file I localized as e.g. MainMenu.nib, 
 the German.lproj however still contains a MainMenu.xib

Make sure there is no MainMenu.nib in your application's root directory. Those 
nibs will be preferred to the localized ones.

Other than that I can't see any obvious reason why it shouldn't work.


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Retain/Release and Properties clarification

2011-10-03 Thread Andreas Mayer

Am 03.10.2011 um 16:14 schrieb John Tsombakos:

 audioPlayer = [self getSoundFile:soundfile.wav];
 ...
 
 in getSoundFile routine:
 AVAudioPlayer *snd;
 ...
 snd = [[[AVAudioPlayer alloc] initWithContentsOfURL:url error:error]

The question was already answered, but I wanted to point out that the method 
(not 'routine') name is misleading.

a) In Cocoa the get prefix is used when values are returned indirectly by 
pointer.
   Ex. - (void)getRed:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat 
*)blue alpha:(CGFloat *)alpha
b) You don't return a sound file, you return an audio player.

So I would recommend to name the method something like -audioPlayerWithFile: or 
-audioPlayerNamed:

Naming conventions are important in Cocoa. Following them makes your code much 
more readable.


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Questions about -orderFrontTablePanel:

2011-09-26 Thread Andreas Mayer

Am 22.09.2011 um 11:39 schrieb Ulf Dunkel:

 The documentation only says: Brings forward a panel allowing the user to 
 manipulate text tables in the text view., but it also immediately inserts a 
 default table in the currently selected text view, if any.

A search brings up the Text Layout Programming Guide:

NSTextView has built-in support for text tables, which provides the easiest 
way to add table support to your text view. This table support is in the form 
of the action method orderFrontTablePanel:. This method inserts a table into 
the text view and opens a modeless utility window that floats over the 
application windows. This table panel enables the user to manipulate attributes 
of a table while the cursor or selection is in the table.

So this behavior seems to be intentional. I guess your best bet is to file an 
enhancement request.


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Lion breaks the ability to click-through transparent window areas when the window is resizable.

2011-09-09 Thread Andreas Mayer

Am 09.09.2011 um 11:52 schrieb Bill Cheeseman:

 My clickthrough application still works on 10.7.1. 

Making a window completely ignore mouse clicks still works. But try this:

Make Applidude active and click in one of the corners, outside the gray area. 
You are still able to move the window.

That's the bug we are talking about. The click should fall through in 
transparent areas of the window.


I guess I'll file a bug even though it seems to be a known problem.


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Lion breaks the ability to click-through transparent window areas when the window is resizable.

2011-09-09 Thread Andreas Mayer

Follow-Up:

While doing some additional testing before writing a bug report, I noticed that 
Apple's RoundTransparentWindow sample code did work as expected!
Turns out that setIgnoresMouseEvents:NO will do the actual breaking.

Thus:


Bug ID# 10104405

Summary:
Sending setIgnoresMouseEvents:NO to a borderless window makes the transparent 
parts of the window opaque to mouse events.

Steps to Reproduce:
1. Take RoundTransparentWindow sample project 
(https://developer.apple.com/library/mac/samplecode/RoundTransparentWindow/)

2. Add
[self setIgnoresMouseEvents:NO];
to the CustomWindow class' initializer:

- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle
  backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag {
// Using NSBorderlessWindowMask results in a window without a title bar.
self = [super initWithContentRect:contentRect 
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
if (self != nil) {
// Start with no transparency for all drawing into the window
[self setAlphaValue:1.0];
// Turn off opacity so that the parts of the window that are not drawn 
into are transparent.
[self setOpaque:NO];

// this following call will make the transparent parts of the window 
opaque to mouse events!
[self setIgnoresMouseEvents:NO];

}
return self;
}

3. Run project.
4. Click and drag inside the window's frame but outside the visible content. 
The window will move.

Expected Results:
Mouse events should be ignored for transparent parts of the window.

Actual Results:
Window receives mouse events everywhere inside its frame, regardless of opacity.

Regression:
This did work as expected in versions of Mac OS X prior to 10.7.

Notes:
Regarding this specific example: Since the window was initially (per default) 
set up to NOT ignore mouse events anyway, setIgnoresMouseEvents:NO shouldn't do 
anything at all.



Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Lion breaks the ability to click-through transparent window areas when the window is resizable.

2011-09-09 Thread Andreas Mayer

Am 10.09.2011 um 06:21 schrieb Ken Thomases:

 So, it is apparently intentional that setIgnoresMouseEvents:NO will make a 
 transparent window non-transparent to mouse events. I recognize that this 
 seems to be a change in Lion vs. Snow Leopard, but the Lion behavior seems to 
 restore intended behavior.  I guess you'll know for sure when Apple responds 
 to your bug report.

I don't think that is the way to interpret that paragraph. As far as I 
remember, setIgnoresMouseEvents:YES didn't work prior to 10.3 or 10.4; you had 
to use Carbon calls for this. I know since I just removed the old code.

And even if it was as you say, what would be the way to get the initial 
behavior back after setIgnoresMouseEvents:YES?

(Currently, as a workaround, I create a completely new window and move the 
content view over. Ugh.)


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


[ANN] AMRollOverButton for Lion

2011-09-08 Thread Andreas Mayer
Hi there!

AMRollOverButton is a custom NSButton subclass with lots of configuration 
options and built in roll over effect.

Since Xcode 4.x does not support IB plugins, I redesigned the class(es) so that 
you can easily save your button design and load it at runtime. For more 
information, see the included readme.

I also updated almost all of my other public projects to support Lion and Xcode 
4.
And thanks to Xcode's great static analyzer, I crushed some bugs, too! ;-)

Everything is BSD licensed.

http://www.harmless.de/cocoa-code.php


Have fun!

Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Lion breaks the ability to click-through transparent window areas when the window is resizable.

2011-09-08 Thread Andreas Mayer

Am 05.08.2011 um 22:01 schrieb R R Hornback:

I just found this message while searching for a solution to the same problem.

 With OS X Lion, even when the window background is transparent, the window 
 still receives the mouse events.
 
 I have determined that this is related to whether or not the Window is 
 resizable.  If the window is resizable, the mouse events are handled by the 
 Window.  If it is NOT resizable, the events in the transparent areas are NOT 
 handled by the window.


Are you sure? For me the window always receives the mouse event, even if I use 
NSBorderlessWindowMask and nothing else. This is on 10.7.1.

Have you already filed a bug?


Andreas


P.S.:  Since the original message is several weeks old, I'll quote it in full 
for reference:

 The desire is to have a bordered, movable, resizable window with a hollow 
 interior--hollow meaning that the user can both see through the content area 
 (transparent) and any mouse/keyboard events are sent to whatever 
 window/application is below.
 
 This was easily accomplished prior to OS X 10.7 Lion by simply having an 
 NSWindow/NSPanel with a transparent background.
 
 With OS X Lion, even when the window background is transparent, the window 
 still receives the mouse events.
 
 I have determined that this is related to whether or not the Window is 
 resizable.  If the window is resizable, the mouse events are handled by the 
 Window.  If it is NOT resizable, the events in the transparent areas are NOT 
 handled by the window.
 
   NSRect windowRect = NSMakeRect( 200, 200, 200, 200 );
 
NSPanel hollowWindowResizable = [[NSPanel alloc] 
 initWithContentRect:windowRect styleMask:(NSHUDWindowMask | 
 NSNonactivatingPanelMask | NSTitledWindowMask | NSResizableWindowMask | 
 NSUtilityWindowMask | NSClosableWindowMask) backing:NSBackingStoreBuffered 
 defer:NO]; 
 
[hollowWindowResizable setBackgroundColor:[NSColor clearColor]];
[hollowWindowResizable setReleasedWhenClosed:YES];
[hollowWindowResizable setTitle:@Resizable];
[hollowWindowResizable setFloatingPanel:YES];
[hollowWindowResizable setCanHide:NO];
[hollowWindowResizable setOpaque:YES];
[hollowWindowResizable setHasShadow:NO];
 
//[hollowWindowResizable setIgnoresMouseEvents:TRUE]; 
[hollowWindowResizable makeKeyAndOrderFront:nil];
 
 
 My guess is that this is a bug introduced with Lion's ability to resize a 
 window from any edge.
 
 Anyone have any ideas?
 
 Thanks,

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Introductions to OOP? [was: Re: Large over 100K pixel high ruler scroll view]

2011-09-02 Thread Andreas Mayer

Am 02.09.2011 um 19:04 schrieb Jens Alfke:

 I’d like to be able to point people to a good introduction, either online or 
 in a book, but unfortunately I don’t know of any. Can anyone recommend 
 something?

How about Apple's documentation?

Object-Oriented Programming with Objective-C
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/OOP_ObjC/Articles/ooOOP.html

Of course it focuses on Objective-C and introduces some concepts that may not 
be found in certain languages while it ignores others that Objective-C lacks. 
But I think that will be true, no matter what language you use as an example. 
And the basic concepts are not that hard anyway. What is difficult is to learn 
to think in objects.   Reminds me of Valve's Portal: Now you are thinking with 
portals.  ;)


 Another common stumbling block seems to be nib loading, and the concept of 
 wiring up your non-view objects

Resource Programming Guide 
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/Introduction/Introduction.html


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSSplitView and autosave

2011-08-30 Thread Andreas Mayer
NSSplitView's autosave is not working in an existing project of mine.

I created a small test project and there autosave works as intended.
When I create the same test window in a nib of my existing project, it doesn't.

The subview frames' data is correctly saved in the prefs file. But when the 
application is started next time, the split view will not show any subviews at 
all. The splitter is at the very top and the region below is empty.

Now, I worked around the problem by subclassing NSSplitView. That didn't take 
all that long and does what I want.
But I'd still like to know why the built in method fails.

So, any ideas anyone?

(This is on 10.7.1 with Xcode 4.1, latest SDK)


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Transparency of textured controls

2011-08-26 Thread Andreas Mayer

Am 23.08.2011 um 12:58 schrieb Leo:

 Actually, I finally realized what the real issue is: Apple for some reason 
 didn't refresh NSSegmentedControl Rounded style to match the new 
 appearance of NSTabView controls on Lion.
 I guess that's intentional. The 'Capsule' style does look like the NSTabView 
 controls.
 I checked boh IB 3.2.6 and Xcode 4 again, and the Capsule looks almost 
 identical to Textured Rounded, and it's also transparent. Is it really 
 different on your setup?

You said:  

 So NSSegmentedControl still looks like the old Aqua blueish liquified 
 controls.

That's why I mentioned that the capsule style does look like the tab controls.

And yes, it seems to be the same as Textured Rounded and it is also 
transparent. Actually, even the 'Rounded' aqua style is transparent.
Maybe you could try subclassing it and drawing a single colored background in 
-drawRect:.

Why can't you use a tabbed tab view?


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Transparency of textured controls

2011-08-21 Thread Andreas Mayer

Am 19.08.2011 um 21:36 schrieb Leo:

 Actually, I finally realized what the real issue is: Apple for some reason 
 didn't refresh NSSegmentedControl Rounded style to match the new appearance 
 of NSTabView controls on Lion.

I guess that's intentional. The 'Capsule' style does look like the NSTabView 
controls.

 And please bring back the colorful  Finder sidebar 

Thats most definitely intentional. They said so in one of the sessions at WWDC, 
IIRC. It's meant to make the actual content stand out more.


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Transparency of textured controls

2011-08-19 Thread Andreas Mayer

Am 13.08.2011 um 18:41 schrieb Leo:

 For some reason, the textured controls are now transparent (e.g., Textured 
 Rounded and Textured Square of NSSegmentedControl etc.)

From the AppKit Release Notes:

--
Button Appearance Changes (New since early 2011 seed)

As part of an ongoing refresh of Aqua in Mac OS X Lion, some buttons look 
different and may not look the same in every context in your application. 
Specifically, the “Round Textured” button is not appropriate in any context 
other than directly on the background of a textured window. If you are using 
this kind of button in a table view or other context, please consider changing 
it to a “Round Rect” button.
--


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Xcode 3.2.6 on Lion ?

2011-07-23 Thread Andreas Mayer

Am 23.07.2011 um 03:39 schrieb Rick C.:

 I have just installed the App Store version of Xcode 4.1 and I noticed I had 
 no options when installing about choosing directory or anything.

Locate the 'Xcode Install' package. Show package contents. Inside the Resources 
folder you will find Xcode.mpkg. Install as usual.


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Getting CGColor components

2011-06-12 Thread Andreas Mayer

Am 12.06.2011 um 01:12 schrieb Development:

 According to all the examples I have found the following code should give me 
 the RGB components of any UIColor.CGColor I pass to it

CGColorGetComponents() will only give you RGB components if the color actually 
*is* a RGB color.

You should check that with CGColorGetColorSpace() beforehand.


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Stack of NSWindow sheets

2011-04-28 Thread Andreas Mayer

Am 28.04.2011 um 04:31 schrieb Lee Ann Rucker:

 It would be nice if there was some sort of built-in combining stack, 
 especially for the info-only dialogs, the way starting multiple file copies 
 in the Finder gives you one window with multiple sections instead of multiple 
 windows.

Why not build one if you need it? Does not sound that hard.

Maybe you can utilize my collection view class: 
http://www.harmless.de/cocoa-code.php#collectionview


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Display a Red frame on the screen

2011-04-08 Thread Andreas Mayer

Am 08.04.2011 um 19:24 schrieb eveningnick eveningnick:

 I was thinking about the window. But then it has to be something with
 a big hole inside. This hole ought to be transparent for mouse clicks
 (so if there's something below my window, that 'something' has to be
 clickable and focused, and receive keyboard input)? Is it possible to
 do somehow? Borderless is a window without a title (as i understand).
 What kind of properties should i specify to make a window as that Red
 frame? I mean, i really want it to be just a mark for the user,
 without any windowing behaviour (well, the user can drag it, if he
 clicks on the 'red frame' with mouse, but that is the only relation to
 a real window it should have).

See this little project. It uses a (borderless) window to place a 'puff* 
graphic under the mouse cursor.

http://www.harmless.de/cocoa-code.php#floatingimage


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


ANN: HelpViewer code for iOS

2011-04-06 Thread Andreas Mayer
Hi there.

I just posted my first code snippet for iOS. It's a scroll view, that displays 
HTML pages from the app bundle. As the name implies, this was meant to provide 
a means of showing help pages.

http://www.harmless.de/cocoa-code.php#helpviewer

It's free, so have fun. :)


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Are the progress spinner images publically available?

2011-04-01 Thread Andreas Mayer

Am 01.04.2011 um 18:38 schrieb James Bucanek:

 So I'm going with plan B, which is create a custom CALayer that draws a 
 single spinner wheel image and then rotate it using a key-frame animation.


It's old, but you want to take a look regardless:

http://www.harmless.de/cocoa-code.php#progressindicator


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Default keyword selector type

2010-11-14 Thread Andreas Mayer

Am 13.11.2010 um 14:50 schrieb Michael Hall:

 Your links busted, 

The link is fine.


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Is NSStreamEvent a bitfield or not?

2010-11-02 Thread Andreas Mayer

Am 01.11.2010 um 23:01 schrieb Sean McBride:

 I'm just playing with NSStream for the first time,

Me too. :)

 If these things can be bitwised ORed, why is all the code out there
 'switch'ing?  I'm confused.

Good question. My test application seems to work fine with switch statements. 
Maybe the documentation is incorrect?

The Stream Programming Guide says in Handling Stream Events:

More importantly, once the stream object has been opened, it keeps sending 
stream:handleEvent: messages to its delegate until it encounters the end of the 
stream. These messages include a parameter with an NSStreamEvent constant that 
indicates the type of event.

This seems to indicate that only a single constant value is passed, instead of 
a bit field.


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Transparant button click

2010-08-28 Thread Andreas Mayer

Am 28.08.2010 um 10:30 schrieb Graham Cox:

 This NSImage method is the only one built-in that offers this kind of 
 hit-test functionality (10.6 only). You could build your button around it. 
 But for earlier OS versions you have to do the hit-test yourself. This 
 involves testing the point against the alpha channel value of the image at 
 that point.

You can find sample code here:

http://www.harmless.de/cocoa-code.php

Look for the AMShapedButton project.

It's rather old but I just confirmed that it still builds. :)


Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Using an NSToolbar in a sheet

2010-08-01 Thread Andreas Mayer


Am 02.08.2010 um 00:20 Uhr schrieb Dave Fernandes:

Is this just a bug, or is it completely unsupported? Can anyone give  
me a workaround for this?


I don't think toolbars on sheets are supported. As you said yourself,  
the user might get confused if there a two toolbars in a single window.



Any comments on the UI conundrum?


Several possible solutions:

- Use a real window for the modal editor. You can attach it to it's  
parent as a child window.


- Replace the contents of the main window with the editor view (or add  
it on top) and swap toolbars.


- Add some other sort of toolbar to the sheet, that is visually  
different from a main window's toolbar. Perhaps something similar to a  
tab bar in inspector panels (like in iWork etc). You will probably  
have to create your own implementation for that.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: draw NSAttributedstring with transparency

2010-07-23 Thread Andreas Mayer


Am 23.07.2010 um 12:53 Uhr schrieb Bernard Knaepen:

I am currently using the drawAtPoint method but I would like to  
specify a global opacity (transparency) to draw the string. Is there  
a way to do this or should I scan the whole string and make the  
changes to each character color individually by using the  
colorWithAlphaComponent method?


You could draw the string to an intermediate image and composite that  
image with the desired opacity onto the target image.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Download images and modify bundle?

2010-07-02 Thread Andreas Mayer


Am 02.07.2010 um 10:01 Uhr schrieb sebi:

When I download an image and want to keep it for further reference,  
I assume I have to store it in the documents directory and not in  
the app bundle, because otherwise I would invalidate the signature  
and the app wont run anymore. Is this correct?


You should always regard the app bundle as read only. The application  
might have been installed with administrator rights so that the  
current user does not have write access.


If I can't store the images in the app bundle together with the  
others I'm reduced to two options, if I see it correctly: Duplicate  
the original images to the documents directory (waste of memory) or  
manage two image folders (administrative overhead). Does anyone have  
a better idea? Maybe use of file-aliases?


First, it seems the Application Support folder might be a better place  
than Documents, depending on the nature of those images. Are they the  
actual data that the user is creating (put them in Documents) or are  
they material that the user uses to create his documents? (put them in  
Application Support)


To answer the question: Just copy them. That also has the benefit that  
the user can delete them if he wants to.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Case sensitive fileName

2010-03-17 Thread Andreas Mayer


Am 17.03.2010 um 17:46 Uhr schrieb Kevin Wojniak:

NSLog(@displayNameAtPath: %@, [[NSFileManager defaultManager]  
displayNameAtPath:path]);


Note that -displayNameAtPath: will give you the localized name if one  
should exist.


(For example you'll get 'Programme' for the 'Applications' folder if  
you happen to be on a German system.)


You can't use that as an input to file system functions.

Since the OP didn't say what he needs the filename for, - 
displayNameAtPath: may or may not be the right solution.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Best approach for a bunch of new UI controls

2010-03-15 Thread Andreas Mayer


Am 14.03.2010 um 17:51 Uhr schrieb Igor Mozolevsky:


Picture a warehouse [...]


It is not clear to me why you think that you need graphical  
representations for your objects.

Wouldn't simple lists of text work at least as good?

But if I really wanted to have those controls, I'd probably build them  
from the ground up. I.e create my own NSView subclass from scratch.
I found that the more complex build-in views are working best if you  
only use them exactly as they are supposed to be. Subclassing them is  
often more hassle than doing everything yourself.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Best approach for a bunch of new UI controls

2010-03-14 Thread Andreas Mayer


Am 14.03.2010 um 04:14 Uhr schrieb Igor Mozolevsky:


I've got a few *nix libs to flesh out with some Cocoa UI goodness and
would welcome suggestions for a good way to do a bunch of controls:


Instead of describing the proposed look of your controls, you should  
tell us what their *purpose* is supposed to be.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSWindow - makeKeyAndOrderFront problem

2010-03-01 Thread Andreas Mayer


Am 02.03.2010 um 00:27 Uhr schrieb Matthew Lindfield Seager:


If I've told a video player to start playing files on open I would
generally expect the player to bring itself to the front after
specifically dropping a media file onto it.


Well, yes. But that's not what we are talking about. We are talking  
about dropping a file onto a *window* of the player application.  
That's not the same thing as dropping it onto the application's icon.


Dragging something onto an application icon - either in the Finder or  
in the Dock - is an explicit request to bring that application to the  
front.


Dragging something inside another application's window is not.

Of course there might be exceptions. There almost always are. :)


or do some usability testing with some target users.


If you do that, please make sure they are actually Mac users, not  
Windows users sitting in front of a Mac. :P



And as this is rather off-topic for cocoa-dev, I'll leave it at that.
I just tried to give some advice. Do what you think is best.


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSWindow - makeKeyAndOrderFront problem

2010-02-28 Thread Andreas Mayer


Am 28.02.2010 um 15:46 Uhr schrieb Alexander Bokovikov:

I drop a file into my app's window. And the question is how to  
switch the global system focus to my app?


Hm. You don't?

Just dragging should not switch the focus to another application.

Of course you *can* steal the focus using NSApplication's - 
activateIgnoringOtherApps:


Or you could place your window in front without making it key, using - 
orderFrontRegardless. But I don't see how that would be useful.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSWindow - makeKeyAndOrderFront problem

2010-02-28 Thread Andreas Mayer


Am 28.02.2010 um 21:20 Uhr schrieb Alexander Bokovikov:


What do you have in mind? Is it incorrect to create such behavior?


I think it is.


My app is a player. Dropping file into it I'd expect its activation.


Why?

Without activation all visual controls are not reachable unless  
you'll click the window.


So? If I want to use them, I can bring the window and/or the  
application to the front.
(Also, it is possible to make controls active even if the window is  
not.)


This is not a case when user could drop file-by-file into the same  
window, as I believe.


Well, he might want to keep working in the Finder or in some other  
application. Maybe dragging something else to another player.


Try dragging something onto the iTunes source list. iTunes will import  
it, but will not activate itself.


Therefore my app should activate itself after every single file  
drop. Am I wrong?


I think you are.


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Deprecated APIs

2010-02-23 Thread Andreas Mayer


Am 23.02.2010 um 11:09 Uhr schrieb charisse napeÿf1as:

I am not sure if this problem has already been submitted but how do  
I define two APIs, one that is supported from Leopard down and
another that is only supported in Snow Leopard if I only have one  
binary for all OSes?


See

http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/cross_development/

I tried using the #if conditionals e.g. #if  
MAC_OS_X_VERSION_MAX_ALLOWED ..
but my application crashes. It will successfully build on compile  
time but crashes during runtime


It sounds like you build for the 10.6 SDK but expect the code to run  
on earlier systems. That will not work.
You could decide at runtime which API to use, but in the case you  
mentioned, that's of no value.
While - 
beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo 
: is deprecated, it's still there in 10.6. So you don't gain anything  
by not using it.
I suggest you only move over to the new API when you don't have to  
support older systems any more.



Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Deprecated APIs

2010-02-23 Thread Andreas Mayer


Am 23.02.2010 um 14:41 Uhr schrieb charisse napeÿf1as:


But is it still safe to use depracated APIs?


Did you read the document I pointed you to?

I quote:

Note: Deprecation does not mean the immediate deletion of an  
interface from a framework or library. It is simply a way to flag  
interfaces for which better alternatives exists. For example, an older  
interface may be discouraged in favor of a newer, more efficient  
interface. You may still use deprecated interfaces in your code; [...]



Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Removing quit button from dock menu

2010-02-23 Thread Andreas Mayer


Am 23.02.2010 um 16:13 Uhr schrieb Alex Kac:

I think its better to let the user’s themselves admonish the  
developer.


I think it's better - for developer and users - to tell new developers  
up front if something they are about to do is wrong.


On the other hand, I realize there are (too many) people who feel  
personally attacked when they get advice they did not ask for. So what  
*I* usually do is to just ignore that type of question.


Anyway. It seems there is no (supported) way to remove the quit menu  
item from the dock menu. To suggest an alternative solution, it would  
be really helpful if we knew what type of application we are talking  
about.



Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTextField: Change Text Color at Insertion Point?

2010-02-08 Thread Andreas Mayer


Am 08.02.2010 um 17:22 Uhr schrieb Alexander Heinz:

My question is this: let's say my user has already typed some text  
in black (or whatever color) and now wants to change the active  
color of the text at the insertion point, such that any text he or  
she types appears in the new color.


I think you will have to change the typing attributes fo the  
corresponding field editor.


See:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextArchitecture/Concepts/TextFieldsAndViews.html

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextUILayer/Tasks/SetTextAttributes.html


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to hide dock item and application menu?

2010-01-26 Thread Andreas Mayer


Am 25.01.2010 um 23:24 Uhr schrieb Jens Alfke:


This is not
useful to me as my req is to provide the option to user to hide/ 
unhide dock

and menu item.


You can't change that while your app is running. You have to modify  
your own Info.plist and then relaunch.


Well, you can transform a background-only application into a  
foreground application:


http://developer.apple.com/mac/library/documentation/Carbon/Reference/Process_Manager/Reference/reference.html#/ 
/apple_ref/c/func/TransformProcessType


This works as expected since 10.5.

http://www.cocoadev.com/index.pl?TransformProcessType


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Centering a window on the *current* screen, not the *main* screen

2010-01-26 Thread Andreas Mayer


Am 26.01.2010 um 11:34 Uhr schrieb Graham Cox:

Traditionally, this has been at a position leaving one third of the  
space above and two thirds below, though I'm not sure if that's  
still currently the exact placing.




Yup, that's what the Human Interface Guidelines say:

http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/XHIGWindows.html#/ 
/apple_ref/doc/uid/2961-BACFHDHE


For nondocument windows, the preference is to open new windows  
horizontally centered as shown in Figure 14-32. The vertical position  
should be visually centered: The distance from the bottom of the  
window to the top of the Dock (if it’s at the bottom of the screen)  
should be approximately twice the distance as that from the bottom of  
the menu bar to the top of the window.



Andreas___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Imitating Behavior of a Sheet Window

2010-01-24 Thread Andreas Mayer


Am 24.01.2010 um 14:04 Uhr schrieb Oleg Krupnov:


BTW, to my surprise, it appears that the standard sheets are NOT child
windows.


That's because sheets are older than child windows.
Sheets are available since 10.0, child windows since 10.2.


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Knowing mouse pressed time?

2009-12-31 Thread Andreas Mayer


Am 31.12.2009 um 00:09 Uhr schrieb Ken Thomases:

There is no mouse-up event.  He wants to present a menu if there's  
been X time since the mouse-down even when _no other events have  
arrived since then_.  There's no getting around using a timer of  
some sort.


That's a case for -performSelector:withObject:afterDelay: (which  
obviously uses a timer of some sort)


- (void)mouseDown:(NSEvent *)theEvent
{
// send openMenu: to self after 0.8 seconds
	[self performSelector:@selector(openMenu:) withObject:nil afterDelay: 
0.8];

}

- (void)mouseUp:(NSEvent *)theEvent
{
// user released mouse button - cancel previous perform request
	[NSObject cancelPreviousPerformRequestWithTarget:self  
selector:@selector(openMenu:) object:nil];

}

(Typed in Mail.app)


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Updating application info plist

2009-10-10 Thread Andreas Mayer


Am 10.10.2009 um 01:05 Uhr schrieb Rob Keniger:

To do this, surely they must be rewriting the LSUIElement key in the  
app's own Info.plist while the app is running, right? Or is there  
another way to do this?


I did this once, because there was no other way to switch between  
UIElement and normal application mode.
Obviously this was only possible if the user had write access to the  
application bundle.


Fortunately since 10.5 there's now an working API. See Kyle's comment  
and this page:


http://www.cocoadev.com/index.pl?TransformProcessType


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: releasing an object

2009-10-10 Thread Andreas Mayer


Am 10.10.2009 um 17:43 Uhr schrieb Nick Rogers:


selectedPTVolume = [[Volume alloc] initWithDictionary:data];
[selectedPTVolume retain];


Read the memory management rules again. By calling alloc the retain  
count of the created object is one. There is no need to send it an  
additional retain message.



if I comment this the GUI hangs,


Then you've got another problem somewhere else.



[selectedPTVolume release];
selectedPTVolume = nil;
if (outlineViewData)
[outlineViewData reloadData];/ crashes here



I guess it crashes because you just pulled the outline view's model  
data from under it's feet.


How is the outline view connected to the model?


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Two digit dates with NSDateFormatter

2009-10-08 Thread Andreas Mayer


Am 08.10.2009 um 15:07 Uhr schrieb Matthew Lindfield Seager:


Am I missing something obvious? Is this a bug?


No idea. This works for me:

- (IBAction)convertTextToDate:(id)sender
{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setLocale:[NSLocale currentLocale]];
	[formatter setTwoDigitStartDate:[[NSCalendar gregorianCalendar]  
dateFromYear:1950 month:1 day:1]];
	// uses two convenience methods defined elsewhere - semantics should  
be obvious

[formatter setDateStyle:NSDateFormatterShortStyle];
NSString *input = [sender stringValue];
NSLog(@input: %@, input);
NSDate *date = [formatter dateFromString:input];
NSLog(@date: %@, date);
[dateOutput setObjectValue:date];
[formatter release];
}

Note that your input must match the date format(s) specified in your  
current language settings. (I was using the german form with '.' as  
divider and input values with '/' did not work.)



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: pulldown in custom NSCell

2009-08-28 Thread Andreas Mayer


Am 21.08.2009 um 12:48 Uhr schrieb Georg Seifert:

What I found is that the Cell, in its drawwithFrame method, adds  
subview to the TableView and this subview handles all the drawing  
and handling. Is this appropriate or is there a better solution.


In case you don't need a fully fledged TableView, have a look at this  
and see if it fits your bill:


http://www.harmless.de/cocoa-code.php#collectionview


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTableView -setDataCell confusion

2009-06-30 Thread Andreas Mayer


Am 27.06.2009 um 22:18 Uhr schrieb Chase Meadors:

I'm using AMIndeterminateProgressIndicatorCell (at least the drawing  
code) to imitate a progress indicator in the table view. To get it  
to use the custom cell, I've been calling


[myTableColumn setDataCell:[[MyCustomClass alloc] init]];

However, I've run into a 'slight' problem. Apparently, ALL of the  
cells in this column are that one, same, object. When I tested with  
F-script, I found that they have the exact same description, and  
same memory address.


Yes, they are. But what exactly is the problem with that?

This explains why bindings affecting one cell would affect all of  
them...


The sample project does contain a table view and shows how to show/ 
hide the progress indicator in a particular row.


In  -tableView:objectValueForTableColumn:row:  just return YES or NO.

If you want to use bindings, you bind to the table column (containing  
the progress indicator). I just tested this and it works as intended.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTableView -setDataCell confusion

2009-06-30 Thread Andreas Mayer


Am 30.06.2009 um 01:09 Uhr schrieb Raleigh Ledet:

a) Give up on the animation. Then you can use the same cell for the  
entire column. Each row will return the correct value that the  
progress indicator should draw. Be sure to invalidate the row/column  
as the value changes to redraw the cell with the new value.


There's no need to give up on it. The sample project for  
AMIndeterminateProgressIndicatorCell contains a table column  
controller that handles animation.


b) Place actual NSProgressIndicator views into the table view. This  
is somewhat tricky to do [...]


AMIndeterminateProgressIndicatorCell was especially designed to solve  
that problem.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: UITableView port to Mac?

2009-04-02 Thread Andreas Mayer


Am 02.04.2009 um 08:46 Uhr schrieb Seth Pellegrino:

NSCollectionView seems a little like what I'd want, but the API on  
UITableView is much cleaner and easier to use (and I'm only really  
interested in a single column rather than a grid). I've also looked  
at stepwise's method for using views as rows in a NSTableView, but  
it seems like it would be much cleaner to start from scratch.


Toward this end, I was wondering if anyone had seen/built such a  
class,



http://www.harmless.de/cocoa-code.php#collectionview


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Method Sequence on Application Loads

2009-03-09 Thread Andreas Mayer


Am 09.03.2009 um 06:49 Uhr schrieb Kenneth Ramey:


What method do I need to hook for this?


You typically start processing in your application delegate's - 
applicationDidFinishLaunching: method.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: where to store this kind of data

2009-03-04 Thread Andreas Mayer


Am 03.03.2009 um 23:17 Uhr schrieb Benjamin Dobson:


Store it in ~/Library/Application Support/YourAppName/


And make sure not to hard code the path.

See the NSSearchPathForDirectoriesInDomains() function and NSString's - 
stringByAppendingPathComponent:.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-21 Thread Andreas Mayer


Am 21.02.2009 um 17:33 Uhr schrieb Alex Kac:

If an app offered to help - just once - I don't see that as an  
intrusion, but a more Mac-like feature. Its not intrusive.


I disagree. It's not an applications job to tell me where to put it.

If, for some reason, it *must* be put in /Applications, use an  
installer package.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-21 Thread Andreas Mayer


Am 21.02.2009 um 22:23 Uhr schrieb Alex Kac:

Of course if you go with the OP's idea - then its almost like an  
installer pkg, but in a DD install method.


I still don't like it. And if every application did that, each one  
would do it slightly differently which is *not* a Mac like experience.


If you want that feature, I suggest filing a feature request with  
Apple to add it to the OS. The Finder already warns when you start a  
just downloaded application; I'm sure it could also suggest to move  
it. In that case we (hopefully) had a way to permanently disable that  
feature *and* it would be the same for all applications.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to re-create Finders File Copy

2009-02-19 Thread Andreas Mayer


Am 20.02.2009 um 00:43 Uhr schrieb Corbin Dunn:

I suspect it has a view in a separate NIB, as a sort of template.   
It creates a window and loads that view into it.  When another copy  
operation starts, it grows the window, keeping the first view in  
its screen position (which means changing its position in the  
window's coordinate space), and loads another copy of the template  
view from the NIB, putting it below the first.  Etc.


This is the general recipe for how to make something like that.  
NSTableView doesn't work too well with views as subviews. You could  
also consider using NSCollectionView.


You might be interested in AMCollectionView, especially if you want to  
target 10.4:


http://www.harmless.de/cocoa-code.php#collectionview


Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Need recommendations for best way to build a custom view

2009-02-19 Thread Andreas Mayer


Am 19.02.2009 um 22:17 Uhr schrieb Ken Tozier:

I tried writing my own table class from scratch that allows for not  
just cells but entire views to act in the role of cells in  
traditional NSTables. This worked to an extent, but one requirement,  
that projects can each have a different number of pages, made  
vertical refreshing really squirrely when pages are added or deleted  
to a project. It took me over a month to write the class and still  
it didn't work like I wanted.


Hm. Yet another hint at my own class:

http://www.harmless.de/cocoa-code.php#collectionview

While it only supports a single column, you should be able to do what  
you want by adjusting the view for each row.


What is the best way to do this? I took a look at Leopard's  
NSCollectionView class but even this seems to fall short as you have  
to explicitly define the depth of the subviews and my subviews must  
vary in depth.


You mean in height? AMCollectionView does support rows with different  
heights.



Andreas
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


  1   2   >