QTMovieLayer with QTMovie leaking memory

2008-03-26 Thread Freddie Tilley
Hi I'm creating a qt movie player that will play movies in a  
QTMovieLayer from a simple playlist


When running the application with Instruments using the Leaks  
template, it appears the function
[QTMovie idleAllMovies] is leaking memory. This is the stacktrace from  
Instruments


 0 CoreFoundation __CFDictionaryGrow
 1 CoreFoundation CFDictionaryCreateMutableCopy
 2 QuickTime ICMDecompressionSessionCreateForVisualContext
 3  0x9475a2d7
 4  0x94765533
 5  0x947667c4
 6  0x947672da
 7  0x947684b7
 8  0x9476a0df
 9 CarbonCore CallComponentFunctionCommon
10  0x94758fd5
11 CarbonCore CallComponentDispatch
12 QuickTime MediaMoviesTask
13 QuickTime TaskMovie_priv
14  0x9481ae78
15  0x948294dc
16  0x9481acf7
17  0x948162b1
18 CarbonCore CallComponentDispatch
19 QuickTime MCIdle
20 QuickTime QTOMovieObject::SendCommand(unsigned long, void const*)
21 QuickTime DispatchQTMsg(void const*, unsigned long, unsigned long,  
unsigned long, QTOGenericObject*)
22 QuickTime QTObjectTokenPriv::SendMessageToObject(QTMessagePriv*,  
unsigned long)
23 QuickTime QTObjectTokenPriv::DispatchMessage(QTMessagePriv*, void  
const*, __CFAllocator const*, unsigned long, unsigned long,  
ComponentMsgParam*, unsigned long, unsigned long)

24 QuickTime QTSendToObject
25 QTKit QTObjectTokenExecuteCommand
26 QTKit -[QTMovie idle]
27 CoreFoundation CFSetApplyFunction
28 QTKit +[QTMovie idleAllMovies:]
29 Foundation __NSFireTimer
30 CoreFoundation CFRunLoopRunSpecific
31 CoreFoundation CFRunLoopRunInMode
32 HIToolbox RunCurrentEventLoopInMode
33 HIToolbox ReceiveNextEventCommon
34 HIToolbox BlockUntilNextEventMatchingListInMode
35 AppKit _DPSNextEvent
36 AppKit -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:]

37 AppKit -[NSApplication run]
38 AppKit NSApplicationMain

And this leaks 64 bytes of memory. Is there something I'm not doing  
correctly.
I'm only using the QTKit framework for loading the movies and placing  
them in the movielayer
directly, so no under the hood Carbon calls. Is there some missing  
function to call after the

movie has finished playing?


Freddie Tilley
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Ephemeral Changes

2008-03-26 Thread Gerriet M. Denkmann


On 26 Mar 2008, at 04:07, Sherm Pendley wrote:
On Tue, Mar 25, 2008 at 10:07 PM, Gerriet M. Denkmann  
<[EMAIL PROTECTED]> wrote:


On 25 Mar 2008, at 23:12, Graham Cox wrote:
> There may be a simpler way, but this is what occurred to me when I
> read this:
>
> Subclass NSTextView and override -changeFont: -changeAttributes:
> and any other "ephemeral" method. Turn off the undo manager using -
> disableUndoRegistration, call super, then turn it back on again.
>

I have to apologize for not stating my problem more clearly. Let's
try again:

I do want to see "Undo Set Font" or "Redo Paste Font" etc. in my Edit
menu. So disabling the undo manager is probably not the right thing.

You could override the "epemeral" methods and call [self  
updateChangeCount:NSChangeUndone] after calling super. That would  
leave the operation on the undo stack, but leave the document's  
change count, um... unchanged. :-)

This seems to be an excellent idea.

I have implementd in MyTextView:

- (void)changeFont:(id)sender
{
[ super changeFont: sender ] ;  
GmdDocument *docum = [ self delegate ]; 
[ docum updateChangeCount: NSChangeUndone ];
}

- (void)pasteFont:(id)sender   same 

Now I can set the font via:
Format ► Font ► Past Style  or via:
Format ► Font ► Show Fonts and selecting some font in the Font Panel
without the document getting dirty.
Very good so far.

I also can use Edit  ► Undo Set (or Paste) Font but now the document  
gets dirty. Very bad. Also: the complete text gets selected.
So what else do I have to implement? I tried setFont: and  
setFont:range:, but these seem never to be called.

How does the NSUndoManager undo my font changes?





Or, you could keep track of the "real" changes yourself, and  
override -isDocumentEdited with your own implementation.
This would be more work - and also I am not at all sure what to  
override.



Kind regards,

Gerriet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Changing the line height of an NSTextField?

2008-03-26 Thread Nicholas J Humfrey

Hello Cocoa Developers,

I am trying to squeeze an extra line of text into a multiline  
NSTextField, but I can't work out how to adjust the line height? What  
is the easiest way of adjusting this?



The purpose of this is that I'm actually using several NSTextFields on  
an NSView to lay text out for printing on to a sheet of labels, which  
has been working out very nicely up until this point! Perhaps there is  
a better way of doing this?



Thanks,

nick.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Windows networking API

2008-03-26 Thread Ken Thomases

On Mar 25, 2008, at 10:41 AM, Robert Claeson wrote:
Is there an API/framework to interface with the SMB/Samba/Windows  
networking functionality of OS X? More specifically, I need to:


* Find the Active Directory domain (or Windows workgroup name if not  
in an AD network)

* Ensure that the OS X user is authenticated via AD (if available)

As you can probably tell, I'm not too up to date on what Windows can  
really do these days or even the details of how they work. I'm  
porting a piece of system software from Windows that is very well  
integrated with Active Directory and all those management features  
that Windows offers and am trying to get the feature level of the OS  
X port on an equal footing. I have very little Windows programming  
experience, being a Nextstep/Openstep/OS X and Unix developer since  
the beginning of days.


I've never used it before, but Apple's API for this is called Open  
Directory and, sometimes, Directory Services.  Search for those in the  
documentation to get started.


Cheers,
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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Basic question about NSComboBox

2008-03-26 Thread ADIL SALEEM
I have a  basic question about NSComboBox that i want
to clarify.

When user selects some item from the combo box and
actually click on the item itself in the list then
[comboBox indexOfSelectedItem] returns it's index
correctly (0,1,2...) . 

But if the user just clicks on the dropdown button and
not click on any item then [comboBox
indexOfSelectedItem] returns -1, even if there was
previously a selection made by the user. 

For example: If a combo box has items 
   
A
B
C 

User clicks C and the index of selected item is now 2
But now if the user clicks just the dropdown button
and not any item in the list, then the index of
selected item becomes -1. The item that was previously
selected (C in this case) keeps on displaying,but in
actual nothing is selected. Why is the previous
selection invalidated in such a scenario ? The
previously selected item is still displayed in the
combo box and it gives the impression to the user that
it is still selected whereas it is not.   

Currently i am using a workaround for this problem.
Whenever there is a change in selection i save the
index. When i have to use the selected item i first
check if the index of selected item is -1, if it is -1
i use the last saved selection. Is there any better or
more proper solution to this ?


Thank you for your time.





  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Writing a preference pane that configures hotkeys?

2008-03-26 Thread Nathan Day
I use those classes myself in a preference pane (Popup Dock) and they  
work fine. You need to have a NDHotKeyControl to capture the event,  
you can create an input field in IB and change its class to  
NDHotKeyControl. You then need to tell the NDHotKeyControl to wait for  
a HotKey combination event by calling setReadyForHotKeyEvent:, you can  
alternativly set up a button to send a readyForHotKeyEventChanged:  
action.


On 26/03/2008, at 12:38 AM, Brian Kendall wrote:

On Mon, 24 Mar 2008 01:46:27 -0400, Jens Alfke <[EMAIL PROTECTED]>  
wrote:



Take a look at Nathan Day's "NDHotKeyEvent" utility code:
http://homepage.mac.com/nathan_day/pages/source.xml



I tried to use this in my preference pane, but I can't get the  
control to receive hot key events.  There could be something I'm  
doing wrong when setting up or working with the NDHotKeyControl  
class, but is there any reason it wouldn't be able to receive events  
in a preference pane?


- Brian
___

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/nathan_day%40mac.com

This email sent to [EMAIL PROTECTED]




Nathan Day
[EMAIL PROTECTED]
http://homepage.mac.com/nathan_day/

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSOutlineView "sliding" animation

2008-03-26 Thread Lucas Gladding

Mitchell

iChat doesn't use a standard NSTableView or NSOutlineView.  The  
standard views use one NSCell for each column and draw each row's  
contents with the same NSCell (think of using a stencil when  
painting).  For core animation, the ideal setup is an NSView for each  
row.  NSCollectionView could serve as a starting point for your  
purpose, but writing your own NSView with row subviews is probably  
easier.  I have been working on something similar to what you are  
asking, but the amount of work involved is quite substantial.


If you want to pursue this further, let me know and I can post some  
tips based on my own experience.  I would also recommend downloading  
the iPhone SDK and look at how the iPhone handles tables for some  
ideas about implementation (as we cannot discuss those specifics here).


There are other obstacles to overcome once you have the view written  
(like how to handle a layer-backed view inside an NSScrollView -  
again, tips are welcome here), but the undertaking may be worthwhile  
depending on your reasons for the animation.


Best of luck

Luke Gladding


On Mar 26, 2008, at 9:58 AM, [EMAIL PROTECTED] wrote:



Message: 4
Date: Tue, 25 Mar 2008 23:16:58 -0400
From: Mitchell Livingston <[EMAIL PROTECTED]>
Subject: NSOutlineView "sliding" animation
To: cocoa-dev@lists.apple.com
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

Hello,

I want to use core animation to add a sliding effect when expanding/
collapsing rows in an outline view (like iChat's groups), but I can't
figure out where to get started. I have tried using nsview's animator,
but it doesn't seem to be compatible with this type of animation.
Could someone point me in the right direction (perhaps a relevant
tutorial, because my attempts at finding one have failed)?

Thank you,
Mitchell Livingston


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Providing synch/asynch API

2008-03-26 Thread Andy Klepack
I was hoping to look at the problem from a more generic perspective where the 
operation itself was variable but the callback would be either in the same 
thread as they were created from or in the main thread itself.

For a more concrete example I'm working on an ObjC wrapper for a web service 
that my daemon uses. The web service class wraps calls to the actual web 
methods and returns the result objects hydrated from the results of the 
invocation. I'd like some of these methods to be synchronous and some to be 
asynchronous. I figure that the implementation can be simplified if I can come 
up with one mechanism under the hood and provide whichever variant I need.

I am able to target Leopard and above.

-Andy

-Original Message-
From: Kyle Sluder [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2008 4:44 PM
To: Andy Klepack
Cc: cocoa-dev@lists.apple.com
Subject: Re: Providing synch/asynch API

On Tue, Mar 25, 2008 at 12:05 PM, Andy Klepack
<[EMAIL PROTECTED]> wrote:
>  I'm curious how people tackle this problem pre-Leopard and 
> performSelector:onThread:withObject:waitUntilDone: API

Well you've got a couple of unresolved parameters:
1) Do your callbacks need to execute on the same thread they were
created from, the detached thread, or either?
2) What non-trivial operation is your method performing?  Does this
operation perform blocking I/O or thunk down to another blocking API?
3) Can you target only Leopard?

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


