Detecting in/activity

2008-11-15 Thread Jacob Bandes-Storch

Hi all,

I'd like to have an app/daemon/something detect when the computer  
becomes active after a period of inactivity, much like iChat does when  
it says Welcome back! Would you like to change your status from   
Does anyone have any insight as to the best way to do that?


Thanks in advance.

___

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 [EMAIL PROTECTED]


Synchronous modal sheet

2008-08-15 Thread Jacob Bandes-Storch
I want to display a modal sheet, but my code isn't currently at the  
point where I can split it up. Is there a way to run a modal sheet  
synchronously, so the rest of the code after it starts isn't called  
until it ends? Or do I have no choice but to restructure this?

___

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 [EMAIL PROTECTED]


Re: Synchronous modal sheet

2008-08-15 Thread Jacob Bandes-Storch
Yeah, I've worked with sheets before in different contexts. The  
problem with this one is that I want to display the sheet during the  
first iteration of a loop (in which I do a bit of work with other  
loops), and splitting it up will take some work. But unless there are  
any good alternatives to a sheet, I suppose I'll go for it.


On Aug 15, 2008, at 3:52 AM, Graham Cox [EMAIL PROTECTED] wrote:



On 15 Aug 2008, at 3:16 pm, Jacob Bandes-Storch wrote:

I want to display a modal sheet, but my code isn't currently at the  
point where I can split it up. Is there a way to run a modal sheet  
synchronously, so the rest of the code after it starts isn't called  
until it ends? Or do I have no choice but to restructure this?



If you have to have a sheet, you have no choice.

But it's not that hard. Take the code that runs after the call,  
factor it into another method, then call that method from the - 
sheetDidEnd:returnCode:contextInfo: method.



hth,

Graham


___

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

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

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

This email sent to [EMAIL PROTECTED]


Custom URL Handling

2008-08-09 Thread Jacob Bandes-Storch
I want to implement a custom URL scheme (such that myscheme:whatever  
will open my app and somehow pass the URL as a parameter). I've been  
looking around for information on how to do that, and I'm getting  
mixed messages.


The Info.plist documentation is very clear, and I've got the keys all  
set up the right way such that my app opens when a URL of my custom  
scheme is opened. However, I'm not sure how to find out what URL was  
opened. I see some implementations use -[NSAppleEventManager  
setEventHandler:andSelector:forEventClass:andEventID:]; with  
kInternetEventClass and kAEGetURL, and they implement a method (passed  
into the selector): - (void)handleURLEvent:(NSAppleEventDescriptor  
*)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent. In other  
places, I see LSSetDefaultHandlerForURLScheme, and other LS* stuff.  
Another thing I've seen is adding a script suite and using  
performDefaultImplementation and [self directParameter] to get the URL.


So, I need to know what the right way to do this is. I don't see any  
specific information about this in Apple's documentation.


Thanks in advance.
___

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 [EMAIL PROTECTED]


Re: Custom URL Handling

2008-08-09 Thread Jacob Bandes-Storch
It doesn't seem to make sense to use the script suite stuff to receive  
the URL event.. shouldn't it be used for scripting only? Or am I  
mistaken?


On Aug 9, 2008, at 3:03 PM, Uli Kusterer wrote:
I see some implementations use -[NSAppleEventManager  
setEventHandler:andSelector:forEventClass:andEventID:]; with  
kInternetEventClass and kAEGetURL, and they implement a method  
(passed into the selector): - (void)handleURLEvent: 
(NSAppleEventDescriptor *)event withReplyEvent: 
(NSAppleEventDescriptor *)replyEvent.

(...)
Another thing I've seen is adding a script suite and using  
performDefaultImplementation and [self directParameter] to get the  
URL.


When a URL is opened, an Apple Event of kInternetEventClass/ 
kAEGetURL is sent, containing the URL. If you want to handle the  
URL, you'll need to catch this somehow.


