Re: iOS Core Data property getting released unexpectedly

2010-08-20 Thread Rick Mann
It's only ever assigned in one place, and inspection of that code shows that 
the original string it's assigned from is autoreleased. Everywhere else it is 
referenced, it is read (passed in to -[stringWithFormat:] as one of the 
arguments, always with %@ as the format specifier).

I'll try Instruments.

On Aug 20, 2010, at 22:00:04, Joar Wingfors wrote:

> 
> On 20 aug 2010, at 18.50, Rick Mann wrote:
> 
>> I have a Core Data entity with an associated class file and a bunch of 
>> dynamic properties defined. One of them is:
>> 
>> @property (nonatomic, copy) NSString*urlName;
>> 
>> For some reason, every now and again when my code goes to access this 
>> property, it throws an exception for accessing a zombie. The containing 
>> object seems fine, and the other properties seem fine. NSZombieEnabled is 
>> YES.
> 
> 
> The strings is probably over-released from somewhere else - In other words, 
> not a bug with your property. If you can reproduce the issue, you can use 
> Instruments to track all calls to retain / release / autorelease, etc., 
> allowing you to figure out where the erroneous call to release / autorelease 
> comes from.
> 
> j o a r
> 
> 

___

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: iOS Core Data property getting released unexpectedly

2010-08-20 Thread Joar Wingfors

On 20 aug 2010, at 18.50, Rick Mann wrote:

> I have a Core Data entity with an associated class file and a bunch of 
> dynamic properties defined. One of them is:
> 
> @property (nonatomic, copy) NSString* urlName;
> 
> For some reason, every now and again when my code goes to access this 
> property, it throws an exception for accessing a zombie. The containing 
> object seems fine, and the other properties seem fine. NSZombieEnabled is YES.


The strings is probably over-released from somewhere else - In other words, not 
a bug with your property. If you can reproduce the issue, you can use 
Instruments to track all calls to retain / release / autorelease, etc., 
allowing you to figure out where the erroneous call to release / autorelease 
comes from.

j o a r


___

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: Modifying the Window Menu

2010-08-20 Thread Peter Zegelin
Thanks for that Michael - I'd missed that.

I think what I'll do is what you suggest: exclude the subwindows then 
add them myself in the correct order and see if that works. I have to modify 
their titles anyway.


On 20/08/2010, at 4:23 AM, Michael Dautermann wrote:

> 
> On Aug 18, 2010, at 5:56 PM, Peter Zegelin wrote:
> 
>> My app allows the user to create a number of sub windows for each document.
> 
> 
>> 
>> I would prefer the layout to be more like Xcode where the sub windows of a 
>> project are added below the main document entry and indented:
>> 
>> 
>> MyDoc
>>  SubWindow 1
>>  SubWindow 2
>> MyDoc2
>>  SubWindow 1
>>  SubWindow 2
>> 
>> Is it OK to extensively modify this menu? I am mainly concerned that since 
>> it is automatically populated it is going to get quite complicated to do it 
>> properly.
>> Any hints/ code etc. gratefully accepted.
> 
> Hello Peter,
> 
> I found this mention of the Window menu in the reference documentation:
> 
> 
> 
> It sounds like you can manually mess with the Windows menu by setting 
> setExcludedFromWindowsMenu:YES on each window you control and then manually 
> adding/deleting items for the windows via [[NSApplication sharedApplication] 
> addWindowsItem:title:filename: ] or [[NSApplication sharedApplication ] 
> removeWindowsItem:].  
> 
> hth 
> 
> 
> 

kind regards,

Peter Zegelin
http://www.fracturedsoftware.com
Rondo - MIDI for your mac
MacSimAVR - AVR microcontroller simulator for OS X

___

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


iOS Core Data property getting released unexpectedly

2010-08-20 Thread Rick Mann
I have a Core Data entity with an associated class file and a bunch of dynamic 
properties defined. One of them is:

@property (nonatomic, copy) NSString*   urlName;

For some reason, every now and again when my code goes to access this property, 
it throws an exception for accessing a zombie. The containing object seems 
fine, and the other properties seem fine. NSZombieEnabled is YES.

BTW, I wasn't sure how Core Data treated an NSString* property. Normally they 
should be "copy", but Xcode generates accessors with "retain". I tried both 
copy and retain and get the problem either way. Does CD introspect to determine 
the desired behavior of an accessor?

TIA,
Rick

___

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: CoreAnimation - Resizing sublayers along with superlayer animation

2010-08-20 Thread Eric Wing
On 8/20/10, Ignacio Enriquez  wrote:
> Hi,
>
> I have a subclass of CALayer (below self) and it has a sublayer (textLayer).
> I want self to be shrank and enlarges, so I created animations like
> the following:



> self is animated as expected but sublayer textLayer is not resized, it
> just changes its position according to the new bounds of self
>
> I would like to have the same effect when animation view, they resize
> automatically their subviews and/or sublayers

I think this is the essentially the same question asked in the thread
"Core Animation. issue with scaling", which I just responded to. Check
that thread and see if that helps you.

-Eric

-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
___

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: Best way to draw large tiled images?

2010-08-20 Thread Eric Wing
On 8/18/10, Gideon King  wrote:
> I have a relatively large area on my NSView that I want to tile images into.
> I tried using CIAffineTile, but it gives me the following error: "CoreImage:
> ROI is not tilable" for even moderately large images (for small images, it
> works exactly as I want it to).
>
> Also, I am starting to learn about core animation, and may make this either
> a layer backed or layer hosting view. Would either of these configurations
> alter my choices for tiling?
>
> Deployment is 10.5+.

I think CATiledLayer from Core Animation would be a good place to
start. I am not aware of a NSView counterpart, so layer hosting view
will be the way to go.

Bill Dudney's stuff is probably a great place to start learning CATiledLayer.
(Quick Google search:)
http://bill.dudney.net/roller/objc/entry/catiledlayer_example

-Eric


-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
___

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 Animation. issue with scaling

2010-08-20 Thread Eric Wing
> CABasicAnimation *animation =
>  [CABasicAnimation animationWithKeyPath:@"bounds"];
> CGRect orgVal = CGRectMake(0, 0,
> firstWheelLayer.bounds.size.width, firstWheelLayer.bounds.size.height);
> CGRect newVal = CGRectMake(0, 0,
> firstWheelLayer.bounds.size.width+100, firstWheelLayer.bounds.size.height);
>
>  [animation setFromValue:[NSValue valueWithCGRect:orgVal]];
>  [animation setToValue:[NSValue valueWithCGRect:newVal]];
>  [animation setDuration:5.0];
>  [firstWheelLayer setBounds:newVal];
>  [firstWheelLayer addAnimation:animation forKey:@"flag"];
>
> The problem here is that the sublayers do not scale horizontaly like the
> "firstWheelLayer" should I set their bounds here too?

