odd problems with NSData / OpenGL

2009-12-07 Thread Henri Häkkinen
Hello.

I have odd problems with using NSData, maybe someone could point me what's 
going wrong here.

I have a simple Cocoa document-based application, which uses a custom 
NSOpenGLView derived class. This view object has a reference to the document 
object (this binding is set in the nib file), and the document has a reference 
to a Mesh class. Mesh loads vertices and indexed triangular faces from a file, 
and stores them as NSData objects containing vertex arrays, intended to be used 
with glVertexPointer etc. OpenGL calls.

The mesh is drawn in drawRect: of the view class using OpenGL. First call of 
this method works fine and the mesh is rendered. However, after calling 
setNeedsDisplay (for example in reshape method or anywhere) the program crashes 
with EXC_BAD_ACCESS when the drawRect method is trying to access the NSData 
objects of the mesh. Using the debugger I can see that the pointers (both the 
document reference, mesh reference and the NSData pointers inside the mesh) 
remain the same between the calls of drawRect:, as in nothing seems to get 
overwritten accidentally or anything.

What might be causing this problem? Any ideas?

___

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: nscalendardate with 10.4

2009-12-07 Thread Nick Zitzmann

On Dec 7, 2009, at 5:32 PM, Sissy wrote:

>> how do i adjust dates using nscalendardate which is supposed to work with 
>> 10.0 and later without having the use of nsinteger which only works on 10.5 
>> and later.

NSInteger works on all versions of Mac OS X; you just have to define it 
yourself if you're using an SDK older than the Leopard SDK. All that NSInteger 
is is an int typedef (long if you built with NS_BUILD_32_LIKE_64). The same 
goes for NSUInteger.

Also, unless you have a really good reason to use NSCalendarDate, you should 
probably use NSCalendar instead.

Nick Zitzmann




___

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


Fwd: nscalendardate with 10.4

2009-12-07 Thread Sissy




i've complete my project which runs great on 10.5 leopard and i am  
trying to compile it to work with 10.4 (tiger).  i use  
nscalendardate which uses nsinteger which does not exist in 10.4.   
how do i adjust dates using nscalendardate which is supposed to work  
with 10.0 and later without having the use of nsinteger which only  
works on 10.5 and later.
- (NSCalendarDate *)dateByAddingYears:(NSInteger)year months: 
(NSInteger)month days:(NSInteger)day hours:(NSInteger)hourminutes: 
(NSInteger)minute seconds:(NSInteger)second

my code:
//  NSInteger counter = [selectDate dayOfWeek];
int counter = [selectDate dayOfWeek];

//	NSLog(@"dates are picker %@ and calendar %@  and counter is  
%i",theDate,selectDate,counter);	
	NSCalendarDate *tempDate = [selectDate dateByAddingYears:0 months:0  
days: -counter  hours:0 minutes:0 seconds:0];


thanks for your time, sissy



___

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


IKImageBrowserView image quality changing with redraw

2009-12-07 Thread Adam Berger
I'm trying to move from a custom view to an IKImageBrowserView in a project,
and running into a somewhat odd problem. Context: my IKImageBrowserItems are
IKImageBrowserNSImageRepresentationType, backed by a relatively
large (~600x800) NSImage.

When first drawn, at any scale factor, this looks great. However, as soon as
a redraw (not a reload!) occurs, the quality goes to hell. For example,
clicking in the browserview will cause this problem instantly. It's as if
it's deciding all of a sudden to fall back to a cached image of much lower
quality. Scrolling seems not to trigger a redraw of this type; so if a large
view containing as-first-drawn high quality images is clicked, only the
currently visible thumbnails will get degraded, and scrolling can then
present a mix of degraded and full-quality images.

Needless to say, this huge a reduction in image quality is not acceptable.
How can this be prevented?

