Re: Static Cocoa Library

2012-10-07 Thread Graham Cox

On 07/10/2012, at 7:05 AM, koko k...@highrolls.net wrote:

 
 On Oct 6, 2012, at 11:01 AM, Seth Willits wrote:
 
 use a framework to keep the images bundled with the library
 
 Does the Framework Bundle behave as an App Bundle, i.e. is Bundle a Bundle no 
 matter what?


A framework is not the same thing as a static library, so what do you want?

A static library is just code that ends up as part of your app, just like any 
other source code. A framework has its own bundle, which can be contained 
within an application's bundle. The framework's resources can be part of the 
framework bundle rather than the app's bundle (and will usually make sense to 
organise that way). Frameworks aren't hard to make but they bring some 
downsides, including greater complexity, potential for namespace collisions, 
etc. 

Unless you have a truly reusable piece of code that finds many different 
applications, there's probably little reason to make a framework.


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

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


Size limit on .icns files containing 1024x1024 version in 10.5?

2012-10-07 Thread Andrew Madsen
I'm trying to create a retina ready version of my application's icon. The 
application targets 10.5+. I'm using Uli Kusterer's oldiconutil 
(https://github.com/uliwitness/oldiconutil) to post process the .icns file I 
make from a .iconset using iconutil on 10.8. 

The problem is that if I include a 1024x1024 icon (icon_512x...@2x.png), the 
icon does not display on 10.5. Finder doesn't display the icon, and when it is 
opened in Icon Composer on 10.5, it appears to be blank/empty. If I remove this 
largest size, the icon displays correctly on 10.5. Interestingly, if I 
substitute a completely different, simpler 1024x1024 image with a much smaller 
file size (~300K instead of ~1MB), the icon again works fine on 10.5. So it 
seems that there may be some limit on the file size of the overall .icns file 
and/or the individual image chunks in a .icns file that when exceeded breaks 
compatibility with Leopard.

Compressing the 1024x1024 image with TinyPNG (http://tinypng.org/) was not 
enough to fix the problem. It did result in a significantly smaller .icns file 
before running it through oldiconutil, but the final, JPEG2000 compressed 
output of oldiconutil was still much larger than the variant using a simpler 
substitute image, presumably because the more complicated image is simply not 
as compressible.

Has anyone else run into this problem before? Have you found a solution? If I 
can't figure out a solution, I'll have to just omit a retina ready application 
icon until I drop support for 10.5.



Thanks,

Andrew Madsen
___

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

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


NSTextFieldCell assertion failure messages?

2012-10-07 Thread Erik Stainsby
Can anyone tell me what I ought to be doing in response to the following 
message?

 *** Assertion failure in -[NSTextFieldCell 
_objectValue:forString:errorDescription:], 
/SourceCache/AppKit/AppKit-1187.34/AppKit.subproj/NSCell.m:1532


This is cropping up in a table delegate/datasource when I bind: the textField 
in an NSTableViewCell to my model object.
Each model object has three fields and any of them may be empty. So in my 
tableView:viewForColumn:row: method I set each of the textFields' stringValue: 
to @  before binding it to it's object.


- (NSView*) tableView:(NSTableView *)tableView 
viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {

RSPerson * person = (RSPerson*)[self.personAC.content objectAtIndex:row];
NSTableCellView * cellView = [tableView makeViewWithIdentifier:[NSString 
stringWithFormat:@%@Cell,[tableColumn identifier]] owner:self];
cellView.textField.stringValue = @ ;
[cellView.textField bind:@stringValue toObject:person 
withKeyPath:[tableColumn identifier] options:nil];
return cellView;
}


Any advice appreciated.  


Erik Stainsby
erik.stain...@roaringsky.ca


___

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

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


Re: NSTextFieldCell assertion failure messages?

2012-10-07 Thread Quincey Morris
On Oct 7, 2012, at 14:18 , Erik Stainsby erik.stain...@roaringsky.ca wrote:

cellView.textField.stringValue = @ ;
[cellView.textField bind:@stringValue toObject:person 
 withKeyPath:[tableColumn identifier] options:nil];

There are several wrong or code-smelly things here:

-- Why on earth set the string to a space? It's going to make the UI behave 
oddly for users. If you don't want a string property to be nil, set it to @.

-- There's no point in setting a property if the next thing you do is bind 
something that changes the same property. You've done the analog of 'x = 0; x = 
1;' here.

-- Text fields don't have a stringValue binding, they only have a value 
binding:


https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSTextField.html


___

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

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


Re: Embedding resources in Static Cocoa Library

2012-10-07 Thread Alexander Bokovikov

On Oct 7, 2012, at 1:00 AM, koko k...@highrolls.net wrote:

 I want to make a static cocoa library that is an NSTableView and allots data 
 is contained in the library.
 I want images in the rows of the table.
 Where would one get these images as their is no bundle where that can be 
 stored?
 Or the question is where are resources for a static coco library stored?

All suggestions here are reduced to an external file (bundle) usage. Just for a 
case, if you really wish to store any data (non-executable code, like images, 
etc.) within the executable (regardless of the type: the main project, a static 
library, a dynamic library) there is a way to do it. But you'll need to know 
how to use assembler in the Cocoa project. If you know it, this way is for you. 
I used it in my Windows project, but never in Cocoa.

AFAIK, you need to create a .s file and add it to your Xcode sources. Then 
Xcode will know what to do with this file. And you need to write something like 
this within the .s file:

.text
.globl  _MyFunc
pushl   %ebx
callL1
jmp L2
.align  1
.byte   0x0,0x1,0x2,0x3,0x4
.byte   0x5,0x6,0x7,0x8,0x9
L1:
popl%eax
movleax, ebx
pushl   %eax
ret
L2:
addl5, %ebx
movl%ebx,%eax
popl%ebx
ret

As a result, you'll have the address of the embedded information in the eax 
register. I.e. you just need to create the function declaration like this one:

(void *) myFunc(void); 

and call it. Hope this code is close to correct one, as I never dealt with Mac 
OS assembler. And please take it into account, that 5, mentioned in the code 
above, means the size of the jmp L2 instruction, which is five in 32-bit 
assembler, but it will take nine bytes in the 64-bit one. And of course, I'm 
talking only about x86/64 assembler. Don't know anything about PowerPC one.

The only what is left out is how to fill out the .byte with a useful 
information. Personally I used a specially written simple utility, transcoding 
any binary file into the fixed length lines of .byte  hex codes. You can use 
decimal or octal codes too. as far as the assembler allows it.

HTH!

___

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

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


Re: Embedding resources in Static Cocoa Library

2012-10-07 Thread Alexander Bokovikov

On Oct 7, 2012, at 1:00 AM, koko k...@highrolls.net wrote:

 I want to make a static cocoa library that is an NSTableView and allots data 
 is contained in the library.
 I want images in the rows of the table.
 Where would one get these images as their is no bundle where that can be 
 stored?
 Or the question is where are resources for a static coco library stored?

All suggestions here are reduced to an external file (bundle) usage. Just for a 
case, if you really wish to store any data (non-executable code, like images, 
etc.) within the executable (regardless of the type: the main project, a static 
library, a dynamic library) there is a way to do it. But you'll need to know 
how to use assembler in the Cocoa project. If you know it, this way is for you. 
I used it in my Windows project, but never in Cocoa.

AFAIK, you need to create a .s file and add it to your Xcode sources. Then 
Xcode will know what to do with this file. And you need to write something like 
this within the .s file:

.text
.globl  _MyFunc
pushl   %ebx
callL1
jmp L2
.align  1
.byte   0x0,0x1,0x2,0x3,0x4
.byte   0x5,0x6,0x7,0x8,0x9
L1:
popl%eax
movleax, ebx
pushl   %eax
ret
L2:
addl5, %ebx
movl%ebx,%eax
popl%ebx
ret

As a result, you'll have the address of the embedded information in the eax 
register. I.e. you just need to create the function declaration like this one:

(void *) myFunc(void); 

and call it. Hope this code is close to correct one, as I never dealt with Mac 
OS assembler. And please take it into account, that 5, mentioned in the code 
above, means the size of the jmp L2 instruction, which is five in 32-bit 
assembler, but it will take nine bytes in the 64-bit one. And of course, I'm 
talking only about x86/64 assembler. Don't know anything about PowerPC one.

The only what is left out is how to fill out the .byte with a useful 
information. Personally I used a specially written simple utility, transcoding 
any binary file into the fixed length lines of .byte  hex codes. You can use 
decimal or octal codes too. as far as the assembler allows it.

HTH!

___

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

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