I'm a little rusty on my Core Animation, but have you tried using the
actual "scale" property in Core Animation instead of using the bounds
property? I think the problem with using bounds is you are only
setting the dimensions of the specific layer, not the transformation
matrix. Since layers may be used as containers to contain other layers
and they do not clip, I wouldn't expect setting the bounds on a layer
would cause its children to transform.

-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


Re: 9

2010-08-20 Thread angelochen960

___

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


Best strategy for blending many corevideo frames in opengl.

2010-08-20 Thread Evan Harper
I'm currently starting a project that involves buffering a large number of
video frames, and blending between them based on a depth map (i.e depth 0 =
current frame, previous frames are blended in based on values from the depth
map). I'm currently using the QTCoreVideo201 as a guide for buffering in
frames, but I'm wondering what the best strategy for blending many of these
frames together for the final image. I've worked in opengl before, but this
is somewhat new territory and I'm wondering what the pitfalls and
bottlenecks might be.

cheers,
evan
___

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: Cocoa-dev Digest, Vol 7, Issue 847

2010-08-20 Thread Bill Bumgarner

On Aug 20, 2010, at 2:33 PM, Gregory Weston wrote:

> Bill Bumgarner wrote:
> 
>> Preference panes are not designed to be embedded into applications other 
>> than the System Preferences application.   Even if you were to make it work 
>> (which would require duplicating all of the internal functionality of the 
>> System Preferences application), you are setting yourself up for a 
>> maintenance and testing nightmare in that System Preferences' internal 
>> implementation details may change with any version of the OS, including the 
>> one-off interim versions that sometimes ship with new hardware.
>> 
>> I.e. don't do that.
> 
> Is it fair to say that this caution is about the OP's specific goal of using 
> Apple's prefPanes within another app in that they may have been custom-built 
> to play nice with a custom version of System Preferences?
> 
> Or does the documentation at 
> 
>  need to be updated?
> 
> Oh, wait. Better question:
> 
> Is 
> 
>  simply wrong?
> 
> "You can reuse preference panes intended for System Preferences just like the 
> Mac OS X Setup Assistant does with the Date & Time preference pane."

Yup -- I was channeling Pre-Snow Leopard pref panes.  I was totally wrong.

b.bum
___

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


Create pinch/magnify event

2010-08-20 Thread Joe Turner
Hey,

I'm trying to use CGEvent to create a pinch/magnify event, but I can't find any 
info on how to do it. I see there's a NSEventTypeMagnify for NSEvent, but the 
magnification factor does not seem settable. Even if it was, weird things 
happen when you try to convert an NSEvent to a CGEvent. So, I'm wondering if 
anyone has experience with doing this? What about for 4 finger swipes?

If not, is there a way to create raw trackpad touches (pragmatically), so I can 
recreate a pinch?

Thanks!

Joe
___

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: NSImageView and ZoomFactors

2010-08-20 Thread Quincey Morris
On Aug 20, 2010, at 12:13, Brian Postow wrote:

> So, just to clarify, the whole hierarchy is Window> ContentView > ScrollView 
> > ClipView > ImageView > Image? I take the "ContentView" to mean the content 
> view of the window, or is there some other view between the scrollview and 
> the clipview?

I had to laugh when I read this -- you found yet another meaning of "content" 
for the discussion, so now we have 3. Here's the hierarchy, disambiguated:

window (NSWindow) > window content view (NSView) > scroll view 
(NSScrollView) > scroll content view (NSClipView) > document view (whatever 
view sub-hierarchy you want, but a solitary NSImageView in this case) > 
document view contents (whatever you want, but NSImage in this case, not a 
view, just graphical stuff)

The terminology actually makes sense -- the window consists of a content view, 
surrounded by window frame widgetry; the scroll view consists of a content 
view, surrounded by scroll widgetry -- but it would be less confusion-prone if 
the scroll content view was just called the clip view instead.

> If I don't make the imageview smaller than the others (which are (almost) all 
> the same size), then how do I make the image smaller than the content view?

[NSImage drawInRect...] with a suitably sized destination rect -- see below. As 
I said before, you can't do this with a standard NSImageView -- you do it 
within 'drawRect:' of a custom NSView.

> But then I have to manually draw my image into the view and keep track of 
> that myself I *DO* have an image (NSImage, CGImageRef, bitmap, SOMETHING) 


It's as simple as:

[myImage drawInRect: dstRect fromRect: NSZeroRect operation: 
NSCompositeSourceOver fraction: 1.0];

You do have to calculate dstRect first. Its size comes from [myImage size] 
combined with the current display scale factor. Its origin should be chosen to 
position the image so as to occupy the entire view, OR as desired within the 
view *when it's smaller than the view*. Note that the image is never larger 
than the view -- you always size the view to be at least as large as the image, 
so that the scroll bars, in traversing the entire view, also traverse the 
entire image.


___

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: A new flavor of the "this class is not key value coding-compliant for ..." error

2010-08-20 Thread Jay Reynolds Freeman
Addendum:  I should also have said that my implementation's
"didReceiveMemoryWarning" contains nothing at present but the
canonical call to [super didReceiveMemoryWarning], and that
the crash occurs even when I comment out the entire overwrite
of "didReceiveMemoryWarning".

--  Jay Reynolds Freeman
-
jay_reynolds_free...@mac.com
http://web.mac.com/jay_reynolds_freeman (personal web site)

___

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: Cocoa-dev Digest, Vol 7, Issue 847

2010-08-20 Thread Gregory Weston
Bill Bumgarner wrote:

> Preference panes are not designed to be embedded into applications other than 
> the System Preferences application.   Even if you were to make it work (which 
> would require duplicating all of the internal functionality of the System 
> Preferences application), you are setting yourself up for a maintenance and 
> testing nightmare in that System Preferences' internal implementation details 
> may change with any version of the OS, including the one-off interim versions 
> that sometimes ship with new hardware.
> 
> I.e. don't do that.

Is it fair to say that this caution is about the OP's specific goal of using 
Apple's prefPanes within another app in that they may have been custom-built to 
play nice with a custom version of System Preferences?

Or does the documentation at 

 need to be updated?

Oh, wait. Better question:

Is 

 simply wrong?

"You can reuse preference panes intended for System Preferences just like the 
Mac OS X Setup Assistant does with the Date & Time preference pane."

G
___

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


A new flavor of the "this class is not key value coding-compliant for ..." error

2010-08-20 Thread Jay Reynolds Freeman
This could be cocoa-related or Xcode-related, so I will
probably eventually do separate posts to the two lists, but
I thought I would start here.

I am using Xcode 3.2.2 to write an iPad app, using the SDKs that
came with it (all public to developers now), running on the simulator.
All is well, till I start simulating memory warnings.

Without memory warnings, I open my app in the simulator, then
immediately do an operation that causes a .xib file to load
and display a view (the .xib contains a subclass of a UIViewController
and the associated view), and all is well.

However, if I open my app in the simulator, then simulate a memory
warning, and then try to get the .xib file to load and display,
I get a crash with the error message:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 
'[ setValue:forUndefinedKey:]: this class is not 
key value coding-compliant for the key toolBar.'


