Re: drawRect not being called by NSCollectionView..

2011-10-10 Thread Robert Monaghan
Well,

After some troubleshooting, it looks like the NSView that is attached to the 
NSCollectionViewItem object is missing its superview.
Does any know how this might be possible??

I can see my Subclassed NSView being created. AwakeFromNib works, as does 
hitTest.
The drawRect does get called, but the call to superview fails, because it is 
set to nil.

Just for laughs, I created another NSCollectionView, with NSArrayController, 
etc, and manually add objects. This works, with the NSViews displaying properly.
Is there a way to force NSCollectionView to reload/re-display the NSViews with 
a proper superview set?

bob.

On Oct 10, 2011, at 4:49 PM, Robert Monaghan wrote:

> Hi Everyone,
> 
> I can't seem to get an NSCollectionView to render an of the 
> NSCollectionViewItems' NSViews.
> 
> I have an NSCollectionView that is bound to an NSArrayController's 
> arrangedObjects.
> The NSCollectionViewItem is set up as a template, and also has its Outlet 
> attached to an NSView.
> For fun I added a text label as well as an image from the Media Library, as a 
> placeholder image on the NSView.
> (It helps to have something to look at!)
> 
> I don't have anything bound to the NSView at all.
> I haven't subclassed anything either. These are the standard objects within 
> IB.
> 
> My App inserts objects into an array using the NSArrayController as needed.
> However, as this happens, *nothing* is rendered at all. As a test, I have 
> subclassed the NSView, and checked the drawRect method.
> 
> Nothing.
> 
> I enabled selectable in my NSCollectionView and checked for a hitTest method 
> in my view. I can blindly click inside the NSCollectionView to the 
> approximate location of the view, and see an hitTest response. Strange! So I 
> know that my NSView is being recognized by my NSCollectionView, as hitTest is 
> being called. But drawRect isn't happening.
> 
> Can anyone hazard a guess at what I am doing wrong?
> 
> Some notes..
> This interface is to drive a network device. As such, the UI doesn't actually 
> populate with anything until it is discovered over the network.
> As a matter of fact, the array that the NSArrayController uses doesn't even 
> exit during the "awakeFromNib" process. The actual array is created as soon 
> as the device comes online, and is attached using a binding. Perhaps I need 
> to send some sort of message to the NSCollectionView after the new array is 
> bound?
> 
> Thanks!
> 
> bob.
> 
> ___
> 
> 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/bob%40gluetools.com
> 
> This email sent to b...@gluetools.com

___

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

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

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

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


Re: Quandary : NSAppleScript ties up main thread

2011-10-10 Thread Shane Stanley

On 11/10/2011, at 10:41 AM, Jerry Krinock wrote:

> However, any invocation to NSAppleScript must occur on the main thread

From the 10.6 release notes:

> Thread Safety
> OSA and AppleScript are now thread-safe: they may be safely called on a 
> non-main thread or from multiple threads without any locking in the client 
> code. This also applies toNSAppleScript. This does not mean that AppleScript 
> is totally concurrent: AppleScript uses locking to ensure that any single 
> connection (a ComponentInstance) will only run on one thread at a time. 
> Because of the size of the locking granularity, trying to manipulate the same 
> script from multiple threads at once may still be subject to race conditions, 
> and is not recommended.
> 
> Before using a scripting component on a background thread, developers should 
> test the component’s “thread-safe” bit (cmpThreadSafe in the 
> ComponentDescription’scomponentFlags.) Test the generic component before 
> using OSA on a background thread, and then test the specific language 
> component before using it on a background thread.


-- 
Shane Stanley 
'AppleScriptObjC Explored' 

___

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 get info about an iOS device (UDID, etc)?

2011-10-10 Thread Don Quixote de la Mancha
Ad Hoc Helper does it and is available from the App Store.  But it doesn't
seem to be Open Source.  It was written by Erica Sadun who also wrote The
iPhone Developer Cookbook.  Maybe she can tell you.