NSMatrix

2008-03-26 Thread Matthew Miller
Could some please explain in simple terms how to create a NSMatrix  
which distributes cells in rows based on the input of a table and  
takes away the cells when it is not needed. Thank you very much!


P.S. I am new to cocoa so please don't use really big and complex  
cocoa vocab, but then again, I would appreciate anything! :)

___

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

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

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

This email sent to [EMAIL PROTECTED]


Leopard on PPC

2008-03-26 Thread Lorenzo
Hi,
I have compiled my Cocoa application against SDK 10.4.
While my application runs well on both Leopard and Tiger on Intel machines,
It run on PPC machines only with Tiger. On PPC machines with Leopard it
won't launch. Any idea about the origin of the trouble?

Some of my settings:
ARCHS = ppc i386
VALID_ARCHS = ppc64 ppc7400 ppc970 i386 x86_64 ppc
SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk
MACOSX_DEPLOYMENT_TARGET = 10.4
GCC_MODEL_TUNING = G4
GCC_FAST_OBJC_DISPATCH = YES


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing the line height of an NSTextField?

2008-03-26 Thread John Stiles
I've found that adjusting the font matrix to include a negative Y 
transformation has the effect of decreasing the line height. This seemed 
like a bug to me when I discovered it, since I just wanted the text to 
be translated upwards in its cell, not shrink the line height. I wasn't 
sure if it was a bug or desired functionality. If this is the correct 
behavior, it's one way to do it.



Nicholas J Humfrey wrote:

Hello Cocoa Developers,

I am trying to squeeze an extra line of text into a multiline 
NSTextField, but I can't work out how to adjust the line height? What 
is the easiest way of adjusting this?



The purpose of this is that I'm actually using several NSTextFields on 
an NSView to lay text out for printing on to a sheet of labels, which 
has been working out very nicely up until this point! Perhaps there is 
a better way of doing this?



Thanks,

nick.

___

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/jstiles%40blizzard.com

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leopard on PPC

2008-03-26 Thread Laurent Cerveau

Is there any message in the console?

Laurent

Sent from my roadPhone

On Mar 26, 2008, at 5:51 PM, Lorenzo <[EMAIL PROTECTED]> wrote:


Hi,
I have compiled my Cocoa application against SDK 10.4.
While my application runs well on both Leopard and Tiger on Intel  
machines,
It run on PPC machines only with Tiger. On PPC machines with Leopard  
it

won't launch. Any idea about the origin of the trouble?

Some of my settings:
   ARCHS = ppc i386
   VALID_ARCHS = ppc64 ppc7400 ppc970 i386 x86_64 ppc
   SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk
   MACOSX_DEPLOYMENT_TARGET = 10.4
   GCC_MODEL_TUNING = G4
   GCC_FAST_OBJC_DISPATCH = YES


Best Regards
--
Lorenzo
email: [EMAIL PROTECTED]

___

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/lcerveau%40mac.com

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leopard on PPC

2008-03-26 Thread Jean-Daniel Dupas


Le 26 mars 08 à 17:51, Lorenzo a écrit :


Hi,
I have compiled my Cocoa application against SDK 10.4.
While my application runs well on both Leopard and Tiger on Intel  
machines,
It run on PPC machines only with Tiger. On PPC machines with Leopard  
it

won't launch. Any idea about the origin of the trouble?

Some of my settings:
   ARCHS = ppc i386
   VALID_ARCHS = ppc64 ppc7400 ppc970 i386 x86_64 ppc
   SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk
   MACOSX_DEPLOYMENT_TARGET = 10.4
   GCC_MODEL_TUNING = G4
   GCC_FAST_OBJC_DISPATCH = YES


Best Regards


Can you provide the error it produces on Leopard PPC (crash log ?,  
launch using terminal, sometime you can get a message, etc…).


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSMatrix

2008-03-26 Thread Dave Hersey

On Mar 26, 2008, at 11:52 AM, Matthew Miller wrote:
Could some please explain in simple terms how to create a NSMatrix  
which distributes cells in rows based on the input of a table and  
takes away the cells when it is not needed. Thank you very much!


P.S. I am new to cocoa so please don't use really big and complex  
cocoa vocab, but then again, I would appreciate anything! :)


The problem is that NSMatrix is not a beginner class. If you don't  
have a solid understanding of other Cocoa frameworks like NSControl,  
NSView, NSCell (and its variants- NSActionCell, NSImageCell), and if  
you aren't comfortable subclassing yet, you're going to have a lot of  
trouble with NSMatrix.


But, here's what you need to do.

First, you need to do some design.

1. Create a subclass for the data that goes in the cells. While not  
strictly necessary (e.g. you could create a matrix of strings using  
just NSString as the object class), you almost always will want to do  
this. Typically you'll have information that won't be displayed, such  
as a path to an image, and you'll want to keep that connected to the  
data you are displaying. So, we'll create an NSObject subclass to hold  
our data and call it ThumbnailObject.


2. Decide where you're going to store that data. NSArrayController is  
a great way to manage contents of an NSMatrix, but if you're not  
familiar with that, I'd go with an NSMutableArray for now. Your  
ThumbnailObjects will be stored in the array as they are created, and  
removed from it when they're tossed aside. The Matrix will reflect the  
objects that are stored in this array.


3. Decide what your cell class will be for the matrix. For example, if  
you were displaying a bunch of images, you might use NSImageCell. If  
you were displaying text, you might use NSTextFieldCell. If you're  
displaying checkboxes, you might use NSButtonCell. However, unless  
your matrix needs are very basic, you'll probably want to subclass  
this base cell class. Do you absolutely need to? Maybe not, but it  
will probably make your code easier to follow and maintain. So, let's  
say you're going to display images. You'd probably want to subclass  
NSImageCell or NSActionCell for that. Which you choose is an  
implementation detail, and determines the methods you need to override  
or provide in order to have the cell behave the way you want. For this  
discussion, we'll create a subclass of NSImageCell called ThumbnailCell.


4. Create a subclass of NSMatrix. You'll almost certainly need this,  
since NSMatrix is a rather peculiar class that almost feels  
"unfinished" when you get working with it. We'll call our subclass of  
NSMatrix ThumbnailMatrix.


So, in this design, you have a ThumbnailMatrix which contains  
ThumbnailCells that display data from ThumbnailObjects. You've created  
subclasses of NSMatrix, NSImageCell and NSObject to do this.


You've got to get the design above nailed down before going any  
further. If any of that is confusing or doesn't make sense to you,  
read up on the classes mentioned above before proceeding.


Now you code.

5. Code the subclasses.

The ThumbnailMatrix class is going to have the following methods:

initWithFrame - Create an instance of ThumbnailCell and pass it to the  
superclass's initWithFrame method as the prototype cell for your matrix.


awakeFromNib - Here, I'd set up things like interCellSpacing,  
cellSize, autoScroll, etc.


renewRowsIfNeeded - This is a method I create that checks to see if  
the number of cells that can fit on the rows has changed or if the  
width between them has changed. (I usually spread the extra space at  
the end of the row between the cells to make them appear evenly  
distributed.) Get the cell size and the super view's bounds, then  
determine how many rows and columns fit. Get the "left over" space  
from a full row and use that to determine what the interCell spacing  
should be, then set the interCell spacing if it's different. Compare  
the number of rows and columns to what you already have. If they're  
different you need to call renewRows. Return true if the intercell  
spacing changed or renewRows was called.


setFrameSize - Override this if you want to have the matrix do live  
rebuilding as you grow or shrink the window. If you don't do this, the  
matrix will stay it's old size until the mouse button is released, at  
which point it will change its number of rows and columns to fit  
(because of viewDidEndLiveResize below). It looks nice to have the  
matrix change to reflect the final state while you're dragging, so I'd  
implement this. It should call it's super then, if  renewRowsIfNeeded  
returns true, call sizeToCells. Then call setNeedsDisplay (or  
setNeedsDisplayInRect if you're optimizing for live resizing.) Do  
setNeedsDisplay for now, then look into live resizing optimization.


viewDidEndLiveResize - When the mouse is released after a resize, this  
method is called. If renewRowsIfNeeded retur

Re: outlineViewSelectionDidChange not called

2008-03-26 Thread Jonathan Dann



On 26 Mar 2008, at 03:24, Adam Gerson wrote:


I take that back. [outlineView selectedRow] does appear to tell the
absolute truth. So I should now be able to try what you said and tie
the tree controller's @"selectionIndexPaths" to [outlineView
selectedRow]. I will report back my results...

Adam



Ah.. I'm not quite sure you got what I meant.  In a (document-based)  
app set up an NSArray *selectionIndexPaths ivar, so the  
NSTreeController then binds its @"selectionIndexPaths" binding to the  
keypath @"File's Owner.selectionIndexPaths" where file's owner (the  
document) is the owner of the nib containing the tree controller and  
the outline view.  The outline view then has its content bound to the  
tree controller's @"arrangedObjects" controller key, the  
selectionIndexPaths to the @"selectionIndexPaths" controller key and  
then the outline view's table column's @"value" binding is set to the  
tree controller's @"arrangedObjects.nodeName" (nodeName is just an  
NSString representation of a file path).


Doing what you said may not work.

On Tue, Mar 25, 2008 at 10:29 AM, Jonathan Dann  
<[EMAIL PROTECTED]> wrote:

Have your tried binding the tree controller's @"selectionIndexPaths"
binding to a variable in your model object?

I havent tried it but it seems that you can do this in IB and then  
get
the model to observe the bound instance variable and you cab then  
see

each time the variable changes. Not sure if it will cover all the
bases you need though.

You'd get an array if selection index paths and then just see if the
count of the array is 1 for single selection or more if you have
multiple.

Jonathan Dann



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Source list using bindings?

2008-03-26 Thread Jonathan Dann


On 26 Mar 2008, at 00:45, Hamish Allan wrote:


Hi Jon,

On Tue, Mar 25, 2008 at 9:49 PM, Jonathan Dann <[EMAIL PROTECTED]>  
wrote:


As of 10.5 it's the Apple-sanctioned way to go!  I've used it for  
ages
now, no problems at all.  The tree node is a proxy for whatever  
'real'

item you add to the tree.


I just wondered why it was NSTreeControllerTreeNode rather than
NSTreeNode. I'm just naturally wary of solutions beginning "class-dump
shows..."!


You do get a lot of that, it's maybe a contrived example, but many of  
your classes will get replaced at runtime by isa-swizzling to make  
them something like KVONotifyingMyAwesomeClass (I forget the prefix  
Apple adds, just have a look in the debugger).  It'll just be some odd  
implementation detail that will be beyond me!  The 10.5 docs for  
NSTreeController all refer to NSTreeNode.





You can also get the selectedNodes, which returns treeNode objects,  
or

the selectedObjects, which returns the 'real' obejcts that you've
created.


Splendid!


My isGroupItem just compares an NSString *nodeName of the represented
object to a list of strings I want to have as groups, i.e @"SOURCES",
@"PLAYLISTS", etc.


I just treat everything at the top level as a group item:

- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item
{
return ([outlineView parentForItem:item] == nil);
}


Thank you for your autosaving advice; I did see your code for that on
the list recently, and it will doubtless be very useful.



You're welcome.

