Re: Trap mouse and keyboard events

2012-06-25 Thread Graham Cox

On 25/06/2012, at 3:56 PM, Abhijeet Singh wrote:

 Hi,I want to perform some action in my application whenever user presses any 
 key on keyboard or uses the mouse. How can I trap these events...


RTFM?


--Graham
___

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: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Uli Kusterer
On 24.06.2012, at 03:41, Dave DeLong wrote:
 #define DD_RETAIN(_o) (_o)
 #define DD_RELEASE(_o) 
 #define DD_AUTORELEASE(_o) (_o)


 IIRC GNUstep already has standard-defined RETAIN() macros etc. (When they 
added their garbage collector, way before Apple made their attempt at one) 
Might be worth just keeping the same terminology.

Cheers,
-- Uli Kusterer
Die Zeugen des TeachText sind überall...
http://www.wiederholungstaeter-podcast.de




___

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: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Uli Kusterer
On 24.06.2012, at 05:55, Jerry Krinock wrote:
 Why didn't Apple do the same thing for ARC?

 Because the whole point of ARC is that you don't have to write retain/release 
calls, and thus can't make mistakes in them. Since, once compiled, ARC code is 
pretty much identical to manually managed code (and you can mix and match ARC 
and manually managed modules), there really is no point in using ARC if you're 
then going to add manual calls anyway. That would only cause your code to exist 
in two versions (ARC and non-ARC) with two different sets of possible memory 
management bugs. So not only are you STILL writing manual-managed code, you've 
now also DOUBLED your QA load.

Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.masters-of-the-void.com




___

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

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

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

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


CALayer coordinates question

2012-06-25 Thread Vincent Habchi
Hi there,

briefly speaking, I have a sublayer that I draw using various Bezier paths and 
other goodies (code generated by PaintCode™). No matter where I set the frame 
of my sublayer, or what I do with bounds, the drawing always appear in the 
lower left corner of the parent NSView. Is that normal?

Thanks a lot!
Vincent
___

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 coordinates question

2012-06-25 Thread David Duncan
On Jun 25, 2012, at 5:12 AM, Vincent Habchi wrote:

 Hi there,
 
 briefly speaking, I have a sublayer that I draw using various Bezier paths 
 and other goodies (code generated by PaintCode™). No matter where I set the 
 frame of my sublayer, or what I do with bounds, the drawing always appear in 
 the lower left corner of the parent NSView. Is that normal?


No, it isn't. Can you share a brief example that triggers the issue?
--
David Duncan


___

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

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

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

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

Re: willDisplayOutlineCell of view-based NSOutlineView is not called

2012-06-25 Thread Corbin Dunn
You really want to call [super didAddSubview:] in that code snippet.

corbin

On Jun 23, 2012, at 2:29 PM, Nava Carmon ncar...@mac.com wrote:

 Just for those who need to customize their outline view disclosure arrow:
 Here's the answer from SO, that worked perfectly for me. 
 
 http://stackoverflow.com/questions/11127764/how-to-customize-disclosure-cell-in-view-based-nsoutlineview
 
 
 Best Regards,
 
 Nava Carmon,
 
 Moshiach Times Ltd.,
 
 e-mail: ncar...@mac.com
 Skype: navacarmon
 Phone: +972.52.8157770
 
 
 
 
 On Jun 21, 2012, at 7:27 PM, Nava Carmon wrote:
 
 Thank you all for answering.
 
 Corbin, where is the best place to add my own disclosure button?
 I believe not in the view itself, since it's indented.
 
 Thanks
 
 
 
 On Jun 21, 2012, at 7:25 PM, Corbin Dunn wrote:
 
 
 On Jun 21, 2012, at 7:45 AM, Kyle Sluder k...@ksluder.com wrote:
 
 On Jun 21, 2012, at 1:22 AM, Nava Carmon ncar...@mac.com wrote:
 
 
 
 
 And this is what apple documentation says on this:
 
 outlineView:willDisplayOutlineCell:forTableColumn:item:
 Informs the delegate that an outline view is about to display a cell used 
 to draw the expansion symbol.
 
 _There are no cells_ in a *view-based* outline view.
 
 Either on this list or in the developer forums (devforums.apple.com), 
 Corbin Dunn acknowledged that lack of customizability of disclosure 
 triangles is a known shortcoming with view-based outline views. He 
 mentioned a workaround that involves looking for a subviews with a certain 
 identifier.
 
 Please do log a bug requesting this functionality so we can expose it in an 
 easy way.
 
 Yes, the documentation should be more clear too -- please log a bug on that 
 also.
 
 Another alternative is to hide the disclosure triangle and add your own 
 button that does it. It just would call expandItem or collapseItem as 
 needed.
 
 corbin
 
 
 
 ___
 
 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/ncarmon%40mac.com
 
 This email sent to ncar...@mac.com
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

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

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

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

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