There has been a lot of discussion of this error message on the web,
and most of the problems mentioned have had to do with misspelled
ivar names, incorrect links in the nib file set up in IB, and
the like.  I think I have been through all of those: I have renamed
several ivars and rebuilt the entire .xib file from scratch, and
done a lot of code-walking.  

What is more, all the errors I have read about on the web so far appear
to be of such nature as to cause a crash at load-nibfile time even
if I have *not* previously simulated a memory warning.  The crash
I am encountering happens *only* when I have just simulated a memory
warning.


I temporarily overwrote and instrumented "loadView" with NSLog
(and included a call to [super loadView] to get the default behavior):
There was no change in the crash behavior, and it appears that the
crash occurs before loadView starts.  (Then I excised the entire
code for the overwrite of loadView, so as to be sure I was not
getting into extra trouble for overwriting it when perhaps I shouldn't.


Also, I temporarily removed *all* code from the body of "dealloc"
-- not even a call to [super dealloc]:  No change in crash behavior.


Also, I temporarily added an extra "retain" of the relevant controller,
not balanced by any release:  No change in crash behavior.


It looks to me as if, in response to the memory warning, something
is forgetting something important about the class structure of
my subclassed UIViewController, but that is only a conjecture: I
really have no idea what is going on.

And oh, yes, the allegedly non-key-value-compliant ivar is in
fact declared in the header file as 

IBOutlet UIToolbar *toolBar;

...

@property (nonatomic, retain ) IBOutlet UIToolbar *toolBar;

And then in the .mm file for the class I have

@synthesize toolBar;

Does anyone have any clues?

--  Jay Reynolds Freeman
-
jay_reynolds_free...@mac.com
http://web.mac.com/jay_reynolds_freeman (personal web site)


___

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: Embedding a system preference pane

2010-08-20 Thread Knut Lorenzen

Am 20.08.2010 um 10:44 schrieb Jon Guy:

> I'm trying to embed a couple of the system pref panes into an app by 
> following the Apple documented method, here's basically whats going on:

<...>

I've slightly modified your code (mainWindow is the apps main window) to look 
like this:

NSBundle *prefBundle = [NSBundle bundleWithPath: 
@"/System/Library/PreferencePanes/SharingPref.prefPane"];
Class prefPaneClass = [prefBundle principalClass];
NSPreferencePane *prefPaneObject = [[prefPaneClass alloc] initWithBundle: 
prefBundle];
[prefPaneObject loadMainView];
[prefPaneObject willSelect];
[[mainWindow contentView] addSubview: [prefPaneObject mainView]];
[mainWindow makeKeyAndOrderFront: self];
[prefPaneObject didSelect];

Everything works fine for me (10.6.4, Xcode 3.2.3) - though there are several 
messages in the debugger console, saying:

service: This command still works, but it is deprecated. Please use 
launchctl(8) instead.

Tested with DateAndTime.prefPane, too (like mentioned in the documentation) and 
that works fine as well.

Cheers,

Knut

___

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 Lightweight Migration Woes

2010-08-20 Thread Quincey Morris
On Aug 20, 2010, at 11:48, Brad Gibbs wrote:

> - (NSManagedObjectModel *)managedObjectModel {

Here's what the lightweight migration documentation says:

> To perform a lightweight migration, Core Data needs to be able to find the 
> source and destination managed object models itself at runtime. (Core Data 
> searches the bundles returned by NSBundle’s allBundles andallFrameworks 
> methods.)

(http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmLightweight.html)

When I read this yesterday, I didn't pay any attention to the word "itself", 
but maybe it's important. Taken literally, it would suggest that you can't use 
lightweight migration if you're supplying the model yourself, and that Core 
Data must be able to find the model by its own bundle search. I don't think 
those conditions are met in your project.

A bug report with a simple project is probably your next step, to find out if 
this is a documentation bug, or a functional requirement.


___

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: NSImageView and ZoomFactors

2010-08-20 Thread Brian Postow

On Aug 20, 2010, at 2:52 PM, Quincey Morris wrote:

> On Aug 20, 2010, at 10:54, Brian Postow wrote:
> 
>> I just discovered[imageView setImageAlignment: ] which, as long as the 
>> imageView is bigger than the scrollview, does the correct thing (Lock the 
>> image to the upper left corner of the scrollView). However, when the 
>> imageView is smaller than the scrollview, The imageView is still locked to 
>> the bottom left of the scrollview, but the image is locked to the top left 
>> of the imageview. 
> 
> The image view's image alignment is irrelevant to scrolling. Scrolling 
> relates entirely and exclusively to the geometric relationship between the 
> document view and the content view. (You say "scrollview", but I think you 
> really mean the content view.) Moving the image around within the image view 
> does something that looks a little bit like scrolling, but isn't -- the 
> scroll bars wouldn't match the part of the image you can see.
> 
> If the image view is smaller than the content view, another can of worms gets 
> opened up. It should be possible to put the image view in the center of the 
> content view, or at its top left, which should mean it's surrounded by the 
> scroll view's background color. But then you can't do any drawing outside of 
> the image view, which kind of feels wrong when you're trying to drag out a 
> selection rectangle. So in fact what I usually do is keep the document view 
> at least as large as the content view, even if its "canvas" is a smaller area 
> within it. That effectively divorces both the scale and the position of the 
> image area from the view, something that NSImageView can't actually do.

So, just to clarify, the whole hierarchy is Window> ContentView > ScrollView > 
ClipView > ImageView > Image? I take the "ContentView" to mean the content view 
of the window, or is there some other view between the scrollview and the 
clipview?

If I don't make the imageview smaller than the others (which are (almost) all 
the same size), then how do I make the image smaller than the content view? 


> 
>> Setting the Scrollview boundsOrigin, the imageView bounds origin and 
>> translating the origin of the imageview or the scrollview had absolutely no 
>> effect. 
> 
> It's not the scroll view that's relevant, but the content (clip) view. I 
> think setting the clip view bounds origin works, or scrollToPoint:, but 
> [imageView setFrame:] is probably the easiest way.
> 

Ok, I'll play with the imageView setframe a little more and see if I can get 
that to work for me.

> I feel like I keep confusing matters rather than clarifying them, so I 
> apologize for that, but I also think the trouble you're having comes from 
> clinging to NSImageView. If you'd let go of that, I suspect things will fall 
> into place fairly easily.
> 

But then I have to manually draw my image into the view and keep track of that 
myself I *DO* have an image (NSImage, CGImageRef, bitmap, SOMETHING) 

Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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: NSImageView and ZoomFactors

2010-08-20 Thread Quincey Morris
On Aug 20, 2010, at 10:54, Brian Postow wrote:

> I just discovered [imageView setImageAlignment: ] which, as long as the 
> imageView is bigger than the scrollview, does the correct thing (Lock the 
> image to the upper left corner of the scrollView). However, when the 
> imageView is smaller than the scrollview, The imageView is still locked to 
> the bottom left of the scrollview, but the image is locked to the top left of 
> the imageview. 

The image view's image alignment is irrelevant to scrolling. Scrolling relates 
entirely and exclusively to the geometric relationship between the document 
view and the content view. (You say "scrollview", but I think you really mean 
the content view.) Moving the image around within the image view does something 
that looks a little bit like scrolling, but isn't -- the scroll bars wouldn't 
match the part of the image you can see.

If the image view is smaller than the content view, another can of worms gets 
opened up. It should be possible to put the image view in the center of the 
content view, or at its top left, which should mean it's surrounded by the 
scroll view's background color. But then you can't do any drawing outside of 
the image view, which kind of feels wrong when you're trying to drag out a 
selection rectangle. So in fact what I usually do is keep the document view at 
least as large as the content view, even if its "canvas" is a smaller area 
within it. That effectively divorces both the scale and the position of the 
image area from the view, something that NSImageView can't actually do.

> Setting the Scrollview boundsOrigin, the imageView bounds origin and 
> translating the origin of the imageview or the scrollview had absolutely no 
> effect. 

It's not the scroll view that's relevant, but the content (clip) view. I think 
setting the clip view bounds origin works, or scrollToPoint:, but [imageView 
setFrame:] is probably the easiest way.

I feel like I keep confusing matters rather than clarifying them, so I 
apologize for that, but I also think the trouble you're having comes from 
clinging to NSImageView. If you'd let go of that, I suspect things will fall 
into place fairly easily.


___

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 Lightweight Migration Woes

2010-08-20 Thread Brad Gibbs
I'm still having some serious issues.  I've tried all suggestions from all 
three responses.  One or two of the suggestions worked once or twice, but 
nothing worked reliably.


Is it possible that the dataModel itself is corrupt?  I rebuilt it by creating 
a new data model and copying all of the objects into it.  Didn't make a 
difference.

After copying the entities into the new data model and rearranging them, I 
created the custom classes for each.  I've been putting my methods in 
categories on each of the individual classes so I can quickly delete the custom 
classes and re-create them after making model changes without having to cut and 
paste the methods.

I ran the app once to confirm that it was working and added some sample data, 
saved and quit.  

I highlighted the .xcdatamodel and did a Design > Data Model >  Add New 
Version.  That created the Config.xcdatamodeld with an unnumbered version of 
the datamodel (Config.xcdatamodel) and a numbered copy named Config 
2.xcdatamodel.  

I go into Config.xcdatamodel and add a single string attribute to one entity, 
Clean and Build & Go.  I get the missing source model error.  Quincey, you 
asked about the log for PrototypePath.  It's:

2010-08-20 11:44:12.044 IconConfig[86221:a0f] Prototype path is 
/Users/brad/iconConfigClone/IconConfig/IconConfig/build/Debug/IconConfig.app/Contents/Resources/Config.momd
2010-08-20 11:44:12.046 IconConfig[86221:a0f] Prototype URL is 
file://localhost/Users/brad/iconConfigClone/IconConfig/IconConfig/build/Debug/IconConfig.app/Contents/Resources/Config.momd/


If I delete the attribute I just added, it compiles and runs.

The two versions appear in my target's Compile Sources, but the .xcdatamodeld 
does not.  Could this have something to do with the problems I'm having?

Is there some build setting that might be causing this?

I don't think there's anything tricky going on with my -managedObjectModel or 
-persistentStoreCoordinator, but, I'd be glad to post the code.


Thanks in advance.  This is driving me nuts!

Brad

On Aug 20, 2010, at 12:28 AM, Jack Nutting wrote:

> On Fri, Aug 20, 2010 at 8:21 AM, Steve Steinitz
>  wrote:
>> - Removed any stray mopping models, just in case
>> 
> 
> I didn't see your question until you'd already solved it yourself, but
> I just wanted to highlight this one point; Assumming you're referring
> here to old .mom files, I'd almost bet money that this is the only
> thing you needed to do (either manually delete the old file from your
> target app, or "build clean"). Like Quincey mentioned, if your app at
> runtime finds both Model.mom and Model.momd, it will use the former
> and then either ignore the latter or give you cryptic errors (I forget
> which).
> 
> -- 
> // jack
> // http://nuthole.com
> // http://learncocoa.org

___

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: Statically link libmysqlclient.a to my Foundation tool

2010-08-20 Thread Heizer, Charles
I found it "-lmysqlclient" I removed the "libmysqlclient.a" from my
external frameworks. And I was good to go. I had the "External Frameworks
and Libraries" group closed so I did not see it.

Thanks for all of your help!

Charles


--
Charles Heizer
Systems Management Solutions Group
Lawrence Livermore National Laboratory
P: 925-422-0197 







On 8/20/10 11:26 AM, "Heizer, Charles"  wrote:

>So I did a "Clean All" and here is what is in the link step.
>
>Ld build/Release/MySQLTest2 normal i386
>cd /Users/heizer1/Desktop/MySQLTest2
>setenv MACOSX_DEPLOYMENT_TARGET 10.5
>/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot
>/Developer/SDKs/MacOSX10.5.sdk
>-L/Users/local/Desktop/MySQLTest2/build/Release
>-F/Users/local/Desktop/MySQLTest2/build/Release -filelist
>/Users/local/Desktop/MySQLTest2/build/MySQLTest2.build/Release/MySQLTest2.
>b
>uild/Objects-normal/i386/MySQLTest2.LinkFileList -mmacosx-version-min=10.5
>/usr/local/lib/libmysqlclient.a -framework Foundation -lmysqlclient -o
>/Users/local/Desktop/MySQLTest2/build/Release/MySQLTest2
>
>
>Thanks,
>Charles
>
>--
>Charles Heizer
>Systems Management Solutions Group
>Lawrence Livermore National Laboratory
>P: 925-422-0197 
>
>
>
>
>
>
>
>On 8/20/10 11:14 AM, "Sherm Pendley"  wrote:
>
>>On Fri, Aug 20, 2010 at 2:03 PM, Heizer, Charles 
>>wrote:
>>> Thanks for the quick response. So I just tried this and I'm having the
>>> same issue.
>>>
>>> I changed my "Other linker flags" as suggested and when I try to run
>>>this
>>> without the libmysqlclient.dylib in my path it still complains ...
>>
>>What did the link step have to say when you rebuilt your app? Did you
>>try a clean & rebuild?
>>
>>sherm--
>>
>>-- 
>>Cocoa programming in Perl:
>>http://**camelbones.sourceforge.net
>>
>
>___
>
>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/heizer1%40llnl.gov
>
>This email sent to heiz...@llnl.gov
>

___

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 Animation. issue with scaling

2010-08-20 Thread Ahsan Shafiq
bump*

On Thu, Aug 19, 2010 at 10:47 AM, Ahsan Shafiq wrote:

> Hi
> I have read that in explicit animation, say translation, to really change
> the model layer position we have to change it's position too. So here is my
> code:
>
> CABasicAnimation *animation =
>  [CABasicAnimation animationWithKeyPath:@"position"];
>  CGPoint pt = CGPointMake(firstWheelLayer.position.x + 100,
> firstWheelLayer.position.y + 100);
>  [animation setFromValue:[NSNumber
> valueWithCGPoint:firstWheelLayer.position]];
>  [animation setToValue:[NSNumber valueWithCGPoint:pt]];
>  [animation setDuration:5.0];
>  [firstWheelLayer setPosition:pt];
>  [firstWheelLayer addAnimation:animation forKey:@"flag"];
>
>
> "firstWheelLayer" is a layer with some sublayers. The above code is run as
> result of touch on sublayers of "firstWheelLayer". The above code works
> fine, even all sublayers translate also and if I click a sublayer after
> animation , the "firstWheelLayer" further translate 100 in x and 100 in y.
> I want to achieve same functionality with scaling i.e. if I scale
> "firstWheelLayer" all sublayers should also scale up/down. So here is my
> code:
>
> CABasicAnimation *animation =
>  [CABasicAnimation animationWithKeyPath:@"bounds"];
> CGRect orgVal = CGRectMake(0, 0,
> firstWheelLayer.bounds.size.width, firstWheelLayer.bounds.size.height);
> CGRect newVal = CGRectMake(0, 0,
> firstWheelLayer.bounds.size.width+100, firstWheelLayer.bounds.size.height);
>
>  [animation setFromValue:[NSValue valueWithCGRect:orgVal]];
>  [animation setToValue:[NSValue valueWithCGRect:newVal]];
>  [animation setDuration:5.0];
>  [firstWheelLayer setBounds:newVal];
>  [firstWheelLayer addAnimation:animation forKey:@"flag"];
>
> The problem here is that the sublayers do not scale horizontaly like the
> "firstWheelLayer" should I set their bounds here too?
>
>
>
___

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: Statically link libmysqlclient.a to my Foundation tool

2010-08-20 Thread Heizer, Charles
So I did a "Clean All" and here is what is in the link step.

Ld build/Release/MySQLTest2 normal i386
cd /Users/heizer1/Desktop/MySQLTest2
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot
/Developer/SDKs/MacOSX10.5.sdk
-L/Users/local/Desktop/MySQLTest2/build/Release
-F/Users/local/Desktop/MySQLTest2/build/Release -filelist
/Users/local/Desktop/MySQLTest2/build/MySQLTest2.build/Release/MySQLTest2.b
uild/Objects-normal/i386/MySQLTest2.LinkFileList -mmacosx-version-min=10.5
/usr/local/lib/libmysqlclient.a -framework Foundation -lmysqlclient -o
/Users/local/Desktop/MySQLTest2/build/Release/MySQLTest2


Thanks,
Charles

--
Charles Heizer
Systems Management Solutions Group
Lawrence Livermore National Laboratory
P: 925-422-0197 







On 8/20/10 11:14 AM, "Sherm Pendley"  wrote:

>On Fri, Aug 20, 2010 at 2:03 PM, Heizer, Charles  wrote:
>> Thanks for the quick response. So I just tried this and I'm having the
>> same issue.
>>
>> I changed my "Other linker flags" as suggested and when I try to run
>>this
>> without the libmysqlclient.dylib in my path it still complains ...
>
>What did the link step have to say when you rebuilt your app? Did you
>try a clean & rebuild?
>
>sherm--
>
>-- 
>Cocoa programming in Perl:
>http://*camelbones.sourceforge.net
>

___

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: Statically link libmysqlclient.a to my Foundation tool

2010-08-20 Thread Sherm Pendley
On Fri, Aug 20, 2010 at 2:03 PM, Heizer, Charles  wrote:
> Thanks for the quick response. So I just tried this and I'm having the
> same issue.
>
> I changed my "Other linker flags" as suggested and when I try to run this
> without the libmysqlclient.dylib in my path it still complains ...

What did the link step have to say when you rebuilt your app? Did you
try a clean & rebuild?

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

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: Statically link libmysqlclient.a to my Foundation tool

2010-08-20 Thread Heizer, Charles
Thanks for the quick response. So I just tried this and I'm having the
same issue.

I changed my "Other linker flags" as suggested and when I try to run this
without the libmysqlclient.dylib in my path it still complains ...

/Users/local/Desktop/new/MySQLTest2 
dyld: Library not loaded: libmysql.16.dylib
  Referenced from: /Users/local/Desktop/new/MySQLTest2
  Reason: image not found
Trace/BPT trap



Thanks,
Charles

 
--
Charles Heizer
Systems Management Solutions Group
Lawrence Livermore National Laboratory
P: 925-422-0197 







On 8/20/10 10:34 AM, "Sherm Pendley"  wrote:

>On Fri, Aug 20, 2010 at 1:26 PM, Heizer, Charles  wrote:
>>
>> I have been googling for a while now and have tried a few suggestions I
>> have found in other like posts but have not had much success.
>>
>> I'm trying to create a stand alone Foundation tool which will connect to
>> MySQL and I can get this to work if I link to the "libmysqlclient.dylib"
>> library. But as others have also wanted :) I do not want the user to
>>have
>> to install the MySQL connector software.
>>
>> I have added the "Other linker flags" "-lmysql -lpthread -lz
>>$(inherited)"
>> and no luck, I always need the "libmysqlclient.dylib" in my DYLB path
>>for
>> it to work.
>
>The "-l" linker flag will always prefer dynamic libraries over static.
>To link with a static library when both are present, just provide the
>full path to the library, without the "-l". For example:
>"/usr/local/lib/mysql.a -lpthread -lz $(inherited)".
>
>sherm--
>
>-- 
>Cocoa programming in Perl:
>http://*camelbones.sourceforge.net
>

