Re: NSXMLDocument and threads

2010-03-26 Thread Marcel Weiher

On Mar 2, 2010, at 10:18 PM, Jeff Johnson wrote:

 My question is, how do I use NSXMLDocument safely on a non-main thread? I 
 need to do this for performance reasons, otherwise my app can pinwheel during 
 XML parsing.

Maybe you need faster XML parsing?

Marcel

___

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


Path to preference folder

2010-03-26 Thread Nikhil Khandelwal
Hi,

I want to get the path of /User/library/Preference to put the plist file over 
there. For getting the path I am using
NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) 
which gives me path to library. Is there anything which gives me directly path 
to Preference folder instead of appending it to Library path.

Thanks,
---Nikhil

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
___

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


Previous ShutDown Message : 3 received

2010-03-26 Thread Poonam Virupaxi Shigihalli

Hi All,

Running our application(Soft Phone) on iMac, 2.66 GHz, core 2 duo.
making calls from other end to iMac continuously, the system shuts down when 
about to sleep.

After the system is restarted we get these messages in our console.

26/03/10 10:12:44 AMkernel  Sleep failure code 0x 0x1100
26/03/10 10:12:44 AMkernel  mbinit: done (64 MB memory set for mbuf pool)
26/03/10 10:12:44 AMkernel  rooting via boot-uuid from /chosen: 
04960551-748F-3626-A3B6-01B0DDB5A0AC
26/03/10 10:12:44 AMkernel  Waiting on dict 
ID=0keyIOProviderClass/keystring 
ID=1IOResources/stringkeyIOResourceMatch/keystring 
ID=2boot-uuid-media/string/dict
26/03/10 10:12:44 AMkernel  com.apple.AppleFSCompressionTypeZlib load 
succeeded
26/03/10 10:12:44 AMkernel  AppleIntelCPUPowerManagementClient: ready
26/03/10 10:12:44 AMkernel  Got boot device = 
IOService:/AppleACPIPlatformExpert/p...@0/AppleACPIPCI/s...@b/AppleMCP79AHCI/p...@0/ioahcidev...@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/ST31000528ASQ
 Media/IOGUIDPartitionScheme/custo...@2
26/03/10 10:12:44 AMkernel  BSD root: disk0s2, major 14, minor 2
26/03/10 10:12:44 AMkernel  jnl: unknown-dev: replay_journal: from: 
69142016 to: 80729600 (joffset 0x1721c000)
26/03/10 10:12:44 AMkernel  FireWire (OHCI) TI ID 823f built-in now active, 
GUID 0026bbfffe50bdc6; max speed s800.
26/03/10 10:12:44 AMkernel  USBMSC Identifier (non-unique): 9833 
0x5ac 0x8403 0x9833
26/03/10 10:12:44 AMkernel  jnl: unknown-dev: journal replay done.
26/03/10 10:12:44 AMkernel  hfs: Removed 2 orphaned / unlinked files and 0 
directories 
26/03/10 10:12:44 AMkernel  AppleIntelCPUPowerManagement: initialization 
complete
26/03/10 10:12:41 AMcom.apple.launchd[1]*** launchd[1] has started up. 
***
26/03/10 10:12:44 AMDirectoryService[15]Improper shutdown detected
26/03/10 10:12:45 AMkernel  NVEthernet: Ethernet address 00:26:bb:50:bd:c6
26/03/10 10:12:45 AMkernel  systemShutdown false
26/03/10 10:12:49 AMfseventsd[33]   event logs in /.fseventsd out of sync 
with volume.  destroying old logs. (325 11 384)
26/03/10 10:12:49 AMfseventsd[33]   log dir: /.fseventsd getting new uuid: 
E0F423C1-0397-495F-86F7-CF4C2FA56E7F
26/03/10 10:12:49 AMbootlog[40] BOOT_TIME: 1269578558 0
26/03/10 10:12:51 AMblued[41]   Apple Bluetooth daemon started
26/03/10 10:12:52 AMkernel  Waiting for DSMOS...
26/03/10 10:12:53 AMcom.apple.SecurityServer[24]Session 0x5fbff962 
created
26/03/10 10:12:54 AMcom.apple.SecurityServer[24]Entering service
26/03/10 10:12:54 AMmDNSResponder[28]   mDNSResponder mDNSResponder-214 
(Oct  4 2009 23:10:54) starting
26/03/10 10:12:54 AMcom.apple.usbmuxd[20]   usbmuxd-176 built for 
iTunesNine on Jul 20 2009 at 13:06:53, running 32 bit
26/03/10 10:12:55 AM
/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow[29] 
Login Window Application Started
26/03/10 10:12:55 AMconfigd[13] network configuration changed.
26/03/10 10:12:55 AMkernel  Previous Shutdown Cause: 3
26/03/10 10:12:55 AMkernel  ** Device in slot: SLOT--1 **
26/03/10 10:12:55 AMkernel  DSMOS has arrived
26/03/10 10:12:55 AMkernel  Warning - com.apple.driver.InternalModemSupport 
declares no kernel dependencies; using com.apple.kernel.6.0.
26/03/10 10:12:55 AMkernel  NVEthernet::setLinkStatus - Valid but not Active
26/03/10 10:12:55 AMkernel  Atheros: mac 128.2 phy 13.0 radio 12.0



Thanks  Regards 
Poonam.

___

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


NSWindow subclass VERY slow to resize

2010-03-26 Thread Daniel Weber
Ok, I finally managed to get all the drawing/event-handling code
working for my borderless window subclass. The only problem I have
left now is performance. I have a basic formula in the mouseDown
method that does a little arithmetic and sets the window's new frame.
It works fine when the window is  400 x 400, more or less. However,
when the window starts to get bigger, around 800x800 maybe, there is
very noticeable slowdown as the window is redrawn. I find this odd
because my drawing code is not complicated at all (I'm drawing a
rounded rect with a little arrow pointing up):

- (void)drawRect:(NSRect)rect
{
roundedRect.size.height = roundedRect.size.height - window.arrowHeight;
NSBezierPath *roundRectPath = [NSBezierPath
bezierPathWithRoundedRect:roundedRect xRadius:10.0 yRadius:10.0];

if (window.drawsArrow) {
  NSPoint p1 = NSMakePoint(NSMidX(rect) - window.arrowWidth / 2.0,
NSMaxY(roundedRect));
  NSPoint p2 = NSMakePoint(NSMidX(rect), NSMaxY(rect));
  NSPoint p3 = NSMakePoint(NSMidX(rect) + window.arrowWidth / 2.0,
NSMaxY(roundedRect));
  NSBezierPath *trianglePath = [NSBezierPath bezierPath];
  [trianglePath moveToPoint:p1];
  [trianglePath lineToPoint:p2];
  [trianglePath lineToPoint:p3];
  [trianglePath closePath];
  [roundRectPath appendBezierPath:trianglePath];
}
}

Is there some way to speed this up? Could something else be going on?

Thanks.
___

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

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

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

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


Re: Determining an inter-application drag source

2010-03-26 Thread Matt Gough
A fragile way would be to see what other drag types are being put on the 
pasteboard. I imagine Finder has some esoteric old types for backwards 
compatibility and I would guess that Aperture has some image types that the 
Finder wouldn't normally use (except maybe for picture clippings)

But as Steve said, why should it matter?

Matt Gough

On 25 Mar 2010, at 23:22:54, Steve Christensen wrote:

 I'm curious why you need to know where the drag originated since it generally 
 shouldn't matter. Do you have to do some extra work in one case? And what 
 happens if you see a drag from another application?
 
 
 On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote:
 
 Is there any way to determine the source of a drag operation outside your 
 own application? For example, if I'm set to receive NSFilenamesPboardType, 
 then I'd like to distinguish between the Finder and Aperture as drag sources.
 
 I had thought I'd seen a solution to this at one point, but can't seem to 
 find anything. The draggingSource in NSDraggingInfo is set to nil when the 
 source is an external application. The pasteboard doesn't seem to guarantee 
 any that information, although some sources will occasionally have unique 
 pasteboard types that might distinguish them, but only as an exception.
 
 ___
 