Jon

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Leopard on PPC

2008-03-26 Thread Lorenzo
Thanks,
actually I get this crash log on the Console

Path:/Applications/MyApp 1.2.3/MyApp.app/Contents/MacOS/MyApp
Identifier:  com.myapp.myapp
Version: 1.2.3 (1.2.3)
Code Type:   PPC (Native)
Parent Process:  launchd [104]

Date/Time:   2008-03-26 20:33:19.245 +0200
OS Version:  Mac OS X 10.5.2 (9C31)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0014
Crashed Thread:  0

Thread 0 Crashed:
0   com.apple.CoreFoundation  0x91ef3354
_CFStringCreateWithFormatAndArgumentsAux + 112
1   com.apple.CoreFoundation  0x91ef33e8 CFStringCreateWithFormat +
44
2   com.apple.CoreFoundation  0x91ea0da0
__CFDictionaryHandleOutOfMemory + 56
3   com.apple.CoreFoundation  0x91ea2510 __CFDictionaryGrow + 452
4   com.apple.CoreFoundation  0x91ea3830 CFDictionaryAddValue + 252
5   com.apple.CoreFoundation  0x91ea3f60 CFDictionaryCreate + 104
6   com.apple.CoreFoundation  0x91f37c0c -[__NSPlaceholderDictionary
initWithObjects:forKeys:count:] + 972
7   com.apple.CoreFoundation  0x91f3a7d4 +[NSDictionary
dictionaryWithObjectsAndKeys:] + 692
8   com.apple.AppKit  0x9462362c -[NSTableColumn
_postColumnDidResizeNotificationWithOldWidth:] + 384
9   com.myapp.myapp   0x00120d48 0x1000 + 1178952
10  com.myapp.myapp   0x00120b30 0x1000 + 1178416
11  com.apple.AppKit  0x9462f034 -[NSTableView numberOfRows]
+ 180
12  com.apple.AppKit  0x94619774 -[NSTableView
_verifySelectionIsOK] + 100
13  com.apple.AppKit  0x946196e8 -[NSTableView
_tileAndRedisplayAll] + 244
14  com.apple.AppKit  0x946193d8 -[NSTableView
setDataSource:] + 260
15  com.apple.AppKit  0x94525a94 -[NSIBObjectData
nibInstantiateWithOwner:topLevelObjects:] + 1048
16  com.apple.AppKit  0x9451d170 loadNib + 224
17  com.apple.AppKit  0x9451cb14 +[NSBundle(NSNibLoading)
_loadNibFile:nameTable:withZone:ownerBundle:] + 840
18  com.apple.AppKit  0x9451c6f0 +[NSBundle(NSNibLoading)
loadNibNamed:owner:] + 336
19  com.apple.AppKit  0x9451c3d8 NSApplicationMain + 332
20  com.myapp.myapp   0x2ed8 0x1000 + 7896
21  com.myapp.myapp   0x2bdc 0x1000 + 7132

Thread 0 crashed with PPC Thread State 32:
  srr0: 0x91ef3354  srr1: 0xf030   dar: 0x0014 dsisr: 0x4000
r0: 0x91ef334cr1: 0xb060r2: 0x0078r3: 0x
r4: 0x0003r5: 0xr6: 0x002cr7: 0x0e03
r8: 0xr9: 0x   r10: 0x9308009c   r11: 0x84044422
   r12: 0x   r13: 0x0021bfa0   r14: 0x   r15: 0xa09bf4f8
   r16: 0xa099567c   r17: 0x1407f040   r18: 0xa099567c   r19: 0x
   r20: 0xffdfc070   r21: 0x   r22: 0xa057c174   r23: 0x
   r24: 0x0002   r25: 0xa057c174   r26: 0x   r27: 0xb144
   r28: 0x   r29: 0xffdfc030   r30: 0xa058476c   r31: 0x91ef32ec
cr: 0x24044422   xer: 0x2000lr: 0x91ef334c   ctr: 0x92f66970
vrsave: 0x



Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa Database Connection

2008-03-26 Thread Andrew Satori

Justin,

Sorry, I've been buried with other work and didn't get this earlier.

There are several ways to solve what you want.  You can bridge to the  
various databases using native toolkits or you can use a generic  
toolkit like JDBC via the java bridge (not supported anymore under  
Leopard) or ODBC.


Since you are rolling with PostgreSQL, there are several ways of  
getting there.  libpq is the most well supported and documented, but  
it is not very 'Cocoa'.  For that you need BaseTen, which is  
excellent.  However, it might be more than what you are after.


I've been down this path with PostgreSQL twice now.  I started by  
writing pgCocoaDB which is the foundation of the current GUI tools in  
the PostgreSQLforMac project.  I learned alot, and honestly did a fair  
amount wrong there.  So I reworked that into what is the foundation of  
the future PostgreSQL tools from both my company and the OSS  
PostgreSQLforMac project.


It is called PGSQLKit, it is a framework that is intended to be a  
middle ground bridge of Cocoa like structure and the very familiar  
ADODB interfaces that most Windows programmers will be familiar with.


It is built upon libpq, but does not require a local installation of  
PostgreSQL and it's header files.



At it's very basic, it exposes a PGSQLConnection class that is more or  
less the root of all your PG usage.  for example, let's establish a  
connection, login, run a query and return a result (this is copied  
directly from the upcoming automator action for running an array of  
dynamic querie against a PostgreSQL database):



- (id)runWithInput:(id)input fromAction:(AMAction *)anAction error: 
(NSDictionary **)errorInfo

{
	// Add your code here, returning the data to be passed to the next  
action.

NSMutableDictionary *dict = [self parameters];

NSString *user = [dict valueForKey:@"userName"];
NSString *password = [dict valueForKey:@"password"];

NSString *serverName = [dict valueForKey:@"serverName"];
NSString *serverPort = [dict valueForKey:@"serverPort"];
NSString *databaseName = [dict valueForKey:@"databaseName"];

PGSQLConnection *connection = [[PGSQLConnection alloc] init];

[connection setUserName:user];
[connection setPassword:password];

[connection setServer:serverName];
[connection setPort:serverPort];
[connection setDatabaseName:databaseName];

if ([connection connect])
{
NSArray *cmdArray = [[NSArray alloc] initWithArray:input];
NSMutableArray *result = nil;

// loop the array and execute each command in a transaction,
// rollback ALL command if any errors occur.
int i;
for (i = 0; i < [cmdArray count]; i++)
{
NSString *query = (NSString *)[cmdArray 
objectAtIndex:i];

PGSQLRecordset *rs = [connection open:query];
if (rs != nil) {
if (![rs isEOF])
{
if (result != nil)
{
[result release];
result = nil;
}
result = [[NSMutableArray alloc] init];
while (![rs isEOF])
{
[result addObject:[rs 
dictionaryFromRecord]];
[rs moveNext];
}   
}
[rs close]; 

}
}

[connection close];

return result;  
} else {
// setup the error dictionary
}
return nil; 
}

The relevant code is the PGSQLConnection and setting the login  
variables, the connect command, the open command (which returns a  
result set) and the dictionaryFromRecord that returns an NSDictionary  
representation of the current record.


The framework is available as part of the dmg download from www.postgresqlformac.com 
, and though it is not complete, it is usable and I am slowly building  
user friendly documentation.  If you wish, there is a good bit of  
documentation written for it's syntactically similiar  
ODBCKit.framework, that is part of the ODBCKit.  The PGSQLKit does  
have some goodies that I haven't pushed back into ODBCKit, including  
the built in login dialog has intrinsic support fo

Re: Leopard on PPC

2008-03-26 Thread Nick Zitzmann


On Mar 26, 2008, at 2:02 PM, Lorenzo wrote:

actually I get this crash log on the Console

[...]

2   com.apple.CoreFoundation  0x91ea0da0
__CFDictionaryHandleOutOfMemory + 56



How much memory does your application use? 32-bit applications have a  
4 GB VM limit.


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


Re: Question regarding NSDictionary and saving a 'tree structure'

2008-03-26 Thread Hamish Allan
Hi Dirk,

If you want to use an NSTreeController to show your data in an
NSOutlineView, your plist will probably look something like the
following:


http://www.apple.com/DTDs/PropertyList-1.0.dtd";>



name
Day1
children


name
morning
children

purchase1
purchase2
purchase3



name
afternoon
children

purchase4
purchase5





name
Day2
children


name
morning
children

purchase6
purchase7







(You may need the leaves to be something other than strings, but you
can see what the basic structure looks like.)

Then you set up your NSTreeController with "children" as its key path
for children, and bind your NSOutlineView's table column to your tree
controller's arrangedObjects.name. Bind your outline view's content to
the tree controller's arrangedObjects, and bind the tree controller to
the array you got from the plist, and you should see your data.

Best wishes,
Hamish