On Monday, October 10, 2011, Jens Alfke  wrote:
> I’m writing an internal app our QA engineers going to use to capture
performance metrics on various iOS devices. After running tests, the app
will upload the results to a server. In those results I need to include
enough info to identify the device, so I want to get things like the UDID,
the model ID (e.g. “iPhone 4” or a codename that can be mapped to it), and
maybe lower-level stuff like the clock speed and RAM and whether it’s on
battery power or charging.
>
> I can’t find the APIs to get this sort of stuff. I was thinking the
SystemConfiguration framework, but I didn’t see anything relevant in
SCSchemaDefinitions.h. Searching the Xcode doc browser didn’t help. Any
clues?
>
> —Jens
>
> PS: I realize these may not be Cocoa APIs, but I’m not sure what other
list would be more relevant.
>
> ___
>
> 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/quixote%40dulcineatech.com
>
> This email sent to quix...@dulcineatech.com
>

-- 
Don Quixote de la Mancha
Dulcinea Technologies Corporation
Software of Elegance and Beauty
http://www.dulcineatech.com
quix...@dulcineatech.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: How to get info about an iOS device (UDID, etc)?

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

On 10/10/11 5:44 PM, Jens Alfke wrote:
> I’m writing an internal app our QA engineers going to use to
> capture performance metrics on various iOS devices. After running
> tests, the app will upload the results to a server. In those
> results I need to include enough info to identify the device, so I
> want to get things like the UDID, the model ID (e.g. “iPhone 4” or
> a codename that can be mapped to it), and maybe lower-level stuff
> like the clock speed and RAM and whether it’s on battery power or
> charging.
> 
> I can’t find the APIs to get this sort of stuff. I was thinking
> the SystemConfiguration framework, but I didn’t see anything
> relevant in SCSchemaDefinitions.h. Searching the Xcode doc browser
> didn’t help. Any clues?
> 
> —Jens
> 
> PS: I realize these may not be Cocoa APIs, but I’m not sure what 
> other list would be more relevant.

Check out the UIDevice class.

(You probably want to use the MAC address instead of the UDID...)


- -- 
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/

iD8DBQFOk5WZaOlrz5+0JdURAr8MAJ4kqfFnOCwCC+iepHClb4vknZ9hjQCfVUfo
fZO2wPPnpKYBojTzmQRwfSk=
=N0Iv
-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


How to get info about an iOS device (UDID, etc)?

2011-10-10 Thread Jens Alfke
I’m writing an internal app our QA engineers going to use to capture 
performance metrics on various iOS devices. After running tests, the app will 
upload the results to a server. In those results I need to include enough info 
to identify the device, so I want to get things like the UDID, the model ID 
(e.g. “iPhone 4” or a codename that can be mapped to it), and maybe lower-level 
stuff like the clock speed and RAM and whether it’s on battery power or 
charging.

I can’t find the APIs to get this sort of stuff. I was thinking the 
SystemConfiguration framework, but I didn’t see anything relevant in 
SCSchemaDefinitions.h. Searching the Xcode doc browser didn’t help. Any clues?

—Jens

PS: I realize these may not be Cocoa APIs, but I’m not sure what other list 
would be more relevant.

___

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: Quandary : NSAppleScript ties up main thread

2011-10-10 Thread Jens Alfke

On Oct 10, 2011, at 4:41 PM, Jerry Krinock wrote:

> NSAppleScript does not seem to have any asychronous/callback methods for 
> executing scripts.  The only solution I can think of is to not use it.  
> Instead, maybe launch the script as an application, and return the result by 
> writing it to a temp file which I'm observing with a kqueue, or some other 
> form of interprocess communication.  I don't think AppleScripts can talk to 
> Mach ports.
> 
> Any suggestions to make this simple little enhancement less painful?

Try using NSTask to launch /usr/bin/osascript. You can read the script’s return 
value from the task’s stdout.

—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


drawRect not being called by NSCollectionView..

2011-10-10 Thread Robert Monaghan
Hi Everyone,

I can't seem to get an NSCollectionView to render an of the 
NSCollectionViewItems' NSViews.

I have an NSCollectionView that is bound to an NSArrayController's 
arrangedObjects.
The NSCollectionViewItem is set up as a template, and also has its Outlet 
attached to an NSView.
For fun I added a text label as well as an image from the Media Library, as a 
placeholder image on the NSView.
(It helps to have something to look at!)

