Re: Speeding up image drawing?

2011-11-01 Thread Mike Abdullah

On 1 Nov 2011, at 01:44, Arbit Richardi wrote:

> I'm looking for tips to speed image drawing on OS X — this is a
> primary function of my application. I started out naively with
> NSImage, switched to CGImage, tried layer backing, and now draw
> directly into a hosted layer with Quartz. I have an implementation
> using CATiledLayers but it doesn't add speed in common cases.
> 
> At this point, large images still draw significantly slower than in
> Preview. For example, I can display a 25MB test JPEG (~9k x 9k pixels)
> in ~2 seconds while Preview can display it in ~1 second on the same
> machine. I can display a 12MB raw (~4k x 3k) in ~2.5 seconds while
> Preview can display it in less than 1 second.
> 
> In my code, almost all that time is spent in CGContextDrawImage() —
> not something I can optimize.
> 
> Looking at rendering the test JPEG in Instruments, I can see that
> Preview's call tree is largely the same as my call tree except that
> Preview uses some sort of custom tiling.

I'm pretty certain Preview is using IKImageView, or at least it used to.
> 
> Looking at the rendering the test raw in Instruments, the primary
> difference is that my code calls a specific RawCamera function three
> times more than Preview calls it. What this means, I don't know.
> 
> I've combed the documentation, the internet, and the list archives
> pretty thoroughly and I feel like I'm about out of things to try. Can
> anyone give me advice or leads?
> 
> 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/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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

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

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


Re: Batch Build

2011-11-01 Thread koko
Yes, I got a script working with xcodebuild and subsequently learned that a 
Scheme can be written to build any Targets desired.  Have not done this yet but 
this is more akin to Visual studio's Batch Build.


Thanks to all.

-koko


On Oct 31, 2011, at 9:32 PM, David Dunham wrote:

> On 26 Oct 2011, at 11:48, koko wrote:
> 
>> Visual Studio has a Batch Build feature ... does Xcode 4.2 have something 
>> similar?
> 
> 
> Do you mean from a batch (script) file? xcodebuild would do the trick.
> 
> David Dunham  http://a-sharp.com  Twitter: @ASharpLLC
> 
> ___
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list  (xcode-us...@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/xcode-users/koko%40highrolls.net
> 
> This email sent to k...@highrolls.net
> 

___

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

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

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

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


Re: Batch Build

2011-11-01 Thread hufey
sounds great. could you share it once you done it?

On Tue, Nov 1, 2011 at 10:33 PM, koko  wrote:
> Yes, I got a script working with xcodebuild and subsequently learned that a 
> Scheme can be written to build any Targets desired.  Have not done this yet 
> but this is more akin to Visual studio's Batch Build.
>
>
> Thanks to all.
>
> -koko
>
>
> On Oct 31, 2011, at 9:32 PM, David Dunham wrote:
>
>> On 26 Oct 2011, at 11:48, koko wrote:
>>
>>> Visual Studio has a Batch Build feature ... does Xcode 4.2 have something 
>>> similar?
>>
>>
>> Do you mean from a batch (script) file? xcodebuild would do the trick.
>>
>> David Dunham      http://a-sharp.com      Twitter: @ASharpLLC
>>
>> ___
>> Do not post admin requests to the list. They will be ignored.
>> Xcode-users mailing list      (xcode-us...@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/xcode-users/koko%40highrolls.net
>>
>> This email sent to k...@highrolls.net
>>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/hufeyy%40gmail.com
>
> This email sent to huf...@gmail.com
>
___

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

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

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

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


How to make modal window appear on the screen (not in background) ?

2011-11-01 Thread Vojtěch Meluzín
Hi,

I'm using NSApp runModalForWindow to display a modal window, but it appears
in background. Also as a response to some action in the window there may be
additional modal window shown, so kind of a nested runModalForWindow. In
that case the new window, which should be in front doesn't appear in front,
but behind the first window and is show when I click to the background
window (it's probable that that's caused by me calling NSWindow
makeKeyAndOrderFront).

So how to make this behave correctly?

Thanks,
Vojtech
___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Thanks Jens. I solved the crash problem - I now call setReleasedWhenClosed
FALSE for the window and it seems helping. On the other hand now
runModalForWindow
increases retainCount! Why is that? It makes no sense to me.
Also the window still appears in background (code below) and cursor cannot
be changed.

Here's part of the code (it's an interface, so I just put out relevant
parts of the methods being used, MCocoaView is a custom view class):

NSRect rect = MRectToNSRect(ctrl->GetSizeRect());
desc.View = [[MCocoaView alloc]initWithMControl: ctrl WindowSystem:
winsys];

   // Create window.
NSRect bounds = MRectToNSRect(MRect(pos.X, pos.Y, pos.X + sz.X
- 1, pos.Y + sz.Y - 1));
NSUInteger style = NSBorderlessWindowMask;
desc->Window = [[NSWindow alloc] initWithContentRect: bounds
styleMask: style
backing: NSBackingStoreBuffered
defer: YES];
[desc->Window setReleasedWhenClosed: FALSE];

NSString *titlens = MStringToNSString(caption);
[desc->Window setTitle: titlens ];
[titlens release];

[desc->Window setContentView: desc->View];

// Activate the process...
 ProcessSerialNumber ourPsn = {0, kCurrentProcess};
//OSStatus status =
SetFrontProcess(&ourPsn);
   [desc->Window makeKeyAndOrderFront: NULL];


[NSApp activateIgnoringOtherApps: TRUE];
[NSApp runModalForWindow: desc->Window];

Thanks, Vojtech


Dne 1. listopadu 2011 5:27 Jens Alfke  napsal(a):

>
> On Oct 31, 2011, at 6:00 PM, Vojtěch Meluzín wrote:
>
> I tried using runModalForWindow, but found following problems:
> 1) The method seems to release the window or something. If I don't call
> [NSWindow retain] before calling it, further calls lead to a crash.
> Therefore I cannot show subwindows.
> 2) It doesn't show and activate the window - in most cases the window
> appears in the background.
> 3) It cannot change cursor - [NSCursor set] does nothing.
>
>
> I think you need to show us the code you use to run the window.
>
> 4) The documentation says nothing about the problems above, but it states
> the processing stops any other processing in other windows, including
> timers, that's not a good idea.
>
>
> It puts the runloop into a different mode, and blocks user events aimed at
> other windows, which sounds like what you want. Whether timers run depends
> on what runloop modes they were registered with; but there are plenty of
> other cases where modal windows are run, so the host app has probably had
> to deal with those before.
>
> —Jens
>
___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Jens Alfke

On Nov 1, 2011, at 8:43 AM, Vojtěch Meluzín wrote:

> On the other hand now runModalForWindow increases retainCount! Why is that? 
> It makes no sense to me.

It’s probably being retained and then autoreleased by AppKit. Don’t pay any 
attention to retainCount, it’s generally not useful for detecting memory issues.

However, note that you called -alloc to create the NSWindow, so by the memory 
guidelines you are responsible for releasing it when you’re through with it.

> Also the window still appears in background (code below) and cursor cannot be 
> changed.

What app is this in? Is it a Carbon app? I’ve never done Cocoa-in-Carbon 
embedding but I think there may be some special considerations involved.

> NSUInteger style = NSBorderlessWindowMask;

Borderless windows can’t get keyboard focus by default. If you want that you’ll 
have to subclass NSWindow and override -canBecomeKey.

Also, running a borderless window as modal is kind of weird and probably 
contrary to the HI Guidelines. Is there a good reason this needs to not have a 
title bar?

> NSString *titlens = MStringToNSString(caption);
> [desc->Window setTitle: titlens ];
> [titlens release];

This seems sort of weird — your MStringToNSString doesn’t return an 
autoreleased NSString? That’s against refcounting conventions and rather 
error-prone.

> 
> [desc->Window setContentView: desc->View];

I don’t see any code to release desc->View. If you’re not already releasing it 
after the code you showed, this line might be a good place to add the -release 
call, since the view is now retained by the window.