___

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: Sync .DS_Store files

2010-03-26 Thread gMail.com
Thank you Dave, Thank you Jens.
I will ignore the .DS_Store files. I think the Finder will take care of
them. Also I have got the same question on the hidden directory
/.fseventsd
As I know it contains log files created by Time Machine. I have tried to
backup the files it contains but, even running as root, I can't. It seems
that even the root user has no permissions to do that.
So, can I exclude this directory from the backup? If I do that, will Time
Machine not work as expected on the backup disk? I would not cause a
problem...

Regards
--
Leonardo



 Da: Jens Alfke j...@mooseyard.com
 Data: Thu, 25 Mar 2010 16:08:03 -0700
 A: gMail.com mac.iphone@gmail.com
 Cc: cocoa-dev@lists.apple.com
 Oggetto: Re: Sync .DS_Store files
 
 
 On Mar 25, 2010, at 9:42 AM, gMail.com wrote:
 
 I am trying to sync a folder containing several files and the hidden
 file
 .DS_Store. I know that this file contains special info about the
 directory,
 so I sync it too. Should I really do that?
 
 Ideally you should, because it contains some user data (like the view
 settings, I think). But as you've discovered, the way the Finder
 touches these files all the time makes it very awkward to sync them,
 so I think people usually just ignore them.
 
 ‹Jens


 Hi,
 
 I've had similar problems in the past. I usually just filter out the
 files you mentioned, e.g. ignore them. There are also AppleScript
 etc. that will delete them for you, do a google and you are bound to
 find them. Bottom line: it's not worth trying to treat them as normal
 files.
 
 All the Best
 Dave


___

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: Core Data doesn't save toMany relations please HELP :S

2010-03-26 Thread Gustavo Pizano
Hello all again, 

So was digging more into the problem, and realize that  the Items are being 
saved the ItemXInvoice are being saved and related to the invoice, but I can't 
acces the invoice detail (ItemXInvoice) immediately I get a console error:

Cannot remove an observer NSTableBinder 0x116087000 for the key path 
toItem.descr from ItemXInvoice 0x116024800, most likely because the value 
for the key toItem has changed without an appropriate KVO notification being 
sent. Check the KVO-compliance of the ItemXInvoice class.

I then checked the class and in the setItem Im doing:

-(void)setToItem:(Item *)value{
[self willChangeValueForKey:@toItem];
[value retain];
[self setPrimitiveValue:value forKey:@toItem];
[self didChangeValueForKey:@toItem];
}

when I quit the application and reopened I can see the detial without problem, 
but when I create an Invoice and try to check it right after I can not.  These 
are the methods Im usign when creating ItemXDetail and saving the invoice 
Invoice:

-(IBAction)addItemXInvoice:(id)sender{

Item  * newItem = [NSEntityDescription 
insertNewObjectForEntityForName:@Item inManagedObjectContext:[self 
managedObjectContext]];
ItemXInvoice * newItemXInvoice = [NSEntityDescription 
insertNewObjectForEntityForName:@ItemXInvoice inManagedObjectContext: [self 
managedObjectContext]];
[newItemXInvoice willChangeValueForKey:@toItem];
[newItemXInvoice setValue:newItem forKey:@toItem];
[newItemXInvoice didChangeValueForKey:@toItem];
[_itemsArrayController addObject:newItemXInvoice];
if(_newInvoice == nil){
_newInvoice = [NSEntityDescription 
insertNewObjectForEntityForName:@Invoice inManagedObjectContext:[self 
managedObjectContext]];
}   
[_newInvoice addToItemsXInvoiceObject:newItemXInvoice];
[_tempItemsArray addObject:newItem]; //I need to keep track of the 
newly created itmes by this method so I can safelty remove them.
//Set the creationItemPrice for each ItemXInvoice


}

the above creates a new Item, and a nte ItemXInvoice and relate them togheter 
then checks if _newinvoice instance is nil, if so then creates one, and relate 
the itemXInvoice to it.

-(IBAction)setPredefinedItem:(id)sender{
ItemXInvoice * newItemXInvoice = [NSEntityDescription 
insertNewObjectForEntityForName:@ItemXInvoice inManagedObjectContext: [self 
managedObjectContext]];
NSMenuItem * menuItem = [_predefinedItems selectedItem];
NSInteger indexOfItem = [_predefinedItems indexOfItem:menuItem];

[newItemXInvoice setValue:[[_prefetchedItems arrangedObjects] 
objectAtIndex:indexOfItem]  forKey:@toItem];
if(_newInvoice == nil){
_newInvoice = [NSEntityDescription 
insertNewObjectForEntityForName:@Invoice inManagedObjectContext:[self 
managedObjectContext]];
}
[_itemsArrayController addObject:newItemXInvoice];

}

Here I get a precreated Item, that I select form a poop up, then I create a 
ItemXInvoice and relate them together, and then I relate it to the _newInvoce 
instance.


Then when I click the save button:

if(_newInvoice != nil){
[(User *)[[[parent _userListArrayController] selectedObjects] 
objectAtIndex:0] addToInvoicesObject:_newInvoice]; //Setting the Relationship 
Witht the User. 
[(Client *)[[_clientsArrayController selectedObjects] lastObject] 
addToInvoicesObject:_newInvoice]; //Settting the RelationShip To the 
Customer.

for(ItemXInvoice * acutalItem in [_itemsArrayController 
arrangedObjects]){//Set the creationItemPrice for each ItemXInvoice
[acutalItem setValue:[acutalItem 
valueForKeyPath:@toItem.unitPrice] forKey:@creationItemPrice];
[acutalItem setValue:[self getNewStatusEntity] 
forKey:@toStatus]; 
}   
//I relate the selected user to the invoice (by this time the _newInvoice 
instnace shall not be null)
// then I iterate through all the elements in the ItemXInvoice Array 
Controller, and  set the unit Item Price and the toStatus,  the following lines 
set up the attributes of the invoice, and then I jsut save, call the method:

if([managedObjectContext save:error] == NO) {

and present an alert.

Now in the NSTable where Im putting the ItemXInvoice values,  the first column, 
is toItem.descr , (Item has attributes of descr and unitPrice). the second 
column is quantity which is attribute of ItemXInvoice, and the third one is 
unit price with bound to toItem.unitPrice,  So I dunno if its because of this 
way Im managing the table that its being boydn to a NSArrayController of 
ItemXInvoice, and when I push the add button, I do  what 
-(IBAction)addItemXInvoice:(id)sender{ shows, and then somehow the item its not 
being related whith the ItemxIvnoice or its not notifying of the change.

Im kinda lost already.. 

Re: Sync .DS_Store files

2010-03-26 Thread Jean-Daniel Dupas
.fseventd is not a time machine specific folder.

See FSEvent API for details.

Le 26 mars 2010 à 13:21, gMail.com a écrit :

 Thank you Dave, Thank you Jens.
 I will ignore the .DS_Store files. I think the Finder will take care of
 them. Also I have got the same question on the hidden directory
/.fseventsd
 As I know it contains log files created by Time Machine. I have tried to
 backup the files it contains but, even running as root, I can't. It seems
 that even the root user has no permissions to do that.
 So, can I exclude this directory from the backup? If I do that, will Time
 Machine not work as expected on the backup disk? I would not cause a
 problem...
 
 Regards
 --
 Leonardo
 
 
 
 Da: Jens Alfke j...@mooseyard.com
 Data: Thu, 25 Mar 2010 16:08:03 -0700
 A: gMail.com mac.iphone@gmail.com
 Cc: cocoa-dev@lists.apple.com
 Oggetto: Re: Sync .DS_Store files
 
 
 On Mar 25, 2010, at 9:42 AM, gMail.com wrote:
 
 I am trying to sync a folder containing several files and the hidden
 file
 .DS_Store. I know that this file contains special info about the
 directory,
 so I sync it too. Should I really do that?
 
 Ideally you should, because it contains some user data (like the view
 settings, I think). But as you've discovered, the way the Finder
 touches these files all the time makes it very awkward to sync them,
 so I think people usually just ignore them.
 
 —Jens
 
 
 Hi,
 
 I've had similar problems in the past. I usually just filter out the
 files you mentioned, e.g. ignore them. There are also AppleScript
 etc. that will delete them for you, do a google and you are bound to
 find them. Bottom line: it's not worth trying to treat them as normal
 files.
 
 All the Best
 Dave
 
 
 ___
 
 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/devlists%40shadowlab.org
 
 This email sent to devli...@shadowlab.org

-- Jean-Daniel




___

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: Determining an inter-application drag source

2010-03-26 Thread Jeffrey J. Early
I apparently didn't hit reply-all on my response to Steve.

I wrote:
When a user drags a photo from iPhoto to my application I need to be able to 
update iPhoto's database (via ScriptingBridge) with changes that are made while 
in my program. Other programs require different bits of extra work to at 
least provide the user some extra information about how things will or won't be 
updated. iPhoto fortunately provides some extra information in the pasteboard 
that distinguish itself, but Lightroom does not.

In my case, because I know the possible sources are (mostly) limited to a few 
programs, I have some other work arounds I might try. For example, testing to 
see if the applications are open and then querying their databases directly to 
see if they manage that particular file. None of this kind of thing failsafe, 
however.

But let me add:
I'm not even sure why the apparent argument is that it theoretically it 
shouldn't matter. Why is the pure abstraction that we don't need to know the 
source of the information? We get that information when the drag is within our 
own application -- why should inter-application be any different. Sure in most 
cases that's probably fine, but aren't exceptions the rule the programming?

In my case I suppose that one could argue it's the failure of these digital 
asset managers (iPhoto, Lightroom, Aperture) to provide robust hooks to their 
assets. Maybe they should be aware that if they're handing a path to a file 
they're managing, that they might need to do some updates later on. But, 
regardless of whether that should be the case, it isn't.

Jeffrey

On Mar 26, 2010, at 7:59 AM, Matt Gough wrote:

 A fragile way would be to see what other drag types are being put on the 
 pasteboard. I imagine Finder has some esoteric old types for backwards 
 compatibility and I would guess that Aperture has some image types that the 
 Finder wouldn't normally use (except maybe for picture clippings)
 
 But as Steve said, why should it matter?
 
 Matt Gough
 
 On 25 Mar 2010, at 23:22:54, Steve Christensen wrote:
 
 I'm curious why you need to know where the drag originated since it 
 generally shouldn't matter. Do you have to do some extra work in one case? 
 And what happens if you see a drag from another application?
 
 
 On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote:
 
 Is there any way to determine the source of a drag operation outside your 
 own application? For example, if I'm set to receive NSFilenamesPboardType, 
 then I'd like to distinguish between the Finder and Aperture as drag 
 sources.
 
 I had thought I'd seen a solution to this at one point, but can't seem to 
 find anything. The draggingSource in NSDraggingInfo is set to nil when 
 the source is an external application. The pasteboard doesn't seem to 
 guarantee any that information, although some sources will occasionally 
 have unique pasteboard types that might distinguish them, but only as an 
 exception.
 
 ___
 
 

___

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

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

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

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


Re: NSWindow subclass VERY slow to resize

2010-03-26 Thread Jens Alfke

On Mar 26, 2010, at 3:36 AM, Daniel Weber wrote:

 Is there some way to speed this up? Could something else be going on?

Sample it and find out. The way I do it is:

sleep 5; sample MyApp 5

hit Return, immediately click your app’s window and start resizing. Keep going 
until the ‘sample’ command says it’s processing the samples.

—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: Determining an inter-application drag source

2010-03-26 Thread Jens Alfke

On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote:

 When a user drags a photo from iPhoto to my application I need to be able to 
 update iPhoto's database (via ScriptingBridge) with changes that are made 
 while in my program.

Can you check the path to the file and see if it’s inside the iPhoto library? 
(IIRC, the root of the library is a bundle with a specific filename extension.)

—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: Determining an inter-application drag source

2010-03-26 Thread Steve Christensen
I wouldn't say that there has been any argument over whether or not  
knowing the drag source is a good thing; we were simply asking why you  
needed to know. You could have just as easily made a bad assumption  
about something else and were trying to fix it in the drag.


And if you would like to see a new OS or application feature, file a  
bug at http://bugreport.apple.com/. Just grousing about it here will  
not effect change within Apple.



On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote:


I apparently didn't hit reply-all on my response to Steve.

I wrote:
When a user drags a photo from iPhoto to my application I need to be  
able to update iPhoto's database (via ScriptingBridge) with changes  
that are made while in my program. Other programs require different  
bits of extra work to at least provide the user some extra  
information about how things will or won't be updated. iPhoto  
fortunately provides some extra information in the pasteboard that  
distinguish itself, but Lightroom does not.


In my case, because I know the possible sources are (mostly) limited  
to a few programs, I have some other work arounds I might try. For  
example, testing to see if the applications are open and then  
querying their databases directly to see if they manage that  
particular file. None of this kind of thing failsafe, however.


But let me add:
I'm not even sure why the apparent argument is that it theoretically  
it shouldn't matter. Why is the pure abstraction that we don't  
need to know the source of the information? We get that information  
when the drag is within our own application -- why should inter- 
application be any different. Sure in most cases that's probably  
fine, but aren't exceptions the rule the programming?


In my case I suppose that one could argue it's the failure of these  
digital asset managers (iPhoto, Lightroom, Aperture) to provide  
robust hooks to their assets. Maybe they should be aware that if  
they're handing a path to a file they're managing, that they might  
need to do some updates later on. But, regardless of whether that  
should be the case, it isn't.


Jeffrey

On Mar 26, 2010, at 7:59 AM, Matt Gough wrote:

A fragile way would be to see what other drag types are being put  
on the pasteboard. I imagine Finder has some esoteric old types for  
backwards compatibility and I would guess that Aperture has some  
image types that the Finder wouldn't normally use (except maybe for  
picture clippings)


But as Steve said, why should it matter?

Matt Gough

On 25 Mar 2010, at 23:22:54, Steve Christensen wrote:

I'm curious why you need to know where the drag originated since  
it generally shouldn't matter. Do you have to do some extra work  
in one case? And what happens if you see a drag from another  
application?



On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote:

Is there any way to determine the source of a drag operation  
outside your own application? For example, if I'm set to receive  
NSFilenamesPboardType, then I'd like to distinguish between the  
Finder and Aperture as drag sources.


I had thought I'd seen a solution to this at one point, but can't  
seem to find anything. The draggingSource in NSDraggingInfo is  
set to nil when the source is an external application. The  
pasteboard doesn't seem to guarantee any that information,  
although some sources will occasionally have unique pasteboard  
types that might distinguish them, but only as an exception.


___

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: Determining an inter-application drag source

2010-03-26 Thread Jeffrey J. Early

On Mar 26, 2010, at 10:23 AM, Jens Alfke wrote:

 
 On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote:
 
 When a user drags a photo from iPhoto to my application I need to be able to 
 update iPhoto's database (via ScriptingBridge) with changes that are made 
 while in my program.
 
 Can you check the path to the file and see if it’s inside the iPhoto library? 
 (IIRC, the root of the library is a bundle with a specific filename 
 extension.)

They actually don't have to be inside the library bundle... there's an 
Advanced preference to not copy the original into the 
library.___

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: Determining an inter-application drag source

2010-03-26 Thread Jeffrey J. Early
Gotcha -- sorry if I read into that a bit much.

I haven't complained this as a missing feature here at all yet -- I was 
actually still under the impression that there was a mechanism to determine the 
drag source that I didn't know about. As the consensus appears to be that there 
isn't, I will file a bug report.

Jeffrey

On Mar 26, 2010, at 10:28 AM, Steve Christensen wrote:

 I wouldn't say that there has been any argument over whether or not knowing 
 the drag source is a good thing; we were simply asking why you needed to 
 know. You could have just as easily made a bad assumption about something 
 else and were trying to fix it in the drag.
 
 And if you would like to see a new OS or application feature, file a bug at 
 http://bugreport.apple.com/. Just grousing about it here will not effect 
 change within Apple.
 
 
 On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote:
 
 I apparently didn't hit reply-all on my response to Steve.
 
 I wrote:
 When a user drags a photo from iPhoto to my application I need to be able to 
 update iPhoto's database (via ScriptingBridge) with changes that are made 
 while in my program. Other programs require different bits of extra work 
 to at least provide the user some extra information about how things will or 
 won't be updated. iPhoto fortunately provides some extra information in the 
 pasteboard that distinguish itself, but Lightroom does not.
 
 In my case, because I know the possible sources are (mostly) limited to a 
 few programs, I have some other work arounds I might try. For example, 
 testing to see if the applications are open and then querying their 
 databases directly to see if they manage that particular file. None of this 
 kind of thing failsafe, however.
 
 But let me add:
 I'm not even sure why the apparent argument is that it theoretically it 
 shouldn't matter. Why is the pure abstraction that we don't need to know 
 the source of the information? We get that information when the drag is 
 within our own application -- why should inter-application be any different. 
 Sure in most cases that's probably fine, but aren't exceptions the rule the 
 programming?
 
 In my case I suppose that one could argue it's the failure of these digital 
 asset managers (iPhoto, Lightroom, Aperture) to provide robust hooks to 
 their assets. Maybe they should be aware that if they're handing a path to a 
 file they're managing, that they might need to do some updates later on. 
 But, regardless of whether that should be the case, it isn't.
 
 Jeffrey
 
 On Mar 26, 2010, at 7:59 AM, Matt Gough wrote:
 
 A fragile way would be to see what other drag types are being put on the 
 pasteboard. I imagine Finder has some esoteric old types for backwards 
 compatibility and I would guess that Aperture has some image types that the 
 Finder wouldn't normally use (except maybe for picture clippings)
 
 But as Steve said, why should it matter?
 
 Matt Gough
 
 On 25 Mar 2010, at 23:22:54, Steve Christensen wrote:
 
 I'm curious why you need to know where the drag originated since it 
 generally shouldn't matter. Do you have to do some extra work in one case? 
 And what happens if you see a drag from another application?
 
 
 On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote:
 
 Is there any way to determine the source of a drag operation outside your 
 own application? For example, if I'm set to receive 
 NSFilenamesPboardType, then I'd like to distinguish between the Finder 
 and Aperture as drag sources.
 
 I had thought I'd seen a solution to this at one point, but can't seem to 
 find anything. The draggingSource in NSDraggingInfo is set to nil when 
 the source is an external application. The pasteboard doesn't seem to 
 guarantee any that information, although some sources will occasionally 
 have unique pasteboard types that might distinguish them, but only as an 
 exception.
 

___

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: Determining an inter-application drag source

2010-03-26 Thread Jens Alfke

On Mar 26, 2010, at 7:40 AM, Jeffrey J. Early wrote:

 They actually don't have to be inside the library bundle... there's an 
 Advanced preference to not copy the original into the library.

In that case, the image file would be visible to other apps. So I might have 
dragged the photo from the Finder into your app, even though it belongs to an 
iPhoto library. It doesn’t seem that checking the source of the drag is going 
to be a reliable indication of whether it belongs to iPhoto.

—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: Determining an inter-application drag source

2010-03-26 Thread Mike Abdullah

On 26 Mar 2010, at 14:43, Jeffrey J. Early wrote:

 Gotcha -- sorry if I read into that a bit much.
 
 I haven't complained this as a missing feature here at all yet -- I was 
 actually still under the impression that there was a mechanism to determine 
 the drag source that I didn't know about. As the consensus appears to be that 
 there isn't, I will file a bug report.

I think you're slightly misunderstanding -draggingSource. It gives you a 
reference to the object initiating the drag, if that drag was within your app. 
Would you like it to somehow return a reference to the initiating object *from 
the other application* somehow? That's pretty much impossible without things 
getting rather messy.

It seems to me that perhaps you want an additional -draggingApplication method 
which would return an instance of NSRunningApplication.

 
 Jeffrey
 
 On Mar 26, 2010, at 10:28 AM, Steve Christensen wrote:
 
 I wouldn't say that there has been any argument over whether or not knowing 
 the drag source is a good thing; we were simply asking why you needed to 
 know. You could have just as easily made a bad assumption about something 
 else and were trying to fix it in the drag.
 
 And if you would like to see a new OS or application feature, file a bug at 
 http://bugreport.apple.com/. Just grousing about it here will not effect 
 change within Apple.
 
 
 On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote:
 
 I apparently didn't hit reply-all on my response to Steve.
 
 I wrote:
 When a user drags a photo from iPhoto to my application I need to be able 
 to update iPhoto's database (via ScriptingBridge) with changes that are 
 made while in my program. Other programs require different bits of extra 
 work to at least provide the user some extra information about how things 
 will or won't be updated. iPhoto fortunately provides some extra 
 information in the pasteboard that distinguish itself, but Lightroom does 
 not.
 
 In my case, because I know the possible sources are (mostly) limited to a 
 few programs, I have some other work arounds I might try. For example, 
 testing to see if the applications are open and then querying their 
 databases directly to see if they manage that particular file. None of this 
 kind of thing failsafe, however.
 
 But let me add:
 I'm not even sure why the apparent argument is that it theoretically it 
 shouldn't matter. Why is the pure abstraction that we don't need to know 
 the source of the information? We get that information when the drag is 
 within our own application -- why should inter-application be any 
 different. Sure in most cases that's probably fine, but aren't exceptions 
 the rule the programming?
 
 In my case I suppose that one could argue it's the failure of these digital 
 asset managers (iPhoto, Lightroom, Aperture) to provide robust hooks to 
 their assets. Maybe they should be aware that if they're handing a path to 
 a file they're managing, that they might need to do some updates later on. 
 But, regardless of whether that should be the case, it isn't.
 
 Jeffrey
 
 On Mar 26, 2010, at 7:59 AM, Matt Gough wrote:
 
 A fragile way would be to see what other drag types are being put on the 
 pasteboard. I imagine Finder has some esoteric old types for backwards 
 compatibility and I would guess that Aperture has some image types that 
 the Finder wouldn't normally use (except maybe for picture clippings)
 
 But as Steve said, why should it matter?
 
 Matt Gough
 
 On 25 Mar 2010, at 23:22:54, Steve Christensen wrote:
 
 I'm curious why you need to know where the drag originated since it 
 generally shouldn't matter. Do you have to do some extra work in one 
 case? And what happens if you see a drag from another application?
 
 
 On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote:
 
 Is there any way to determine the source of a drag operation outside 
 your own application? For example, if I'm set to receive 
 NSFilenamesPboardType, then I'd like to distinguish between the Finder 
 and Aperture as drag sources.
 
 I had thought I'd seen a solution to this at one point, but can't seem 
 to find anything. The draggingSource in NSDraggingInfo is set to nil 
 when the source is an external application. The pasteboard doesn't seem 
 to guarantee any that information, although some sources will 
 occasionally have unique pasteboard types that might distinguish them, 
 but only as an exception.
 
 
 ___
 
 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 

Re: NSXML Parsing Problem

2010-03-26 Thread Jeffrey Oleander


 On Thu, 2010/03/25, Keary Suska cocoa-...@esoteritech.com wrote:
 Maybe a cool option for NSXML would be to be able to
 specify the  pound ; sequence and have it map it to
 whatever...
 
 My XML is a little rusty but IIRC this is an XML issue, and
 any XML parser would choke. You have to define (or perhaps
 more properly declare) every named entity other than the
 pre-defined named entities such as gt;, lt; and
 amp;.

 I believe you can use numeric references with impunity:
 #nnn; but make sure it jives with your character
 encoding.

Agreed.  pound is defined in html 4 but not in xhtml,
which has only pre-defined character references for 
amp, lt, gt, apos, and quot
http://www.w3.org/TR/2006/REC-xml11-20060816/#intern-replacement
But in the current mode, they strive to make it difficult 
to put the pieces together, though they may believe they
are clearly doing so here
http://www.w3.org/TR/2006/REC-xml11-20060816/#intern-replacement
here
http://www.w3.org/TR/2006/REC-xml11-20060816/#sec-entexpand
and here
http://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue

But if you've told it you're using UTF-8 or UTF-16 it
shouldn't need an ampersand escape, since the British
pound sterling symbol is not otherwise used in XML itself;
in which case you just use the Unicode character.  But,
if you want to be compatible with html 4 you've got to
define that character reference.


  
___

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: Path to preference folder

2010-03-26 Thread Kyle Sluder
On Mar 26, 2010, at 1:54 AM, Nikhil Khandelwal nikhil_khandel...@persistent.co.in 
 wrote:


I want to get the path of /User/library/Preference to put the plist  
file over there. For getting the path I am using
NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,  
NSUserDomainMask, YES) which gives me path to library. Is there  
anything which gives me directly path to Preference folder instead  
of appending it to Library path.