I don't have anything bound to the NSView at all.
I haven't subclassed anything either. These are the standard objects within IB.

My App inserts objects into an array using the NSArrayController as needed.
However, as this happens, *nothing* is rendered at all. As a test, I have 
subclassed the NSView, and checked the drawRect method.

Nothing.

I enabled selectable in my NSCollectionView and checked for a hitTest method in 
my view. I can blindly click inside the NSCollectionView to the approximate 
location of the view, and see an hitTest response. Strange! So I know that my 
NSView is being recognized by my NSCollectionView, as hitTest is being called. 
But drawRect isn't happening.

Can anyone hazard a guess at what I am doing wrong?

Some notes..
This interface is to drive a network device. As such, the UI doesn't actually 
populate with anything until it is discovered over the network.
As a matter of fact, the array that the NSArrayController uses doesn't even 
exit during the "awakeFromNib" process. The actual array is created as soon as 
the device comes online, and is attached using a binding. Perhaps I need to 
send some sort of message to the NSCollectionView after the new array is bound?

Thanks!

bob.

___

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


Quandary : NSAppleScript ties up main thread

2011-10-10 Thread Jerry Krinock
I currently run AppleScripts using -[NSAppleScript executeAndReturnError:].  
Sometimes, but not often, one of them takes 5-10 seconds to execute, and when 
this happens I'd like to display a small window showing indeterminate progress.

However, any invocation to NSAppleScript must occur on the main thread, so the 
main thread is going to be blocked while it is running.  I can run my 1-second 
timer on a secondary thread, but to display a window or even un-hide a progress 
bar in an existing window, I need the main thread.  (Correct?)  Thus, this 
ain't going to work.

NSAppleScript does not seem to have any asychronous/callback methods for 
executing scripts.  The only solution I can think of is to not use it.  
Instead, maybe launch the script as an application, and return the result by 
writing it to a temp file which I'm observing with a kqueue, or some other form 
of interprocess communication.  I don't think AppleScripts can talk to Mach 
ports.

Any suggestions to make this simple little enhancement less painful?

Thanks,

Jerry Krinock

___

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: Keeping grayscale image grayscale

2011-10-10 Thread Scott Ribe
On Oct 10, 2011, at 11:43 AM, Jonathan Taylor wrote:

> Does anyone have any suggestions?

Personally, I use Apple's vImage library (in the Accelerate framework). Much 
lower level, but it gives you total control, while still using highly-optimized 
algorithms.

-- 
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: Give a menu keyboard focus – in code

2011-10-10 Thread Lee Ann Rucker
An issue I discovered recently: If your NSStatusItem uses a menu it gets 
AXPress for free but if it uses a custom view, the view needs to implement all 
the necessary accessibility pieces required for AXPress itself.

Granted its accessibility is rather lacking if keyboard navigation doesn't 
work, but at least it'll be there for other cases.

On Oct 10, 2011, at 10:23 AM, Charles Srstka wrote:

> On Oct 10, 2011, at 7:34 AM, Jerry Krinock wrote:
> 
>> 
>> On 2011 Oct 10, at 02:03, Martin Hewitson wrote:
>> 
>>> I haven't been following this thread closely, so I may be talking about the 
>>> wrong thing here, but I just noticed I can cycle through the status items, 
>>> and some of them (e.g. istat menus and apple items) are selectable with 
>>> ctrl-f8 then arrow keys, and some not (e.g. dropbox). So it seems like it's 
>>> possible, in principle. Don't know if that helps.
>> 
>> Thank you, Martin.  I have 7 non-Apple Status Items on my Mac account, and 
>> none of them are accessible via the F8 key.  However, you are correct.  I 
>> just installed iStat Menus from bjango.com and, indeed, its Status Items 
>> *are* accessible via F8.  Furthermore, instead of being appended to the 
>> left, they take priority over all the other non-Apple Status Items.  The 
>> right half of my menu bar looks like this:
>> 
>>   |  Other Non-Apple Items  |  iStat Menu Items  |  Apple Items 
>> 
>> Apparently, bjango has figured out a trick that no one else has.  I wonder 
>> if it's "legal”?
> 
> It looks like they’re just using the private NSMenuExtra API. They’re 
> probably using code injection to patch SystemUIServer to get around Apple’s 
> protection to do so.
> 
> Not something I’d recommend.
> 
> Charles___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
> 
> This email sent to lruc...@vmware.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: Give a menu keyboard focus – in code