> // Activate the process...
>  ProcessSerialNumber ourPsn = {0, kCurrentProcess};
> //OSStatus status = 
> SetFrontProcess(&ourPsn);

This is unnecessary if you’re already calling -activateIgnoringOtherApps:, 
which does the same thing.

—Jens___

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 make modal window appear on the screen (not in background) ?

2011-11-01 Thread Jens Alfke

On Nov 1, 2011, at 8:36 AM, Vojtěch Meluzín wrote:

> 'm using NSApp runModalForWindow to display a modal window, but it appears
> in background.

Um, you already asked this in another message. Let’s keep this in one thread to 
avoid confusion.

—Jens___

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: Batch Build

2011-11-01 Thread koko
I will post an answer when I do it.  It is not a high priority as I have the 
xcodebuild scripts.

-koko


On Nov 1, 2011, at 9:08 AM, hufey wrote:

> sounds great. could you share it once you done it?
> 
> On Tue, Nov 1, 2011 at 10:33 PM, koko  wrote:
>> Yes, I got a script working with xcodebuild and subsequently learned that a 
>> Scheme can be written to build any Targets desired.  Have not done this yet 
>> but this is more akin to Visual studio's Batch Build.
>> 
>> 
>> Thanks to all.
>> 
>> -koko
>> 
>> 
>> On Oct 31, 2011, at 9:32 PM, David Dunham wrote:
>> 
>>> On 26 Oct 2011, at 11:48, koko wrote:
>>> 
 Visual Studio has a Batch Build feature ... does Xcode 4.2 have something 
 similar?
>>> 
>>> 
>>> Do you mean from a batch (script) file? xcodebuild would do the trick.
>>> 
>>> David Dunham  http://a-sharp.com  Twitter: @ASharpLLC
>>> 
>>> ___
>>> Do not post admin requests to the list. They will be ignored.
>>> Xcode-users mailing list  (xcode-us...@lists.apple.com)
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/xcode-users/koko%40highrolls.net
>>> 
>>> This email sent to k...@highrolls.net
>>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/hufeyy%40gmail.com
>> 
>> This email sent to huf...@gmail.com
>> 
> 

___

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

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

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

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


Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Scott Ribe
On Nov 1, 2011, at 9:43 AM, Vojtěch Meluzín wrote:

> On the other hand now
> runModalForWindow
> increases retainCount! Why is that? It makes no sense to me.

Why wouldn't it? Why would NSApp not retain the window that it's running 
modally???

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

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 do we get rid of "application downloaded from the internet" warnings?

2011-11-01 Thread Howard Moon
I experienced the exact same symptoms as the OP when trying to open more than 
just a handful of .png files at once (NONE of which were downloaded from the 
internet, but created in Photoshop).  Perhaps after some number of files is 
exceeded, the behavior changes?  It worked fine when I opened just a few of 
them at a time.

On Oct 31, 2011, at 9:24 PM, Jens Alfke wrote:

> PNG files shouldn’t have any dangers, but my point is that it sounded like 
> some of the files the OP downloaded weren’t actually PNG, or were perhaps 
> corrupt enough to look like some other filetype to the OS.

___

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: inserting/removing items in NSOutlineView subclass

2011-11-01 Thread Sebastien Boisvert
As you can see from the sample code I provided, I call -beginUpdates and 
-endUpdates around it.

Full stack trace below. Could the fact that it was being done during a 
notification being handled have something to do with it?

I was able to avoid the exception by calling the code async on the main thread, 
but that's not really a workable solution for me.