NSUserDefaults (and CFPreferences) already does this for you. You  
should not do this yourself.


--Kyle Sluder
___

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 catch modal window appearance?

2010-03-26 Thread Alexander Bokovikov

Hi, All,

Is there any notification or NSWindow delegate method, called  
immediately after the modal window is shown on screen? It looks like  
windowDidExposed doesn't come to a modal window. Is there any solution?


Thanks.
___

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

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

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

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


Re: Sync .DS_Store files

2010-03-26 Thread gMail.com
Thank you Jean,
I have now read that docs, so I will not copy the contents of that folder,
nor copy it empty.


 Da: Jean-Daniel Dupas devli...@shadowlab.org
 Data: Fri, 26 Mar 2010 14:44:20 +0100
 A: gMail.com mac.iphone@gmail.com
 Cc: cocoa-dev@lists.apple.com
 Oggetto: Re: Sync .DS_Store files
 
 .fseventd is not a time machine specific folder.
 
 See FSEvent API for details.
 
 Le 26 mars 2010 à 13:21, gMail.com a écrit :
 
 Thank you Dave, Thank you Jens.
 I will ignore the .DS_Store files. I think the Finder will take care of
 them. Also I have got the same question on the hidden directory
/.fseventsd
 As I know it contains log files created by Time Machine. I have tried to
 backup the files it contains but, even running as root, I can't. It seems
 that even the root user has no permissions to do that.
 So, can I exclude this directory from the backup? If I do that, will Time
 Machine not work as expected on the backup disk? I would not cause a
 problem...
 
 Regards
 --
 Leonardo
 
 
 
 Da: Jens Alfke j...@mooseyard.com
 Data: Thu, 25 Mar 2010 16:08:03 -0700
 A: gMail.com mac.iphone@gmail.com
 Cc: cocoa-dev@lists.apple.com
 Oggetto: Re: Sync .DS_Store files
 
 
 On Mar 25, 2010, at 9:42 AM, gMail.com wrote:
 
 I am trying to sync a folder containing several files and the hidden
 file
 .DS_Store. I know that this file contains special info about the
 directory,
 so I sync it too. Should I really do that?
 
 Ideally you should, because it contains some user data (like the view
 settings, I think). But as you've discovered, the way the Finder
 touches these files all the time makes it very awkward to sync them,
 so I think people usually just ignore them.
 
 ‹Jens
 
 
 Hi,
 
 I've had similar problems in the past. I usually just filter out the
 files you mentioned, e.g. ignore them. There are also AppleScript
 etc. that will delete them for you, do a google and you are bound to
 find them. Bottom line: it's not worth trying to treat them as normal
 files.
 
 All the Best
 Dave
 
 
 ___
 
 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/devlists%40shadowlab.org
 
 This email sent to devli...@shadowlab.org
 
 -- Jean-Daniel
 
 
 
 