[Side note: I've seen reference to the prefetching behavior
of IKImageBrowserView is particularly gnarly for NSImages as all the preload
must be done on main thread since NSImage is not thread safe. With this in
mind, what's the preferred type for IKImageBrowserItem backings?]

Adam
___

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


Issue with Input method using IMK

2009-12-07 Thread Sai Naveen
Hi,

I am trying to develop an input method using IMKit approach by implementing
the below.
-(BOOL)inputText:(NSString*) string key:(NSInteger)keyCode
modifiers:(NSUInteger)flags client:(id)sender

I took the IMK sample available at ADC, and understood the flow by
installing and dumping the traces to a file (I had some problems while
setting up remote debugging). After I customized the sample to implement the
above and replacing the app, I am no longer seeing the calls to inputText. I
only see calls to setValue (which is called when the selection is changed).
The OS is snow leopard.

Is this a known issue? Am I doing something wrong?

Thanks for your help!
___

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


ABPerson and Note property issue

2009-12-07 Thread Greg Hoover
When setting the value for the note property in an ABPerson record, the new 
value isn't available until relaunching the application.

Scenario:
- read the note value for a contact and I get "foo" 
- set the value to "bar"
- save the address book

- read the note value for the contact but get an empty string

I'm printing the description of the record after writing and before reading.  
After writing the new value, the description does show that the value for the 
note attribute has been set correctly.  However, when reading the note property 
the next time the record shows no note at all.

Interestingly I get the correct (new) value if I store the note as RTF rather 
than plain text.  I use RTFDataFromRange and initWithData:encoding: 
(NSASCIIStringEncoding) to convert the contents of an NSTextView to an ASCII 
RTF string.

Can anyone shed some light on this?

Thanks,
Greg___

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: Tracking Multiple Touches For Appropriate Label

2009-12-07 Thread Chunk 1978
is this suppose to work for multiple touches where one touch is
already present, then another touches the screen?  it's not working
for me.  each time i touch the screen and add an object to the
myTouches array the return count always returns 1, no matter how many
fingers i already have touching the screen.

On Mon, Dec 7, 2009 at 8:09 PM, mmalc Crawford  wrote:
>
> On Dec 7, 2009, at 4:12 pm, Chunk 1978 wrote:
>
>>       if ([[[event allTouches] anyObject] view] == self)
>>               {
>>               for (UITouch *touch in touches)
>>                       {
>>                       CGPoint touchPoint = [[touches anyObject] 
>> locationInView:self];
>>                       switch ([touches count])
>>                               {
>>                               case 1: [self Touch1:touchPoint];
>>                                               break;
>>
> This logic doesn't make sense at all.
> Moreover the custom method doesn't follow any standard Cocoa naming 
> conventions.
>
> You probably want something more like:
>
>
> - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
>
>    NSMutableArray *myTouches = [[NSMutableArray alloc] initWithCapacity:5];
>    NSArray *myLabels = [[NSArray alloc] initWithObjects:touchLabel1, 
> touchLabel2, touchLabel3, touchLabel4, touchLabel5, nil];
>
>    UITouch *touch;
>
>    for (touch in touches) {
>        if (touch.view == self) {
>            [myTouches addObject:touch];
>        }
>    }
>
>    NSUInteger i, count;
>    count = [myTouches count];
>
>    for (i = 0; i < 5; i++) {
>        UILabel *label = [myLabels objectAtIndex:i];
>        NSString *text = @"";
>        if (i < count) {
>            UITouch *touch = [myTouches objectAtIndex:i];
>            text = NSStringFromCGPoint([touch locationInView:self]);
>        }
>        label.text = text;
>    }
>
>    [myTouches release];
>    [myLabels release];
> }
>
> (First pass, there may be a better strategy, but at least this will work.)
>
> mmalc
>
> ___
>
> 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/chunk1978%40gmail.com
>
> This email sent to chunk1...@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: breakout game - openGL or quartz?

2009-12-07 Thread BravoBug Software
Everyone seems to have already pointed you in the right direction, but
as someone who has specific experience making such a game solo
(http://bravobug.com/megabrickbash3000) I wanted to just throw in my
.02 that OpenGL is definitely the way to go. NeHe's tutorials will be
very handy along the way and iDevGames is definitely worth visiting,
as the folks are generally very helpful and know their stuff, and you
can likely get quite a bit of help with all manner of game dev topics
(collision, audio, interface, etc.), not just graphics.

Be sure to also look into OpenAL for your sound effects. And you may
even want to take a peek at a 2D collision/physics library like
Chipmunks (http://code.google.com/p/chipmunk-physics/). It's not
really necessary for a breakout-type game but you might be surprised
at how much work it can save you. And you can do some really cool
stuff with it.

Cheers~
-Matt

On Sun, Dec 6, 2009 at 10:48 PM, Patrick J. Collins
 wrote:
> Hi everyone,
>
> I wrote a "breakout" style game for actionscript3:
> http://collinatorstudios.com/dev/super_collins_breakout
>
> and it's been on my mind to make a version for the iPhone..  But before I do
> that, I thought it would be good to just make a version for plain old OS X...
> So before I do this, I wanted to ask the opinions of every one here--  Should 
> I
> use OpenGL or quartz/core animation for my graphics drawing?  I am thinking
> that I want to use OpenGL-- even though the game is 2D, I still would like to
> be able to do gradients and shading and glowing, etc..  Which I am assuming
> isn't going to be as easy to accomplish with quartz/core animation.
>
> Also if anyone recommends any particular books or online tutorials for 
> learning
> how to draw simple rectangles and spheres, and make them glow, etc, that would
> be great.
>
> Thanks!
>
> Patrick J. Collins
> http://collinatorstudios.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/bravobug%40gmail.com
>
> This email sent to bravo...@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: NSScroller position

2009-12-07 Thread Graham Cox

On 08/12/2009, at 11:58 AM, PCWiz wrote:

> Is it possible to have a vertical NSScroller start from a specified Y 
> coordinate rather than at the top of its scroll view?


[NSScroller setFloatValue:] or [NSScroller setIntValue:]

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


Re: Tracking Multiple Touches For Appropriate Label

2009-12-07 Thread mmalc Crawford

On Dec 7, 2009, at 4:12 pm, Chunk 1978 wrote:

>   if ([[[event allTouches] anyObject] view] == self)
>   {
>   for (UITouch *touch in touches)
>   {
>   CGPoint touchPoint = [[touches anyObject] 
> locationInView:self];
>   switch ([touches count])
>   {
>   case 1: [self Touch1:touchPoint];
>   break;
> 
This logic doesn't make sense at all.
Moreover the custom method doesn't follow any standard Cocoa naming conventions.

You probably want something more like:


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

NSMutableArray *myTouches = [[NSMutableArray alloc] initWithCapacity:5];
NSArray *myLabels = [[NSArray alloc] initWithObjects:touchLabel1, 
touchLabel2, touchLabel3, touchLabel4, touchLabel5, nil];

UITouch *touch;

for (touch in touches) {
if (touch.view == self) {
[myTouches addObject:touch];
}
}

NSUInteger i, count;
count = [myTouches count];

for (i = 0; i < 5; i++) {
UILabel *label = [myLabels objectAtIndex:i];
NSString *text = @"";
if (i < count) {
UITouch *touch = [myTouches objectAtIndex:i];
text = NSStringFromCGPoint([touch locationInView:self]);
}
label.text = text;
}

[myTouches release];
[myLabels release];
}

(First pass, there may be a better strategy, but at least this will work.)

mmalc

___

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


NSScroller position

2009-12-07 Thread PCWiz
Is it possible to have a vertical NSScroller start from a specified Y 
coordinate rather than at the top of its scroll view?

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


Image gets wrong resolution value on Snow Leopard

2009-12-07 Thread Randall Meadows
In this application, I have a method that reads in an image and writes it back 
out with a different resolution.  This resolution is specified by the user via 
a textfield in a sheet.

On Leopard, the method works as expected; whatever value for the resolution is 
specified is what is actually used to write out the image.

But on Snow Leopardsigh.  The client has asked that this textfield's value 
default to "250", indicating the image should be written out with a DPI of 250 
pixels/inch.  When that value is used, the resulting image does NOT have a 
resolution of 250, but rather "72.05 x 72.03 pixels/inch" as indicated by 
Preview's Info window.  GraphicConverter and Photoshop agree with this.  I 
tried various values, including 249, 248, 245, and 239--all these resulted in 
the "wrong" value, but lo and behold "240" *works*.

I've posted the method at , so you can 
turn on line numbers for easy reference, but I'll also paste it here for easy 
discussion:

- (void)exportImageDefinition:(AMImageDefinition *)imageDefinition
  destination:(NSString *)destination
retouched:(BOOL)retouched
  revertRetouched:(BOOL)revertRetouch
  cropped:(BOOL)cropped
revertCropped:(BOOL)revertCrop
   resolution:(float)resolution
 recompressed:(BOOL)recompressed
 fileType:(NSString *)fileType
 settings:(void *)settings
  appendExtension:(BOOL)appendExtension
writePath:(NSString *)writePath
stripMetadata:(BOOL)stripMetadata
{
   NSString  *imagePath = nil, *savePath = writePath;
   BOOL  isDir;

   if (retouched) {
  imagePath = [imageDefinition retouchedImagePathForSource:retouchedSource];
  if (revertRetouch && !imagePath) {
 imagePath = [imageDefinition imagePath];
  }
   }
   else {
  imagePath = ((![imageDefinition 
retouchedImagePathForSource:retouchedSource] || revertRetouch) ? 
   [imageDefinition imagePath] : nil);
   }

   if (!recompressed) {
  // The fileType may be wrong, because it just blindly takes whatever the 
menu says, without
  // checking whether it *should* be recompressed or not.
  NSString   *extension = [imagePath pathExtension];
  fileType = [self fileTypeForExtension:extension];
   }
   OSType  creator = '8BIM' /* Photoshop */, typeCode = [self 
typeCodeForFileType:fileType];
   
   if ([[NSFileManager defaultManager] fileExistsAtPath:savePath 
isDirectory:&isDir] && isDir) {
  savePath = [savePath stringByAppendingPathComponent:[[imagePath 
lastPathComponent] 
   
stringByDeletingPathExtension]];

  if (!recompressed) {
 if ([imagePath pathExtension] != nil) {
savePath = [savePath stringByAppendingPathExtension:[imagePath 
pathExtension]];
 }
  }
   }

   if (recompressed && imagePath && (!cropped || [imageDefinition 
regionOfInterest])) {
  CGImageSourceRef  imageSource = 
CGImageSourceCreateWithURL((CFURLRef)[NSURL fileURLWithPath:imagePath], NULL);
  NSMutableDictionary   *imageProperties = nil;
  NSImage   *image = nil;
  CGImageRefimageRef = NULL;

  @try {
 if (CGImageSourceGetCount(imageSource) > 0) {
imageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL);
CIImage *ciImage = [CIImage imageWithCGImage:imageRef];

imageProperties = [NSMutableDictionary dictionaryWithDictionary:
   [(NSDictionary *)CGImageSourceCopyPropertiesAtIndex(imageSource, 
0, NULL) autorelease]];

// clean up after our CGImage
CGImageRelease(imageRef);
imageRef = NULL;
// convert image into nsImage
if (ciImage != nil)
   image = [NSImageCreateWithCIImage(ciImage, imageProperties) 
autorelease];
 }
  }

  // clean up
  @finally {
 CFRelease(imageSource);
 imageSource = NULL;
  }

  // cancel the export if we can't open the image
  if (image != nil) {
 // configure the exporter
 //[exporter setSettings:settings];

 if (appendExtension) {
NSString   *extension = [self extensionForFileType:fileType];
if (extension != nil) {
   savePath = [savePath stringByAppendingPathExtension:extension];
}
 }

 if (resolution == 0) {
// This will be non-zero when cropping has been requested; if it's 
zero, don't actually
// change the value, but use what the current value is.
// Could probably just as easily use DPIWidth or TIFF:XResolution 
or TIFF:YResolution
resolution = [[imageProperties valueForKey:@"DPIHeight"] 
floatValue];
 }
 
 if (cropped) {
  

Tracking Multiple Touches For Appropriate Label

2009-12-07 Thread Chunk 1978
for 2 days now i've had unsuccessful attempts at trying to track
UITouches that share the same view.

i have a plain, full screen view that accepts multiple touches.  i
have 3 labels titled "Touch1", "Touch2", "Touche3".  all i'm trying to
accomplish is to output the coordinates of the touches thru the labels
and update the appropriate label according to the number of touches on
the screen.

so if one finger is touching and moving around the screen, Touch1 will
display it's coordinates.  if 2 fingers are touching or moving around
the screen than Touch2 will show the second's touches coordinates
while Touch1 is still being tracked by the first finger.  if 3 fingers
are touching the screen, Touch3 will show the coordinates of the 3rd
finger.

my current, non working state:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([[[event allTouches] anyObject] view] == self)
{
for (UITouch *touch in touches)
{
CGPoint touchPoint = [[touches anyObject] 
locationInView:self];
switch ([touches count])
{
case 1: [self Touch1:touchPoint];
break;
case 2: [self Touch2:touchPoint];
break;
case 3: [self Touch3:touchPoint];
break;
case 4: [self Touch4:touchPoint];
break;
}
}
}
}
___

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


the ABLocalizedPropertyOrLabel() function

2009-12-07 Thread Steve Cronin
Folks;

I am trying to understand the ABAddressBook's ABLocalizedPropertyOrLabel() 
function.

I can find descriptions of what it is supposed to do but no actual examples or 
guidance on how to use it or the necessary conditions for it to work.

I have configured a Snow Leopard machine to use Danish language and selected 
the 'Denmark' Region on the 'International' system preference pane.
I've logged out and back in.
The Finder menus are all in Danish and when I open Address Book the various 
labels are all in Danish.

However, when I run a simple Cocoa app :
NSLog(@"%@",ABLocalizedPropertyOrLabel(kABPhoneHomeLabel));   --->  home

What have I overlooked in using this function?

Thanks,
Steve


___

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


ABAddressBook -> Default Account?

2009-12-07 Thread Steve Cronin
Folks;

In Snow Leopard an Address Book user now has a preference setting for setting 
the 'default account for new contacts'

-save always stores to the local machine regardless

Am I just missing something?

Thanks,
Steve


___

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


receiving events

2009-12-07 Thread Ariel Feinerman
Hi,
in Apple`s reference library, examples the event stream looks like following:
NSApplication -> NSWindow -> NSView / custom View / OpenGLView or any
NSResponder-inherited class; If a display is captured (for OpenGL)
does view receive any events or not? if not and if app for example
works in fullscreen only mode, can we do not create NSWindow instance
at all?

I cannot find answer in mailing lists or other sources.

--
best regards
Ariel
___

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: Untitled Document Leak

2009-12-07 Thread Seth Willits
On Dec 7, 2009, at 9:36 AM, Richard Somers wrote:

>> This isn't a leak, it's caching the color. Otherwise it would have to call 
>> into the OS (CoreUI or what have you) every time anyone asked for the 
>> control color, which happens quite often.
> 
> MallocDebug reported it as a leak so I thought it was a leak. So how do you 
> identify leaks from non-leaks?

Intuition. 

The only way to know is to understand what's going on which makes it think it's 
a leak. But you can pretty much ignore any reported "leaks" which aren't from 
your own code. There may be a leak in the frameworks, but it's so rare it 
wouldn't really be worth your time trying to understand every potential one. 
You'll get used to seeing the same kind of "leak" over and over and learn to 
ignore it.

--
Seth Willits



___

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

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

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

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


Re: Draw rounded NSImage

2009-12-07 Thread John Wright
Thanks Gideon, that worked.

On Sun, Dec 6, 2009 at 9:03 PM, Gideon King  wrote:

> Your code restores the graphics state, which will remove your rounded rect
> clipping path, before you draw the image.
>
> If you draw the image before restoring the graphics state, you should be
> OK.
>
> Also you should not need to explicitly set the winding rule.
>
> HTH
>
> Gideon
>
> On 05/12/2009, at 7:22 AM, John Wright wrote:
>
> > I am trying to create a NSImage or NSImageCell with rounded corners
> > inside a NSTableView. I can't get anything to work. Here is the best I
> > have so far inside my custom NSCell:
> >
> > - (void)drawInteriorWithFrame:(NSRect)frame inView:(NSView *)controlView
> {
> >   if (thumbnailLink) {
> > NSURL *url = [NSURL URLWithString:thumbnailLink];
> > if (url) {
> > NSRect imageFrame = [self
> _imageFrameForInteriorFrame:frame];
> > NSImage *image = [[NSImage alloc]
> initWithContentsOfURL:url];
> > [image setScalesWhenResized:YES];
> > [image setSize:NSMakeSize(IMAGE_HEIGHT, IMAGE_WIDTH)];
> >
> > [NSGraphicsContext saveGraphicsState];
> > imageFrame = NSInsetRect(imageFrame, 1, 1);
> > NSBezierPath *clipPath = [NSBezierPath
> > bezierPathWithRoundedRect:imageFrame cornerRadius:5.0];
> > [clipPath setWindingRule:NSEvenOddWindingRule];
> > [clipPath addClip];
> > [NSGraphicsContext restoreGraphicsState];
> > [image drawInRect:imageFrame fromRect:NSMakeRect(0, 0,
> > 0, 0) operation:NSCompositeSourceIn fraction:1.0];
> > [image release];
> > }
> > }
> > ...
> >
> > Any ideas on how to do 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 arch...@mail-archive.com


Re: Question about aliasing (analog clock hands)

2009-12-07 Thread Eric E. Dolecki
That's cool - when I used PNGs and rotated them, they looked all aliased on
the iPhone so I went with CAShapeLayers instead. Thanks for that link
though.

On Sun, Dec 6, 2009 at 12:21 AM, Scott Anguish  wrote:

> not sure if this is helpful, but on http://www.abandoninplace.com/ in
> SampleCode, there is an example of using a dial created with Core Animation.
>
> On Dec 3, 2009, at 3:34 PM, Eric E. Dolecki wrote:
>
> > Will do. One question - when I am rotating around z - it's using the top
> > left of the shapeLayer as the anchor point. Trying to set it differently
> > isn't changing the anchor point...
> >
> > CABasicAnimation *rotationAnimation;
> >
> > rotationAnimation =[CABasicAnimation animationWithKeyPath:@
> > "transform.rotation.z"];
> >
> > [rotationAnimation setFromValue:DegreesToNumber(0)];
> >
> > [rotationAnimation setToValue:DegreesToNumber(360)];
> >
> > [rotationAnimation setDuration:2.0f];
> >
> > [rotationAnimation setRepeatCount:1];
> >
> > [shapeLayer setAnchorPoint:CGPointMake(240, 160)];
> >
> > [shapeLayer addAnimation:rotationAnimation forKey:@"rotate"];
> >
> > It just rotates around the top left corner (meaning it comes into and out
> of
> > view)... I am looking to simply spin the shape where it sits from it's
> > center.
> >
> >
> >
> > On Thu, Dec 3, 2009 at 3:17 PM, Kyle Sluder 
> wrote:
> >
> >> On Thu, Dec 3, 2009 at 12:07 PM, Eric E. Dolecki 
> >> wrote:
> >>> If I use CAShapeLayer, can I use CGAffineTransform on it? I need to
> pour
> >>> through the docs now I guess.
> >>
> >> Yes, please brush up on Core Animation.  You can apply arbitrary
> >> transformations to a layer, or you can use the rotation/position
> >> properties of the layer itself and let CA take care of all the nested
> >> coordinate systems for you.  Since the iPhone uses layers for pretty
> >> much all drawing, you're going to need to get a handle on Core
> >> Animation sooner rather than later.
> >>
> >> --Kyle Sluder
> >>
> >
> >
> >
> > --
> > http://ericd.net
> > Interactive design and development
> > ___
> >
> > 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/scott%40cocoadoc.com
> >
> > This email sent to sc...@cocoadoc.com
>
>


-- 
http://ericd.net
Interactive design and development
___

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: CAShapeLayer & CGAffineTransformMakeForRotation?

2009-12-07 Thread Eric E. Dolecki
float radians = DegreesToRadians((h*30+m/2));

CATransform3D hourTransform;

hourTransform = CATransform3DMakeRotation(radians, 0, 0, 1.0 );

[hourHandLayer setTransform:hourTransform];


I have a method called on a timer every second and the hands update from it.


On Mon, Dec 7, 2009 at 2:37 PM, Kyle Sluder  wrote:

> On Mon, Dec 7, 2009 at 11:32 AM, Eric E. Dolecki 
> wrote:
> > I don't see a CGPathCreateImmutable() anywhere in the docs.
>
> Sorry, I was thinking in NSBezierPath terms.
>
> > I did solve my problem though.
>
> How did you do that?  Did you do what I recommended, something else, or
> both?
>
> --Kyle Sluder
>



-- 
http://ericd.net
Interactive design and development
___

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: CAShapeLayer & CGAffineTransformMakeForRotation?

2009-12-07 Thread Kyle Sluder
On Mon, Dec 7, 2009 at 11:32 AM, Eric E. Dolecki  wrote:
> I don't see a CGPathCreateImmutable() anywhere in the docs.

Sorry, I was thinking in NSBezierPath terms.

> I did solve my problem though.

How did you do that?  Did you do what I recommended, something else, or both?

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


Re: Localizing Xibs using bindings

2009-12-07 Thread Quincey Morris
On Dec 7, 2009, at 10:34, Jerry Krinock wrote:

> At the risk of being flamed, I'll state that I also use single, language-less 
> xibs.

Well, this is no flame, and ya gotta do what ya gotta do, but I will just point 
out that you and the OP are mostly talking about translation, not localization 
-- you're talking about making room in the layout for the sizes of the strings 
translated into the "localized" language. Localization isn't just about which 
language your interface uses, but which set of cultural values it embraces.

After all, if you're producing a great-looking app, your initial interface 
design (in, presumably, your own language) has a carefully hand-crafted XIB 
file. Even if the same design works for a different language -- one that has 
strings of approximately the same length -- there are other aspects to 
consider. Another culture's preference for balance in the layout may differ 
subtly from yours. Effective colors may vary from culture to culture. Cultures 
with languages with long words might prefer more vertical white space between 
lines than cultures with languages with short words. Some countries may love 
tool tips and other countries may hate them, I don't know.

Language is the largest part of localization, perhaps, but not the whole of it. 
In an ideal world, if users of your primary XIB localization get a carefully 
hand-crafted design, then surely your users of your other localizations deserve 
the attention of a design hand-crafted for them too.

But, ya gotta do what ya gotta do. :)


___

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: CAShapeLayer & CGAffineTransformMakeForRotation?

2009-12-07 Thread Eric E. Dolecki
I don't see a CGPathCreateImmutable() anywhere in the docs.

I did solve my problem though.

On Mon, Dec 7, 2009 at 1:49 PM, Kyle Sluder  wrote:

> On Mon, Dec 7, 2009 at 6:16 AM, Eric E. Dolecki 
> wrote:
> > I am still on the analog clock thing here. I am drawing the hands of the
> >  hourHandPath = CGPathCreateMutable();
>
> Rather than making a mutable path and transforming it, you should
> instead create a CAShapeLayer with an immutable path and change that
> layer's transformation matrix.
>
> --Kyle Sluder
>



-- 
http://ericd.net
Interactive design and development
___

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: Localizing Xibs using bindings

2009-12-07 Thread Jerry Krinock

On 2009 Dec 07, at 10:43, Kyle Sluder wrote:

> On Mon, Dec 7, 2009 at 10:34 AM, Jerry Krinock  wrote:
>> It depends on your situation.  I don't foresee my limited resources ever 
>> going beyond localizing to de, fr, es, it and ja.  At the risk of being 
>> flamed, I'll state that I also use single, language-less xibs.
> 
> Why not do both? ... use ibtool to apply string localizations when
> necessary, and a bit of scripting

That's a good idea which I have filed in case I want to do better.  Actually, 
even developers with localized nibs are "doing both" anyhow, because of all the 
strings that are in code and not in xibs.   Examples: tooltips, warnings, any 
text which must be generated dynamically.  My apps tend to have more of these 
non-xib strings anyhow -- far more if you'd count words instead of 
strings.___

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: CAShapeLayer & CGAffineTransformMakeForRotation?

2009-12-07 Thread Kyle Sluder
On Mon, Dec 7, 2009 at 6:16 AM, Eric E. Dolecki  wrote:
> I am still on the analog clock thing here. I am drawing the hands of the
>  hourHandPath = CGPathCreateMutable();

Rather than making a mutable path and transforming it, you should
instead create a CAShapeLayer with an immutable path and change that
layer's transformation matrix.

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


Re: AudioToolbox detect VBR?

2009-12-07 Thread David Duncan
On Dec 7, 2009, at 6:53 AM, Richard wrote:

> i am working on an app that needs to scan a bunch of music files, and i am
> currently getting the bitrate and duration using AudioFileGetProperty
> 
> what i would like to know is if it is possible to determine whether a file
> is VBR or not, is this possible using the AudioToolbox framework, or any
> other apple framework?


You would have a better chance of getting an answer on the CoreAudio-API list.
--
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: Localizing Xibs using bindings

2009-12-07 Thread Kyle Sluder
On Mon, Dec 7, 2009 at 10:34 AM, Jerry Krinock  wrote:
> It depends on your situation.  I don't foresee my limited resources ever 
> going beyond localizing to de, fr, es, it and ja.  At the risk of being 
> flamed, I'll state that I also use single, language-less xibs.

Why not do both?  Japanese tends to be pretty concise, especially
compared to German.  Those are the two LTR languages that people most
frequently wind up resizing things for.  But you can use ibtool to
apply string localizations when necessary, and a bit of scripting will
keep your different localized nib bundles in sync, unless it detects a
non-strings modification has been made to the localized variant, in
which case it requires a checkup to ensure things still fit.

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


Re: How to determine the type of a motherboard controller

2009-12-07 Thread David Duncan

On Dec 5, 2009, at 12:02 AM, Zephyroth Akash wrote:

> How do I get the class-code definition of a motherboard controller ?


The first question that comes to mind is what do you need to know this 
information for? Knowing would give us some idea of how to direct you further.
--
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: Localizing Xibs using bindings

2009-12-07 Thread Jerry Krinock

On 2009 Dec 07, at 08:28, Andrew Farmer wrote:

> On 5 Dec 2009, at 10:05, Rossi Matteo wrote:
>> I find it very annoying to localize Xibs by keeping a copy for each 
>> translation. It's both tedious and error-prone.
>> 

>> Obvously I take care to keep control sizes large enough to host each 
>> translation.

which can be a bit of a pain and will, in places, compromise your cosmetics 
slightly.

> it will make your application look backwards in RTL languages.

Indeed, the Semitic languages of the Middle East, and the languages of 
south-central Asia, are right-to-left languages (RTL).  However, if you don't 
foresee ever having localizers for these languages, then a strategy such as 
yours has the advantages you have noted.  Another advantage is that if you 
write comments which well define each string in your .strings file, the same 
.strings file can be used in multiple applications.

It depends on your situation.  I don't foresee my limited resources ever going 
beyond localizing to de, fr, es, it and ja.  At the risk of being flamed, I'll 
state that I also use single, language-less xibs.

___

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: breakout game - openGL or quartz?

2009-12-07 Thread Randall Meadows
On Dec 6, 2009, at 11:48 PM, Patrick J. Collins wrote:

> I wrote a "breakout" style game for actionscript3:
> http://collinatorstudios.com/dev/super_collins_breakout
> 
> and it's been on my mind to make a version for the iPhone..  But before I do
> that, I thought it would be good to just make a version for plain old OS X...
> So before I do this, I wanted to ask the opinions of every one here--  Should 
> I
> use OpenGL or quartz/core animation for my graphics drawing?  I am thinking
> that I want to use OpenGL-- even though the game is 2D, I still would like to
> be able to do gradients and shading and glowing, etc..  Which I am assuming
> isn't going to be as easy to accomplish with quartz/core animation.

I am putting the finishing touches on a 2D game.  I started out with Quartz/CA 
graphics, and while the game was simple enough, I was simply unable to get 
anything near decent performance.  I learned enough OpenGL [ES] in about 15 
hours (all from top hits on googling "opengl 2d sample code" [I think]) to 
outperform the old code by probably an order of magnitude.  Just for grins, I 
quadrupled the number of objects in my scene (to over several hundred), and I'm 
still getting 60fps with no problem (I'm actually limiting my frame rate to 
that, so I'm sure it would be much higher).  My scenes are rather simple (no 
lighting, "glowing", or anything), but still...a *remarkable* difference.

I decided to leave in a few CA animations because they were so simple, and I 
really want to ship RSN; this was my first foray into OpenGL, and I'm now a 
believer.


randy___

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: Untitled Document Leak

2009-12-07 Thread Richard Somers

On Dec 7, 2009, at 10:26 AM, Kyle Sluder wrote:

This isn't a leak, it's caching the color. Otherwise it would have  
to call into the OS (CoreUI or what have you) every time anyone  
asked for the control color, which happens quite often.


MallocDebug reported it as a leak so I thought it was a leak. So how  
do you identify leaks from non-leaks?


--Richard

___

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

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

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

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


Re: NSTableView reloadData works just on init.

2009-12-07 Thread Nick Zitzmann

On Dec 7, 2009, at 2:57 AM, Alberto Piu wrote:

> You said that this line:
> 
> shortcutsTable = [[NSTableView alloc] init];
> 
> should be
> 
> shortcutsTable = [[NSTableView alloc] initWithFrame:etc];
> 
> but although this is correct it resets the pointer to a brand new object, so 
> I have to remove this line?

That's correct. If you made the connection to the outlet in IB, then the outlet 
pointer will point to the table view in the nib (you did place a table view in 
the nib, and connect the outlet, right?) once the nib is loaded.

> I have an AppDelegate controller. Inside awakeFromNib there is:
> 
> id shortcuts = [[ShortcutsTableController alloc] init];
> [shortcuts addLine:@"blabla" :@"bla"];
> 
> this simply does nothing. He goes correctly to the addLine method but 
> reloadData simply does not work.

That's to be expected. When you init an object with IB outlets, the outlets are 
nil. You have to load the nib, and then, if you made a connection between the 
table view and the outlet in the nib, the outlet to the table view will be 
initialized and ready to take messages. Until then, the outlet will be nil, and 
sending messages to nil is a no-op.

Nick Zitzmann


___

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: Untitled Document Leak

2009-12-07 Thread Kyle Sluder
On Dec 7, 2009, at 8:40 AM, Richard Somers  
 wrote:



186 bytes in 1 node:
0x6b8b4
CSMemNewPtr
CSMemNewHandle
QDUnflattenPixPat
_NSReadThemePatternFromRsrc
_NSReadThemeImageFromplutEntry
GetThemeImage
+[NSColor _controlColor]
-[NSDynamicSystemColor recacheColor]


This isn't a leak, it's caching the color. Otherwise it would have to  
call into the OS (CoreUI or what have you) every time anyone asked for  
the control color, which happens quite often.


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


Untitled Document Leak

2009-12-07 Thread Richard Somers
I have the following memory leak in my application. It is mostly  
always present but sometimes it will go away. It appears to be  
associated with opening an untitled document. Does anyone know how to  
get rid of this?


The leak does not grow but stays constant at 186 bytes. Not a big deal  
but is is annoying.


Leak as reported by MallocDebug (inverted form).

186 bytes in 1 node:
0x6b8b4
CSMemNewPtr
CSMemNewHandle
QDUnflattenPixPat
_NSReadThemePatternFromRsrc
_NSReadThemeImageFromplutEntry
GetThemeImage
+[NSColor _controlColor]
-[NSDynamicSystemColor recacheColor]
-[NSDynamicSystemColor initWithSelector:]
+[NSColor controlColor]
-[NSTextFieldCell drawsBackground]
-[NSTextFieldCell interiorBackgroundStyle]
-[NSCell _textAttributes]
-[NSTextFieldCell _textAttributes]
__NSGetStringAndAttributesFromTextCell
_NSGetTextCellBoundingRect
-[NSCell cellSizeForBounds:]
-[NSTextFieldCell cellSizeForBounds:]
-[NSCell cellSize]
-[NSTitledFrame _titleCellSize]
-[NSThemeFrame _defaultTitlebarTitleRect]
-[NSWindow _customTitleFrame]
-[NSThemeFrame _titlebarTitleRect]
-[NSTitledFrame setTitle:]
-[NSWindow _dosetTitle:andDefeatWrap:]
-[NSWindowController window]
-[NSWindowController showWindow:]
-[NSDocument showWindows]
-[NSDocumentController openUntitledDocumentAndDisplay:error:]
-[NSDocumentController(NSInternal) _openUntitled]
-[NSApplication _doOpenUntitled]
-[NSApplication(NSAppleEventHandling) _handleAEOpen:]
-[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:]
-[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:]
_NSAppleEventManagerGenericHandler
aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned  
char*)

dispatchEventAndSendReply(AEDesc const*, AEDesc*)
aeProcessAppleEvent
AEProcessAppleEvent
_DPSNextEvent
-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
-[NSApplication run]
NSApplicationMain
main
start

--Richard

___

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

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

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

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


Re: Localizing Xibs using bindings

2009-12-07 Thread Andrew Farmer
On 5 Dec 2009, at 10:05, Rossi Matteo wrote:
> I find it very annoying to localize Xibs by keeping a copy for each 
> translation. It's both tedious and error-prone.
> I've found that by simply binding each button's title (or wharever other 
> control you need) to the appropriate key of a NSDictionary object I can 
> easily localize each item.
> No need to create tons of outlets for each control. Indeed I have no outlet 
> at all. It works smoothly and I can send only .strings files to my 
> translators.
> Since I haven't found no article on this solution, I was wondering if it's 
> wrong or which problems may arise.
> Obvously I take care to keep control sizes large enough to host each 
> translation.

Among other issues, it will make your application look backwards in RTL 
languages.___

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


IKImageBrowserView out drag & drop with NSData

2009-12-07 Thread Micha Fuhrmann
Hi everyone,

I'm using an IKImageBrowserView with data rep 
IKImageBrowserNSDataRepresentationType.

I'm using 

- (NSUInteger) imageBrowser:(IKImageBrowserView *)aBrowser 
writeItemsAtIndexes:(NSIndexSet *) itemIndexes toPasteboard: (NSPasteboard 
*)pasteboard 

and filling the pasteboard with 

[pasteboard declareTypes:[NSArray arrayWithObject:(NSString 
*)kPasteboardTypeFileURLPromise] owner:self];
[pasteboard setPropertyList:imageData forType:(NSString 
*)kPasteboardTypeFileURLPromise];

imageData being an Array with NSData objects containing images.

The drag works fine, A nice red badge appears if I select multiple items, then 
the plus sign appears as I hover above the finder, but as I drop 

- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination

Doesn't get called.

I'm stuck here, everything works fine, but I just need the drop location...

I've tried subclassing IKImageBrowserView  as shown on http://speirs.org/

But then the badge is gone, the thumbs of the first image is gone too, and I've 
got the feeling I will bump into problems with sublclassing all the mouse 
action later on in the project.

Any help greatly appeciated.
___

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


CAShapeLayer

2009-12-07 Thread Eric E. Dolecki
Is it possible to add a drop shadow to a CAShapeLayer? (not a copy below it,
but a blurred drop shadow)?

If so, how would one approach 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 arch...@mail-archive.com


Re: breakout game - openGL or quartz?

2009-12-07 Thread Brian Dittmer
You'll probably want to check out cocos2d-iphone, a great objective-c
framework for writing opengl games on the iphone.  You can find more
info at http://www.cocos2d-iphone.org.

-Brian

On Mon, Dec 7, 2009 at 2:46 AM, Chunk 1978  wrote:
> cool game, patrick.  i especially liked your sound.
>
> On Mon, Dec 7, 2009 at 2:05 AM, Nick Zitzmann  wrote:
>>
>> On Dec 6, 2009, at 11:48 PM, Patrick J. Collins wrote:
>>
>>> and it's been on my mind to make a version for the iPhone..  But before I do
>>> that, I thought it would be good to just make a version for plain old OS 
>>> X...
>>> So before I do this, I wanted to ask the opinions of every one here--  
>>> Should I
>>> use OpenGL or quartz/core animation for my graphics drawing?
>>
>> This thread is probably going to go OT, but I'd recommend OpenGL. There are 
>> plenty of examples of great 2D games that were implemented using a 3D API of 
>> some sort; World of Goo immediately comes to mind.
>>
>>> Also if anyone recommends any particular books or online tutorials for 
>>> learning
>>> how to draw simple rectangles and spheres, and make them glow, etc, that 
>>> would
>>> be great.
>>
>> 
>>
>> Nick Zitzmann
>> 
>>
>>
>>
>> ___
>>
>> 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/chunk1978%40gmail.com
>>
>> This email sent to chunk1...@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/brian.t.dittmer%40gmail.com
>
> This email sent to brian.t.ditt...@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


AudioToolbox detect VBR?

2009-12-07 Thread Richard
hey

i am working on an app that needs to scan a bunch of music files, and i am
currently getting the bitrate and duration using AudioFileGetProperty

what i would like to know is if it is possible to determine whether a file
is VBR or not, is this possible using the AudioToolbox framework, or any
other apple framework?

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


CAShapeLayer & CGAffineTransformMakeForRotation?

2009-12-07 Thread Eric E. Dolecki
I am still on the analog clock thing here. I am drawing the hands of the
clock myself and would like to programmatically rotate them.

For instance this is how I am constructing the hour hand:

rootLayer = [CALayer layer];

rootLayer.frame = CGRectMake(240, 160, 240, 160);

self.view.layer addSublayer:rootLayer];

CGPoint center = CGPointMake(0, 0);


 hourHandPath = CGPathCreateMutable();

CGPathMoveToPoint(hourHandPath, nil, center.x, center.y+10);

CGPathAddLineToPoint(hourHandPath, nil, center.x, center.y - 50);

CGPathCloseSubpath(hourHandPath);

 hourHandLayer = [CAShapeLayer layer];

hourHandLayer.path = hourHandPath;

UIColor *myStrokeColor = [UIColor colorWithHue:0.2 saturation:1
brightness:0.1 alpha:1.0];

hourHandLayer.strokeColor = myStrokeColor.CGColor;

hourHandLayer.lineWidth = 3.0;

[rootLayer addSublayer:hourHandLayer];


Now I am attempting to initially set it rotation:


 NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];

unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |
NSDayCalendarUnit | NSHourCalendarUnit| NSMinuteCalendarUnit
|NSSecondCalendarUnit;

NSDate *date = [NSDate date];

NSDateComponents *comps = [gregorian components:unitFlags fromDate:date];

int h = [comps hour];

int m = [comps minute];

int s = [comps second];

CGAffineTransform cgaRotateHr =
CGAffineTransformMakeRotation(DEGREES_TO_RADIANS( h*30+m/2 ));

CGAffineTransform cgaRotateMin =
CGAffineTransformMakeRotation(DEGREES_TO_RADIANS( m*6+s/10 ));


*//This is not working - must be another method to do this I am unaware of
at the moment...*

[hourHandLayer setTransform:cgaRotateHr];


What is the proper way to apply the rotation? A CABasicAnimation with a
duration of 0 and a repeat count of 0?


Thanks in advance,

Eric
___

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


NSString memory allocation

2009-12-07 Thread jonat...@mugginsoft.com
My GC app receives string data from a server and displays it.
If the strings are small, say around 60-100KB then real memory allocation seems 
unremarkable.

Above this, say around 100-300KB, then real memory allocation increases by 
about 20MB.
This memory does not seem to be released even after an exhaustive collection.

Would it be right to assume that NSString switches to a different allocation 
strategy as the data size increases?

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.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: drag and drop form NSViewController or NSView subclass

2009-12-07 Thread Gustavo Pizano
HEHEH ok.. I have realized that it can't be done through the NSViewController 
but its view...

G.


On Dec 7, 2009, at 2:38 PM, Gustavo Pizano wrote:

> Hello.
> 
> Sorry I have answered my own question, I can use the NSViewController, but to 
> register the types I must do it in the view of the controller,  even if I do 
> [[self view] registerForDraggedTypes: ] for the rest of the dragging 
> destination methods it seems I can use the NSViewcontroller...
> 
> G.
> 
> 
> On Dec 7, 2009, at 10:42 AM, Gustavo Pizano wrote:
> 
>> Hello..
>> 
>> I implemented in the past drag and drop, but I did it from within the sub 
>> classes of NSView, Im wondering if I can do the same from within the 
>> NSViewControllers that control the view.. what implications it has? what you 
>> recommend best?
>> 
>> Thanks
>> 
>> Gustavo
> 

___

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

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

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

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


Re: drag and drop form NSViewController or NSView subclass

2009-12-07 Thread Gustavo Pizano
Hello.

Sorry I have answered my own question, I can use the NSViewController, but to 
register the types I must do it in the view of the controller,  even if I do 
[[self view] registerForDraggedTypes: ] for the rest of the dragging 
destination methods it seems I can use the NSViewcontroller...

G.


On Dec 7, 2009, at 10:42 AM, Gustavo Pizano wrote:

> Hello..
> 
> I implemented in the past drag and drop, but I did it from within the sub 
> classes of NSView, Im wondering if I can do the same from within the 
> NSViewControllers that control the view.. what implications it has? what you 
> recommend best?
> 
> Thanks
> 
> Gustavo

___

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

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

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

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


Re: Services Menu Heading

2009-12-07 Thread Gerriet M. Denkmann

On 7 Dec 2009, at 13:01, Kyle Sluder wrote:

> It's good list etiquette to keep replies on-list.
I know; and I apologize for hitting the wrong button.
It happened while I was sitting in a rather noisy cafe (because my home 
internet connection is not working).

> 
> On Sun, Dec 6, 2009 at 9:55 PM, Gerriet M. Denkmann
>  wrote:
>> Yes, but Dictionary and Safari just have NSSendTypes = NSStringPboardType 
>> (no UTIs at all) and appear under the correct heading.
> 
> Like I said, there are hardcoded exceptions.
> 
>> Any ideas what UTI I micht have to add?
> 
> I don't think there are any UTIs you can add for the "Searching" category.
> 
> --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


Re: Heap and memory zone queries

2009-12-07 Thread jonat...@mugginsoft.com
On 7 Dec 2009, at 01:25, Andrew Farmer wrote:

> On 6 Dec 2009, at 13:57, jonat...@mugginsoft.com wrote:
>> 1. GC is on. Does that mean that all allocations invocation by NS*/CF* will 
>> be in the auto_zone?
> 
> Not necessarily. AppKit and CoreFoundation objects are still capable of 
> allocating unmanaged memory (via malloc(), for instance) for their use under 
> garbage collection, so long as they clean it up when they're done with it.
> 
>> 2. Are the allocations accomplished using NSZoneMalloc and 
>> CFAllocatorAllocate?
> 
> Not sure on this one - I'll defer to someone more knowledgable.
> 
>> 3. grepping the heap(1) output shows little data allocated to NSText* 
>> instances. Is some of the 40MB of non-object data allocated by the NSText 
>> system? for glyph storage?`
>> 4. If 3 is not utterly incorrect - why isn't the memory utilised by  the 
>> NSText system flagged as being allocated by NSText*.
> 
> All that #3 means is that the NSText objects themselves are small. heap(1) is 
> relatively simplistic - it can't determine that one allocated object "belongs 
> to" another. If a NSText object allocates a bunch of CTRun objects (for 
> instance), those allocation will be billed against CTRun, not NSText.

Thanks for the reply Andrew. A couple more!

How does the heap manager even know that a particular allocation is associated 
with a certain class?
Does it maintain a table that is updated whenever an allocation occurs?

Whenever we create an instance of NSString we generally seem to receive a 
concrete instance of NSCFString.
Presumably NSCFString has instance/structure variables in addition to malloced 
data to hold the character info.
The NSCFString byte count is high so  in this case heap(1) seems to be able to 
track the total memory allocated.

I do use instruments(1) but heap(1) is also appealing because of its low 
impact/snapshot nature.___

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: NSTableView reloadData works just on init. (Alberto Piu)

2009-12-07 Thread Alberto Piu

Thank you for your reply.
I understand more or less what are the problems, but I don't really  
know what to change to make it work.


You said that this line:

shortcutsTable = [[NSTableView alloc] init];

should be

shortcutsTable = [[NSTableView alloc] initWithFrame:etc];

but although this is correct it resets the pointer to a brand new  
object, so I have to remove this line?


I have an AppDelegate controller. Inside awakeFromNib there is:

id shortcuts = [[ShortcutsTableController alloc] init];
[shortcuts addLine:@"blabla" :@"bla"];

this simply does nothing. He goes correctly to the addLine method but  
reloadData simply does not work.


--

Please don't get my words wrong. I REALLY appreciate your help, but  
I'm a "bit" unskilled and I need more precision.


Again, thanks for reply.

Regards,
—Albé


Il giorno 07/dic/2009, alle ore 06.07, Nick Zitzmann ha scritto:



On Dec 5, 2009, at 5:22 AM, Alberto Piu wrote:


  shortcutsTable = [[NSTableView alloc] init];


There are several problems here:

1. The designated initializer of views is -initWithFrame:, not -init.

2. Even if you got that right, it would still not work, because you  
are resetting the pointer to the table view object to a brand new  
object. The table view object you probably want to address is freeze- 
dried in the nib, and will be connected once the nib is loaded, and  
so you shouldn't overwrite the pointer with something else unless  
you want to programmatically get rid of it and create a new one (if  
you're working on a dynamic interface, for instance).


3. Even if you corrected that, you can't send messages to objects  
connected by IB outlet in -init, because it's most likely that the  
nib has not been loaded yet unless you explicitly loaded it there.  
If you need to initialize things in the UI, then you should do that  
in -awakeFromNib instead.


HTH...

Nick Zitzmann





___

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


drag and drop form NSViewController or NSView subclass

2009-12-07 Thread Gustavo Pizano
Hello..

I implemented in the past drag and drop, but I did it from within the sub 
classes of NSView, Im wondering if I can do the same from within the 
NSViewControllers that control the view.. what implications it has? what you 
recommend best?

Thanks

Gustavo ___

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

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

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

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


TextfieldCell becomes see through in a tableview

2009-12-07 Thread Symadept
Hi,

I was writing a Custom TableView whose cells should be drawing no
background. For that I made the Textfieldcell as DrawsBackground:NO.

I have overridden TableView and TextfieldCell also. But when I click on the
textfield to modify its contents, it becomes see through. Rather I want the
textfieldcell to display the background as it does when it is not in edit
state.

Regards
Mustafa
___

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