Stack Trace:(
0   CoreFoundation                      0x7fff8672c286 
__exceptionPreprocess + 198
1   libobjc.A.dylib                     0x7fff8aad4d5e objc_exception_throw 
+ 43
2   CoreFoundation                      0x7fff8672c0ba +[NSException 
raise:format:arguments:] + 106
3   Foundation                          0x7fff8c4757d3 -[NSAssertionHandler 
handleFailureInMethod:object:file:lineNumber:description:] + 169
4   AppKit                              0x7fff8e89f32b -[NSTableView 
_doUpdatedWorkWithHandler:] + 133
5   AppKit                              0x7fff8ebd5f35 -[NSOutlineView 
removeItemsAtIndexes:inParent:withAnimation:] + 214
6   MyFrmwrk                             0x0001003b0ddb -[MyOutlineView 
endEditing] + 347
7   MyFrmwrk                             0x0001003b2177 -[MyCustomEditView 
controlTextDidEndEditing:] + 215
8   Foundation                          0x7fff8c3c0de2 
__-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 47
9   CoreFoundation                      0x7fff866d4e0a _CFXNotificationPost 
+ 2634
10  Foundation                          0x7fff8c3ad097 
-[NSNotificationCenter postNotificationName:object:userInfo:] + 65
11  AppKit                              0x7fff8ecc5f67 -[NSTextField 
textDidEndEditing:] + 374
12  Foundation                          0x7fff8c3c0de2 
__-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 47
13  CoreFoundation                      0x7fff866d4e0a _CFXNotificationPost 
+ 2634
14  Foundation                          0x7fff8c3ad097 
-[NSNotificationCenter postNotificationName:object:userInfo:] + 65
15  AppKit                              0x7fff8ed1d361 
-[NSTextView(NSPrivate) _giveUpFirstResponder:] + 438
16  AppKit                              0x7fff8ed0123e 
-[NSTextView(NSKeyBindingCommands) insertNewline:] + 537
17  CoreFoundation                      0x7fff8671ba1d -[NSObject 
performSelector:withObject:] + 61
18  AppKit                              0x7fff8ec1bbad -[NSResponder 
doCommandBySelector:] + 62
19  AppKit                              0x7fff8ecf690e -[NSTextView 
doCommandBySelector:] + 198
20  AppKit                              0x7fff8eb4 
-[NSKeyBindingManager(NSKeyBindingManager_MultiClients) 
interpretEventAsCommand:forClient:] + 1799
21  AppKit                              0x7fff8eea1b4a -[NSTextInputContext 
handleEvent:] + 747
22  AppKit                              0x7fff8ed6deaf -[NSView 
interpretKeyEvents:] + 248
23  AppKit                              0x7fff8ece6c65 -[NSTextView 
keyDown:] + 691
24  AppKit                              0x7fff8e7c6544 -[NSWindow 
sendEvent:] + 7430
25  AppKit                              0x7fff8e75e68f -[NSApplication 
sendEvent:] + 5593
26  AppKit                              0x7fff8e6f4682 -[NSApplication run] 
+ 555
27  AppKit                              0x7fff8e97380c NSApplicationMain + 
867
28  Daylite                             0x00019862 main + 34
29  Daylite                             0x00019834 start + 52
30  ???                                 0x0005 0x0 + 5




>
>From: Corbin Dunn 
>To: Sebastien Boisvert 
>Cc: cocoa-devDev 
>Sent: Monday, October 24, 2011 11:45:27 AM
>Subject: Re: inserting/removing items in NSOutlineView subclass
>
>hi sebastien,
>Are you sure you are calling beginUpdates? At what point are you doing the 
>code below in your subclass? Also, can you post the complete stack trace?
>
>If you think it is a bug in appkit, please log it at bugreporter.apple.com -- 
>but please include a test app, as I haven't been able to reproduce this 
>myself, and this is the first i've heard of the method not working.
>
>corbin
>
>On Oct 22, 2011, at 7:56 PM, Sebastien Boisvert wrote:
>
>> I have an NSOutlineView subclass that does the following to remove a row:
>> 
>> [self beginUpdates];
>> [selfremoveItemsAtIndexes:[NSIndexSetindexSetWithIndex:editingRow] 
>> inParent:nilwithAnimation:NSTableViewAnimationEffectNone];
>> [self endUpdates];
>> 
>> However, when the above runs, I get the following exception:
>> 
>> *** Assertion failure in -[MyOutlineView _doUpdatedWorkWithHandler:], 
>> /SourceCache/AppKit/AppKit-1138.23/TableView.subproj/NSTableView.m:14634
>> Exception detected while handling key input.
>> Exception Name: NSInternalInconsistencyException
>> Exception Reason: NSTableView Error: Insert/remove/move only works within a 
>> -beginUpdates/-endUpdates block.
>> 
>> 
>> Huh? The row in

Re: Write to file Entitlement

2011-11-01 Thread Laurent Etiemble
Hello,

In a sandboxed application, you can read/write files without the save
dialog by using the "File Access Temporary Exceptions" (cf.
http://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/EntitlementKeyReference/AppSandboxTemporaryExceptionEntitlements/AppSandboxTemporaryExceptionEntitlements.html).
These keys describe the folders in which you want to read/write files,
either relative to user home folder or absolute.

Here is an example to read any files inside the /Users folder:

com.apple.security.temporary-exception.files.absolute-path.read-only
 
/Users/


Here is an example to read and write any files inside the user home:

com.apple.security.temporary-exception.files.home-relative-path.read-write
 
/


Regards, Laurent Etiemble.

2011/10/31 James Merkel 

> Reading the sandboxing documents, it looks like in order to write to a
> file you need to use the save dialog.
> My app updates files without the save dialog.
> Will that be permitted in a sandboxed app ?
>
> Jim Merkel
> ___
>
> 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/laurent.etiemble%40gmail.com
>
> This email sent to laurent.etiem...@gmail.com
>
___

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

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

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

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


Re: Write to file Entitlement

2011-11-01 Thread James Merkel
Why would someone want to base their application on the tenuous availability of 
a temporary exception ?

Jim Merkel

On Nov 1, 2011, at 10:30 AM, Laurent Etiemble wrote:

> Hello,
> 
> In a sandboxed application, you can read/write files without the save dialog 
> by using the "File Access Temporary Exceptions" (cf. 
> http://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/EntitlementKeyReference/AppSandboxTemporaryExceptionEntitlements/AppSandboxTemporaryExceptionEntitlements.html).
>  These keys describe the folders in which you want to read/write files, 
> either relative to user home folder or absolute.
> 
> Here is an example to read any files inside the /Users folder:
> 
>   
> com.apple.security.temporary-exception.files.absolute-path.read-only
>   
>   /Users/
>   
> 
> Here is an example to read and write any files inside the user home:
> 
>   
> com.apple.security.temporary-exception.files.home-relative-path.read-write
>   
>   /
>   
> 
> Regards, Laurent Etiemble.
> 
> 2011/10/31 James Merkel 
> Reading the sandboxing documents, it looks like in order to write to a file 
> you need to use the save dialog.
> My app updates files without the save dialog.
> Will that be permitted in a sandboxed app ?
> 
> Jim Merkel
> ___
> 
> 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/laurent.etiemble%40gmail.com
> 
> This email sent to laurent.etiem...@gmail.com
> 

___

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

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

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

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


Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
> > On the other hand now
> > runModalForWindow
> > increases retainCount! Why is that? It makes no sense to me.
>
> Why wouldn't it? Why would NSApp not retain the window that it's running
> modally???
>

Why would it? It's AFTER the runModalForWindow ends, so the window is not
used anymore, is it?

Vojtech
___

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: Write to file Entitlement

2011-11-01 Thread Laurent Daudelin
On Nov 1, 2011, at 11:00, James Merkel wrote:

> Why would someone want to base their application on the tenuous availability 
> of a temporary exception ?
> 
> Jim Merkel
> 
> On Nov 1, 2011, at 10:30 AM, Laurent Etiemble wrote:
> 
>> Hello,
>> 
>> In a sandboxed application, you can read/write files without the save dialog 
>> by using the "File Access Temporary Exceptions" 
>> (cf.http://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/EntitlementKeyReference/AppSandboxTemporaryExceptionEntitlements/AppSandboxTemporaryExceptionEntitlements.html).
>>  These keys describe the folders in which you want to read/write files, 
>> either relative to user home folder or absolute.
>> 
>> Here is an example to read any files inside the /Users folder:
>> 
>>  
>> com.apple.security.temporary-exception.files.absolute-path.read-only
>>  
>>  /Users/
>>  
>> 
>> Here is an example to read and write any files inside the user home:
>> 
>>  
>> com.apple.security.temporary-exception.files.home-relative-path.read-write
>>  
>>  /
>>  

Well, I maintain a synchronization tool. For me, that seems like a reasonable 
solution. Each time the user decides to synchronize 2 folders, I could just use 
a temporary exception.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Thanks Jens.

On the other hand now runModalForWindow increases retainCount! Why is that?
> It makes no sense to me.
>
>
> It’s probably being retained and then autoreleased by AppKit. Don’t pay
> any attention to retainCount, it’s generally not useful for detecting
> memory issues.
>
> However, note that you called -alloc to create the NSWindow, so by the
> memory guidelines you are responsible for releasing it when you’re through
> with it.
>

But the retainCount is needed for successful release of the window, right?
I allocate the window and then deallocate it when I'm finished with it. But
runModalForWindow increases retainCount to 2, so when I release it, it's
actually not destroyed and causes a crash afterward, because for some crazy
reason the OS tries to repaint the view in it, despite the window is
already closed...


>
>

> Also the window still appears in background (code below) and cursor cannot
> be changed.
>
>
> What app is this in? Is it a Carbon app? I’ve never done Cocoa-in-Carbon
> embedding but I think there may be some special considerations involved.
>

No no, I do it only because Apple discarded Carbon for 64bit apps. But the
app/plugin is all C++, so there should just be a small layer, that does
what Carbon does normally... ugly world of development for Apple...




> NSUInteger style = NSBorderlessWindowMask;
>
>
> Borderless windows can’t get keyboard focus by default. If you want that
> you’ll have to subclass NSWindow and override -canBecomeKey.
>
> Also, running a borderless window as modal is kind of weird and probably
> contrary to the HI Guidelines. Is there a good reason this needs to not
> have a title bar?
>

I'm using my own styles. It may be no according to HI guidelines, but to be
honest, I don't care. The app/plugin should look the same on all platforms.




> NSString *titlens = MStringToNSString(caption);
> [desc->Window setTitle: titlens ];
> [titlens release];
>
>
> This seems sort of weird — your MStringToNSString doesn’t return an
> autoreleased NSString? That’s against refcounting conventions and rather
> error-prone.
>

Yaj, ok, can you explain a little more? I don't know much about Objective
C, how should the MStringToNSString be implemented to create the
autoreleased NSString? (sorry for lack of knowledge, but I just don't plan
any further development in objc, just want the small layer...)

Vojtech
___

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


Custom NSView binding

2011-11-01 Thread Livio Isaia
I repost this mail because I had problems connecting with mailing lists, sorry 
if this is someway annoying...

I created an IB plug-in with a subclass of NSView with an exposed bind of type 
NSNumber, and then I bind it to a MyNSImageView through an NSObjectController 
(this is made directly in IB).
Now, everything works fine, except that when the method setSelectedIndex: from 
MyClass is called the bound NSImageView doesn't receive any change notification.
Can anyone tell me why?

In source code of the class myclass.h:

@interface MyClass  : NSView{
NSNumber *type;
}

-(NSNumber *)type;
-(void)setType:(NSNumber *)value;
...
@end

In source code of the class myclass.m:

@implementation MyClass

+ (void)initialize
{
   if (self == [MyClass class])
   {
   [NSObject exposeBinding:@"type"];
   }
}

-(NSNumber *)type {
return type;
}

-(void)setType:(NSNumber *)value {
type = value;
}:

-(void)setSelectedIndex:(NSNumber *)value {
...
[self setValue:type forKey:@"type"];
}
@end

And in MyNSImageView.h:

@interface MyNSImageView : NSImageView {
NSNumber *type;
}
-(NSNumber *)type {return type;}
-(void)setType:(NSNumber *)value {type = value;}
@end


Thank you all in advance.
Best regards,
livio. ___

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: Sandboxing question

2011-11-01 Thread Sean McBride
On Sat, 29 Oct 2011 13:39:32 +1000, Gideon King said:

>I have an application that I am just moving to using sandboxing, and it
>currently (before sandboxing) writes log files to a folder in the
>Application Support folder, then if the program crashes, or the user
>wants to submit a defect report, it launches another application that
>picks up the log files and includes them in the report that is sent to
>our development team.
>
>I am planning to have both the main application and the defect reporting
>application sandboxed, but am wondering what the best approach is for
>the log files that are written by one application and read by the other.
>
>If I migrate the log folder from the Application Support folder to
>either of my other containers, it will not be accessible to the other
>application. I therefore think I need a file access temporary exception
>set up in both applications - would this be the best approach?
>
>If so, I will need to have it relative to the Application Support
>folder, but the only settings available are relative to the user's home
>folder, and I'm worried about hard coding a reference to /Library/
>Application Support in case there are localization issues - is this
>something I need to worry about? Is it always ~/Library/Application
>Support on all systems in all languages?

Yes, the names are constant in all languages on the file system, though the UI 
displays them localized.  Still, in general, you shouldn't hardcode paths.  
They changed between OS 9 and OS X and could change again.

I'm not sure there is a good solution for your problem.  I'd file a bug.  I 
suspect Apple only cares about apps in their store, for which I believe Apple 
provides developers crash logs.  Even using asl APIs to read logs does not work 
in the sandbox.

Cheers,

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Scott Ribe
On Nov 1, 2011, at 12:33 PM, Vojtěch Meluzín wrote:

> Why would it? It's AFTER the runModalForWindow ends, so the window is not 
> used anymore, is it?

Even so, you agree it should retain it, no? Now, should it release it or 
autorelease it when it's done? Examining retain counts is almost always the 
wrong thing to do, because it almost always indicates a basic lack of 
understanding of Cocoa memory management.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Gary L. Wade
Did you try calling stopModal or one of its variants before releasing it?
And, did you release the window rather than dealloc'ing it?  Try those to
get rid of your crash.
--
Gary L. Wade
http://www.garywade.com/


On 11/01/2011 11:41 AM, "Vojtěch Meluzín" 
wrote:

>But the retainCount is needed for successful release of the window, right?
>I allocate the window and then deallocate it when I'm finished with it.
>But
>runModalForWindow increases retainCount to 2, so when I release it, it's
>actually not destroyed and causes a crash afterward, because for some
>crazy
>reason the OS tries to repaint the view in it, despite the window is
>already closed...


___

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: Custom NSView binding

2011-11-01 Thread Quincey Morris
On Nov 1, 2011, at 11:54 , Livio Isaia wrote:

> I created an IB plug-in with a subclass of NSView with an exposed bind of 
> type NSNumber, and then I bind it to a MyNSImageView through an 
> NSObjectController (this is made directly in IB).
> Now, everything works fine, except that when the method setSelectedIndex: 
> from MyClass is called the bound NSImageView doesn't receive any change 
> notification.
> Can anyone tell me why?

Based on the information you've given us:

You *exposed* (i.e. declared) a binding called "type", but you haven't 
*implemented* that binding.

So, when you establish the particular binding relationship from a MyClass 
object to a MyNSImageView object, the automatic KVO portion of the binding 
(changes to the MyNSImageView object get pushed back to the MyClass object) 
works, but the part you're supposed to provide (pushing changes from the 
MyClass object to the MyNSImageView object) doesn't.

In other words, if you don't provide any code for the binding, it'll sort of 
appear to work, but *in one direction only*.


___

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: Write to file Entitlement

2011-11-01 Thread James Merkel

On Nov 1, 2011, at 11:37 AM, Laurent Daudelin wrote:

> On Nov 1, 2011, at 11:00, James Merkel wrote:
> 
>> Why would someone want to base their application on the tenuous availability 
>> of a temporary exception ?
>> 
>> Jim Merkel
>> 
>> On Nov 1, 2011, at 10:30 AM, Laurent Etiemble wrote:
>> 
>>> Hello,
>>> 
>>> In a sandboxed application, you can read/write files without the save 
>>> dialog by using the "File Access Temporary Exceptions" 
>>> (cf.http://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/EntitlementKeyReference/AppSandboxTemporaryExceptionEntitlements/AppSandboxTemporaryExceptionEntitlements.html).
>>>  These keys describe the folders in which you want to read/write files, 
>>> either relative to user home folder or absolute.
>>> 
>>> Here is an example to read any files inside the /Users folder:
>>> 
>>> 
>>> com.apple.security.temporary-exception.files.absolute-path.read-only
>>> 
>>> /Users/
>>> 
>>> 
>>> Here is an example to read and write any files inside the user home:
>>> 
>>> 
>>> com.apple.security.temporary-exception.files.home-relative-path.read-write
>>> 
>>> /
>>> 
> 
> Well, I maintain a synchronization tool. For me, that seems like a reasonable 
> solution. Each time the user decides to synchronize 2 folders, I could just 
> use a temporary exception.
> 
> -Laurent.
> -- 
> Laurent Daudelin
> AIM/iChat/Skype:LaurentDaudelin   
> http://www.nemesys-soft.com/
> Logiciels Nemesys Software
> laur...@nemesys-soft.com
> 

Your're assuming the temporary exception will always be granted.

Jim Merkel
___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Sure. I used AbortModal, just in case it's not from the main thread, then
performed release once, since I have also allocated it. Still 1 remains. I
also used autorelease pool in for the modal processing. But still
retainCount is 1 after my release. And after that Mac OS tries to redraw
the view...

Vojtech

2011/11/1 Gary L. Wade 

> Did you try calling stopModal or one of its variants before releasing it?
> And, did you release the window rather than dealloc'ing it?  Try those to
> get rid of your crash.
> --
> Gary L. Wade
> http://www.garywade.com/
>
>
> On 11/01/2011 11:41 AM, "Vojtěch Meluzín" 
> wrote:
>
> >But the retainCount is needed for successful release of the window, right?
> >I allocate the window and then deallocate it when I'm finished with it.
> >But
> >runModalForWindow increases retainCount to 2, so when I release it, it's
> >actually not destroyed and causes a crash afterward, because for some
> >crazy
> >reason the OS tries to repaint the view in it, despite the window is
> >already closed...
>
>
>
___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11/1/11 11:41 AM, Vojtěch Meluzín wrote:
> But the retainCount is needed for successful release of the window,
> right? I allocate the window and then deallocate it when I'm
> finished with it. But runModalForWindow increases retainCount to 2,
> so when I release it, it's actually not destroyed and causes a
> crash afterward, because for some crazy reason the OS tries to
> repaint the view in it, despite the window is already closed...


Quoting from the NSObject protocol reference:



- - (NSUInteger)retainCount
...
Important: This method is typically of no value in debugging memory
management issues. Because any number of framework objects may have
retained an object in order to hold references to it, while at the
same time autorelease pools may be holding any number of deferred
releases on an object, it is very unlikely that you can get useful
information from this method.

To understand the fundamental rules of memory management that you must
abide by, read “Memory Management Rules”...



You may have a problem leading to a crash, but examining retainCount
will only confuse matters.

> I'm using my own styles. It may be no according to HI guidelines,
> but to be honest, I don't care. The app/plugin should look the same
> on all platforms.


I disagree vehemently (as I suspect do others on the list), but I
won't dwell on this.

> Yaj, ok, can you explain a little more? I don't know much about
> Objective C, how should the MStringToNSString be implemented to
> create the autoreleased NSString? (sorry for lack of knowledge, but
> I just don't plan any further development in objc, just want the
> small layer...)


I don't really know C++, so there is some generalization here.  Since
you are returning a retained NSString, presumably inside your function
are you are doing something like:

return [[NSString alloc] initWithCString:stringFromCPlusPlusMethod
encoding:someEncoding];

To return an autoreleased string, instead use:

return [NSString stringWithCString:stringFromCPlusPlusMethod
encoding:someEncoding];


- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFOsEmlaOlrz5+0JdURAvPIAJ0T9zfk1j0pkPAppTeXRTQ6Fo9HWgCfYb9W
AWSjxZKNtvONuqN6vS5YvCQ=
=ILa7
-END PGP SIGNATURE-
___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Preston Sumner

On Nov 1, 2011, at 12:41 PM, Vojtěch Meluzín wrote:

> Thanks Jens.
> 
> On the other hand now runModalForWindow increases retainCount! Why is that?

retainCount should not be used to debug memory management issues--or at all, 
really.

> I'm using my own styles. It may be no according to HI guidelines, but to be
> honest, I don't care. The app/plugin should look the same on all platforms.

That is up to you, but be warned that the Apple userbase in general is 
negatively reactive to interfaces that feel non-native.

Preston___

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: Speeding up image drawing?

2011-11-01 Thread Seth Willits
On Oct 31, 2011, at 6:44 PM, Arbit Richardi wrote:

> I'm looking for tips to speed image drawing on OS X — this is a
> primary function of my application. I started out naively with
> NSImage, switched to CGImage, tried layer backing, and now draw
> directly into a hosted layer with Quartz. I have an implementation
> using CATiledLayers but it doesn't add speed in common cases.
> 
> At this point, large images still draw significantly slower than in
> Preview. For example, I can display a 25MB test JPEG (~9k x 9k pixels)
> in ~2 seconds while Preview can display it in ~1 second on the same
> machine.


Well, your multiple approaches make me wonder what you mean by "draw" but take 
a look at the graphics context's interpolation quality for scaling. It makes a 
huge difference.



--
Seth Willits



___

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: Write to file Entitlement

2011-11-01 Thread Seth Willits
On Nov 1, 2011, at 12:19 PM, James Merkel wrote:

>> Well, I maintain a synchronization tool. For me, that seems like a 
>> reasonable solution. Each time the user decides to synchronize 2 folders, I 
>> could just use a temporary exception.
> 
> Your're assuming the temporary exception will always be granted.


Not to mention it's a compile-time setting which makes it practically useless.

These stupid entitlements prevent all of my applications from being in the MAS 
at the moment. Extremely annoying. Yes, I've filed reports (which have been 
marked as duplicates).


--
Seth Willits



___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
> > I'm using my own styles. It may be no according to HI guidelines, but to
> be
> > honest, I don't care. The app/plugin should look the same on all
> platforms.
>
> That is up to you, but be warned that the Apple userbase in general is
> negatively reactive to interfaces that feel non-native.
>
> Preston


It's mainly for VST/VST3/AU plugins, where the users are used to much more
hardcore things :)).

Vojtech
___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
> I don't really know C++, so there is some generalization here.  Since
> you are returning a retained NSString, presumably inside your function
> are you are doing something like:
>
> return [[NSString alloc] initWithCString:stringFromCPlusPlusMethod
> encoding:someEncoding];
>
> To return an autoreleased string, instead use:
>
> return [NSString stringWithCString:stringFromCPlusPlusMethod
> encoding:someEncoding];
>
>
Thanks!

Now to the original topic - the window is still not displayed over the
others. I tried NSTitledWindowMask instead of the borderless, but it's
still the same. Any ideas?

Vojtech
___

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: inserting/removing items in NSOutlineView subclass

2011-11-01 Thread Corbin Dunn
Hi Sebastien,

Your code looked like pseudo code, since it lacked spacing. I think you should 
still double check if it is called.

As I said before, if you think it is a bug in appkit, please log it at 
bugreporter.apple.com -- but please include a test app, as I haven't been able 
to reproduce this myself, and this is the first i've heard of the method not 
working.

corbin

On Nov 1, 2011, at 10:04 AM, Sebastien Boisvert wrote:

> As you can see from the sample code I provided, I call -beginUpdates and 
> -endUpdates around it.
> 
> Full stack trace below. Could the fact that it was being done during a 
> notification being handled have something to do with it?
> 
> I was able to avoid the exception by calling the code async on the main 
> thread, but that's not really a workable solution for me.
> 
> 
> Stack Trace:(
> 0   CoreFoundation  0x7fff8672c286 
> __exceptionPreprocess + 198
> 1   libobjc.A.dylib 0x7fff8aad4d5e 
> objc_exception_throw + 43
> 2   CoreFoundation  0x7fff8672c0ba +[NSException 
> raise:format:arguments:] + 106
> 3   Foundation  0x7fff8c4757d3 
> -[NSAssertionHandler 
> handleFailureInMethod:object:file:lineNumber:description:] + 169
> 4   AppKit  0x7fff8e89f32b -[NSTableView 
> _doUpdatedWorkWithHandler:] + 133
> 5   AppKit  0x7fff8ebd5f35 -[NSOutlineView 
> removeItemsAtIndexes:inParent:withAnimation:] + 214
> 6   MyFrmwrk 0x0001003b0ddb -[MyOutlineView 
> endEditing] + 347
> 7   MyFrmwrk 0x0001003b2177 
> -[MyCustomEditView controlTextDidEndEditing:] + 215
> 8   Foundation  0x7fff8c3c0de2 
> __-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 
> 47
> 9   CoreFoundation  0x7fff866d4e0a 
> _CFXNotificationPost + 2634
> 10  Foundation  0x7fff8c3ad097 
> -[NSNotificationCenter postNotificationName:object:userInfo:] + 65
> 11  AppKit  0x7fff8ecc5f67 -[NSTextField 
> textDidEndEditing:] + 374
> 12  Foundation  0x7fff8c3c0de2 
> __-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 
> 47
> 13  CoreFoundation  0x7fff866d4e0a 
> _CFXNotificationPost + 2634
> 14  Foundation  0x7fff8c3ad097 
> -[NSNotificationCenter postNotificationName:object:userInfo:] + 65
> 15  AppKit  0x7fff8ed1d361 
> -[NSTextView(NSPrivate) _giveUpFirstResponder:] + 438
> 16  AppKit  0x7fff8ed0123e 
> -[NSTextView(NSKeyBindingCommands) insertNewline:] + 537
> 17  CoreFoundation  0x7fff8671ba1d -[NSObject 
> performSelector:withObject:] + 61
> 18  AppKit  0x7fff8ec1bbad -[NSResponder 
> doCommandBySelector:] + 62
> 19  AppKit  0x7fff8ecf690e -[NSTextView 
> doCommandBySelector:] + 198
> 20  AppKit  0x7fff8eb4 
> -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) 
> interpretEventAsCommand:forClient:] + 1799
> 21  AppKit  0x7fff8eea1b4a 
> -[NSTextInputContext handleEvent:] + 747
> 22  AppKit  0x7fff8ed6deaf -[NSView 
> interpretKeyEvents:] + 248
> 23  AppKit  0x7fff8ece6c65 -[NSTextView 
> keyDown:] + 691
> 24  AppKit  0x7fff8e7c6544 -[NSWindow 
> sendEvent:] + 7430
> 25  AppKit  0x7fff8e75e68f -[NSApplication 
> sendEvent:] + 5593
> 26  AppKit  0x7fff8e6f4682 -[NSApplication 
> run] + 555
> 27  AppKit  0x7fff8e97380c NSApplicationMain 
> + 867
> 28  Daylite 0x00019862 main + 34
> 29  Daylite 0x00019834 start + 52
> 30  ??? 0x0005 0x0 + 5
> 
> 
> 
> 
>> 
>> From: Corbin Dunn 
>> To: Sebastien Boisvert 
>> Cc: cocoa-devDev 
>> Sent: Monday, October 24, 2011 11:45:27 AM
>> Subject: Re: inserting/removing items in NSOutlineView subclass
>> 
>> hi sebastien,
>> Are you sure you are calling beginUpdates? At what point are you doing the 
>> code below in your subclass? Also, can you post the complete stack trace?
>> 
>> If you think it is a bug in appkit, please log it at bugreporter.apple.com 
>> -- but please include a test app, as I haven't been able to reproduce this 
>> myself, and this is the first i've heard of the method not working.
>> 
>> corbin
>> 
>> On Oct 22, 2011, at 7:56 PM, Sebastien Boisvert wrote:
>> 
>>> I have an NSOutlineView subclass that does the following to remove a row:
>>> 
>>> [sel

NSOutlineView with NSTableCellView not working, what am I missing?

2011-11-01 Thread Gustavo Pizano
Hello.

Im trying to set a NSOutlineView not Cell based but View based. 

Now, I read the documentation and pretty much I had all set up except that the 
binding doest go to the table column, but to the table view contents. 

- So I have a class called PGTreeNode with a name and an image properties. In 
IB I set up the a NSTreeController and bound the content array to an 
NSMutableArray form the File Owner.
- I then bound the outlineView's content binding to the NSTreeController with 
arrangedObjects  controller key.
- Then I selected the TextField of the NSTableCellView and bound it;s value to 
Table View Cell  with model key path objectValue.name.
- the same as above for the image property.


I run the app, click an add button, (which is connected to the add: of the 
NSTreeController). In fact a new instance of PGTreeNode is created, but the 
outline view displays only the disclosure triangle with no name and no image. 

Any ideas?


Thx Gustavo

Gustavo

___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Ok, here's an interesting development:
1) In a simple "console" application the modal window is initially hidden.
2) In a plugin the window is displayed above and even nested modal windows
are displayed correctly.