Cocoa AppleScript support is fairly new (I think 10.2 or 10.3 or  
thereabouts). So, depending on what system version your app has as  
its minimal requirement, you'll either use NSAppleEventManager  
(which is the older class, AFAIK) or the script suite. Instead of  
performDefaultImplementation, I think you could also just create an  
NSScriptCommand or whatever the class was called. Whatever feels  
cleaner to you.

___

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 [EMAIL PROTECTED]


CSV parsing (large files)

2008-07-29 Thread Jacob Bandes-Storch
I've got several large-size CSV files (a total of about 1.25 million  
lines, and an average of maybe 10 or so columns) that I want to parse  
into a 2D array. I found some parsing code that uses NSScanner, and it  
works fine with small files, but it's very resource-intensive and slow  
with large files. Should I try and optimize it more, or try using C  
instead of Objective-C for parsing, or what?


The ultimate goal here is to convert the CSV files into a SQLite  
database. Should I even be doing it this way? Maybe just one row into  
the database at a time? I'd like to hear people's opinions. Thanks in  
advance!

___

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 [EMAIL PROTECTED]


Re: NSTextView + other NSView in NSScrollView?

2008-07-28 Thread Jacob Bandes-Storch

On Jul 27, 2008, at 10:49 PM, Andy Lee wrote:


On Jul 27, 2008, at 11:31 PM, Jacob Bandes-Storch wrote:
I'm trying to create a Mail-style scroll view, with a view for  
information (like the view for message headers) above a text view  
for the content. I created two NSViews in Interface Builder,  
changed the class of the bottom one to NSTextView,


Is there some reason you didn't drag an NSTextView into the window  
in the first place?


Because the Text View that IB provides is embedded in a scroll view  
already and I can't add another view to it.



selected both, and clicked Layout  Embed Objects In  Scroll View.


Are you sure you didn't want a Split View rather than a Scroll View?

If you were trying to create a Mail-like layout, I would have  
expected your two views to be an NSTableView and an NSTextView, both  
embedded in a Split View.
No... what I want is like the bottom half of Mail's split view, with  
the view for the headers and the text view with the message content.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTextView + other NSView in NSScrollView?

2008-07-28 Thread Jacob Bandes-Storch

On Jul 28, 2008, at 7:48 AM, Andy Lee [EMAIL PROTECTED] wrote:


On Jul 27, 2008, at 11:31 PM, Jacob Bandes-Storch wrote:
I'm trying to create a Mail-style scroll view, with a view for  
information (like the view for message headers) above a text view  
for the content. I created two NSViews in Interface Builder,  
changed the class of the bottom one to NSTextView,


Just one more thought: I think some people have mentioned unexpected  
resizing behavior because they didn't take into account the fact  
that NSTextView uses a flipped coordinate system.
Yes, I was wondering about that. It seems like that's the issue I run  
into when trying to use an NSTextView that's not the documentView of  
the NSScrollView. What can I do to work around that?

___

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 [EMAIL PROTECTED]


IB view transitions, CA, NSWindow animation

2008-07-27 Thread Jacob Bandes-Storch
For a bit of background, I've got a window, and I'll be swapping its  
content view's subview between some other views. One (and more in the  
future) of the other views has a subview with wants layer set so it  
can use some CALayer stuff for fading and such. Now, when I switch  
between views for the window, I want the window to resize, and a nice  
animated transition (like a cube).


For resizing, the logical method is -[NSWindow  
setFrame:display:animate:]. This all works fine... until a descendant  
subview has a layer. Then I get a pause, and the window resizes  
without animating. If I remove the layer from the subview, the  
animation works. (The subview is a descendant of the view which I am  
*removing* from the window *before* changing the size. Why does it  
make a difference anyway?)