___

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:decodeObjectForKey without definition

2010-08-20 Thread Kirk Kerekes
Open the file in a hex editor (0xED, for example), if it has the text "plist" 
near the beginning, it may have been archived with NSKeyedArchiver. If instead 
it displays 0x3 or 0x4 followed by 0xb followed by "typedstream" or 
"streamtyped" at the beginning of the file, it was probably archived with 
NSArchiver.

In either case, examining the file should give you some clues as to the class 
contents. 

If they are all stock NSClasses, just use the appropriate unarchiver class's 
methods.

If the root is a custom class, you are sort of toast unless you can Google the 
class -- and even then you may be going down a wrong path. 

You could write an app that would let you select subtrees of the archive and 
decode them perhaps. Sounds like an interesting project. 

Or you could subclass the appropriate archiver class and add some error 
handling/exception handling so that it could proceed as best it could when 
encountering unknown classes. Might need to swizzle in a subclass of NSCoder 
also.

You could substitute an NSMutableDictionary instance for unknown classes 
NSArchiver finds and dynamically create entries in the dictionary for any 
decodable items. 

It isn't going to be drop-dead easy -- and there is always the possibility 
(however unlikely) that the originator of the file had subclassed NSCoder 
itself to do something custom.

Could be an interesting tool, if you can make it even half work. Might find a 
market in forensic computing and related areas.