So could it be just by the fact that the testing application was "console"
app?

Vojtech

Dne 1. listopadu 2011 21:06 Vojtěch Meluzín
napsal(a):

>
> I don't really know C++, so there is some generalization here.  Since
>> you are returning a retained NSString, presumably inside your function
>> are you are doing something like:
>>
>> return [[NSString alloc] initWithCString:stringFromCPlusPlusMethod
>> encoding:someEncoding];
>>
>> To return an autoreleased string, instead use:
>>
>> return [NSString stringWithCString:stringFromCPlusPlusMethod
>> encoding:someEncoding];
>>
>>
> Thanks!
>
> Now to the original topic - the window is still not displayed over the
> others. I tried NSTitledWindowMask instead of the borderless, but it's
> still the same. Any ideas?
>
> Vojtech
>
>
___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Jens Alfke

On Nov 1, 2011, at 11:41 AM, Vojtěch Meluzín wrote:

> Yaj, ok, can you explain a little more? I don't know much about Objective C, 
> how should the MStringToNSString be implemented to create the autoreleased 
> NSString? (sorry for lack of knowledge, but I just don't plan any further 
> development in objc, just want the small layer...)

If you don’t understand how to return an autoreleased string, then you really 
should go and learn more about Objective-C before you try to get your app 
running. Seriously, that is literally one of the first interview questions I 
ask candidates for entry-level Mac/iOS programming jobs. I wouldn’t want anyone 
who didn’t know the answer to that working on any Cocoa code I was using.