___

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: Determining an inter-application drag source

2010-03-26 Thread Jeffrey J. Early
On Mar 26, 2010, at 11:31 AM, Jens Alfke wrote:

 
 On Mar 26, 2010, at 7:40 AM, Jeffrey J. Early wrote:
 
 They actually don't have to be inside the library bundle... there's an 
 Advanced preference to not copy the original into the library.
 
 In that case, the image file would be visible to other apps. So I might have 
 dragged the photo from the Finder into your app, even though it belongs to an 
 iPhoto library. It doesn’t seem that checking the source of the drag is going 
 to be a reliable indication of whether it belongs to iPhoto.

Excellent point -- thanks. That does prove I'll need a more robust method like 
querying the iPhoto database directly.


On Mar 26, 2010, at 11:41 AM, Mike Abdullah wrote:
 
 I think you're slightly misunderstanding -draggingSource. It gives you a 
 reference to the object initiating the drag, if that drag was within your 
 app. Would you like it to somehow return a reference to the initiating object 
 *from the other application* somehow? That's pretty much impossible without 
 things getting rather messy.
 
 It seems to me that perhaps you want an additional -draggingApplication 
 method which would return an instance of NSRunningApplication.


No, I think the -draggingSource property should return nil as it does now. It 
wouldn't at all make sense to get a pointer to an object in other application's 
memory space.

I was originally just hoping to somehow get the application bundle identifier, 
but as an extension to NSDraggingInfo your solution makes more sense.

Abstractly, we're passing around references to model objects on the pasteboard 
-- and the applications represent controllers and views. If we make changes to 
those objects, we want the controllers to know about those changes.  This 
generally isn't a problem for things like text documents which are re-read each 
time the user opens them in a application. But for these programs that keep 
proprietary databases as caches of the model objects, they should probably be 
using something like FSEvents to check if the files are changing, sort of 
equivalent to KVO in this case.

Regardless, Jens is right: I need a more robust 
solution.___

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: Determining an inter-application drag source

2010-03-26 Thread Steve Christensen
Well, other than saying one could argue it's the failure of these  
digital asset managers... to suggest that there are missing  
features. :)


And having a nil dragSource makes sense if the source and destination  
for the drag are in different processes. The drag source is an object  
(type id), so its value only has meaning in the scope of the source  
process' address space.



On Mar 26, 2010, at 7:43 AM, Jeffrey J. Early wrote:


Gotcha -- sorry if I read into that a bit much.

I haven't complained this as a missing feature here at all yet -- I  
was actually still under the impression that there was a mechanism  
to determine the drag source that I didn't know about. As the  
consensus appears to be that there isn't, I will file a bug report.


Jeffrey

On Mar 26, 2010, at 10:28 AM, Steve Christensen wrote:

I wouldn't say that there has been any argument over whether or not  
knowing the drag source is a good thing; we were simply asking why  
you needed to know. You could have just as easily made a bad  
assumption about something else and were trying to fix it in the  
drag.


And if you would like to see a new OS or application feature, file  
a bug at http://bugreport.apple.com/. Just grousing about it here  
will not effect change within Apple.



On Mar 26, 2010, at 7:00 AM, Jeffrey J. Early wrote:


I apparently didn't hit reply-all on my response to Steve.