2011-10-10 Thread Andy Lee
Sounds great, Jerry. Thanks for sharing the details of your approach.

--Andy

On Oct 10, 2011, at 2:10 PM, Jerry Krinock wrote:

> 
> On 2011 Oct 10, at 02:57, Andy Lee wrote:
> 
>> Accessorizer's "Action Menu" is a status item that provides the exact UI 
>> Jerry is talking about
> 
> Thank you, Andy.
> 
> After thinking about what Kevin Callahan has done with Accessorizer, and the 
> suggestion by Graham and Seth, I have an answer that's even better than what 
> I was looking for.
> 
> Like Kevin's Accessorizer, which is a utility for Xcode, my app is a 
> bookmarking utility which, among other things, grabs sites from web browsers. 
>  Users want it to be accessible via a global keyboard shortcut while other 
> apps are active.  My original idea was to make this shortcut activate my 
> app's Status Item or Dock Menu.  But now I realize that, thanks to -[NSMenu 
> popUpMenuPositioningItem:atLocation:inView:] which was introduced in 10.6, I 
> don't need the damned Status Item or Dock Menu.  This is great, because the 
> same anti-mouse keyboard-aholic power users who want the global keyboard 
> shortcuts are generally the same users that hate Status Items and hate the 
> Dock.
> 
> So all I do is InstallApplicationEventHandler(), and RegisterEventHotKey() 
> with the user's preferred keyboard shortcut.  My handler invokes this 3-line 
> method which is implemented in the NSMenu subclass which I use for my Status 
> Item and Dock Menu…
> 
> - (void)popUpAnywhereMenu {
>NSPoint mouseLocation = [NSEvent mouseLocation] ;
>[self popUpMenuPositioningItem:[[self itemArray] objectAtIndex:0]
>atLocation:mouseLocation
>inView:nil] ;
> }
> 
> Hit the keyboard shortcut while in any web browser, and Poof!  My app's menu 
> appears, with keyboard focus, at the current mouse location on the screen.
> 
> I'll leave my Status Item Dock Menu as a preference option for the mouse 
> fans.  But I'm also keeping my Bug 10122120 open, because it's stupid that 
> the F8 shortcut can't access non-Apple Status Items.  We can't all be as 
> smart (or hacky as Charles suspects) as the bjango guys are.
> 
> ___
> 
> 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/aglee%40mac.com
> 
> This email sent to ag...@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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Give a menu keyboard focus – in code

2011-10-10 Thread Jerry Krinock

On 2011 Oct 10, at 02:57, Andy Lee wrote:

> Accessorizer's "Action Menu" is a status item that provides the exact UI 
> Jerry is talking about

Thank you, Andy.

After thinking about what Kevin Callahan has done with Accessorizer, and the 
suggestion by Graham and Seth, I have an answer that's even better than what I 
was looking for.

Like Kevin's Accessorizer, which is a utility for Xcode, my app is a 
bookmarking utility which, among other things, grabs sites from web browsers.  
Users want it to be accessible via a global keyboard shortcut while other apps 
are active.  My original idea was to make this shortcut activate my app's 
Status Item or Dock Menu.  But now I realize that, thanks to -[NSMenu 
popUpMenuPositioningItem:atLocation:inView:] which was introduced in 10.6, I 
don't need the damned Status Item or Dock Menu.  This is great, because the 
same anti-mouse keyboard-aholic power users who want the global keyboard 
shortcuts are generally the same users that hate Status Items and hate the Dock.

So all I do is InstallApplicationEventHandler(), and RegisterEventHotKey() with 
the user's preferred keyboard shortcut.  My handler invokes this 3-line method 
which is implemented in the NSMenu subclass which I use for my Status Item and 
Dock Menu…