On Wed, Mar 26, 2008 at 7:50 PM, D. Hoffmann <[EMAIL PROTECTED]> wrote:
> Dear Hamish,
>
>  Thanks for your deep answer.
>  What I've right at the moment is your last given alernative : { key1
>
> => [object2, object3], key4 => [object5, object6] }
>  In other words I save something like :  Day1{key} => morning, noon,
>  evening{3 objects in NSArray}
>
>  What I want to save to plist is : Day1{key or 1st level}=> morning
>  {1st object of second level} => purchase1 {1st object of third level}
>   
>   
> =>purchase2 {2nd object of
>  third level}
>   
>   
> =>purchase3 {3rd object of
>  third level}
>
>   
> => noon {2nd object of second
>  level => purchase4
>   
>   
> =>purchase5..
>
>  I hope, this makes it more understandable. It has to be underlined
>  that purchase 1 to 3 "belong" to morning,   purchase 4 and 5 belong
>  to noon in a sense that if I reload the plist into my application
>  and show them via NSOutlineview, still purchase 1 to 3 is shown below
>  morning, purchase 4 and 5 are shown below noon (of course everything
>  mentioned belongs to Day1.Day2 or Day3 would look similar).
>
>  Do you have an idea how to manage this. Maybe you already told me
>  with the beforementioned but I don't see it at the moment :-)))
>
>  Thanks and regards
>  Dirk
>
>
>
>
>
>
>  Am 26.03.2008 um 19:11 schrieb Hamish Allan:
>
>
>
>  > On Wed, Mar 26, 2008 at 4:07 PM,  <[EMAIL PROTECTED]> wrote:
>  >
>  >>  Now i tried to go one step further for what I need to accomplish,
>  >>  instead of saving 2 levels (the key and the corresponding object) I
>  >>  want to save 3 levels (Key, object and another object linked to the
>  >>  first object).
>  >
>  > It's not quite clear what you mean by "linked to". Do you mean you
>  > want to use two keys to arrive at each object? If so, the objects of
>  > your first dictionary should themselves be dictionaries:
>  >
>  > { key => { key => object, key => object } , key => { key => object,
>  > key => object } }
>  >
>  > Or the keys could be arrays:
>  >
>  > { [key, key] => object, [key, key] => object }
>  >
>  > Or perhaps you mean you want each key to yield two objects? In which
>  > case, the objects of your dictionary should be arrays:
>  >
>  > { key1 => [object2, object3], key4 => [object5, object6] }
>  >
>  > Hamish
>
>
___

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

Please do not post admin re

Re: Leopard on PPC

2008-03-26 Thread Laurent Cerveau
It seems to be debuggable by yourself. Can you start up in XCode on  
PPC? If not you can simply launch the app under gdb and put a  
breakpoint at +[NSDictionary dictionaryWithObjectsAndKeys:] with br.  
From then it would be interesting to check the passed argument (on  
PPC the argument of a method function are in register $r3, $r4, be  
careful that an objective-C call will have implicit $r3 being self and  
$r4 being the selector). You can also also crash and simply go up in  
the backtrace. Then you can find which arguments is bogus (and then why)


HTH

laurent

On Mar 26, 2008, at 9:02 PM, Lorenzo wrote:


Thanks,
actually I get this crash log on the Console

Path:/Applications/MyApp 1.2.3/MyApp.app/Contents/MacOS/ 
MyApp

Identifier:  com.myapp.myapp
Version: 1.2.3 (1.2.3)
Code Type:   PPC (Native)
Parent Process:  launchd [104]

Date/Time:   2008-03-26 20:33:19.245 +0200
OS Version:  Mac OS X 10.5.2 (9C31)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0014
Crashed Thread:  0

Thread 0 Crashed:
0   com.apple.CoreFoundation  0x91ef3354
_CFStringCreateWithFormatAndArgumentsAux + 112
1   com.apple.CoreFoundation  0x91ef33e8  
CFStringCreateWithFormat +

44
2   com.apple.CoreFoundation  0x91ea0da0
__CFDictionaryHandleOutOfMemory + 56
3   com.apple.CoreFoundation  0x91ea2510 __CFDictionaryGrow  
+ 452
4   com.apple.CoreFoundation  0x91ea3830  
CFDictionaryAddValue + 252
5   com.apple.CoreFoundation  0x91ea3f60 CFDictionaryCreate  
+ 104
6   com.apple.CoreFoundation  0x91f37c0c - 
[__NSPlaceholderDictionary

initWithObjects:forKeys:count:] + 972
7   com.apple.CoreFoundation  0x91f3a7d4 +[NSDictionary
dictionaryWithObjectsAndKeys:] + 692
8   com.apple.AppKit  0x9462362c -[NSTableColumn
_postColumnDidResizeNotificationWithOldWidth:] + 384
9   com.myapp.myapp   0x00120d48 0x1000 + 1178952
10  com.myapp.myapp   0x00120b30 0x1000 + 1178416
11  com.apple.AppKit  0x9462f034 -[NSTableView  
numberOfRows]

+ 180
12  com.apple.AppKit  0x94619774 -[NSTableView
_verifySelectionIsOK] + 100
13  com.apple.AppKit  0x946196e8 -[NSTableView
_tileAndRedisplayAll] + 244
14  com.apple.AppKit  0x946193d8 -[NSTableView
setDataSource:] + 260
15  com.apple.AppKit  0x94525a94 -[NSIBObjectData
nibInstantiateWithOwner:topLevelObjects:] + 1048
16  com.apple.AppKit  0x9451d170 loadNib + 224
17  com.apple.AppKit  0x9451cb14 + 
[NSBundle(NSNibLoading)

_loadNibFile:nameTable:withZone:ownerBundle:] + 840
18  com.apple.AppKit  0x9451c6f0 + 
[NSBundle(NSNibLoading)

loadNibNamed:owner:] + 336
19  com.apple.AppKit  0x9451c3d8 NSApplicationMain +  
332

20  com.myapp.myapp   0x2ed8 0x1000 + 7896
21  com.myapp.myapp   0x2bdc 0x1000 + 7132

Thread 0 crashed with PPC Thread State 32:
 srr0: 0x91ef3354  srr1: 0xf030   dar: 0x0014 dsisr:  
0x4000
   r0: 0x91ef334cr1: 0xb060r2: 0x0078r3:  
0x
   r4: 0x0003r5: 0xr6: 0x002cr7:  
0x0e03
   r8: 0xr9: 0x   r10: 0x9308009c   r11:  
0x84044422
  r12: 0x   r13: 0x0021bfa0   r14: 0x   r15:  
0xa09bf4f8
  r16: 0xa099567c   r17: 0x1407f040   r18: 0xa099567c   r19:  
0x
  r20: 0xffdfc070   r21: 0x   r22: 0xa057c174   r23:  
0x
  r24: 0x0002   r25: 0xa057c174   r26: 0x   r27:  
0xb144
  r28: 0x   r29: 0xffdfc030   r30: 0xa058476c   r31:  
0x91ef32ec
   cr: 0x24044422   xer: 0x2000lr: 0x91ef334c   ctr:  
0x92f66970

vrsave: 0x



Best Regards
--
Lorenzo
email: [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Weird NSFontManager Behavior

2008-03-26 Thread Andre Schnoor

Hi All,

hopefully someone can shed a bit light on this strange issue:

[[NSFontManager sharedFontManager]
fontWithFamily: @"Lucida_Grande"
traits: NSUnitalicFontMask | NSBoldFontMask
weight: 0.5
size: 14.0]

delivers the correct font when the application was launched by double- 
clicking on its icon, but returns nil when the app was launched from a  
shell:


/path/to/MyApp.app/Contents/MacOS/mybinary

How can that happen? How is NSFontManager supposed to be influenced by  
the way an application was launched?


Any hint is appreciated.

Andre

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leopard on PPC

2008-03-26 Thread Jonathan Hess

Hey Lorenzo -

Did you remember to pass the trailing nil argument in the argument  
list to -[NSDictionary dictionaryWithObjectsAndKeys:]?


Jon Hess

On Mar 26, 2008, at 1:02 PM, Lorenzo wrote:


Thanks,
actually I get this crash log on the Console

Path:/Applications/MyApp 1.2.3/MyApp.app/Contents/MacOS/ 
MyApp

Identifier:  com.myapp.myapp
Version: 1.2.3 (1.2.3)
Code Type:   PPC (Native)
Parent Process:  launchd [104]

Date/Time:   2008-03-26 20:33:19.245 +0200
OS Version:  Mac OS X 10.5.2 (9C31)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0014
Crashed Thread:  0

Thread 0 Crashed:
0   com.apple.CoreFoundation  0x91ef3354
_CFStringCreateWithFormatAndArgumentsAux + 112
1   com.apple.CoreFoundation  0x91ef33e8  
CFStringCreateWithFormat +

44
2   com.apple.CoreFoundation  0x91ea0da0
__CFDictionaryHandleOutOfMemory + 56
3   com.apple.CoreFoundation  0x91ea2510 __CFDictionaryGrow  
+ 452
4   com.apple.CoreFoundation  0x91ea3830  
CFDictionaryAddValue + 252
5   com.apple.CoreFoundation  0x91ea3f60 CFDictionaryCreate  
+ 104
6   com.apple.CoreFoundation  0x91f37c0c - 
[__NSPlaceholderDictionary

initWithObjects:forKeys:count:] + 972
7   com.apple.CoreFoundation  0x91f3a7d4 +[NSDictionary
dictionaryWithObjectsAndKeys:] + 692
8   com.apple.AppKit  0x9462362c -[NSTableColumn
_postColumnDidResizeNotificationWithOldWidth:] + 384
9   com.myapp.myapp   0x00120d48 0x1000 + 1178952
10  com.myapp.myapp   0x00120b30 0x1000 + 1178416
11  com.apple.AppKit  0x9462f034 -[NSTableView  
numberOfRows]

+ 180
12  com.apple.AppKit  0x94619774 -[NSTableView
_verifySelectionIsOK] + 100
13  com.apple.AppKit  0x946196e8 -[NSTableView
_tileAndRedisplayAll] + 244
14  com.apple.AppKit  0x946193d8 -[NSTableView
setDataSource:] + 260
15  com.apple.AppKit  0x94525a94 -[NSIBObjectData
nibInstantiateWithOwner:topLevelObjects:] + 1048
16  com.apple.AppKit  0x9451d170 loadNib + 224
17  com.apple.AppKit  0x9451cb14 + 
[NSBundle(NSNibLoading)

_loadNibFile:nameTable:withZone:ownerBundle:] + 840
18  com.apple.AppKit  0x9451c6f0 + 
[NSBundle(NSNibLoading)

loadNibNamed:owner:] + 336
19  com.apple.AppKit  0x9451c3d8 NSApplicationMain +  
332

20  com.myapp.myapp   0x2ed8 0x1000 + 7896
21  com.myapp.myapp   0x2bdc 0x1000 + 7132

Thread 0 crashed with PPC Thread State 32:
 srr0: 0x91ef3354  srr1: 0xf030   dar: 0x0014 dsisr:  
0x4000
   r0: 0x91ef334cr1: 0xb060r2: 0x0078r3:  
0x
   r4: 0x0003r5: 0xr6: 0x002cr7:  
0x0e03
   r8: 0xr9: 0x   r10: 0x9308009c   r11:  
0x84044422
  r12: 0x   r13: 0x0021bfa0   r14: 0x   r15:  
0xa09bf4f8
  r16: 0xa099567c   r17: 0x1407f040   r18: 0xa099567c   r19:  
0x
  r20: 0xffdfc070   r21: 0x   r22: 0xa057c174   r23:  
0x
  r24: 0x0002   r25: 0xa057c174   r26: 0x   r27:  
0xb144
  r28: 0x   r29: 0xffdfc030   r30: 0xa058476c   r31:  
0x91ef32ec
   cr: 0x24044422   xer: 0x2000lr: 0x91ef334c   ctr:  
0x92f66970

vrsave: 0x



Best Regards
--
Lorenzo
email: [EMAIL PROTECTED]

___

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/jhess%40apple.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSMatrix

2008-03-26 Thread Erik Buck
Wow!  Dave Hersey wrote a very detailed and comprehensive post that must have 
taken a long time.  Sadly, I disagree with almost all of it.

NSMatrix is an "older" class that predates the "data source" design pattern 
that emerged (i think) in NeXTstep 3.0 in about 1994 as I recall.  I think 
NSMatrix was in Nextstep 0.8 in 1988.

I highly discourage sub-classing NSMatrix.

To use NSMatrix...
Before adding any rows or columns to your matrix, set it's cell class with 
setCellClass: or its prototype cell with – setPrototype: but don't do both.

Add rows with – addRow and add columns with -addColumn until you have enough 
cells for all of your data.  Then loop through the rows and columns calling – 
cellAtRow:column: and configuring each cell based on your data.



The better approach is to use NSCollectionView in Leopard. 
http://developer.apple.com/documentation/Cocoa/Reference/NSCollectionView_Class/Introduction/Introduction.html

NSCollectionView is much more flexible and more supportive of MVC design using 
less overall code.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [ANN] RegexKitLite

2008-03-26 Thread Daniel Staal
--As of March 23, 2008 1:16:47 PM -0400, John Engelhart is alleged to have 
said:



I've just released what I'm calling 'RegexKitLite'.  It targets a
different group of people than the full fledged RegexKit
(http://regexkit.sourceforge.net/).


--As for the rest, it is mine.

Nice.  Though I'd rather 'RKLMatchEnumerator' (or similar functionality, 
even just a method that returned an array of ranges) were rolled into the 
main distribution, instead of being stuck in an 'example' file.  A common 
regex case is to split a string into sub-strings based on some arbitrary 
division points, and having a quick way to get _all_ of them is worth a bit.


Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSMatrix

2008-03-26 Thread Dave Hersey

Hi Erik,

NSCollectionView is great if you have it, but if you're still coding  
for pre-10.5 it doesn't help.


What is it that you disagree with specifically?

Before adding any rows or columns to your matrix, set it's cell  
class with setCellClass: or its prototype cell with – setPrototype:  
but don't do both.



The prototype cell was set in the initWithFrame in my example.

Before adding any rows or columns to your matrix, set it's cell  
class with setCellClass: or its prototype cell with – setPrototype:  
but don't do both.


Add rows with – addRow and add columns with -addColumn until you  
have enough cells for all of your data.  Then loop through the rows  
and columns calling – cellAtRow:column: and configuring each cell  
based on your data.


This is what's going on in the rebuildThumbnailMatrix class I mentioned.

For all but the most simplistic of tasks, I think you'll end up  
subclassing NSMatrix and the cell class to customize the behavior and  
look. If you're talking about a matrix of buttons or static items that  
doesn't change or resize, fine, but anything more involved requires  
subclassing. Drag and Drop support alone requires an NSMatrix subclass.


If you want to deal with live resizing, you need to subclass as well.  
I think there are lots of reasons to work with an NSMatrix subclass.  
Why do you highly discourage it?


- d

On Mar 26, 2008, at 4:42 PM, Erik Buck wrote:
Wow!  Dave Hersey wrote a very detailed and comprehensive post that  
must have taken a long time.  Sadly, I disagree with almost all of it.


NSMatrix is an "older" class that predates the "data source" design  
pattern that emerged (i think) in NeXTstep 3.0 in about 1994 as I  
recall.  I think NSMatrix was in Nextstep 0.8 in 1988.


I highly discourage sub-classing NSMatrix.

To use NSMatrix...
Before adding any rows or columns to your matrix, set it's cell  
class with setCellClass: or its prototype cell with – setPrototype:  
but don't do both.


Add rows with – addRow and add columns with -addColumn until you  
have enough cells for all of your data.  Then loop through the rows  
and columns calling – cellAtRow:column: and configuring each cell  
based on your data.




The better approach is to use NSCollectionView in Leopard. 
http://developer.apple.com/documentation/Cocoa/Reference/NSCollectionView_Class/Introduction/Introduction.html

NSCollectionView is much more flexible and more supportive of MVC  
design using less overall code.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Windows networking API

2008-03-26 Thread Kyle Sluder
On Tue, Mar 25, 2008 at 11:41 AM, Robert Claeson
<[EMAIL PROTECTED]> wrote:
> Is there an API/framework to interface with the SMB/Samba/Windows
>  networking functionality of OS X?

Just to clarify for posterity, these are two separate topics.  SMB
(aka CIFS), of which Samba is an implementation, is a network
filesystem protocol.  Windows Networking in the post WinNT world is
Active Directory, which is an implementation of (among other things)
LDAP, a hierarchical data storage and retrieval protocol, and
Kerberos, a token-passing authentication scheme.  OS X also implements
LDAP and Kerberos, but calls it Open Directory.

Now as for your question, look into CBIdentity, CBIdentityAuthority
(from the Collaboration framework) and
CSIdentityQueryCreateForCurrentUser (part of Core Services Identity
API).  These will be able to do what you want against all bound
directory servers.

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


How to get current renderer for an NSOpenGLView?

2008-03-26 Thread Duncan Champney
I need to find out the amount of total VRAM and available VRAM in the  
current renderer before creating a large renderbuffer object, to make  
sure I don't choke the system in doing it.


I know how to find the current renderer for a given display, but I  
want the current renderer for my NSOpenGLView. I can get to the core  
graphics context like this:


   //code is from my NSOpenGLView object, so self refers to an  
NSOpenGLView

   NSOpenGLContext* theContext = [self openGLContext];
   void* the_CGLContext = [theContext CGLContextObj];

But that still doesn't get me to the renderer. What I want to to is  
get a handle to the current renderer's CGLRendererInfoObj, then use  
the call:


CGLDescribeRenderer (theRendererInfoObj, theRendererInex,  
kCGLRPVideoMemory,

 &deviceVRAM);

But I can't for the life of me figure out how to get from my  
NSOpenGLView to the renderer's CGLRendererInfoObj. I don't want to  
assume that the openGL view is on the main display, as all the example  
code I can find does.


Can somebody help me here? I'm going in circles with the  
documentation, and can't find an answer to this.




Thanks,

Duncan C
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Ephemeral Changes

2008-03-26 Thread Graham Cox
The undo manager will directly change the data in the text view using  
an invocation or target/action - it doesn't go back through  
changeFont: normally, which is really a "high level" method.


Maybe the solution to this is to subclass NSUndoManager so that you  
can hook into the undo and redo methods and use those opportunities to  
modify the change count of the document. Since the undo manager itself  
is the central object where the various invocations are collected,  
it's going to be a lot easier to handle things there than to try and  
trap all the individual invocations or method calls that it makes.


You can switch the document's undo manager early in the document  
creation sequence.


--
S.O.S.

P.S. - I've done a lot of work with Undo lately, and really  
understanding it takes some effort, especially if you need to do  
something even slightly non-standard, so good luck!



On 26 Mar 2008, at 9:26 pm, Gerriet M. Denkmann wrote:
I also can use Edit  ► Undo Set (or Paste) Font but now the  
document gets dirty. Very bad. Also: the complete text gets selected.
So what else do I have to implement? I tried setFont: and  
setFont:range:, but these seem never to be called.

How does the NSUndoManager undo my font changes?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing the line height of an NSTextField?

2008-03-26 Thread Nicholas J Humfrey
Ah, interesting, thanks for this tip. As a note for anyone else who  
wants to try and do this:


In the end I subclased the NSTextField class and overrid the drawRect  
function. I then split the string up into its lines and drew them  
myself using drawRect. This is some of the first Cocoa code I have  
written, so please don't hurt me if what I am doing is crazy!



-(void)drawRect:(NSRect)r
{
	NSArray *lines = [[self stringValue]  
componentsSeparatedByString:@"\n"];

NSDictionary* attributes = [self textAttributes];
int n;

// Use a black pen to draw the text
[[NSColor blackColor] set];

// Draw the text to the view, line by line
for (n=0; n<[lines count]; n++) {
NSString *line = [lines objectAtIndex:n];
NSPoint point;
point.x = 0;
point.y = (n*10);

// Should the text be centered?
if ([self alignment] == NSCenterTextAlignment) {
NSSize size = [line sizeWithAttributes:attributes];
point.x += (r.size.width - size.width)/2;
}

// Draw it!
[line drawAtPoint: point withAttributes: attributes];
}
}


On 26 Mar 2008, at 16:58, John Stiles wrote:
I've found that adjusting the font matrix to include a negative Y  
transformation has the effect of decreasing the line height. This  
seemed like a bug to me when I discovered it, since I just wanted  
the text to be translated upwards in its cell, not shrink the line  
height. I wasn't sure if it was a bug or desired functionality. If  
this is the correct behavior, it's one way to do it.



Nicholas J Humfrey wrote:


Hello Cocoa Developers,

I am trying to squeeze an extra line of text into a multiline  
NSTextField, but I can't work out how to adjust the line height?  
What is the easiest way of adjusting this?



The purpose of this is that I'm actually using several NSTextFields  
on an NSView to lay text out for printing on to a sheet of labels,  
which has been working out very nicely up until this point! Perhaps  
there is a better way of doing this?



Thanks,

nick.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing the line height of an NSTextField?

2008-03-26 Thread Douglas Davidson


On Mar 26, 2008, at 3:10 PM, Nicholas J Humfrey wrote:

In the end I subclased the NSTextField class and overrid the  
drawRect function. I then split the string up into its lines and  
drew them myself using drawRect. This is some of the first Cocoa  
code I have written, so please don't hurt me if what I am doing is  
crazy!


Well, what you're doing is using only explicit line breaks, rather  
than allowing wrapping, and you're taking into account only \n as a  
line separator, rather than handling all of the line and paragraph  
break characters.  What you're doing will work, more or less, but it's  
not sufficiently general to be a real solution.


I missed the initial question, but in general line heights are  
controlled by an NSParagraphStyle, which is used as the value of the  
NSParagraphStyleAttributeName attribute.  This is the same object that  
controls most paragraph-level styling, including line breaking,  
alignment, etc.


Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSPersistentDocument Revert Question

2008-03-26 Thread Mike Burns

Hello list,

I'm having trouble tracking down what I would think to be a simple  
answer for a simple question:


In my NSPersistentDocument based application (10.4), selecting  
'revert' from the file menu creates new window controllers (I assume  
it is just re-opening the original document), but it doesn't  
deallocate the old window controllers from the document that was  
edited pre-revert.  This creates a ton of "'entityForName' could not  
locate an NSManagedObjectModel" error's due to the fact that the  
document these window controllers were retained in no longer exists.   
Am I doing something strange or do I need to manually deallocate my  
window controllers in my NSPersitentDocuments' revert override?


Thanks,
Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Changing the line height of an NSTextField?

2008-03-26 Thread Nicholas J Humfrey


On 26 Mar 2008, at 22:17, Douglas Davidson wrote:


On Mar 26, 2008, at 3:10 PM, Nicholas J Humfrey wrote:

In the end I subclased the NSTextField class and overrid the  
drawRect function. I then split the string up into its lines and  
drew them myself using drawRect. This is some of the first Cocoa  
code I have written, so please don't hurt me if what I am doing is  
crazy!


Well, what you're doing is using only explicit line breaks, rather  
than allowing wrapping, and you're taking into account only \n as a  
line separator, rather than handling all of the line and paragraph  
break characters.  What you're doing will work, more or less, but  
it's not sufficiently general to be a real solution.


Yes. It certainly isn't a real/generic solution. In this case I  
actually wanted the lines to clip, rather than wrap if the user hadn't  
explicitly sorted them out previously in the application.



I missed the initial question, but in general line heights are  
controlled by an NSParagraphStyle, which is used as the value of the  
NSParagraphStyleAttributeName attribute.  This is the same object  
that controls most paragraph-level styling, including line breaking,  
alignment, etc.



Ah, cool, thanks. Not sure why I didn't find that with Google!


nick.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leopard on PPC

2008-03-26 Thread Lorenzo
Hi Laurent,
I am going to debug and let you know. Right now I have found these lines.
Might they cause the trouble on Leopard && PPC?

number = CFNumberCreate(NULL, kCFNumberFloatType, &destSize.width);
options = [NSDictionary dictionaryWithObjectsAndKeys:
(id) kCFBooleanTrue,   (id) kCGImageSourceShouldCache,
(id) kCFBooleanTrue,   (id)
kCGImageSourceCreateThumbnailFromImageIfAbsent,
(id) number,   (id) kCGImageSourceThumbnailMaxPixelSize,
NULL];



options = [NSDictionary dictionaryWithObjectsAndKeys:
(id) kCFBooleanTrue,(id) kCGImageSourceShouldCache,
(id) kCFBooleanTrue,(id) kCGImageSourceShouldAllowFloat,
NULL];


Best Regards
-- 
Lorenzo
email: [EMAIL PROTECTED]

> From: Laurent Cerveau <[EMAIL PROTECTED]>
> Date: Wed, 26 Mar 2008 21:29:45 +0100
> To: Lorenzo <[EMAIL PROTECTED]>
> Cc: "cocoa-dev@lists.apple.com" , Jean-Daniel Dupas
> <[EMAIL PROTECTED]>
> Subject: Re: Leopard on PPC
> 
> It seems to be debuggable by yourself. Can you start up in XCode on
> PPC? If not you can simply launch the app under gdb and put a
> breakpoint at +[NSDictionary dictionaryWithObjectsAndKeys:] with br.
> From then it would be interesting to check the passed argument (on
> PPC the argument of a method function are in register $r3, $r4, be
> careful that an objective-C call will have implicit $r3 being self and
> $r4 being the selector). You can also also crash and simply go up in
> the backtrace. Then you can find which arguments is bogus (and then why)
> 
> HTH
> 
> laurent
> 
> On Mar 26, 2008, at 9:02 PM, Lorenzo wrote:
> 
>> Thanks,
>> actually I get this crash log on the Console
>> 
>> Path:/Applications/MyApp 1.2.3/MyApp.app/Contents/MacOS/
>> MyApp
>> Identifier:  com.myapp.myapp
>> Version: 1.2.3 (1.2.3)
>> Code Type:   PPC (Native)
>> Parent Process:  launchd [104]
>> 
>> Date/Time:   2008-03-26 20:33:19.245 +0200
>> OS Version:  Mac OS X 10.5.2 (9C31)
>> Report Version:  6
>> 
>> Exception Type:  EXC_BAD_ACCESS (SIGBUS)
>> Exception Codes: KERN_PROTECTION_FAILURE at 0x0014
>> Crashed Thread:  0
>> 
>> Thread 0 Crashed:
>> 0   com.apple.CoreFoundation  0x91ef3354
>> _CFStringCreateWithFormatAndArgumentsAux + 112
>> 1   com.apple.CoreFoundation  0x91ef33e8
>> CFStringCreateWithFormat +
>> 44
>> 2   com.apple.CoreFoundation  0x91ea0da0
>> __CFDictionaryHandleOutOfMemory + 56
>> 3   com.apple.CoreFoundation  0x91ea2510 __CFDictionaryGrow
>> + 452
>> 4   com.apple.CoreFoundation  0x91ea3830
>> CFDictionaryAddValue + 252
>> 5   com.apple.CoreFoundation  0x91ea3f60 CFDictionaryCreate
>> + 104
>> 6   com.apple.CoreFoundation  0x91f37c0c -
>> [__NSPlaceholderDictionary
>> initWithObjects:forKeys:count:] + 972
>> 7   com.apple.CoreFoundation  0x91f3a7d4 +[NSDictionary
>> dictionaryWithObjectsAndKeys:] + 692
>> 8   com.apple.AppKit  0x9462362c -[NSTableColumn
>> _postColumnDidResizeNotificationWithOldWidth:] + 384
>> 9   com.myapp.myapp   0x00120d48 0x1000 + 1178952
>> 10  com.myapp.myapp   0x00120b30 0x1000 + 1178416
>> 11  com.apple.AppKit  0x9462f034 -[NSTableView
>> numberOfRows]
>> + 180
>> 12  com.apple.AppKit  0x94619774 -[NSTableView
>> _verifySelectionIsOK] + 100
>> 13  com.apple.AppKit  0x946196e8 -[NSTableView
>> _tileAndRedisplayAll] + 244
>> 14  com.apple.AppKit  0x946193d8 -[NSTableView
>> setDataSource:] + 260
>> 15  com.apple.AppKit  0x94525a94 -[NSIBObjectData
>> nibInstantiateWithOwner:topLevelObjects:] + 1048
>> 16  com.apple.AppKit  0x9451d170 loadNib + 224
>> 17  com.apple.AppKit  0x9451cb14 +
>> [NSBundle(NSNibLoading)
>> _loadNibFile:nameTable:withZone:ownerBundle:] + 840
>> 18  com.apple.AppKit  0x9451c6f0 +
>> [NSBundle(NSNibLoading)
>> loadNibNamed:owner:] + 336
>> 19  com.apple.AppKit  0x9451c3d8 NSApplicationMain +
>> 332
>> 20  com.myapp.myapp   0x2ed8 0x1000 + 7896
>> 21  com.myapp.myapp   0x2bdc 0x1000 + 7132
>> 
>> Thread 0 crashed with PPC Thread State 32:
>>  srr0: 0x91ef3354  srr1: 0xf030   dar: 0x0014 dsisr:
>> 0x4000
>>r0: 0x91ef334cr1: 0xb060r2: 0x0078r3:
>> 0x
>>r4: 0x0003r5: 0xr6: 0x002cr7:
>> 0x0e03
>>r8: 0xr9: 0x   r10: 0x9308009c   r11:
>> 0x84044422
>>   r12: 0x   r13: 0x0021bfa0   r14: 0x   r15:
>> 0xa09bf4f8
>>   r16: 0xa099567c   r17: 0x1407f040   r18: 0xa099567c   r19:
>> 0x
>>   r20: 0xffdfc070   r21: 0x   r22: 0xa057c174   r23:
>> 0x
>>   r24: 0x0002   r25: 0xa057c174   r26: 0x   r27:
>> 0xb144
>>   r28: 0x   r29: 0xffdfc030   r30: 0xa058476c   r31:

Re: Simple Out-of-Box Demo: Private Framework Crashes in 10.3.9

2008-03-26 Thread Jerry Krinock

I found a workaround.  First, I'll answer Greg's questions

On 2008 Mar, 25, at 22:39, Greg Parker wrote:

Don't add +initialize in a category. The category's method will  
replace any present in the original class, which could break that  
class.


Agreed.  As I said, I just wanted to "apply pressure" to see if  
anything interesting popped up.



What happens if you compile your code with -fno-constant-cfstrings?


Setting, in "Other C Flags", -fno-constant-cfstrings, recompiling and  
running in 10.3.9,

   Setting this flag in the main app only , no effect.  Still crashes
  upon executing -[NSDictionary setObject:forKey].
   Setting this flag in both the main app and the framework, it makes
  things worse.  Now it crashes immediately upon sending the
  +crashMe to the framework, or possibly at NSLog(@"checkpoint 1").
  It never even gets to -[NSDictionary setObject:forKey].

What happens if you copy the contents +crashMe into - 
applicationDidFinishLaunching: , and omit the call to +crashMe  
completely?


This executes OK with no crash.

What happens if you do the above, and also delete your NSString  
category?


Did not try this test because it is obviated by the previous test  
result.


What happens if you call `[@"name" copyWithZone:NULL]` directly,  
from either +crashMe or -applicationDidFinishLaunching:


I de-activated -fno-constant-cfstrings so the framework would execute  
again.

Results:
   In the main app, in -applicationDidFinishLaunching, no crash.
   In the framework, in +crashMe, [@"name" copyWithZone:NULL] causes  
a crash.


*

Now, the workaround...

(1) Add the following class to my framework:

   @implementation PantherFixer
  + (void)fix { }   
   @end

(2) In the main app, first line in -applicationDidFinishLaunching, add

   [PantherFixer fix] ;

Result: Subsequently invoking +crashMe no longer causes a crash.   
Applying these two steps to my real app fixes the problem in my real  
app too.


My hypothesis is: A bug in Mac OS 10.3 which causes a crash when  
frameworked code in a Cocoa category executes before any "regular"  
code in that framework executes.  It's as though the framework is  
lazily wired up to Cocoa when needed, but if the need is from a  
category method, it gets wired wrong, particularly to NSString.


Indeed the above trigger would be a rather rare occurrence in the  
world, so not many people noticed.  Either it was one of the thousands  
of unspecified bugs fixed in Tiger, or it got fixed by accident when  
the "class cluster" magic got reworked for Tiger.


Thanks again to Greg and everyone who read this.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Is it possible to change color of NSBox Title?

2008-03-26 Thread Samvel

Hello,

I have created a NSPanel in Interface Builder and added NSBox. It  
looks nice except NSBox Title written in black color on dark  
background of NSPanel. Is it possible to change color either in  
Interface Builder or with code (say in awakeFromNib)?


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


Re: Leopard on PPC

2008-03-26 Thread Sherm Pendley
On Wed, Mar 26, 2008 at 7:04 PM, Lorenzo <[EMAIL PROTECTED]> wrote:

> Hi Laurent,
> I am going to debug and let you know. Right now I have found these lines.
> Might they cause the trouble on Leopard && PPC?
>
>number = CFNumberCreate(NULL, kCFNumberFloatType, &destSize.width);
>options = [NSDictionary dictionaryWithObjectsAndKeys:
>(id) kCFBooleanTrue,   (id) kCGImageSourceShouldCache,
>(id) kCFBooleanTrue,   (id)
>kCGImageSourceCreateThumbnailFromImageIfAbsent,
>(id) number,   (id)
> kCGImageSourceThumbnailMaxPixelSize,
>NULL];
>
>
>
>options = [NSDictionary dictionaryWithObjectsAndKeys:
>(id) kCFBooleanTrue,(id) kCGImageSourceShouldCache,
>(id) kCFBooleanTrue,(id) kCGImageSourceShouldAllowFloat,
>NULL];


I'm deeply suspicious of those typecast CFBoolRefs. Not every Core
Foundation class is toll-free bridged. CFNumber is, but I don't see any
indication in the CF reference that CFBoolean is. Have you tried using
NSNumber objects instead of those kCFBooleanTrue constants?

sherm--
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSLayoutManager & Non-Contiguous Layout

2008-03-26 Thread Jonathan Dann

Hi Guys,

I'm using non-contiguous layout in one of my text views and I keep  
getting this strange drawing error when I scroll quickly just after  
the document has loaded:


http://flickr.com/photos/jonathandann/2364567591/

I have a method that highlights syntax by getting the visible  
character range in the scroll view and setting some temporary  
attributes to the text.  When that is never called, this drawing bug  
(is it invalidation of glyphs?) doesn't happen.  I've tried all the  
different variations on the ensureLayout and placed them everywhere I  
can think of I'm even getting the -didCompleteLayout. method sent  
to my layout manager's delegate.


When this happens if I switch apps I see the view fix the drawing, the  
same happens if I scroll a tiny bit more after I see this.  Calling - 
display and -displayIfNeeded on the textView after setting the  
temporary attributes doesn't work either. Does anybody have any  
experience with this issue, I'm at a loss.


Thanks in advance,

Jonathan

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Getting a list of all classes, etc...

2008-03-26 Thread Graham Cox
Is there a way to obtain from the runtime a list of all classes that  
are subclasses of a given class, or failing that, a list of all  
classes that I can iterate and test with isKindOfClass:?


--
S.O.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


CoreAnimation weird problems with NSView animator

2008-03-26 Thread Milen Dzhumerov

Hi all,

I've been playing with CA today and encountered some weird problems.  
Firstly, I tested setHidden: on an animator on a NSSegmentedView and  
it worked fine - it gets faded in/out. Now, all the problems I  
encountered happen in another NIB file. I've got the following piece  
of code (in a controller):


[self.generalView setHidden:YES];
[self.window setContentView:self.generalView];
[[self.generalView animator] setHidden:NO];

I expect this to animate the view but it doesn't happen - no animation  
goes on. I've made sure that all NSView's want layers. I also noticed  
some other unusual problems

with the said NIB:
- Animations work on a random basis (CA animations)
- If I attach an outlet to a particular NSPopUpButton, it disappears.  
Removing the outlet makes it appear again


I think I'm missing some setup here but I cannot figure out exactly  
what it is. The NIB (saved as a XIB) was created from scratch (i.e.,  
not included in a project template) but I can't see how this can be a  
problem. Any help is greatly appreciated.


M
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting a list of all classes, etc...

2008-03-26 Thread Sherm Pendley
On Wed, Mar 26, 2008 at 10:01 PM, Graham Cox <[EMAIL PROTECTED]> wrote:

> Is there a way to obtain from the runtime a list of all classes that
> are subclasses of a given class, or failing that, a list of all
> classes that I can iterate and test with isKindOfClass:?


Here's the function I use in CamelBones to iterate through all registered
classes. It hasn't been updated to Leopard's new ObjC 2.0 runtime yet, but
neither have most Mac users. :-)

// Create Perl wrappers for all registered ObjC classes
void REAL_CBWrapRegisteredClasses(void) {
int numClasses;
Class *classes;
int i;

classes = NULL;
numClasses = objc_getClassList(NULL, 0);
if (numClasses > 0) {
classes = malloc(sizeof(Class) * numClasses);
objc_getClassList(classes, numClasses);
for(i=0; i < numClasses; i++) {
REAL_CBWrapObjectiveCClass(classes[i]);
}
free(classes);
}
}

sherm--
___

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

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

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

This email sent to [EMAIL PROTECTED]


Core Data/IB questions

2008-03-26 Thread Rick Mann
I'm following the NSPersistentDocument Core Data tutorial, but  
changing things for my little app along the way. For example, instead  
of Employees and Departments, I have TrackPoints and Tracks (GPS  
tracks).


After following a portion of the tutorial, I got a nice little master/ 
detail view, with a table of tracks I can add to, and edit, etc. The  
tutorial suggested looking at the various connections in IB to get an  
idea of how it wired together. I used the Core Data Entity doohickie  
in IB to build the master-detail view for me.


Question 1: Is there any way to see, at a glance, all the  
interconnections in a .xib file at once?


The next thing I did was add another master/detail view (in the same  
window) for the Track entity. What I'd like it to do is, when a track  
is selected in the track list, show the points belonging to that track  
in the Track Point list.


Question 2: I can see how a text field gets populated when you select  
an item in the table. How can I get a one table to populate based on  
the selection in another?


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


uncaught breakpoint

2008-03-26 Thread Roland Silver
I have a breakpoint set for the statement after an NSLog statement.  
When I run the program under debugging, the NLog statement is  
executed, but the program doesn't stop at the breakpoint.


How come?

Roland Silver
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: uncaught breakpoint

2008-03-26 Thread Dave Hersey

Could be a lot of things. Do any of your breakpoints work?

Some things that might help are to make sure you're debug format is  
set to DWARF in the target build prefs and "Load symbols lazily" is  
off in the Xcode Debugging prefs. And of course that you're running a  
debug build...


- d

On Mar 26, 2008, at 11:15 PM, Roland Silver wrote:
I have a breakpoint set for the statement after an NSLog statement.  
When I run the program under debugging, the NLog statement is  
executed, but the program doesn't stop at the breakpoint.


How come?

Roland Silver
[EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Streaming Images between Cocoa Touch and Pure Java

2008-03-26 Thread Liviu Constantinescu

Good afternoon, everyone.

I'm a bit new to Cocoa Touch programming, and I haven't done any work  
with Cocoa for a while, so I would like some advice regarding the  
right API objects, etc. to use, if anyone is able to help:


If I want to transmit a JPEG between a Java application using a  
BufferedImage object and a Cocoa Touch app's UIImageView, what would  
be the easiest, most direct way to code that?


ie. I'm mostly asking what kind of Socket objects to use, and how I  
could re-create the image Cocoa-side so as to be able to display it in  
the UIImageView.


Thanks in advance,

-- Liviu
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Streaming Images between Cocoa Touch and Pure Java

2008-03-26 Thread Andrew Farmer

On 26 Mar 08, at 20:51, Liviu Constantinescu wrote:
I'm a bit new to Cocoa Touch programming, and I haven't done any  
work with Cocoa for a while, so I would like some advice regarding  
the right API objects, etc. to use, if anyone is able to help:


If I want to transmit a JPEG between a Java application using a  
BufferedImage object and a Cocoa Touch app's UIImageView, what would  
be the easiest, most direct way to code that?


The first rule of Cocoa Touch is "you don't talk about Cocoa Touch".

(Remember that NDA you clicked through to download the SDK? Yeah.)
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting a list of all classes, etc...

2008-03-26 Thread Graham Cox
What's the correct file to include to obtain these functions? I  
thought it would come along with , but I'm  
getting the following:


: error: implicit declaration of function 'objc_getClassList'

Also, I'm trying to heed the warning in the docs that state:

"You cannot assume that class objects you get from this function are  
classes that inherit from NSObject, so you cannot safely call any  
methods on such classes without detecting that the method is  
implemented first."


So I need a way to test the resulting Classes to see if they really do  
derive from NSObject. What's a good (safe) way to do that? I'm trying  
to compare the result of class_getSuperclass with [NSObject class],  
but I'm not sure this is right.


--
S.O.S.


On 27 Mar 2008, at 1:19 pm, Sherm Pendley wrote:
On Wed, Mar 26, 2008 at 10:01 PM, Graham Cox  
<[EMAIL PROTECTED]> wrote:

Is there a way to obtain from the runtime a list of all classes that
are subclasses of a given class, or failing that, a list of all
classes that I can iterate and test with isKindOfClass:?

Here's the function I use in CamelBones to iterate through all  
registered classes. It hasn't been updated to Leopard's new ObjC 2.0  
runtime yet, but neither have most Mac users. :-)


// Create Perl wrappers for all registered ObjC classes
void REAL_CBWrapRegisteredClasses(void) {
int numClasses;
Class *classes;
int i;

classes = NULL;
numClasses = objc_getClassList(NULL, 0);
if (numClasses > 0) {
classes = malloc(sizeof(Class) * numClasses);
objc_getClassList(classes, numClasses);
for(i=0; i < numClasses; i++) {
REAL_CBWrapObjectiveCClass(classes[i]);
}
free(classes);
}
}

sherm--



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting a list of all classes, etc...

2008-03-26 Thread Graham Cox
I should also mention I need something that will work on 10.4+ -  
looking at the latest docs I'm wondering if this function is 10.5  
only, though it does not say so.


--
S.O.S.


On 27 Mar 2008, at 3:01 pm, Graham Cox wrote:
What's the correct file to include to obtain these functions? I  
thought it would come along with , but I'm  
getting the following:


: error: implicit declaration of function 'objc_getClassList'


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting a list of all classes, etc...

2008-03-26 Thread Graham Cox
Thanks, that was it (docs not explicit on this point, saying the file  
is called "runtime.h" or "/usr/include/objc/runtime.h"). I guess  
something changed since it was written.



---

However, having got it compiling, I think it's a blind alley anyway.  
Maybe if I can explain WHY I'm trying to do this a better solution  
might pop up ;-)