If you are just looking for text, it may be staring at you in the hex editor.


> I am trying to decode a Yahoo chat file which has been encoded using
> NSArchiver.  The problem is I don't have the definition of the class it has
> encoded and I want to be able to decode it to view the chat conversation.
> Any ideas on how I go about working out the definition to decode the file?
___

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: Embedding a system preference pane

2010-08-20 Thread Bill Bumgarner

On Aug 20, 2010, at 3:44 AM, Jon Guy wrote:

> Hi
> I'm trying to embed a couple of the system pref panes into an app by 
> following the Apple documented method, here's basically whats going on:
> 
> NSBundle *bundle = [NSBundle 
> bundleWithPath:@"/System/Library/PreferencePanes/SharingPref.prefPane"];
> Class principalClass = [bundle principalClass];
> prefPane = [[principalClass alloc] initWithBundle:bundle];
> [prefPane loadMainView];
> [prefPane willSelect];
> prefView = [prefPane mainView];
> [[[self window] contentView] addSubview:prefView];
> [[self window] makeKeyAndOrderFront:self];
> [prefPane didSelect];
> 
> This works fine for one of the other panes. I then tried it for the Sharing 
> pref pane but it only seems to be half working. The Pane appears and I can 
> see the computer name and the table with the list of services but only the 
> DVD Sharing service is working (somewhat). None of the other services are 
> reflecting the state of that service and they are always greyed out. Also 
> when you select a service it's corresponding settings view does not appear on 
> the right side of the table (I hope this is making sense). This is not 
> something hacky, it is documented by Apple and is supposed to work but it's 
> clearly not or I'm doing something wrong. Any help would be appreciated.