- (void)popUpAnywhereMenu {
NSPoint mouseLocation = [NSEvent mouseLocation] ;
[self popUpMenuPositioningItem:[[self itemArray] objectAtIndex:0]
atLocation:mouseLocation
inView:nil] ;
}

Hit the keyboard shortcut while in any web browser, and Poof!  My app's menu 
appears, with keyboard focus, at the current mouse location on the screen.

I'll leave my Status Item Dock Menu as a preference option for the mouse fans.  
But I'm also keeping my Bug 10122120 open, because it's stupid that the F8 
shortcut can't access non-Apple Status Items.  We can't all be as smart (or 
hacky as Charles suspects) as the bjango guys are.

___

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: NSTreeController with bindings and core data - still an issue?

2011-10-10 Thread Koen van der Drift
On Mon, Oct 10, 2011 at 12:40 PM, Richard Somers
 wrote:

> When Wil Shipley wrote his blog article in April 2006 the API was at the 10.4 
> Tiger level. Since then NSTreeController has had one method revised and six > 
> new methods have been added in the 10.5 Leopard API. The 10.5 release notes 
> also talk about the improvements made to this class. So Apple has been > 
> working on the class. Perhaps the bindings also work better.

Just found this sample code from Apple, that seems to tie it all
together: 
http://developer.apple.com/library/mac/#samplecode/AbstractTree/Introduction/Intro.html,
I wil check it out later.

- Koen.
___

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 + NSSavePanel's accessoryView

2011-10-10 Thread Corbin Dunn
Hi Rimas,
It sounds like a bug in sandboxing in AppKit. Can you log a bug on this? And 
(if possible, but not required) include a sample application that reproduces 
it. 

A work around is to just always set the accessoryView.

thanks,
corbin

On Oct 10, 2011, at 3:17 AM, Rimas M. wrote:

> Hello,
> 
> I am trying to enable sandboxing in my app, and I am dealing with a very
> strange behavior. I am not sure if this is a bug of Lion/Sandboxing or I
> have missed something in documentation.
> 
> In save panel I am using a custom accessoryView which is set in "-
> (BOOL)prepareSavePanel:(NSSavePanel *)savePanel". I am setting setting
> accessory view to the real one only if savePanel's "- (BOOL)isExpanded"
> returns YES. Otherwise I am setting it to nil.
> To handle save panel's expansion I am using "- (void)panel:(id)sender
> willExpand:(BOOL)expanding" from NSOpenSavePanelDelegate. If expanding ==
> YES, I am setting the real accessory view, and nil if expanding==NO.
> 
> That worked very well on Snow Leopard. It even works well on Lion without
> sandboxing. But if sandboxing is enabled, it does not work. When save panel
> is displayed and I am trying to expand it, expands and collapses back. It is
> impossible to expand it.
> 
> Log has showed, that I am getting - (void)panel:(id)sender
> willExpand:(BOOL)expanding with expanding==YES and the second one
> with expanding==NO. At the moment I have no clue what is going on.
> 
> Any thoughts about this behavior would be very appreciate.
> 
> Best Regards,
> 
> Rimas M.
> ___
> 
> 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/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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Keeping grayscale image grayscale

2011-10-10 Thread Jonathan Taylor
I'm working with 16-bit grayscale images, and for the most part I'm just 
manipulating bits within NSBitmapImageRep objects. However for convenience it 
would be nice to do some stuff with NSImages, particularly when rescaling and 
suchlike. The problem is that whenever I draw into such an NSImage it gets 
converted to 3x8 bit RGB. Is there a simple way I can force things to stay 
grayscale, or am I fighting a losing battle here. The code snippet I have looks 
like this:

NSImage *srcImage = [[NSImage alloc] initWithContentsOfFile:thePath];
NSImage *destImage = [srcImage copy];   // Attempt to "encourage" same 16-bit 
grayscale format as source
[destImage setSize:destSize];   // Shrink dest image

// Draw image into a new image at reduced size
// This causes the result to be saved as a 3x8 bit RGB TIFF (which is not what 
I want!)
[destImage lockFocus];
[srcImage drawInRect:destRect fromRect:srcRect operation:NSCompositeCopy 
fraction:1.0];
[destImage unlockFocus];
[[destImage TIFFRepresentation] writeToFile:destFile atomically:NO];