I wrote:
When a user drags a photo from iPhoto to my application I need to  
be able to update iPhoto's database (via ScriptingBridge) with  
changes that are made while in my program. Other programs require  
different bits of extra work to at least provide the user some  
extra information about how things will or won't be updated.  
iPhoto fortunately provides some extra information in the  
pasteboard that distinguish itself, but Lightroom does not.


In my case, because I know the possible sources are (mostly)  
limited to a few programs, I have some other work arounds I might  
try. For example, testing to see if the applications are open and  
then querying their databases directly to see if they manage that  
particular file. None of this kind of thing failsafe, however.


But let me add:
I'm not even sure why the apparent argument is that it  
theoretically it shouldn't matter. Why is the pure abstraction  
that we don't need to know the source of the information? We get  
that information when the drag is within our own application --  
why should inter-application be any different. Sure in most cases  
that's probably fine, but aren't exceptions the rule the  
programming?


In my case I suppose that one could argue it's the failure of  
these digital asset managers (iPhoto, Lightroom, Aperture) to  
provide robust hooks to their assets. Maybe they should be aware  
that if they're handing a path to a file they're managing, that  
they might need to do some updates later on. But, regardless of  
whether that should be the case, it isn't.


Jeffrey

On Mar 26, 2010, at 7:59 AM, Matt Gough wrote:

A fragile way would be to see what other drag types are being put  
on the pasteboard. I imagine Finder has some esoteric old types  
for backwards compatibility and I would guess that Aperture has  
some image types that the Finder wouldn't normally use (except  
maybe for picture clippings)


But as Steve said, why should it matter?

Matt Gough

On 25 Mar 2010, at 23:22:54, Steve Christensen wrote:

I'm curious why you need to know where the drag originated since  
it generally shouldn't matter. Do you have to do some extra work  
in one case? And what happens if you see a drag from another  
application?



On Mar 25, 2010, at 7:55 AM, Jeffrey J. Early wrote:

Is there any way to determine the source of a drag operation  
outside your own application? For example, if I'm set to  
receive NSFilenamesPboardType, then I'd like to distinguish  
between the Finder and Aperture as drag sources.


I had thought I'd seen a solution to this at one point, but  
can't seem to find anything. The draggingSource in  
NSDraggingInfo is set to nil when the source is an external  
application. The pasteboard doesn't seem to guarantee any that  
information, although some sources will occasionally have  
unique pasteboard types that might distinguish them, but only  
as an exception.


___

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


Creating NSMappingModel programmatically

2010-03-26 Thread Ulai Beekam

I'm trying to create an NSMappingModel manually between two models, but it's 
not working in that no data gets migrated over (I checked with an SQLite 
database browser) to the new store, the tables are just empty.

The source model has one entity Person with two attributes: name and eyeColor.

The destination model also has only one entity Person with two attributes: name 
and address.

Thus, name should get transferred over, eyeColor get deleted, and address added 
as a new attribute.

Given this information, what is wrong with the following code to create the 
mapping model for this?

  NSMutableArray *attributeMappings = [[NSMutableArray alloc] init];
NSPropertyMapping *propertyMapping = [[NSPropertyMapping alloc] init];
  [propertyMapping setName:@name];  NSString *str = [NSString 
stringWithFormat:@%...@.name,NSMigrationSourceObjectKey];
  //i also tried expressionForKeyPath but it didn't work:
  [propertyMapping setValueExpression:[NSExpression 
expressionForConstantValue:str]];
  [attributeMappings addObject:propertyMapping];
propertyMapping = [[NSPropertyMapping alloc] init];
  [propertyMapping setName:@address];
  [propertyMapping setValueExpression:nil];
  [attributeMappings addObject:propertyMapping];
NSEntityMapping *entityMapping = [[NSEntityMapping alloc] init];
  [entityMapping setSourceEntityName:@Person];
  [entityMapping setDestinationEntityName:@Person];
  [entityMapping setName:@PersonToPerson];
  [entityMapping setMappingType:NSTransformEntityMappingType];
  [entityMapping setAttributeMappings:attributeMappings];
NSMutableArray *entityMappings = [[NSMutableArray alloc] init];
  [entityMappings addObject:entityMapping];
NSMappingModel *mappingModel = [[NSMappingModel alloc] init];
  [mappingModel setEntityMappings:entityMappings];



Thanks in advance, U. 
_
Hotmail: Free, trusted and rich email service.
https://signup.live.com/signup.aspx?id=60969___

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: Creating NSMappingModel programmatically

2010-03-26 Thread Ulai Beekam

Ok, that code really looks bad through email, so I'm going to give you a link 
to the code in much more pleasant format:
http://pastie.org/888526


 
 
 I'm trying to create an NSMappingModel manually between two models, but it's 
 not working in that no data gets migrated over (I checked with an SQLite 
 database browser) to the new store, the tables are just empty.
 
 The source model has one entity Person with two attributes: name and eyeColor.
 
 The destination model also has only one entity Person with two attributes: 
 name and address.
 
 Thus, name should get transferred over, eyeColor get deleted, and address 
 added as a new attribute.
 
 Given this information, what is wrong with the following code to create the 
 mapping model for this?
 
   NSMutableArray *attributeMappings = [[NSMutableArray alloc] init];
 NSPropertyMapping *propertyMapping = [[NSPropertyMapping alloc] init];
   [propertyMapping setName:@name];NSString *str = [NSString 
 stringWithFormat:@%...@.name,NSMigrationSourceObjectKey];
   //i also tried expressionForKeyPath but it didn't work:
   [propertyMapping setValueExpression:[NSExpression 
 expressionForConstantValue:str]];
   [attributeMappings addObject:propertyMapping];
 propertyMapping = [[NSPropertyMapping alloc] init];
   [propertyMapping setName:@address];
   [propertyMapping setValueExpression:nil];
   [attributeMappings addObject:propertyMapping];
 NSEntityMapping *entityMapping = [[NSEntityMapping alloc] init];
   [entityMapping setSourceEntityName:@Person];
   [entityMapping setDestinationEntityName:@Person];
   [entityMapping setName:@PersonToPerson];
   [entityMapping setMappingType:NSTransformEntityMappingType];
   [entityMapping setAttributeMappings:attributeMappings];
 NSMutableArray *entityMappings = [[NSMutableArray alloc] init];
   [entityMappings addObject:entityMapping];
 NSMappingModel *mappingModel = [[NSMappingModel alloc] init];
   [mappingModel setEntityMappings:entityMappings];
 
 
 
 Thanks in advance, U.   
 _
 Hotmail: Free, trusted and rich email service.
 https://signup.live.com/signup.aspx?id=60969___
 
 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/ulaibeekam%40hotmail.com
 
 This email sent to ulaibee...@hotmail.com
  
_
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969___

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

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

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

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


Re: NSWindow subclass VERY slow to resize

2010-03-26 Thread Daniel Weber
It appears that drawing the rounded rect vs. a regular rect is slow.
Also, I am filling using a pattern image vs. a solid color. These
things add up to a pretty slow redraw at large sizes. I can set the
max size to something relative low, but does anyone have any other
suggestions?

How does a Finder window redraw so fast at large sizes?

On Fri, Mar 26, 2010 at 7:19 AM, Jens Alfke j...@mooseyard.com wrote:

 On Mar 26, 2010, at 3:36 AM, Daniel Weber wrote:

 Is there some way to speed this up? Could something else be going on?

 Sample it and find out. The way I do it is:

        sleep 5; sample MyApp 5

 hit Return, immediately click your app’s window and start resizing. Keep 
 going until the ‘sample’ command says it’s processing the samples.

 —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 catch modal window appearance?

2010-03-26 Thread Fritz Anderson
On 26 Mar 2010, at 11:12 AM, Alexander Bokovikov wrote:

 Is there any notification or NSWindow delegate method, called immediately 
 after the modal window is shown on screen? It looks like windowDidExposed 
 doesn't come to a modal window. Is there any solution?

Just to check on the obvious points:

* Have you set a delegate for the window, which would receive the 
windowDidExpose: message?