For the animated transition, it appears that IB has a setting for some  
predefined transitions. I set the window's subviews transition to  
Rotating Cube... and yet, I don't get a rotating cube effect when  
removing a subview and adding another. If I use the content view's  
animator ([[window contentView] animator]) to add the subview, nothing  
seems to change... If I do the same, only addSubview:[newView  
animator] as well, it seems to try, but it doesn't work all that well.


Can anyone give me some advice here? What am I doing that's ruining  
the NSWindow resize animation? How can I get the view transitions  
working? Thanks in advance.

___

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 [EMAIL PROTECTED]


Re: IB view transitions, CA, NSWindow animation

2008-07-27 Thread Jacob Bandes-Storch
By one content view, do you mean a view inside the window's content  
view? It appears to do the same thing. The resizing animation works  
when it has a layer, but then again the same thing happens with the  
content view having a layer.


On Jul 27, 2008, at 11:58 AM, Milen Dzhumerov wrote:

On 27 Jul 2008, at 07:36, Jacob Bandes-Storch wrote:


[snip]
For resizing, the logical method is -[NSWindow  
setFrame:display:animate:]. This all works fine... until a  
descendant subview has a layer. Then I get a pause, and the window  
resizes without animating. If I remove the layer from the subview,  
the animation works. (The subview is a descendant of the view which  
I am *removing* from the window *before* changing the size. Why  
does it make a difference anyway?)