Does anyone have any suggestions?
Thanks
Jonny___

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: Give a menu keyboard focus – in code

2011-10-10 Thread Charles Srstka
On Oct 10, 2011, at 7:34 AM, Jerry Krinock wrote:

> 
> On 2011 Oct 10, at 02:03, Martin Hewitson wrote:
> 
>> I haven't been following this thread closely, so I may be talking about the 
>> wrong thing here, but I just noticed I can cycle through the status items, 
>> and some of them (e.g. istat menus and apple items) are selectable with 
>> ctrl-f8 then arrow keys, and some not (e.g. dropbox). So it seems like it's 
>> possible, in principle. Don't know if that helps.
> 
> Thank you, Martin.  I have 7 non-Apple Status Items on my Mac account, and 
> none of them are accessible via the F8 key.  However, you are correct.  I 
> just installed iStat Menus from bjango.com and, indeed, its Status Items 
> *are* accessible via F8.  Furthermore, instead of being appended to the left, 
> they take priority over all the other non-Apple Status Items.  The right half 
> of my menu bar looks like this:
> 
>|  Other Non-Apple Items  |  iStat Menu Items  |  Apple Items 
> 
> Apparently, bjango has figured out a trick that no one else has.  I wonder if 
> it's "legal”?

It looks like they’re just using the private NSMenuExtra API. They’re probably 
using code injection to patch SystemUIServer to get around Apple’s protection 
to do so.

Not something I’d recommend.

Charles___

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

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

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

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


Re: NSFont squashes my first two characters

2011-10-10 Thread Jens Alfke

On Oct 9, 2011, at 3:19 AM, Oron Cherry wrote:

> "Geneva" font gives the problem shown in the above image. Other fonts such as 
> "Helvetica" are fine.

That’s sort of odd (that string in Geneva 10 displays correctly in TextEdit.) 
Are you drawing directly to a view or into an image?

My advice would be “don’t use Geneva”, which has been solid advice since 1991. 
Geneva was created as a bitmap font on the earliest version of Mac OS back in 
1984, and had some truly screwy nonlinear metrics. A TrueType version was added 
in 1991 as an extrapolation from the original bitmaps, but it was kind of a 
hack. It’s only kept around for backward compatibility with old Carbon apps. 
For any real purpose you should use Helvetica instead.

—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: NSTreeController with bindings and core data - still an issue?

2011-10-10 Thread Richard Somers
On Oct 10, 2011, at 9:05 AM, Koen van der Drift wrote:

> I'm looking to implement a simple iTunes/Mail like source list in an app, and 
> have been rummaging through the internets for some decent tutorials and 
> sample code. I found some, but they are all a bit outdated. Basically, I want 
> to combine my Core Data model with an NSOutlineView and NSTreeController all 
> connected through bindings. However, I've also come accross some websites (eg 
> http://blog.wilshipley.com/2006/04/pimp-my-code-part-10-whining-about.html or 
> http://www.cocoadev.com/index.pl?NSTreeController) that state that 
> NSTreeController, Core Data and bindings are not really working well 
> together, and I should use the datasource approach. Is this still the case, 
> or has NSTreeController improved over the years and can it be used with 
> bindings without any problems?

When Wil Shipley wrote his blog article in April 2006 the API was at the 10.4 
Tiger level. Since then NSTreeController has had one method revised and six new 
methods have been added in the 10.5 Leopard API. The 10.5 release notes also 
talk about the improvements made to this class. So Apple has been working on 
the class. Perhaps the bindings also work better.

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

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


Re: Xcode 3 to 4 - CoreData in IB

2011-10-10 Thread Fritz Anderson
On 10 Oct 2011, at 12:47 AM, GW Rodriguez wrote:

> Back in Xocde 3 you could drag an entity into IB.  With Xcode 4 you can no 
> longer do this.  I have found a way to do the exact same thing in IB but miss 
> the ease of use of dragging an entity into IB.  
> 
> Does anyone know if the IB team will be bringing this back in future releases 
> of xcode?  

(Readers: He means you could drag an entity into a window in IB from a data 
model, and an assistant would build a UI for that entity automatically. There 
was also a pseudo-object in the library that would allow you to do the same 
thing.)