I don’t mean to be rude, but it’s like you're saying “I don’t understand what 
malloc or free do, but I need help because my C program crashes when I call 
free”. Your chances of writing reliable code are pretty slim if you don’t know 
what you’re doing here, and we’re not likely to be able to help figure out a 
crash if it’s indirectly caused by something you’re doing wrong elsewhere in 
your code (which is what it sounds like is happening here.)

If you’re really not willing to learn Cocoa, you could find a contract 
programmer who does, who can do just this piece of work for you.

—Jens___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Don't worry, the allocation seems working now. A few autorelease pools did
the trick. I know just the most basic stuff and don't intend to learn more
simply because I'm not planning to use it at all. The simple layer only
calls other functions made in C++. That's all I need.

Anyway we are getting out of the topic. Does anyone here know why the modal
windows work in a plugin (in a normal application) and not from a console
application?

And 2 more things - the main view in the window still doesn't receive
keyboard input (I subclassed NSWindow adding canBecomeKeyWindow and
canBecomeMainWindow, both return true) and the cursor cannot be changed.
Any ideas?

Thanks.
Vojtech

Dne 1. listopadu 2011 22:58 Jens Alfke  napsal(a):

>
> On Nov 1, 2011, at 11:41 AM, Vojtěch Meluzín wrote:
>
> Yaj, ok, can you explain a little more? I don't know much about Objective
> C, how should the MStringToNSString be implemented to create the
> autoreleased NSString? (sorry for lack of knowledge, but I just don't plan
> any further development in objc, just want the small layer...)
>
>
> If you don’t understand how to return an autoreleased string, then you
> really should go and learn more about Objective-C before you try to get
> your app running. Seriously, that is literally one of the first interview
> questions I ask candidates for entry-level Mac/iOS programming jobs. I
> wouldn’t want anyone who didn’t know the answer to that working on any
> Cocoa code I was using.
>
> I don’t mean to be rude, but it’s like you're saying “I don’t understand
> what malloc or free do, but I need help because my C program crashes when I
> call free”. Your chances of writing reliable code are pretty slim if you
> don’t know what you’re doing here, and we’re not likely to be able to help
> figure out a crash if it’s indirectly caused by something you’re doing
> wrong elsewhere in your code (which is what it sounds like is happening
> here.)
>
> If you’re really not willing to learn Cocoa, you could find a contract
> programmer who does, who can do just this piece of work for you.
>
> —Jens
>
___

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: Custom NSView binding