Preference panes are not designed to be embedded into applications other than 
the System Preferences application.   Even if you were to make it work (which 
would require duplicating all of the internal functionality of the System 
Preferences application), you are setting yourself up for a maintenance and 
testing nightmare in that System Preferences' internal implementation details 
may change with any version of the OS, including the one-off interim versions 
that sometimes ship with new hardware.

I.e. don't do that.

b.bum

___

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: NSImageView and ZoomFactors

2010-08-20 Thread Brian Postow

On Aug 20, 2010, at 1:35 PM, Quincey Morris wrote:

> On Aug 20, 2010, at 06:46, Brian Postow wrote:
> 
>> Ok,. Since the NSImageView wants to always center the image in the bounds 
>> rect, that should make the translation (moving the origin) not too hard, yes?
> 
> Yes, though I'd say it differently. What's important is the size of the 
> document view, and where its frame is positioned within the bounds rect of 
> the content (clip) view. That's because zooming has an impact on the limits 
> and scroll position of the scroll bars.
> 

ok, it appears that it's a little more complicated that that.

I just discovered   [imageView setImageAlignment: ] which, as long as the 
imageView is bigger than the scrollview, does the correct thing (Lock the image 
to the upper left corner of the scrollView). However, when the imageView is 
smaller than the scrollview, The imageView is still locked to the bottom left 
of the scrollview, but the image is locked to the top left of the imageview. 

Setting the Scrollview boundsOrigin, the imageView bounds origin and 
translating the origin of the imageview or the scrollview had absolutely no 
effect. 

do I need to do something (other than setNeedsDisplay: YES) in order to make a 
translate actually happen?

Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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: Embedding a system preference pane

2010-08-20 Thread Mark Ritchie
Hey!

On 20/Aug/2010, at 1:44 AM, Jon Guy wrote:
> This is not something hacky, it is documented by Apple and is supposed to 
> work but it's clearly not or I'm doing something wrong.

A shot in the dark however...
What OS version are you running and is it in 32 of 64 bit mode?  There was a 
time when only certain pref panes would open in certain modes otherwise the 
SystemPreferences app had to restart itself and I think that Sharing was one of 
those panes.
M.

___

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

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

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

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


Embedding a system preference pane

2010-08-20 Thread Jon Guy
Hi
I'm trying to embed a couple of the system pref panes into an app by following 
the Apple documented method, here's basically whats going on:

NSBundle *bundle = [NSBundle 
bundleWithPath:@"/System/Library/PreferencePanes/SharingPref.prefPane"];
Class principalClass = [bundle principalClass];
prefPane = [[principalClass alloc] initWithBundle:bundle];
[prefPane loadMainView];
[prefPane willSelect];
prefView = [prefPane mainView];
[[[self window] contentView] addSubview:prefView];
[[self window] makeKeyAndOrderFront:self];
[prefPane didSelect];

This works fine for one of the other panes. I then tried it for the Sharing 
pref pane but it only seems to be half working. The Pane appears and I can see 
the computer name and the table with the list of services but only the DVD 
Sharing service is working (somewhat). None of the other services are 
reflecting the state of that service and they are always greyed out. Also when 
you select a service it's corresponding settings view does not appear on the 
right side of the table (I hope this is making sense). This is not something 
hacky, it is documented by Apple and is supposed to work but it's clearly not 
or I'm doing something wrong. Any help would be appreciated.
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: NSImageView and ZoomFactors

2010-08-20 Thread Quincey Morris
On Aug 20, 2010, at 06:46, Brian Postow wrote:

> If I don't want to be using NSImageView, what DO I want to be using? I 
> started out trying to use IKImageView, but that is  swatting a fly with a 
> bazooka. It takes like 2 seconds to draw the image because its doing lots of 
> thumbnailing and stuff that I don't need... is there another kind of 
> imageview I should use?

Given a scroll view architecture, your document view can be a single view, or 
the parent of an entire sub-hierarchy of views (Kyle's suggestion). 

If you're going to use a sub-hierarchy, then using a NSImageView within it is 
fine and probably convenient. (It doesn't do anything that you can't do 
yourself in a couple of lines of code, but a saving is a saving.)

If you're going to use a single view, then you'd use a custom NSView, and draw 
all of the pieces in the right order within its 'drawRect:'. The part of the 
view that's occupied by the image would be drawn with [NSImage drawInRect...], 
for example. You *could* make your custom view a subclass of NSImageView, but 
in this case there's no point that I can see.

Unlike IKImageView, NSImageView doesn't encapsulate a lot of behavior. 
(Offhand, all I can think of is: scaling, optionally drawing a border, and 
drawing a background when there's no image.) It's *mostly* a convenience for 
adding images to XIBs in IB without having to write any code, but with your 
scaling requirements you're already committed to writing UI glue code. So I'm 
suggesting you shouldn't feel obliged to use NSImageView at all, unless it 
genuinely saves you some effort.

> Ok,. Since the NSImageView wants to always center the image in the bounds 
> rect, that should make the translation (moving the origin) not too hard, yes?

Yes, though I'd say it differently. What's important is the size of the 
document view, and where its frame is positioned within the bounds rect of the 
content (clip) view. That's because zooming has an impact on the limits and 
scroll position of the scroll bars.


___

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: Statically link libmysqlclient.a to my Foundation tool

2010-08-20 Thread Sherm Pendley
On Fri, Aug 20, 2010 at 1:26 PM, Heizer, Charles  wrote:
>
> I have been googling for a while now and have tried a few suggestions I
> have found in other like posts but have not had much success.
>
> I'm trying to create a stand alone Foundation tool which will connect to
> MySQL and I can get this to work if I link to the "libmysqlclient.dylib"
> library. But as others have also wanted :) I do not want the user to have
> to install the MySQL connector software.
>
> I have added the "Other linker flags" "-lmysql -lpthread -lz $(inherited)"
> and no luck, I always need the "libmysqlclient.dylib" in my DYLB path for
> it to work.

The "-l" linker flag will always prefer dynamic libraries over static.
To link with a static library when both are present, just provide the
full path to the library, without the "-l". For example:
"/usr/local/lib/mysql.a -lpthread -lz $(inherited)".

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

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


Statically link libmysqlclient.a to my Foundation tool

2010-08-20 Thread Heizer, Charles
Hello,
I have been googling for a while now and have tried a few suggestions I
have found in other like posts but have not had much success.

I'm trying to create a stand alone Foundation tool which will connect to
MySQL and I can get this to work if I link to the "libmysqlclient.dylib"
library. But as others have also wanted :) I do not want the user to have
to install the MySQL connector software. 