* Have you named the method windowDidExpose: (without d, with :)?

— 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


Re: NSWindow subclass VERY slow to resize

2010-03-26 Thread Paul Sanders
Have a look at -[NSBezierPath setFlatness:].  A larger value 
might be faster (but might also look ugly).  There's also a bit 
of code floating around in the web-o-sphere that might be faster 
than what you are using:

http://lists.apple.com/archives/Cocoa-dev/2006/Mar/msg01940.html

Paul Sanders

- Original Message - 
From: Daniel Weber dan.j.we...@gmail.com
To: cocoa-dev@lists.apple.com
Sent: Friday, March 26, 2010 6:08 PM
Subject: Re: NSWindow subclass VERY slow to resize


It appears that drawing the rounded rect vs. a regular rect is 
slow.
Also, I am filling using a pattern image vs. a solid color. 
These
things add up to a pretty slow redraw at large sizes. I can set 
the
max size to something relative low, but does anyone have any 
other
suggestions?



___

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

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

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

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


Re: NSWindow subclass VERY slow to resize

2010-03-26 Thread Jens Alfke


On Mar 26, 2010, at 11:08 AM, Daniel Weber wrote:


It appears that drawing the rounded rect vs. a regular rect is slow.
Also, I am filling using a pattern image vs. a solid color. These
things add up to a pretty slow redraw at large sizes.


I wouldn't expect those to be slow enough to notice. How many of them  
are you drawing each time the window is resized? (Sampling won't tell  
you that; you can add an NSLog call or get fancy and use Instruments.)


—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


Accessing Regional iVars: Best Design Method

2010-03-26 Thread Frederick C . Lee
Environment: iPhone SDK 3.1+

Greetings:

I wish to design a UITabBarController application where each descendent member 
of a particular UITabBarItem has access to its regional iVars, stored within 
the UITabBarItem.

Hence we could multiple tabs, each having the SAME hierarchy of member view 
controllers with their respective regional iVars.

Here's an example:

I've created a NSString var called 'ricString' with some token value, in the 
root view controller of a 
UINavigationController system/UITabBarItem.  I can access this particular iVar 
thusly:

(gdb) po [[self navigationController] viewControllers]
NSCFArray 0x3e5a570(
IRMLaunchController: 0x3e25800,
IRMSerialNumberSearchController: 0x3e8fcf0,
IRMDetailsController: 0x3e90330
)
(gdb) po self navigationController] viewControllers] objectAtIndex:0] 
ricString]
Hello Ric!
(gdb) 

I want to store mutually-shared iVars (regional iVars) for each UITabBarItem 
to be shared 'regionally'.

What would be the best way to access these iVars from within the hierarchy?
... Or must I drill through the array of View Controllers as I've done?

Regards,

Ric.___

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


Sending a Cmd-V keystroke

2010-03-26 Thread Jim Graham
Hi

This is a problem that occurred a few months back in a project. I Never 
actually used it in the project but it has bugged me ever since. I have 
simplified the problem into a small example

There is a window with three NSTextFields and a button. The button is connected 
to the doPaste action and the fields are outlets

Here is the code


-(IBAction)doPaste:(id)sender{

NSPasteboard *pb = [NSPasteboard generalPasteboard];
[pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] 
owner:self];

[pb setString:@Field 1 forType:NSStringPboardType];
[textField1 becomeFirstResponder];
[self pasteIt];

[pb setString:@Field 2 forType:NSStringPboardType];
[textField2 becomeFirstResponder];
[self pasteIt]; 
 
[pb setString:@Field 3 forType:NSStringPboardType];
[textField3 becomeFirstResponder];
[self pasteIt];
  
}
  
-(void)pasteIt{
  
CGEventSourceRef sourceRef = 
CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
  if (!sourceRef)
  { 
  NSLog(@No event source);
  return;
  }
//9 = v
CGEventRef eventDown = CGEventCreateKeyboardEvent(sourceRef, 
(CGKeyCode)9, true);
CGEventSetFlags(eventDown, kCGEventFlagMaskCommand);
CGEventRef eventUp = CGEventCreateKeyboardEvent(sourceRef, 
(CGKeyCode)9, false);
CGEventPost(kCGHIDEventTap, eventDown);
CGEventPost(kCGHIDEventTap, eventUp);
CFRelease(eventDown);
CFRelease(eventUp);
CFRelease(sourceRef);
  
}

I expected that each of the fields would have their respective text pasted into 
them. What actually happens is that the last field gets three copies of it's 
text, Field 3, pasted into it. The other two fields are blank.

Can anybody explain why that should happen.

Jim 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 arch...@mail-archive.com


Compiler Warning: 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:'

2010-03-26 Thread Alec Stewart
This compiler warning  'NSDate' may not respond to
'+dateWithTimeInterval:sinceDate:' is driving me up the wall.

I don't understand why I am getting the warning because, by all indications,
+dateWithTimeInterval:sinceDate: has not been deprecated.

I would be extremely grateful for any insight.


Here's my code:

NSDate *dateWithoutHundredths;

dateWithoutHundredths = [NSDate dateWithString:[NSString
stringWithFormat:@%04d-%02d-%02d %02d:%02d:%02d +, year, month, day,
hour, minutes, seconds]];

NSTimeInterval hundredthsToAdd = (double)(hundredth / 100.0);

date = [NSDate dateWithTimeInterval:hundredthsToAdd
sinceDate:dateWithoutHundredths]; //This is the line the warning shows up on
___

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


NSOutlineView Data Source setObjectValue not being called

2010-03-26 Thread Venkat
Hello
I have an outline view with a custom NSCell on one column with a custom field 
editor for editing.  The field editor is a subclass of NSTextView.
On Leopard, the above custom NSCell correctly displays the data as well as I am 
able to edit the contents using the field editor.
On Snow Leopard, the setObjectValue function of the data source is not called 
and hence the edited changes are not saved.
How can I troubleshoot the problem?  I can send any parts of the code if 
required.

Venkat


___

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: Sending a Cmd-V keystroke

2010-03-26 Thread Dave DeLong
I think you're probably moving too fast.  Pasting is not a synchronous 
operation.  What I'm guessing is happening is that you're filling the 
pasteboard, pasting, filling, pasting, filling, and pasting, but the pasteboard 
hasn't starting actually *pasting* until you've already refilled it a third 
time.

One way around this is to declare and owner for the pasteboard, and not 
initiate the next paste until the pasteboard's owner until *after* the owner 
has received the pasteboard:provideDataForType: method.

However, even then it's not guaranteed to work, because there might be some 
other utility (iClip, PTHPasteboard, whatever) that's listening for changes to 
the pasteboard and requesting the data as well.

Dave

smime.p7s
Description: S/MIME cryptographic 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: Compiler Warning: 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:'

2010-03-26 Thread Quincey Morris
On Mar 26, 2010, at 01:23, Alec Stewart wrote:

date = [NSDate dateWithTimeInterval:hundredthsToAdd
 sinceDate:dateWithoutHundredths]; //This is the line the warning shows up on

The NSDate class reference states that this is available in Mac OS 10.6 or 
later. Chances are  your project is targeting the 10.5 SDK, in which this 
method doesn't exist.


___

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: Compiler Warning: 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:'

2010-03-26 Thread David Duncan
On Mar 26, 2010, at 1:23 AM, Alec Stewart wrote:

 This compiler warning  'NSDate' may not respond to 
 '+dateWithTimeInterval:sinceDate:' is driving me up the wall.


Quincey already answered why you are likely getting this error, but you can use 
-initWithTimeInterval:sinceDate: with to create an NSDate that you can use 
instead. Just don't forget to release or autorelease the object when your done.
--
David Duncan
Apple DTS Animation and Printing

___

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: Compiler Warning: 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:'

2010-03-26 Thread Alec Stewart
Thanks very much!  That took care of the problem.