2011-11-01 Thread Livio Isaia

Il giorno 01/nov/2011, alle ore 20.16, Quincey Morris ha scritto:

> On Nov 1, 2011, at 11:54 , Livio Isaia wrote:
> 
>> I created an IB plug-in with a subclass of NSView with an exposed bind of 
>> type NSNumber, and then I bind it to a MyNSImageView through an 
>> NSObjectController (this is made directly in IB).
>> Now, everything works fine, except that when the method setSelectedIndex: 
>> from MyClass is called the bound NSImageView doesn't receive any change 
>> notification.
>> Can anyone tell me why?
> 
> Based on the information you've given us:
> 
> You *exposed* (i.e. declared) a binding called "type", but you haven't 
> *implemented* that binding.
> 
> So, when you establish the particular binding relationship from a MyClass 
> object to a MyNSImageView object, the automatic KVO portion of the binding 
> (changes to the MyNSImageView object get pushed back to the MyClass object) 
> works, but the part you're supposed to provide (pushing changes from the 
> MyClass object to the MyNSImageView object) doesn't.
> 
> In other words, if you don't provide any code for the binding, it'll sort of 
> appear to work, but *in one direction only*.
> 
> 

Thank you for your answer,
but i can't figure out which method(s) I must implement. I tried with some of 
them and still doesn't work (e.g. valueForKey:)

Regards,
livio.___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Jens Alfke

On Nov 1, 2011, at 3:06 PM, Vojtěch Meluzín wrote:

> Anyway we are getting out of the topic. Does anyone here know why the modal 
> windows work in a plugin (in a normal application) and not from a console 
> application?

Basically, apps aren’t intended to be launched by a plain exec. A normal launch 
through the LaunchServices API provides some extra setup and state. You _can_ 
launch an app from a shell or equivalent, and it’ll mostly work, but that’s 
mostly as a convenience for developers and for debugging, and there’s no 
guarantee that everything will work correctly. One of the known side effects is 
that the app launches in an indeterminate state in between active and inactive, 
which is probably what you’re seeing.

If you need to launch an app programmatically, look at the LaunchServices API, 
or from a shell use the ‘open’ command on the bundle.

—Jens___

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: NSAssert no longer displaying reason in console

2011-11-01 Thread Matt Neuburg
On Sun, 30 Oct 2011 09:45:25 -0700, Matt Neuburg  said:
>On Mon, 24 Oct 2011 16:01:30 -0700, Ben Kennedy  said:
>>On 24 Oct 2011, at 3:53 pm, Matt Neuburg wrote:
>>
>>> That's all! Dude, where's my reason? And without a printing of the reason, 
>>> what's the good of the assert? (And hey, I wouldn't mind seeing that lovely 
>>> call stack, too.)
>>
>>Exceptions don't get logged automatically anymore when running under iOS 5, 
>>in my experience.