Nobody who knows Apple's plans for Xcode is allowed to talk about them. 
Somebody else, on the xcode-users list (which is a better place for questions 
about Xcode), was caught by the loss of that very feature today.

If you want the feature to return, go to bugreport.apple.com, file a feature 
request, and state a concrete case for why you need it.

— F

___

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


NSTreeController with bindings and core data - still an issue?

2011-10-10 Thread Koen van der Drift
Hi,

I'm looking to implement a simple iTunes/Mail like source list in an
app, and have been rummaging through the internets for some decent
tutorials and sample code. I found some, but they are all a bit
outdated. Basically, I want to combine my Core Data model with an
NSOutlineView and NSTreeController all connected through bindings.
However, I've also come accross some websites (eg
http://blog.wilshipley.com/2006/04/pimp-my-code-part-10-whining-about.html
or http://www.cocoadev.com/index.pl?NSTreeController) that state that
NSTreeController, Core Data and bindings are not really working well
together, and I should use the datasource approach. Is this still the
case, or has NSTreeController improved over the years and can it be
used with bindings without any problems?

- Koen.
___

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


Scripting Bridge Finder

2011-10-10 Thread Leonardo
Hi,
with Scripting Bridge Finder, I am trying to change the folder window size
and the icon position of the files therein. I got 2 troubles.

1) If the folder window is closed, I can't resize it.
2) After I change the position of the icon, I have to close the folder then
reopen it, in order to see the change.

Any idea on how to fix that?


Regards
-- Leonardo


___

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: Give a menu keyboard focus – in code

2011-10-10 Thread Jerry Krinock

On 2011 Oct 10, at 02:03, Martin Hewitson wrote:

> I haven't been following this thread closely, so I may be talking about the 
> wrong thing here, but I just noticed I can cycle through the status items, 
> and some of them (e.g. istat menus and apple items) are selectable with 
> ctrl-f8 then arrow keys, and some not (e.g. dropbox). So it seems like it's 
> possible, in principle. Don't know if that helps.

Thank you, Martin.  I have 7 non-Apple Status Items on my Mac account, and none 
of them are accessible via the F8 key.  However, you are correct.  I just 
installed iStat Menus from bjango.com and, indeed, its Status Items *are* 
accessible via F8.  Furthermore, instead of being appended to the left, they 
take priority over all the other non-Apple Status Items.  The right half of my 
menu bar looks like this:

|  Other Non-Apple Items  |  iStat Menu Items  |  Apple Items 

Apparently, bjango has figured out a trick that no one else has.  I wonder if 
it's "legal"?

___

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


Sandboxing + NSSavePanel's accessoryView

2011-10-10 Thread Rimas M.
Hello,

I am trying to enable sandboxing in my app, and I am dealing with a very
strange behavior. I am not sure if this is a bug of Lion/Sandboxing or I
have missed something in documentation.

In save panel I am using a custom accessoryView which is set in "-
(BOOL)prepareSavePanel:(NSSavePanel *)savePanel". I am setting setting
accessory view to the real one only if savePanel's "- (BOOL)isExpanded"
returns YES. Otherwise I am setting it to nil.
To handle save panel's expansion I am using "- (void)panel:(id)sender
willExpand:(BOOL)expanding" from NSOpenSavePanelDelegate. If expanding ==
YES, I am setting the real accessory view, and nil if expanding==NO.

That worked very well on Snow Leopard. It even works well on Lion without
sandboxing. But if sandboxing is enabled, it does not work. When save panel
is displayed and I am trying to expand it, expands and collapses back. It is
impossible to expand it.

Log has showed, that I am getting - (void)panel:(id)sender
willExpand:(BOOL)expanding with expanding==YES and the second one
with expanding==NO. At the moment I have no clue what is going on.

Any thoughts about this behavior would be very appreciate.

Best Regards,

Rimas M.
___

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: Give a menu keyboard focus – in code