On Fri, Mar 26, 2010 at 10:12 AM, David Duncan david.dun...@apple.comwrote:

 On Mar 26, 2010, at 1:23 AM, Alec Stewart wrote:

  This compiler warning  'NSDate' may not respond to
 '+dateWithTimeInterval:sinceDate:' is driving me up the wall.


 Quincey already answered why you are likely getting this error, but you can
 use -initWithTimeInterval:sinceDate: with to create an NSDate that you can
 use instead. Just don't forget to release or autorelease the object when
 your done.
 --
 David Duncan
 Apple DTS Animation and Printing


___

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: Sending a Cmd-V keystroke

2010-03-26 Thread Ross Carter
On Mar 26, 2010, at 12:23 AM, Jim Graham wrote:

   [textField1 becomeFirstResponder];

From the docs: Use the NSWindow makeFirstResponder: method, not this method, 
to make an object the first responder. Never invoke this method directly.
___

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: Sending a Cmd-V keystroke

2010-03-26 Thread Jim Correia
On Mar 25, 2010, at 8:23 PM, Jim Graham wrote:

 This is a problem that occurred a few months back in a project. I Never 
 actually used it in the project but it has bugged me ever since. I have 
 simplified the problem into a small example
 
 There is a window with three NSTextFields and a button. The button is 
 connected to the doPaste action and the fields are outlets

Before explaining why your code, as written doesn’t work, and how to fix it, 
can you give some background as to why you are doing it this way?

Unless you are trying to write a tool similar to Keyboard Maestro, you probably 
don’t want to be doing it this way.

- In general, you probably want to modify the model objects programmatically, 
and have the views react and update their display values.

- In the case that you want to update the views directly, you really ought to 
be reading the value from the pasteboard and setting the view’s display value 
programatically.

If this really is an academic exercise in pulling puppet strings on the UI, and 
you have legitimate reasons for doing so, including them in the original 
question would have avoided the speculation about why you are doing something 
which seems superficially crazy.

Problem #1: 

 
 Here is the code
 
 
 -(IBAction)doPaste:(id)sender{
   
   NSPasteboard *pb = [NSPasteboard generalPasteboard];
   [pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] 
 owner:self];
   
   [pb setString:@Field 1 forType:NSStringPboardType];
   [textField1 becomeFirstResponder];
   [self pasteIt];
   
   [pb setString:@Field 2 forType:NSStringPboardType];
   [textField2 becomeFirstResponder];
   [self pasteIt]; 

   [pb setString:@Field 3 forType:NSStringPboardType];
   [textField3 becomeFirstResponder];
   [self pasteIt];
 
 }
 
 -(void)pasteIt{
 
   CGEventSourceRef sourceRef = 
 CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
 if (!sourceRef)
 { 
 NSLog(@No event source);
 return;
 }
   //9 = v
   CGEventRef eventDown = CGEventCreateKeyboardEvent(sourceRef, 
 (CGKeyCode)9, true);
   CGEventSetFlags(eventDown, kCGEventFlagMaskCommand);
   CGEventRef eventUp = CGEventCreateKeyboardEvent(sourceRef, 
 (CGKeyCode)9, false);
   CGEventPost(kCGHIDEventTap, eventDown);
   CGEventPost(kCGHIDEventTap, eventUp);
   CFRelease(eventDown);
   CFRelease(eventUp);
   CFRelease(sourceRef);
 
 }
 
 I expected that each of the fields would have their respective text pasted 
 into them. What actually happens is that the last field gets three copies of 
 it's text, Field 3, pasted into it. The other two fields are blank.
 
 Can anybody explain why that should happen.
 
 Jim 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/jim.correia%40pobox.com
 
 This email sent to jim.corr...@pobox.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: Sending a Cmd-V keystroke

2010-03-26 Thread Jim Correia
On Mar 25, 2010, at 8:23 PM, Jim Graham wrote:

 This is a problem that occurred a few months back in a project. I Never 
 actually used it in the project but it has bugged me ever since. I have 
 simplified the problem into a small example
 
 There is a window with three NSTextFields and a button. The button is 
 connected to the doPaste action and the fields are outlets

Before explaining why your code, as written doesn’t work, and how to fix it, 
can you give some background as to why you are doing it this way?

Unless you are trying to write a tool similar to Keyboard Maestro, you probably 
don’t want to be doing it this way.

- In general, you probably want to modify the model objects programmatically, 
and have the views react and update their display values.

- In the case that you want to update the views directly, you really ought to 
be reading the value from the pasteboard and setting the view’s display value 
programatically.

If this really is an academic exercise in pulling puppet strings on the UI, and 
you have legitimate reasons for doing so, including them in the original 
question would have avoided the speculation about why you are doing something 
which seems superficially crazy.

   [pb setString:@Field 1 forType:NSStringPboardType];
   [textField1 becomeFirstResponder];

Problem #1: 

You change the first responder to sending -makeFirstResponder: to the window. 
It may fail if editing could not be committed for he current editor.

 -(void)pasteIt

Problem #2a:

This code assumes that your window is the key window and the application is 
frontmost.

Problem #2b:

You have posted an event, but until AppKit dequeues the event and processes it, 
the paste doesn’t actually happen. This is why you eventually get 3 pastes in 
the last edit field.

- Jim___

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: Compiler Warning: 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:'

2010-03-26 Thread Nick Peelman
According to the docs, that method is only available in 10.6 and
later.  Are you building for 10.5?

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/Reference/Reference.html#//apple_ref/doc/uid/2188-SW14

-nick

--
Nick Peelman
n...@peelman.us



On Fri, Mar 26, 2010 at 4:23 AM, Alec Stewart a...@velocitek.com wrote:
 This compiler warning  'NSDate' may not respond to
 '+dateWithTimeInterval:sinceDate:' is driving me up the wall.

 I don't understand why I am getting the warning because, by all indications,
 +dateWithTimeInterval:sinceDate: has not been deprecated.

 I would be extremely grateful for any insight.


 Here's my code:

    NSDate *dateWithoutHundredths;

    dateWithoutHundredths = [NSDate dateWithString:[NSString
 stringWithFormat:@%04d-%02d-%02d %02d:%02d:%02d +, year, month, day,
 hour, minutes, seconds]];

    NSTimeInterval hundredthsToAdd = (double)(hundredth / 100.0);

    date = [NSDate dateWithTimeInterval:hundredthsToAdd
 sinceDate:dateWithoutHundredths]; //This is the line the warning shows up on
 ___

 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/peelman%40gmail.com

 This email sent to peel...@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: Compiler Warning: 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:'

2010-03-26 Thread Philip Mobley
On Mar 26, 2010, at 1:23 AM, Alec Stewart wrote:

 This compiler warning  'NSDate' may not respond to
 '+dateWithTimeInterval:sinceDate:' is driving me up the wall.
 
 I don't understand why I am getting the warning because, by all indications,
 +dateWithTimeInterval:sinceDate: has not been deprecated.
 
 I would be extremely grateful for any insight.
 
 
 Here's my code:
 
NSDate *dateWithoutHundredths;
 
dateWithoutHundredths = [NSDate dateWithString:[NSString
 stringWithFormat:@%04d-%02d-%02d %02d:%02d:%02d +, year, month, day,
 hour, minutes, seconds]];
 
NSTimeInterval hundredthsToAdd = (double)(hundredth / 100.0);
 
date = [NSDate dateWithTimeInterval:hundredthsToAdd
 sinceDate:dateWithoutHundredths]; //This is the line the warning shows up on

Tech notes say:

+ (id)dateWithTimeInterval:(NSTimeInterval)secondssinceDate:(NSDate *)date

Is only available in OS X 10.6 and higher.  If your compiler Base SDK is set 
for 10.5, then that is probably the issue.

As an alternative, you can use a 10.0 compatible function:

- (id)initWithTimeInterval:(NSTimeInterval)seconds sinceDate:(NSDate 
*)refDate___

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