I have added the "Other linker flags" "-lmysql -lpthread -lz $(inherited)"
and no luck, I always need the "libmysqlclient.dylib" in my DYLB path for
it to work.

Any help to get this going would be much appreciated.

Thanks,
Charles

___

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

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

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

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


Re: stringWithQuotedPrintableString almost perfect

2010-08-20 Thread Brad Stone
You know, sometimes it just helps getting other developers perspectives to help 
you look at a bug from a different angle (even though you think you're doing 
this by yourself).  The code works fine for me too!  My problem is I had the 
WRONG ENCODING when I use the converted string to create the data object of my 
NSTextView.  DUH!

s = [dict objectForKey:@"Note"]; 
NSData *noteData = [s dataUsingEncoding: NSUnicodeStringEncoding]; // I had 
NSASCIIStringEncoding for some unknown reason!
[newNote setValue:noteData forKey:@"noteData"];

Stephen - thanks for your mods.  I'll study what you did and fix my code.



On Aug 20, 2010, at 12:28 AM, Quincey Morris wrote:

> On Aug 19, 2010, at 19:27, Brad Stone wrote:
> 
>> Can someone help me figure out why (brackets not included)  [•   m]  
>> (which is, on the Mac, an option-8 character, a tab character and a 
>> lowercase m) converts to (brackets not included [• m] ?
>> 
>> The source text  is quoted-printable UTF-8 text I created and saved in an 
>> XML file in a different application.  All the other characters and line 
>> returns translate perfectly but this option-8 tab combination does not.
>> 
>> Here is my source code.
>> 
>> Thanks
>> 
>> - (NSString *)stringWithQuotedPrintableString:(const char *)qpString {
>>  
>>   const char *p = qpString;
>>   char *ep, *utf8_string = malloc(strlen(qpString) * sizeof(char));
>>   NSParameterAssert( utf8_string );
>>   ep = utf8_string;
>>  
>>  
>>  
>>   while( *p ) {
>>  
>>   switch( *p ) {
>>  case '=':
>>  
>>  NSAssert1( *(p + 1) != 0 && *(p + 2) != 0, 
>> @"Malformed QP String: %s", qpString);
>>  if( *(p + 1) != '\r' ) {
>>  int i, byte[2];
>>  for( i = 0; i < 2; i++ ) {
>>  byte[i] = *(p + i + 1);
>>  if( isdigit(byte[i]) )
>>  byte[i] -= 0x30;
>>  else
>>  byte[i] -= 0x37;
>>  
>>  if (byte[i] >= 0 && byte[i] < 
>> 16) {
>>  continue;
>>  }
>>  
>>  NSAssert( byte[i] >= 0 && 
>> byte[i] < 16, @"bad encoded character");
>>  }
>>  *(ep++) = (char) (byte[0] << 4) | 
>> byte[1];
>>  }
>>  p += 3;
>>  continue;
>>  default:
>>  *(ep++) = *(p++);
>>  continue;
>>   }
>>   }
>>  return [[NSString alloc] initWithBytesNoCopy:utf8_string 
>> length:strlen(utf8_string) encoding:NSUTF8StringEncoding freeWhenDone:YES];
>> }
> 
> It would be a help if you could show the hex bytes actually being passed to 
> 'initWithBytesNoCopy...'.
> 
> I note, however, that if your input contains the sequence "=\r", your code 
> above will eat the character following the '\r'. That sort of looks like a 
> bug.
> 
> 
> ___
> 
> 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/cocoa-dev%40softraph.com
> 
> This email sent to cocoa-...@softraph.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: Set the Cursor Position

2010-08-20 Thread koko

Thanks to all for support!

-koko


On Aug 20, 2010, at 9:11 AM, Ken Thomases wrote:


On Aug 19, 2010, at 8:43 PM, Sherm Pendley wrote:


On Thu, Aug 19, 2010 at 9:32 PM, Murat Konar  wrote:
CGDisplayMoveCursorToPoint(CGDirectDisplayID display, CGPoint  
point);


But heed the other's hints that, except for special classes of  
software
(like a VNC app), software that warps the pointer's location  
independent of

the mouse is much un-loved on the Mac.


One such exception would be 2d or 3d graphics apps, where it's
expected to have a tool that allows the user to click and drag to
scale or rotate an object. When such a tool is active, one might
respond to drag events by modifying the model to match the mouse
movement, then warping the cursor back to its original position.


For that, you probably want to disassociate the mouse from the  
cursor with CGAssociateMouseAndMouseCursorPosition(false) and hide  
the cursor.


Regards,
Ken

___

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/koko%40highrolls.net

This email sent to k...@highrolls.net



___

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: [iPhone] How to change Default.png Image Dynamically

2010-08-20 Thread Hunter Hillegas
It is not, no. You're not allowed to replace anything in the bundle.

You could start with a black Default.png and then very quickly load your own 
shot into an image view while the rest of your apps loads. Probably depends on 
your use case.

On Aug 20, 2010, at 5:15 AM, Tharindu Madushanka wrote:

> Is it possible to save a screen shot of last running application screen as
> the app loading screen next time..
> 
> I see may be Maps iPhone application does something similar to that instead
> loading static Default.png image.
> 
> Could someone kindly clarify 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: NSImageView and ZoomFactors

2010-08-20 Thread Brian Postow

On Aug 19, 2010, at 10:56 PM, Kyle Sluder wrote:

> On Thu, Aug 19, 2010 at 4:54 PM, Quincey Morris
>  wrote:
>> On Aug 19, 2010, at 12:44, Brian Postow wrote:
>> 
>>> ah, so, the way to zoom is to leave the NSImageView on 
>>> NSImageScaleProportionallyUpOrDown, and then change the size of the frame! 
>>> That gives me scrollbars!
>> 
>> I had to go out for a while before finishing my last post, but I wanted to 
>> point out that you likely *don't* want to be using NSImageView at all for 
>> this. The problem is that you seem to want to be doing additional drawing 
>> (you mentioned selection rectangles) earlier, but consider that you almost 
>> certainly don't want such drawing to be scaled along with the image. There 
>> are 3 ways to deal with this:
> 
> It sounds as if you're conflating bounds transformation scaling with
> NSImageView size-to-fit-frame scaling. It's usually the case that you
> don't want to rely on a scaled bounds coordinate system to draw zoomed
> UI for the precise reason you mentioned: you need to untransform any
> additional drawing, including any subview drawing. It is much cleaner
> and simpler to use a custom zoom factor and scale your drawing within
> -drawRect:.
> 
> As for using NSImageView size-to-fit-frame scaling, and using
> NSImageView in general, as long as Brian isn't attempting to do his
> adornments within a -drawRect: override of an NSImageView subclass, it
> might be appropriate for simple uses. You scale the frame, not the
> bounds, of the image view, so all the coordinate systems make sense,
> which means you can do adornment drawing in subviews of the image
> view.
> 
> In fact, that's one common way of doing selection rectangles: use a
> subview to draw your selection lasso. Another common technique, useful
> when your adornment drawing needs to span multiple views (and I
> believe the only way to solve this before overlapping sibling views
> were made legal) is to use a borderless NSWindow. This has the
> advantage that it uses Quartz Extreme to composite the selection lasso
> with the window contents, plus you can do things like fade out the
> lasso when the user releases the mouse (kind of like Finder in 10.6)
> without having to do any complicated timer drawing in your main
> content view—all the fade animation stuff remains in your lasso
> window.
> 

I don't need to worry about multiple views. I have a toolbar with controls, and 
a image view with scrollbars. that's the entire window. So, the trick for 
selection lasso is to make a separate NSView as a subview of the NSImageView, 
somehow make it transparent, and then use it to select the region of the 
NSImageView? interesting, that wouldn't have occured to me...

> 

Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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: NSImageView and ZoomFactors

2010-08-20 Thread Brian Postow

On Aug 19, 2010, at 7:54 PM, Quincey Morris wrote:

> On Aug 19, 2010, at 12:44, Brian Postow wrote:
> 
>> ah, so, the way to zoom is to leave the NSImageView on 
>> NSImageScaleProportionallyUpOrDown, and then change the size of the frame! 
>> That gives me scrollbars!
> 
> I had to go out for a while before finishing my last post, but I wanted to 
> point out that you likely *don't* want to be using NSImageView at all for 
> this. The problem is that you seem to want to be doing additional drawing 
> (you mentioned selection rectangles) earlier, but consider that you almost 
> certainly don't want such drawing to be scaled along with the image. There 
> are 3 ways to deal with this:
> 

If I don't want to be using NSImageView, what DO I want to be using? I started 
out trying to use IKImageView, but that is  swatting a fly with a bazooka. It 
takes like 2 seconds to draw the image because its doing lots of thumbnailing 
and stuff that I don't need... is there another kind of imageview I should use?

> 
>> I think I now need to add some translation when I zoom so that my image 
>> doesn't migrate off the upper right of the screen... Is that the standard 
>> way of doing that?
> 
> The position of the document view relative to the clip view is determined by 
> the relationship of the document view frame to the bounds origin of the 
> content view. (Keep in mind that both are in the same coordinate system.) The 
> easiest way is to set the document view frame origin with a suitable offset. 
> (The amount of the offset is usually easy to calculate. I always figure out 
> the sign -- direction -- of the offset by trial and error, but I always get 
> it exactly wrong when trying to figure it out in advance.)


Ok,. Since the NSImageView wants to always center the image in the bounds rect, 
that should make the translation (moving the origin) not too hard, yes?

Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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


[iPhone] How to change Default.png Image Dynamically

2010-08-20 Thread Tharindu Madushanka
Hi,

Is it possible to save a screen shot of last running application screen as
the app loading screen next time..

I see may be Maps iPhone application does something similar to that instead
loading static Default.png image.

Could someone kindly clarify this ??

Thanks and Kind Regards,

Tharindu Madushanka
tharindufit.wordpress.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


CoreAnimation - Resizing sublayers along with superlayer animation

2010-08-20 Thread Ignacio Enriquez
Hi,

I have a subclass of CALayer (below self) and it has a sublayer (textLayer).
I want self to be shrank and enlarges, so I created animations like
the following:

CABasicAnimation *fadeInAnimation;  
fadeInAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];
fadeInAnimation.repeatCount = 1;
fadeInAnimation.autoreverses = NO;
fadeInAnimation.fromValue = [NSNumber numberWithFloat:1.0];
fadeInAnimation.toValue = [NSNumber numberWithFloat:0.0];