2011-10-10 Thread Andy Lee
On Oct 10, 2011, at 2:02 AM, Jerry Krinock wrote:
> On 2011 Oct 09, at 22:26, John Joyce wrote:
> 
>> For this reason, any menu item with a name can be assigned a keyboard 
>> shortcut in OS X System Preferences by the user.
> 
> Thank you, John, but it doesn't work for Status Items; not for me.
[...]
> Actually, even if it did work, that's not what I want.  Because my status 
> item's menu is populated dynamically, I want users to be able to navigate 
> through it with the arrow keys, like I can do with the Apple Status Items 
> after hitting the F8 key.

Accessorizer's "Action Menu" is a status item that provides the exact UI Jerry 
is talking about, and I think it is brilliant. Not only can you use arrow keys 
to navigate the menu once you've popped it up, but in Accessorizer there are a 
couple dozen menu items, all with keyboard shortcuts, and with this UI:

* You don't have to memorize all those shortcuts (although eventually you will 
remember the ones you use most frequently). All you have to remember is 
Accessorizer's one shortcut to pop up the menu, and the menu items within the 
menu display their shortcuts.

* It doesn't matter if the shortcuts conflict with shortcuts in any other 
application, because the status item's menu has focus when you pop it up. 
Compare this with keyboard shortcuts for Services, where a conflict can be a 
problem, especially if you have lots of them. Kevin Callahan came up with the 
Action Menu precisely because the menus in Xcode 4 use so many keyboard 
shortcuts, including many he had been using for the Services provided by 
Accessorizer.

* The keyboard shortcuts can be plain characters without modifiers, which makes 
them easy to type and remember. This wouldn't be possible if you had to worry 
that a text field might have focus, because the characters would get entered 
into the text field.

Gesturally and conceptually what Accessorizer does, and Jerry wants to do, is 
similar to Command-Tab: a globally-available special keystroke enters a mode 
that allows you to select from a bunch of items either with the mouse or with 
arrow keys. (One difference is that with Command-Tab you have to keep the 
Command key down while you navigate.) There are third-party apps like Alfred 
that are even more similar in concept.

There are tradeoffs for both the user and the developer between the Action Menu 
approach and the Alfred approach. For some reason I find Accessorizer's 
approach feels very natural and appropriate for what it does. I don't know how 
Kevin implements it, but I suspect it's by using a custom view in the status 
item as has been suggested.

--Andy

___

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: Give a menu keyboard focus – in code

2011-10-10 Thread Martin Hewitson
I haven't been following this thread closely, so I may be talking about the 
wrong thing here, but I just noticed I can cycle through the status items, and 
some of them (e.g. istat menus and apple items) are selectable with ctrl-f8 
then arrow keys, and some not (e.g. dropbox). So it seems like it's possible, 
in principle. Don't know if that helps.

Martin


On Oct 10, 2011, at 02:02 AM, Jerry Krinock wrote:

> 
> On 2011 Oct 09, at 22:26, John Joyce wrote:
> 
>> For this reason, any menu item with a name can be assigned a keyboard 
>> shortcut in OS X System Preferences by the user.
> 
> Thank you, John, but it doesn't work for Status Items; not for me.
> 
> True, in System Preferences ▸ Keyboard ▸ Keyboard Shortcuts, I can create a 
> keyboard shortcut for any menu item with a name in the *main* menu.  And the 
> keyboard shortcut is even shown in that menu.  But it does not work for the 
> menus attached to non-Apple Status Items.  For example, I have a Dropbox 
> Status Item.  The first item in its menu is "Open Dropbox Folder".  I just 
> assigned this the keyboard shortcut ⇧⌥⌘O.  But the keyboard shortcut "⇧⌥⌘O" 
> is *not* showing in the Dropbox Status Item, and when I type ⇧⌥⌘O, all that 
> happens is a system alert beep.
> 
> Actually, even if it did work, that's not what I want.  Because my status 
> item's menu is populated dynamically, I want users to be able to navigate 
> through it with the arrow keys, like I can do with the Apple Status Items 
> after hitting the F8 key.
> 
> Maybe there is a reason why Apple does not want non-Apple Status Items to be 
> accessible to non-mouse-users.
> 
> ___
> 
> 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/martin.hewitson%40aei.mpg.de
> 
> This email sent to martin.hewit...@aei.mpg.de


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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