I have a class that can contain different objects which all derive  
from a class R. The container can accept instances of any subclass of R.


Each subclass of R implements a CLASS method for a particular feature,  
returning an array. The container needs to build an array which is the  
union of all the arrays returned by each subclass. Thus it needs to  
iterate through a list of all possible subclasses of R, combining the  
arrays as it goes. Problem is that not all possible subclasses of R  
are known until runtime, so I need a way to be able to get hold of  
such a list, based on the fact that they all inherit from R. Note that  
these are not instances of R, but classes. (I can get a list of  
instances I have right now, but that doesn't cover the possibility of  
another object instance derived from R being added after I already  
built the array).


Hope this makes sense - any ideas?


--
S.O.S.

On 27 Mar 2008, at 3:12 pm, Jerry Krinock wrote:

#import 


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: uncaught breakpoint

2008-03-26 Thread Roland Silver

Here's a bit of the code. Ssignal
-
double t = getTime();
double dt = 1.0/inSampleRate;
// mNumberBuffers is the same as the kNumChannels
UInt32 frame;
StereoSignal ssignal; //a StereoSignal is a struct with two fields  
(doubles), left and right

for (frame = 0; frame < inFrames; ++frame) {
  // generate inFrames 32-bit floats
  ssignal = (signalType ? getSineSignal(t) : getPieceSignal(t));
  ssignal.left = 1.0;
  double ssignalLeft = ssignal.left * plangency * 32768. + 0.5;
  SInt16 ssignalLeftInt = ssignalLeft;
  NSLog(@"ssignal.left=%g, ssignalLeft=%g, ssignalLeftInt=%i",  
ssignal.left, ssignalLeft, ssignalLeftInt);

  ((SInt16*)((&(ioData->mBuffers[0]))->mData))[frame] =
(SInt16)(ssignal.left * plangency * 32768. + 0.5);  
  ((SInt16*)((&(ioData->mBuffers[1]))->mData))[frame] =
(SInt16)(ssignal.right * plangency * 32768. + 0.5); 
  t += dt;
} //end for
-
On 2008Mar26, at 21:19, Aaron Jones wrote:

Why don't you post the code that we can see what you're talking  
about and if its syntax


AJ Jones
Apple Inc.
Software Quality Engineer - Sync Services

Sent from my iPhone

On Mar 26, 2008, at 8:15 PM, Roland Silver <[EMAIL PROTECTED]>  
wrote:


I have a breakpoint set for the statement after an NSLog statement.  
When I run the program under debugging, the NLog statement is  
executed, but the program doesn't stop at the breakpoint.


How come?

Roland Silver
[EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data & Sheet problem

2008-03-26 Thread William Turner
You might want to look at the commitEditing method for the  
NSController subclasses - this pushes any pending changes to the  
underlying model. In your case, you would probably invoke that on the  
tree controller that provides your outline view content right before  
ordering the sheet out.


Wil

On Mar 25, 2008, at 5:21 AM, Jeff LaMarche wrote:

Never mind. I got it working. When you reach a certain point, you  
should just walk away from a problem I guess Setting the sheet's  
first responder to nil is now working, but I do it when the button  
is pressed, not in my sheet callback method.



On Mar 25, 2008, at 7:59 AM, Jeff LaMarche wrote:

Okay, I know I've had this problem before a couple of years ago  
when Core Data was fairly new, but searching the archives didn't  
turn anything up and I think I've just been looking at it too long  
- it's probably something really obvious, but...  I have a custom  
sheet with several text fields. These text fields are bound to  
attributes of an outline view's selection binding. When a button is  
pressed, it drops the sheet down to let them edit additional  
properties of the selected entity in a sheet, and that all works  
great.


Except, the field that the cursor is in when the user presses okay  
doesn't get saved. Now, if I tab out of the field or click on  
another field before hitting okay, it works fine and saves the  
changed value. It seems that I have to tell the field to somehow  
commit its changes, but I'm not sure how to do that. I've tried  
having the field resignFirstResponder, and have tried setting the  
sheet's first responder to nil, and neither changed my results.


___

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/wilshmil%40mac.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting a list of all classes, etc...

2008-03-26 Thread Sherm Pendley
On Thu, Mar 27, 2008 at 12:01 AM, Graham Cox <[EMAIL PROTECTED]> wrote:

> What's the correct file to include to obtain these functions? I
> thought it would come along with , but I'm
> getting the following:
>
> : error: implicit declaration of function 'objc_getClassList'


You might not need both of these:

#import 
#import 

Also, I'm trying to heed the warning in the docs that state:
>
> "You cannot assume that class objects you get from this function are
> classes that inherit from NSObject, so you cannot safely call any
> methods on such classes without detecting that the method is
> implemented first."
>
> So I need a way to test the resulting Classes to see if they really do
> derive from NSObject. What's a good (safe) way to do that?


// The Class struct's super_class member is NULL for root classes,
// so climb the inheritance tree until we get to the root
while(NULL != aClass->super_class)
aClass = aClass->super_class;

// Now we have a root class, now we can check to see if it's NSObject
if (0 == strncmp(aClass->name, "NSObject", 8))


> I'm trying
> to compare the result of class_getSuperclass with [NSObject class],
> but I'm not sure this is right.


Unfortunately, -class is one of the methods you can't safely call until you
verify that you have an NSObject descendant. :-(

sherm--
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data & Sheet problem

2008-03-26 Thread mmalc crawford


On Mar 26, 2008, at 9:55 PM, William Turner wrote:
You might want to look at the commitEditing method for the  
NSController subclasses - this pushes any pending changes to the  
underlying model. In your case, you would probably invoke that on  
the tree controller that provides your outline view content right  
before ordering the sheet out.


... as shown in 


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


Re: Getting a list of all classes, etc...

2008-03-26 Thread Sherm Pendley
On Thu, Mar 27, 2008 at 12:43 AM, Graham Cox <[EMAIL PROTECTED]> wrote:

I have a class that can contain different objects which all derive
> from a class R. The container can accept instances of any subclass of R.
>
> Each subclass of R implements a CLASS method for a particular feature,
> returning an array. The container needs to build an array which is the
> union of all the arrays returned by each subclass. Thus it needs to
> iterate through a list of all possible subclasses of R, combining the
> arrays as it goes. Problem is that not all possible subclasses of R
> are known until runtime, so I need a way to be able to get hold of
> such a list, based on the fact that they all inherit from R. Note that
> these are not instances of R, but classes. (I can get a list of
> instances I have right now, but that doesn't cover the possibility of
> another object instance derived from R being added after I already
> built the array).
>
> Hope this makes sense - any ideas?


You're on the right track, IMHO. What I would do is climb the inheritance
tree for each registered class. If you find an ancestor with the name of R,
the class you're checking is a subclass. If you get to a root class (i.e. a
class whose super_class member is NULL), then it's not.

while( NULL != aClass->super_class && 0 != strncmp(aClass->name, "R", 1) )
aClass = aClass->super_class;

BOOL isSubclassOfR = (NULL != aClass->super_class) ? YES : NO;

Keep in mind that this is for the ObjC 1 runtime. I haven't yet looked at
the ObjC 2 runtime in any detail, so if you're targeting 64-bit Leopard,
YMMV.

sherm--
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting a list of all classes, etc...

2008-03-26 Thread Graham Cox
This worked well (after a little tweaking!) thanks - got the whole  
caboodle running now. I note that NSObject's superclass is NULL, so I  
had to switch the order of the while() test in order to correctly  
detect plain NSObjects (admittedly this will probably never be needed  
in practice).


Here's my implementation (including objective C 2.0 variant), for  
anyone's further use:


@implementation MyRuntimeHelper


+ (NSArray*)allClassesOfKind:(Class) aClass
{
	// returns a list of all Class objects that return YES to  
isKindOfClass: currently registered in the runtime


NSMutableArray* list = [NSMutableArray array];

Class*  buffer = NULL;
Class   cl;

int i, numClasses = objc_getClassList( NULL, 0 );

if( numClasses > 0 )
{
buffer = malloc( sizeof(Class) * numClasses );

NSAssert( buffer != nil, @"couldn't allocate the buffer");

(void)  objc_getClassList( buffer, numClasses );

for( i = 0; i < numClasses; ++i )
{
cl = buffer[i];

if( classIsSubclassOfClass( cl, aClass ))
[list addObject:cl];
}

free( buffer );
}

//NSLog(@"classes: %@", list);

return list;
}

@end



BOOLclassIsNSObject( const Class aClass )
{
	// returns YES if  is an NSObject derivative, otherwise NO.  
It does this without invoking any methods on the class being tested.


return classIsSubclassOfClass( aClass, [NSObject class]);
}


BOOLclassIsSubclassOfClass( const Class aClass, const Class subclass )
{
Class   temp = aClass;
int match = -1;

#ifndef __OBJC2__
	while(( 0 != ( match = strncmp( temp->name, subclass->name,  
strlen( subclass->name  && ( NULL != temp->super_class ))

temp = temp->super_class;
#else
	while(( 0 != ( match = strncmp( class_getName( temp ),  
class_getName( subclass ), strlen( class_getName( subclass ) &&  
( NULL != class_getSuperclass( temp )))

temp = class_getSuperclass( temp );
#endif
return ( match == 0 );
}



On 27 Mar 2008, at 4:11 pm, Sherm Pendley wrote:
On Thu, Mar 27, 2008 at 12:43 AM, Graham Cox  
<[EMAIL PROTECTED]> wrote:


I have a class that can contain different objects which all derive
from a class R. The container can accept instances of any subclass  
of R.


Each subclass of R implements a CLASS method for a particular feature,
returning an array. The container needs to build an array which is the
union of all the arrays returned by each subclass. Thus it needs to
iterate through a list of all possible subclasses of R, combining the
arrays as it goes. Problem is that not all possible subclasses of R
are known until runtime, so I need a way to be able to get hold of
such a list, based on the fact that they all inherit from R. Note that
these are not instances of R, but classes. (I can get a list of
instances I have right now, but that doesn't cover the possibility of
another object instance derived from R being added after I already
built the array).

Hope this makes sense - any ideas?

You're on the right track, IMHO. What I would do is climb the  
inheritance tree for each registered class. If you find an ancestor  
with the name of R, the class you're checking is a subclass. If you  
get to a root class (i.e. a class whose super_class member is NULL),  
then it's not.


while( NULL != aClass->super_class && 0 != strncmp(aClass->name,  
"R", 1) )

aClass = aClass->super_class;

BOOL isSubclassOfR = (NULL != aClass->super_class) ? YES : NO;

Keep in mind that this is for the ObjC 1 runtime. I haven't yet  
looked at the ObjC 2 runtime in any detail, so if you're targeting  
64-bit Leopard, YMMV.


sherm--



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data/IB questions

2008-03-26 Thread Adam Gerson
On Wed, Mar 26, 2008 at 10:31 PM, Rick Mann <[EMAIL PROTECTED]> wrote:
>  Question 2: I can see how a text field gets populated when you select
>  an item in the table. How can I get a one table to populate based on
>  the selection in another?
>
Each table should have its own ArrayController if the two tables
represent the data from two different entities. Since you entities are
related I am assuming one entity has a property that is a to-many
relationship to the other entity. Set the ContentSet bindings for
ArrayController2 to be the selection of ArrayController1.

ArrayController2 ContentSet
Bind to = ArrayController1
Controller Key = selection
Model Key Path = (the name of the relationship that represents entity2
in entity1)

This will cause ArrayController2 to always populate the TableView with
the objects selected by ArrayController1

Let me know if that needs to be more clear.

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


Re: Core Data/IB questions

2008-03-26 Thread Rick Mann


On Mar 26, 2008, at 11:06 PM, Adam Gerson wrote:

Each table should have its own ArrayController if the two tables
represent the data from two different entities. Since you entities are
related I am assuming one entity has a property that is a to-many
relationship to the other entity. Set the ContentSet bindings for
ArrayController2 to be the selection of ArrayController1.

ArrayController2 ContentSet
Bind to = ArrayController1
Controller Key = selection
Model Key Path = (the name of the relationship that represents entity2
in entity1)

This will cause ArrayController2 to always populate the TableView with
the objects selected by ArrayController1

Let me know if that needs to be more clear.



Excellent! That was exactly what was missing. Thank you.

Why ContentSet, and not ContentArray or one of the other ContentXXX  
things?


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


Re: Writing a preference pane that configures hotkeys?

2008-03-26 Thread Brian Kendall


It doesn't look like NDHotKeyControl implements a setReadyForHotKeyEvent:  
method.  Do I perhaps have an older version of the NDHotKeyControl source  
code?  Surely there is something I'm missing here.  I figure I can take  
your word for it on this, since you wrote the class and all. ;-)


- Brian

On Wed, 26 Mar 2008 09:56:01 -0400, Nathan Day <[EMAIL PROTECTED]> wrote:

I use those classes myself in a preference pane (Popup Dock) and they  
work fine. You need to have a NDHotKeyControl to capture the event, you  
can create an input field in IB and change its class to NDHotKeyControl.  
You then need to tell the NDHotKeyControl to wait for a HotKey  
combination event by calling setReadyForHotKeyEvent:, you can  
alternativly set up a button to send a readyForHotKeyEventChanged:  
action.


On 26/03/2008, at 12:38 AM, Brian Kendall wrote:

On Mon, 24 Mar 2008 01:46:27 -0400, Jens Alfke <[EMAIL PROTECTED]>  
wrote:



Take a look at Nathan Day's "NDHotKeyEvent" utility code:
http://homepage.mac.com/nathan_day/pages/source.xml



I tried to use this in my preference pane, but I can't get the control  
to receive hot key events.  There could be something I'm doing wrong  
when setting up or working with the NDHotKeyControl class, but is there  
any reason it wouldn't be able to receive events in a preference pane?


- Brian
___

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/nathan_day%40mac.com

This email sent to [EMAIL PROTECTED]




Nathan Day
[EMAIL PROTECTED]
http://homepage.mac.com/nathan_day/




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data/IB questions

2008-03-26 Thread Adam Gerson
I think that internally when you create a to-many core-data
relationship the group of objects is stored as an NSSet as opposed to
an array.


http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/Reference/Reference.html

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/CntrlContent.html#//apple_ref/doc/uid/TP40002147-181724

http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#//apple_ref/doc/uid/20002174-178830-BAJEDEFB


On Thu, Mar 27, 2008 at 2:10 AM, Rick Mann <[EMAIL PROTECTED]> wrote:
>
>  On Mar 26, 2008, at 11:06 PM, Adam Gerson wrote:
>  > Each table should have its own ArrayController if the two tables
>  > represent the data from two different entities. Since you entities are
>  > related I am assuming one entity has a property that is a to-many
>  > relationship to the other entity. Set the ContentSet bindings for
>  > ArrayController2 to be the selection of ArrayController1.
>  >
>  > ArrayController2 ContentSet
>  > Bind to = ArrayController1
>  > Controller Key = selection
>  > Model Key Path = (the name of the relationship that represents entity2
>  > in entity1)
>  >
>  > This will cause ArrayController2 to always populate the TableView with
>  > the objects selected by ArrayController1
>  >
>  > Let me know if that needs to be more clear.
>
>
>  Excellent! That was exactly what was missing. Thank you.
>
>  Why ContentSet, and not ContentArray or one of the other ContentXXX
>  things?
>
>  --
>  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 [EMAIL PROTECTED]