[snip
Can anyone give me some advice here? What am I doing that's ruining  
the NSWindow resize animation? How can I get the view transitions  
working? Thanks in advance.


This is a known bug (rdar://problem/5827811). Workaround by using  
one content view and replacing the subview of the content view.


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 [EMAIL PROTECTED]


NSTextView + other NSView in NSScrollView?

2008-07-27 Thread Jacob Bandes-Storch
I'm trying to create a Mail-style scroll view, with a view for  
information (like the view for message headers) above a text view for  
the content. I created two NSViews in Interface Builder, changed the  
class of the bottom one to NSTextView, selected both, and clicked  
Layout  Embed Objects In  Scroll View.


This all works (it puts the views inside a scroll view), but the  
NSTextView doesn't play well with the scroll view when it increases in  
size, and when the scroll view changes size. When the text view  
increases in size, instead of just getting longer by a line, it gets  
longer and moves down, and the scroll view doesn't enable the  
scrollbar. If I shrink the scroll view by means of resizing the window  
(and I do have the autosizing set properly), the text view moves up  
erratically, and doesn't move back down when I increase the window  
size again.


Everything works just fine when I create an NSTextView and embed it in  
a scroll view without another view alongside... because the NSTextView  
itself becomes the scroll view's document view.


So... what's the right way to go about doing this? Should I even try  
to be putting 2 views in a scroll view for the effect I'm aiming for?  
Thanks in advance.

___

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 [EMAIL PROTECTED]


NSStatusItem custom view with menu

2008-07-03 Thread Jacob Bandes-Storch
I'm making an NSStatusItem with a custom view. In drawRect:, it draws  
things based on the value of the highlighted instance variable. When  
mouseDown: is called, it pops up a menu using the status item's  
popUpStatusItemMenu: method. Using the mouseUp: event does not work,  
because it is not called after the menu goes away. This is the way  
I've found that makes it work:


- (void)mouseDown:(NSEvent *)theEvent {
highlighted = YES;
[self setNeedsDisplay:YES];
[statusItem popUpStatusItemMenu:menu];
highlighted = NO;
[self setNeedsDisplay:YES];
[super mouseDown:theEvent];
}

Is this a good method, or is there something better that involves  
mouseUp:?

___

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 [EMAIL PROTECTED]


Leopard-specific functionality in non–Leopard -only project

2008-06-21 Thread Jacob Bandes-Storch
I'm working on a project (with another developer) that will target  
OSes older than 10.5, and I'd like to use the Leopard-only NSWindow  
method -setCollectionBehavior:. As far as I know, the best way to do  
this is to check for the method using -respondsToSelector:. I need to  
use the enum type NSWindowCollectionBehavior. When I try this, I get  
an error saying error: 'NSWindowCollectionBehaviorCanJoinAllSpaces'  
undeclared (first use in this function) and a warning warning:  
'NSWindow' may not respond to '-setCollectionBehavior:'. This is  
because I'm using the 10.4 SDK... I've read in some places to set the  
Cross-develop using target SDK setting of the project to 10.5, but  
that setting is not available in the General tab of the project info.  
Does anyone know how to do this properly without angering the compiler?

___

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 [EMAIL PROTECTED]


Tab-based (document-based?) application

2008-06-18 Thread Jacob Bandes-Storch
I'm creating an application that will have an arbitrary number of  
basically identical windows (document-like) which each have tabs (or  
something of the sort) in them that represent the actual documents,  
per se. Would it be best to start out with a Document-Based  
Application or just a regular Cocoa application? Any tips on doing this?

___

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 [EMAIL PROTECTED]


HUD-style panel controls?

2008-04-12 Thread Jacob Bandes-Storch
I'm adding a HUD panel to my application. Looking around, I don't see  
a way to get the proper style of controls easily. The Human Interface  
Guidelines say that HUD controls should be white with gray accents  
and use white or gray text. And yet I don't see a way to get these  
controls (gray sliders, semitransparent buttons, etc.) in Interface  
Builder. Am I missing something?

___

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 [EMAIL PROTECTED]


Re: [iPhone] xml parsing

2008-03-10 Thread Jacob Bandes-Storch
On a similar-ish note, I'm having trouble using libxml. I'm using a  
slightly modified version of the appropriate sample code. I need to  
make sure that the library is in my project. Since I couldn't find the  
library in a convenient place (where are you supposed to get those  
anyway?), I just dragged it from the sample project to mine. However,  
when I try to build the project, it says it cannot locate libxml or  
libxml/tree.h or whatever I import. I can't find any significant  
differences in the projects' properties... does anyone know how to get  
this working?


On Mar 10, 2008, at 4:46 PM, [EMAIL PROTECTED] wrote:


If you find a function/method/class declaration in a public header (an
header that is not in PrivateHeader folder) you can problably
considere it as public.


Le 10 mars 08 à 23:49, Simon Fell a écrit :


The iPhone docs point you in the direction of libXML2 for parsing
XML, yet the headers for NSXML are included in the SDK headers, and
i was able to build and run fine using NSXMLDoc/element/node. (in
fact i just dropped my existing NSXML based code into a iPhone
project and it worked fine, so it never even occurred to me that
this might not be supported).  Would this constitute using a private
API ? (is there a good definition of private API somewhere?)

Tx
Simon



___

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 [EMAIL PROTECTED]


Re: [Moderator] iPhone discussion here - RETRACTION

2008-03-10 Thread Jacob Bandes-Storch
So are we or are we not getting a specialized (password-protected,  
probably) discussion area for the iPhone SDK?


On Mar 10, 2008, at 6:30 PM, [EMAIL PROTECTED] wrote:


That sounds surprisingly plausible.

I imagine a big speech bubble above the Apple campus that says, Well,
I'm glad we got all our ducks in a row for that iPhone SDK release!

Meanwhile, cute little baby ducks are running at everyone's feet,
riding the elevators up and down, quacking during meetings, causing
accidents on Infinite Loop, eating from the salad bowl in the Apple
Cafe, and sitting on the CEO's head.

But, that's just me.

I blame the ducks.

- d

On Mar 10, 2008, at 7:55 PM, I. Savant wrote:


While I was told to allow discussion here, I've now been told that
discussion should not be allowed here.


Oh, that's just MEAN!

Somewhere in Cupertino, somebody's standing next to the big NDA
switch in the iPhone room, giggling maniacally as they flip it on-
off-on-off-... :-D

--
I.S.

PS: I blame Scott. So should everybody else. ;-)

___

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 [EMAIL PROTECTED]