CABasicAnimation *shrinkAnimation;
shrinkAnimation = [CABasicAnimation animationWithKeyPath:@"bounds.size"];
shrinkAnimation.repeatCount = 1;
shrinkAnimation.autoreverses = NO;
shrinkAnimation.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseIn];
shrinkAnimation.toValue = [NSValue valueWithCGSize:CGSizeMake(0, 0)];

aniGroupOFF = [[CAAnimationGroup animation] retain];
aniGroupOFF.delegate = self;
aniGroupOFF.duration = ANI_DURATION;
aniGroupOFF.animations = [NSArray arrayWithObjects:shrinkAnimation,
fadeInAnimation, nil];

then I commit the animation

[self addAnimation:aniGroupOFF forKey:@"shrinkAndFadeOff"];

self is animated as expected but sublayer textLayer is not resized, it
just changes its position according to the new bounds of self

I would like to have the same effect when animation view, they resize
automatically their subviews and/or sublayers

Thanks in advance.

BTW: I tried also:
[self setNeedsDisplayOnBoundsChange:YES];
and overriding
-(void)layoutSublayers{[textLayer setFrame:accordingFrame];}
but didn't work ;(


Ignacio
___

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


decodeObjectForKey without definition

2010-08-20 Thread Andy Bell
Hi All,

I am trying to decode a Yahoo chat file which has been encoded using
NSArchiver.  The problem is I don't have the definition of the class it has
encoded and I want to be able to decode it to view the chat conversation.
 Any ideas on how I go about working out the definition to decode the file?

Thanks in advance
Andy
___

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

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

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

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


Re: Core Data Lightweight Migration Woes

2010-08-20 Thread Jack Nutting
On Fri, Aug 20, 2010 at 8:21 AM, Steve Steinitz
 wrote:
> - Removed any stray mopping models, just in case
>

I didn't see your question until you'd already solved it yourself, but
I just wanted to highlight this one point; Assumming you're referring
here to old .mom files, I'd almost bet money that this is the only
thing you needed to do (either manually delete the old file from your
target app, or "build clean"). Like Quincey mentioned, if your app at
runtime finds both Model.mom and Model.momd, it will use the former
and then either ignore the latter or give you cryptic errors (I forget
which).

-- 
// jack
// http://nuthole.com
// http://learncocoa.org
___

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