Sorry to keep harping on this, but this is a serious bug. As Ben Kennedy says, 
it isn't just NSAssert. iOS often throws a fatal exception with an absolutely 
lovely informative log message explaining the problem (e.g., your view 
controller loaded a nib but the view outlet wasn't hooked up). That log message 
is now being suppressed! The user never sees it. Surely Apple cannot intend 
that Xcode should be swallowing these informative log messages??? m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Thanks Jens. Btw. I fixed it with this:

[window setLevel: CGShieldingWindowLevel()];

I googled it, but I'm just not sure if cannot have some "bad" side-effects.

Vojtech


Dne 2. listopadu 2011 0:31 Jens Alfke  napsal(a):

>
> On Nov 1, 2011, at 3:06 PM, Vojtěch Meluzín wrote:
>
> Anyway we are getting out of the topic. Does anyone here know why the
> modal windows work in a plugin (in a normal application) and not from a
> console application?
>
>
> Basically, apps aren’t intended to be launched by a plain exec. A normal
> launch through the LaunchServices API provides some extra setup and state.
> You _can_ launch an app from a shell or equivalent, and it’ll mostly work,
> but that’s mostly as a convenience for developers and for debugging, and
> there’s no guarantee that everything will work correctly. One of the known
> side effects is that the app launches in an indeterminate state in between
> active and inactive, which is probably what you’re seeing.
>
> If you need to launch an app programmatically, look at the LaunchServices
> API, or from a shell use the ‘open’ command on the bundle.
>
> —Jens
>
___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Scott Ribe
On Nov 1, 2011, at 4:06 PM, Vojtěch Meluzín wrote:

> Does anyone here know why the modal
> windows work in a plugin (in a normal application) and not from a console
> application?

Lack of a run loop? Or did you run one yourself in the console app?

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
I used runModalForWindow, that should handle the even loop, right? Anyway
it seems working now. But still the keyboard events and mouse cursors don't
work...

Vojtech

Dne 2. listopadu 2011 0:41 Scott Ribe napsal(a):

> On Nov 1, 2011, at 4:06 PM, Vojtěch Meluzín wrote:
>
> > Does anyone here know why the modal
> > windows work in a plugin (in a normal application) and not from a console
> > application?
>
> Lack of a run loop? Or did you run one yourself in the console app?
>
> --
> Scott Ribe
> scott_r...@elevated-dev.com
> http://www.elevated-dev.com/
> (303) 722-0567 voice
>
>
>
>
>
___

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: minor ARC casting question

2011-11-01 Thread Matt Neuburg
On Sun, 30 Oct 2011 15:55:39 +, Igor Mozolevsky  
said:
>On 30 October 2011 15:15, Matt Neuburg  wrote:
>> In ARC, this is legal:
>>
>> self.view.layer.contents = (id)[[UIImage imageNamed:@"boat.gif"] CGImage];
>>
>> And this is legal:
>>
>> id ref = (id)[[UIImage imageNamed:@"boat.gif"] CGImage];
>> self.view.layer.contents = ref;
>>
>> But this is not:
>>
>> CGImageRef ref = [[UIImage imageNamed:@"boat.gif"] CGImage];
>> self.view.layer.contents = (id)ref; // compilation fails
>>
>> In the last case, I have to change id to __bridge id. My question is: What's 
>> the difference in the cases? In all situations I'm casting a CGImageRef to 
>> an id, so why does ARC permit this in the first cases but not in the last? 
>> Is it because UIImage's CGImage method is a method, and this fact somehow 
>> gives ARC further info? Thx - m.
>
>The compiler knows how to handle CF objects returned from Cocoa
>methods, but doesn't know how to handle stuff created by yourself. I
>thought that was fairly obvious from and explicit in the Transitioning
>Notes?
>

It's no use referring me to the Transitioning Notes. The problem is in part 
that they are wrong. This makes it hard to know what to do. Presumably we're 
talking about this?

   
http://developer.apple.com/library/mac/#releasenotes/ObjectiveC/RN-TransitioningToARC/_index.html

Well, the example code there says:

CAGradientLayer *gradientLayer = (CAGradientLayer *)[self layer];
gradientLayer.colors = [NSArray arrayWithObjects:[[UIColor darkGrayColor] 
CGColor],
 [[UIColor lightGrayColor] 
CGColor], nil];

The trouble is that in actual fact **that code does not compile** under ARC. 
("Implicit conversion of a non-Objective-C pointer type 'CGColorRef' (aka 
'struct CGColor *') to 'id' is disallowed with ARC.") So your humble narrator 
is no wiser than before about how to silence the compiler while properly 
crossing the bridge. My solution, discovered purely experimentation, is make 
the conversion explicit; this *does* compile:

CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor 
darkGrayColor] CGColor],
(id)[[UIColor lightGrayColor] CGColor], nil];

And now we're back to my original question. Is that the right way? And why am I 
able to get away without saying __bridge id (or whatever), as I would have to 
do if I were generating my own CGColor and not returning the CGColor via a 
built-in method? m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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: minor ARC casting question

2011-11-01 Thread David Duncan
On Nov 1, 2011, at 5:06 PM, Matt Neuburg wrote:

> Well, the example code there says:
> 
>CAGradientLayer *gradientLayer = (CAGradientLayer *)[self layer];
>gradientLayer.colors = [NSArray arrayWithObjects:[[UIColor darkGrayColor] 
> CGColor],
> [[UIColor lightGrayColor] 
> CGColor], nil];
> 
> The trouble is that in actual fact **that code does not compile** under ARC. 
> ("Implicit conversion of a non-Objective-C pointer type 'CGColorRef' (aka 
> 'struct CGColor *') to 'id' is disallowed with ARC.")

This compiles for me under ARC:
NSArray *array = [NSArray arrayWithObject:[[UIColor greenColor] CGColor]];

Since +arrayWithObjects is variadric, the parameters past the first don't need 
any consideration, so the comparison to +arrayWithObject: should be identical.

> So your humble narrator is no wiser than before about how to silence the 
> compiler while properly crossing the bridge. My solution, discovered purely 
> experimentation, is make the conversion explicit; this *does* compile:
> 
>CAGradientLayer *gradientLayer = [CAGradientLayer layer];
>gradientLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor 
> darkGrayColor] CGColor],
>(id)[[UIColor lightGrayColor] CGColor], nil];
> 
> And now we're back to my original question. Is that the right way? And why am 
> I able to get away without saying __bridge id (or whatever), as I would have 
> to do if I were generating my own CGColor and not returning the CGColor via a 
> built-in method? m.


Exactly what you do depends on your needs. For general parameter passing a 
__bridge cast (ala (__bridge id)foo) works fine. If you need to to manage 
ownership, then CFBridgingRetain() or CFBridgingRelease() should be used.
--
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: minor ARC casting question

2011-11-01 Thread Greg Parker
On Nov 1, 2011, at 5:06 PM, Matt Neuburg wrote:
>CAGradientLayer *gradientLayer = [CAGradientLayer layer];
>gradientLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor 
> darkGrayColor] CGColor],
>(id)[[UIColor lightGrayColor] CGColor], nil];
> 
> And now we're back to my original question. Is that the right way?

Yes.


> And why am I able to get away without saying __bridge id (or whatever), as I 
> would have to do if I were generating my own CGColor and not returning the 
> CGColor via a built-in method?

Because the compiler has a special case wherein you can use an ordinary cast on 
the result of an Objective-C method that returns a CF type.


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

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


Re: NSAssert no longer displaying reason in console

2011-11-01 Thread Kyle Sluder
On Nov 1, 2011, at 7:38 PM, Matt Neuburg  wrote:

> 
> Sorry to keep harping on this, but this is a serious bug. As Ben Kennedy 
> says, it isn't just NSAssert. iOS often throws a fatal exception with an 
> absolutely lovely informative log message explaining the problem (e.g., your 
> view controller loaded a nib but the view outlet wasn't hooked up). That log 
> message is now being suppressed! The user never sees it. Surely Apple cannot 
> intend that Xcode should be swallowing these informative log messages??? m.

Here's my WAG: are you sure you didn't turn on the "All Objective-C Exceptions" 
breakpoint, and are therefore breaking in objc_exception_throw before the log 
message whereas you are used to waiting until the default uncaught exception 
handler logs the exception message and raises a signal?

--Kyle Sluder
(Sent from the road)___

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: Custom NSView binding

2011-11-01 Thread Quincey Morris
On Nov 1, 2011, at 15:27 , Livio Isaia wrote:

> Thank you for your answer,
> but i can't figure out which method(s) I must implement. I tried with some of 
> them and still doesn't work (e.g. valueForKey:)

It's not very well documented. Start here:


http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html

and work through the joystick example.

There are *very* few situations where it's worthwhile going to all this trouble 
to implement a custom binding, but IB plugins are one where it makes sense. (Of 
course, IB plugins themselves are now of doubtful value, since there's no 
forward path into Xcode 4.x.)


___

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: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Ok, so even the keyboard input is related to the console application. With
normal "bundled" Cocoa app it works. Cursors are still missing though.
Anyway a good thing to remember: don't use console app to test GUI stuff :).

Vojtech

Dne 2. listopadu 2011 0:46 Vojtěch Meluzín napsal(a):

> I used runModalForWindow, that should handle the even loop, right? Anyway
> it seems working now. But still the keyboard events and mouse cursors don't
> work...
>
> Vojtech
>
> Dne 2. listopadu 2011 0:41 Scott Ribe napsal(a):
>
> On Nov 1, 2011, at 4:06 PM, Vojtěch Meluzín wrote:
>>
>> > Does anyone here know why the modal
>> > windows work in a plugin (in a normal application) and not from a
>> console
>> > application?
>>
>> Lack of a run loop? Or did you run one yourself in the console app?
>>
>> --
>> Scott Ribe
>> scott_r...@elevated-dev.com
>> http://www.elevated-dev.com/
>> (303) 722-0567 voice
>>
>>
>>
>>
>>
>
>
>
___

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: minor ARC casting question

2011-11-01 Thread David Duncan
On Nov 1, 2011, at 6:38 PM, Matt Neuburg wrote:

> 
> On Nov 1, 2011, at 5:21 PM, David Duncan wrote:
> 
>> This compiles for me under ARC:
>> NSArray *array = [NSArray arrayWithObject:[[UIColor greenColor] CGColor]];
>> 
> 
> 
> Well, not for me. I get: "Implicit conversion of a non-Objective-C pointer 
> type 'CGColorRef' (aka 'struct CGColor *') to 'id' is disallowed with ARC."
> 
> So now I'd like to understand the difference in our experiences. On my 
> machine I'm using a drop-dead spanking new iOS 5 template based project, with 
> ARC turned on at template-specification time. m.

Turns out the project I tested this with was confused about which target to 
provide errors & warnings about. I did this in a fresh project and reproduced 
your experience.
--
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSAssert no longer displaying reason in console

2011-11-01 Thread Matt Neuburg

On Nov 1, 2011, at 5:25 PM, Kyle Sluder wrote:

> On Nov 1, 2011, at 7:38 PM, Matt Neuburg  wrote:
> 
>> 
>> Sorry to keep harping on this, but this is a serious bug. As Ben Kennedy 
>> says, it isn't just NSAssert. iOS often throws a fatal exception with an 
>> absolutely lovely informative log message explaining the problem (e.g., your 
>> view controller loaded a nib but the view outlet wasn't hooked up). That log 
>> message is now being suppressed! The user never sees it. Surely Apple cannot 
>> intend that Xcode should be swallowing these informative log messages??? m.
> 
> Here's my WAG: are you sure you didn't turn on the "All Objective-C 
> Exceptions" breakpoint, and are therefore breaking in objc_exception_throw 
> before the log message whereas you are used to waiting until the default 
> uncaught exception handler logs the exception message and raises a signal?
> 
> --Kyle Sluder
> (Sent from the road)

Well, when you get back from the road, try it. And here's what to try: Start 
with Xcode 4.2's Single View Application template and make a new iOS 
application with ARC. Go into the nib (ViewController.xib) and disconnect the 
"view" outlet from the file's owner to the view. Save. Build and run with no 
breakpoints on.

On my machine, what happens is that we SIGABRT with the editor falling into 
main.c and no logging of any kind in the console.

Now, *if* you set up a breakpoint on objc_exception_throw *and* you add an 
action to "po $eax" *and* that breakpoint is turned on *and* you are using the 
LLDB debugger in your scheme's debug action, and you run this project, you'll 
break at a reasonable spot ([self.window makeKeyAndVisible]) and you'll see in 
the console the delightful and helpful message, "Loaded the ViewController nib 
but the view outlet was not set."

But that is a *lot* of ifs. A lot more ifs than we can expect of, say, a 
beginner. (For one thing, the templates don't use the LLDB debugger. For 
another, what beginner has heard of $eax?) And yet this console message is 
helpful particularly for beginners. Why is Xcode suppressing it? This is new 
behavior under Xcode 4.2; in Xcode 4.0, the message just appeared, all by 
itself.

m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Ken Thomases
On Nov 1, 2011, at 6:31 PM, Jens Alfke wrote:

> On Nov 1, 2011, at 3:06 PM, Vojtěch Meluzín wrote:
> 
>> Anyway we are getting out of the topic. Does anyone here know why the modal 
>> windows work in a plugin (in a normal application) and not from a console 
>> application?
> 
> Basically, apps aren’t intended to be launched by a plain exec. A normal 
> launch through the LaunchServices API provides some extra setup and state. 
> You _can_ launch an app from a shell or equivalent, and it’ll mostly work, 
> but that’s mostly as a convenience for developers and for debugging, and 
> there’s no guarantee that everything will work correctly. One of the known 
> side effects is that the app launches in an indeterminate state in between 
> active and inactive, which is probably what you’re seeing.
> 
> If you need to launch an app programmatically, look at the LaunchServices 
> API, or from a shell use the ‘open’ command on the bundle.

This is inaccurate.  The issue is not related to how it was launched.  
Everything boils down to execv().

The problem is whether the app is bundled with an Info.plist or, if a flat 
file, has an Info.plist embedded in a segment.  The frameworks use that info to 
establish the connection to the window server and incorporate the app into the 
GUI (having a Dock icon, etc.).

A properly bundled app will behave roughly the same whether launched via Launch 
Services or directly via execv().  ("Roughly" means there may be differences 
due to inherited environment variables, where stdout and stderr go, which Apple 
events it receives initially, whether multiple instances are launched vs. 
activating an already-running instance, and stuff like that.)

If you need to present a GUI from a process which began life as a console app, 
look into -[NSApplication setActivationPolicy:] or, prior to 10.6, the 
TransformProcessType() function.  You'll need to invoke [NSApplication 
sharedApplication] either way.  Read the class overview of NSApplication for 
further information.

Regards,
Ken

___

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: Speeding up image drawing?

2011-11-01 Thread Arbit Richardi
> I'm pretty certain Preview is using IKImageView, or at least it used to.

Mike, Preview doesn't use IKImageView in 10.6. That class is really
slow, probably because it has a ton of bells and whistles, and it
doesn't show up in the stack frames when I look at Preview in
Instruments (Preview appears to use custom view classes).

> Well, your multiple approaches make me wonder what you mean by "draw"
> but take a look at the graphics context's interpolation quality for scaling. 
> It
> makes a huge difference.

Seth, even the highest quality interpolation looks awful in a lot of
my use cases. It's inferior to drawing directly into a properly sized
hosted layer.
___

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