notification upon restoring a version

2012-06-25 Thread qvacua
Hi,

are there notifications or delegate methods of NSDocument (or
NSDocumentController) which are called when the user invokes Versions
and/or restores a version of a document?

Thanks in advance and best,
Tae
___

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: notification upon restoring a version

2012-06-25 Thread Kevin Perry
When the user enters or exits Versions, there are notifications sent out called 
NSWindowWillEnterVersionBrowserNotification, 
NSWindowDidEnterVersionBrowserNotification, etc. (see NSWindow.h)

You will know when a user chooses Restore, because the NSDocument instance will 
be sent -revertToContentsOfURL:ofType:error: (once the version's contents are 
written in place over the existing file).

[kevin perry];

On Jun 25, 2012, at 1:44 PM, qvacua qva...@gmail.com wrote:

 Hi,
 
 are there notifications or delegate methods of NSDocument (or
 NSDocumentController) which are called when the user invokes Versions
 and/or restores a version of a document?
 
 Thanks in advance and best,
 Tae
 ___
 
 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/kperry%40apple.com
 
 This email sent to kpe...@apple.com


___

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

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

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

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


Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Greg Parker
On Jun 23, 2012, at 8:55 PM, Jerry Krinock je...@ieee.org wrote:
 But now I wonder why Apple did not do this, as they did with Garbage 
 Collection.  Methods -retain, -release, and -autorelease are no-ops when GC 
 is on.
 
 Why didn't Apple do the same thing for ARC?

Objective-C garbage collection supported a hybrid mode, where the same binary 
could run with or without GC enabled. Such code was written with retain/release 
calls in place, but those calls were ignored if you were running with GC on. 
This hybrid mode was used in system libraries and other code that needed to run 
in both GC and non-GC apps.

The problem with hybrid mode is that it is difficult to keep both modes 
functioning. If you have retain/release statements that are ignored, and you 
are not truly fanatical about testing both modes, then in short order you will 
find that your retain/release statements are incorrect because of subsequent 
code changes.

ARC has no need for GC's hybrid mode, because ARC code and non-ARC code are 
fully interoperable. We recommend each file be written for either one or the 
other, with no attempt to be ARC-agnostic. 


-- 
Greg Parker gpar...@apple.com Runtime Wrangler



___

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: Trap mouse and keyboard events

2012-06-25 Thread Richard Somers
On Jun 24, 2012, at 11:56 PM, Abhijeet Singh wrote:

 I want to perform some action in my application whenever user presses any key 
 on keyboard or uses the mouse. How can I trap these events.

One way to do this would be to subclass NSApplication and override sendEvent:. 
The documentation indicates Override sendEvent: if you want to change how 
events are dispatched or perform some special event processing.

https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/nsapplication_Class/Reference/Reference.html

--Richard


___

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: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Graham Cox

On 26/06/2012, at 7:42 AM, Greg Parker wrote:

 We recommend each file be written for either one or the other, with no 
 attempt to be ARC-agnostic.


Does this imply that ARC can be adopted gradually?

For example, I have a large project that uses manual memory management. If I 
add a new class to it, can I write that class with ARC without having to adopt 
it for the whole project? I've been able to do that with properties and other 
Obj-C 2.0 stuff very successfully, but it wasn't clear that ARC could be 
managed the same way. If it can be done, how is ARC enabled for a specific 
class?


--Graham


___

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: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Dave DeLong
Yes, you can do this, because ARC is a compile-time option and files are 
compiled individually. 

To compile with ARC, you'll need to use the -fobjc-arc flag. 

Cheers,

Dave

Sent from Jane

On Jun 25, 2012, at 6:20 PM, Graham Cox graham@bigpond.com wrote:

 
 On 26/06/2012, at 7:42 AM, Greg Parker wrote:
 
 We recommend each file be written for either one or the other, with no 
 attempt to be ARC-agnostic.
 
 
 Does this imply that ARC can be adopted gradually?
 
 For example, I have a large project that uses manual memory management. If I 
 add a new class to it, can I write that class with ARC without having to 
 adopt it for the whole project? I've been able to do that with properties and 
 other Obj-C 2.0 stuff very successfully, but it wasn't clear that ARC could 
 be managed the same way. If it can be done, how is ARC enabled for a specific 
 class?
 
 
 --Graham
 
 
 ___
 
 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/davedelong%40me.com
 
 This email sent to davedel...@me.com
___

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

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

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

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