Re: NSGraphiteControlTint in app

2008-11-10 Thread Benjamin Dobson
At a guess, [[[yourWindow standardWindowButton:NSWindowCloseButton]  
cell] setControlTint:NSGraphiteControlTint];

Repeat for each window button.

On 10 Nov 2008, at 07:51:23, Ralph Manns wrote:


Hello,
I don't think the method setControlTint is the solution I'm looking  
for,
because only a few classes have such a method, NSWindow doesn't.  
Maybe my

question was to general.

Is there a way without using private methods to set the complete  
appearance
of an application to NSGraphiteControlTint, although the control  
tint in

System Preference is set to NSBlueControlTint.

I understand how important the appearance is to mac apps. But the
NSGraphiteControlTint is used by some apps to give them a "pro-app"
appearance. Do you really drag Apples "pro-apps" like Aperture into  
the

trash, because they look different? ;-)
I think for some few apps it is okay to violate the "Aqua-HIG".  
Aperture for

example wouldn't look so great with a blue aqua appearance.

Thanks, Ralph.


___

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: Image from font file

2008-11-10 Thread Georg Seifert

Once again me,

I just did a bit more searching. I found a quicklook-sample with  
displays a QLPreviewPanel. It shows the same image then the finder.  
But I like to get this image as a NSImage inside my app.
I use: QLThumbnailImageCreate but only get a thumbmail-like image. Is  
there any way to get the alphabet like in the preview panel? (I may be  
a privat API, the program will not going public soon).


Thanks
Georg
___

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]


Responder Chain & Multiple Windows

2008-11-10 Thread Todd Heberlein
I have a Documen-based application, and the besides the document's  
main window, the user can create additional windows to be opened to  
show aspects of the document/data from a different perspective; these  
windows are loaded by an instance of an NSWindowController subclass.


Unfortunately, when one of these secondary windows are key, Menu items  
connected to the First Responder are disabled even though the  
NSWindowController subclass implements the action method.


Am I missing something?

From the documentation it seems that the window's  
NSDocumentController, even though it isn't the document's main window,  
should still be in the responder chain.


Todd

___

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: Responder Chain & Multiple Windows

2008-11-10 Thread Graham Cox


On 11 Nov 2008, at 12:11 am, Todd Heberlein wrote:

From the documentation it seems that the window's  
NSDocumentController, even though it isn't the document's main  
window, should still be in the responder chain.


I assume you actually mean the window's NSDocument (or subclass  
thereof) - there is only one shared NSDocumentController in an app.


How are you creating the secondary windows? If you instantiate the  
controllers yourself you need to add them as subcontrollers of the  
document using its -addWindowController: method.


Otherwise yes, what you think you should see should work, menus should  
be enabled if they are implemented by the NSDocument subclass, even if  
a sub-window is frontmost.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Inviting to comment on Cocoa categories

2008-11-10 Thread Kyle Sluder
On Sun, Nov 9, 2008 at 10:58 PM, Michael Ash <[EMAIL PROTECTED]> wrote:
> Whoops, you're right. Still, NSAffineTransform can obviously do
> translations, so surely this objection does not make sense?

It's a gut reaction.  Not being a linear algebra guru, I'm wondering
if it's done to avoid confusion; perhaps it's rather easy to create a
case in which a set of rotations and translations looks like it should
map one way but does another.  If I remember correctly, matrix
multiplication does not distribute over matrix addition, and since a
transformation matrix stack is essentially a product of sums, the API
designers might, as you suggest, have simply left the functionality
out for the sake of clarity.

Interestingly enough, I can't recall seeing any graphics API that
provided rotation around a point.  I know DirectX doesn't.

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


[MEET] CocoaHeads Frankfurt, tonight 2008-11-10 8pm

2008-11-10 Thread Torsten Curdt
Just a quick reminder: Cocoa chit-chat, code and beers. Tonight at
Club Voltaire.

http://cocoaheads.org/de/Frankfurt/index.html

Hope to see you there!

cheers
--
Torsten
___

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: NSGraphiteControlTint in app

2008-11-10 Thread John Joyce


Hello,
I don't think the method setControlTint is the solution I'm looking  
for,
because only a few classes have such a method, NSWindow doesn't.  
Maybe my

question was to general.

Is there a way without using private methods to set the complete  
appearance
of an application to NSGraphiteControlTint, although the control  
tint in

System Preference is set to NSBlueControlTint.

I understand how important the appearance is to mac apps. But the
NSGraphiteControlTint is used by some apps to give them a "pro-app"
appearance. Do you really drag Apples "pro-apps" like Aperture into  
the

trash, because they look different? ;-)
I think for some few apps it is okay to violate the "Aqua-HIG".  
Aperture for

example wouldn't look so great with a blue aqua appearance.

Thanks, Ralph.


Pro-Apps (FCP, Motion, etc...) use ProKit rather than AppKit and it is  
all private.

iTunes has its own widgets it seems.
iMovie may be somewhere in between.
If you're wanting the look of any of those, you'll need to do one of 2  
things:

- build your own controls
- use some controls somebody else built
___

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: Detect microphone

2008-11-10 Thread Graham Cox


On 10 Nov 2008, at 10:15 pm, chaitanya pandit wrote:


Well i tried this before but this doesn't work either



"Doesn't work" covers a multitude of sins; *what* doesn't work?

Also, do you know whether the Mac Mini can actually physically detect  
whether a microphone is plugged into the line-in socket? Maybe it  
can't - that would be a hardware feature. If the hardware doesn't  
know, the software sure won't.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Inviting to comment on Cocoa categories

2008-11-10 Thread Graham Cox


On 10 Nov 2008, at 10:07 pm, Kyle Sluder wrote:

On Mon, Nov 10, 2008 at 5:56 AM, Graham Cox <[EMAIL PROTECTED]>  
wrote:
Yet you need to do this all the time if you do rotation of anything  
at all.

Rotation around the origin is almost never in itself useful.


Eh, I beg to differ.  Rotation about the origin is one of the most
common operations in 3D graphics, since you typically treat the origin
as model space and just do one final translation to get your models
into world space.  This is essentially what OpenGL does when you build
your model and world transformation stacks.

--Kyle Sluder



Well, I defer to your expertise in 3D - not my area. But certainly in  
2D with typical Cocoa objects you are usually concerned with  
positioning paths or text at some point in your view. I don't think  
I've ever done a rotation that didn't translate to some point and back  
again. You can of course think of this as moving the origin and thus  
you are *always* rotating about the origin, but I'd hazard a guess  
that most people are more comfortable with the idea of rotating some  
object about an arbitrary point. Hence the OP's method, which is  
identical in spirit to several I use constantly.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Inviting to comment on Cocoa categories

2008-11-10 Thread Graham Cox


On 10 Nov 2008, at 9:40 pm, Kyle Sluder wrote:


Interestingly enough, I can't recall seeing any graphics API that
provided rotation around a point.  I know DirectX doesn't.


Yet you need to do this all the time if you do rotation of anything at  
all. Rotation around the origin is almost never in itself useful.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSButtonCell question

2008-11-10 Thread Robert Mullen
I have an NSButtonCell in my NSTableView that has an image set to  
imitate the arrow link in iTunes with the title showing the display  
value. Unfortunately the title text is clickable as well as the arrow  
and both send you off to the linked action. I have searched and seen  
references to this problem but no solution to make the image the only  
linked item in the cell. Can anyone offer advice to work around this  
behavior?


TIA
___

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 entity fetching by date

2008-11-10 Thread Sean McBride
On 11/8/08 11:50 PM, Quincey Morris said:

>you may decide it's worth simplifying things by adding a
>separate "month" attribute to every entity

The tradeoff there of course is that the model would then imply a
certain calendar.  Since most of the world use the Gregorian calendar,
that might not be a problem, but it's something to consider.

Something else to think about: perhaps instead of storing an NSDate in
your model, you could store an NSDateComponents (using a 'transformable').

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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: Responder Chain & Multiple Windows

2008-11-10 Thread Todd Heberlein


On Nov 10, 2008, at 5:31 AM, Graham Cox wrote:



On 11 Nov 2008, at 12:11 am, Todd Heberlein wrote:

From the documentation it seems that the window's  
NSDocumentController, even though it isn't the document's main  
window, should still be in the responder chain.


I assume you actually mean the window's NSDocument (or subclass  
thereof) - there is only one shared NSDocumentController in an app.


How are you creating the secondary windows? If you instantiate the  
controllers yourself you need to add them as subcontrollers of the  
document using its -addWindowController: method.


Oops. Yes, MyDocument is a subclass of NSDocument and  
BrowserViewController is a subclass of NSWindowController



In MyDocument I have a method that has the following code:

  BrowserViewController* bvc;

  bvc = [[[BrowserViewController alloc] init] autorelease]; //  
init loads NIB

  [self addWindowController:bvc];
  [bvc showWindow:self];


Both MyDocument and BrowserViewController implement the method (which  
is the action for the menu item):


- (IBAction) extractAuditSession: (id) sender;

But the menu item is only available when the window associated with  
MyDocument is key. When the window associated with  
BrowserViewController is key, the menu item is dimmed out.


Todd

___

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: Can't get CABasicAnimation to explicitly animate "frame" property of CALayer

2008-11-10 Thread David Duncan

On Nov 9, 2008, at 4:04 AM, Oleg Krupnov wrote:


Using Core Animation, I want to make a layer change its position and
size with animation. So I need to use the "frame" property of CALayer,
which is animatable, according to the documentation.



http://developer.apple.com/qa/qa2008/qa1620.html
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Observing NSArrayController selectionIndex always returns null

2008-11-10 Thread Sean McBride
On 11/9/08 3:59 AM, Ken Tozier said:

>Changes do trigger the observer's "observeValueForKeyPath" method but
>trying to fetch the value using
>
>[inChange objectForKey: NSKeyValueChangeNewKey]
>
>Always returns null. Is this a bug in NSArrayController?

Yes.  See "(Missing) KVO notification old and new values" at:


And please file a radar.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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: Inviting to comment on Cocoa categories

2008-11-10 Thread James W. Walker


On Nov 10, 2008, at 2:40 AM, Kyle Sluder wrote:


If I remember correctly, matrix
multiplication does not distribute over matrix addition, and since a
transformation matrix stack is essentially a product of sums, the API
designers might, as you suggest, have simply left the functionality
out for the sake of clarity.


For the record, you remember wrong.  Matrix multiplication is not  
commutative, but the other basic algebraic laws of multiplication and  
addition work.

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: Responder Chain & Multiple Windows

2008-11-10 Thread j o a r


On Nov 10, 2008, at 9:00 AM, Todd Heberlein wrote:

Oops. Yes, MyDocument is a subclass of NSDocument and  
BrowserViewController is a subclass of NSWindowController



...should probably be called "BrowserWindowController" in that  
case...:-)




In MyDocument I have a method that has the following code:

BrowserViewController* bvc;

bvc = [[[BrowserViewController alloc] init] autorelease]; //  
init loads NIB

[self addWindowController:bvc];
[bvc showWindow:self];


Both MyDocument and BrowserViewController implement the method  
(which is the action for the menu item):


- (IBAction) extractAuditSession: (id) sender;

But the menu item is only available when the window associated with  
MyDocument is key. When the window associated with  
BrowserViewController is key, the menu item is dimmed out.



What if you make the window controller the delegate of the window?


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Detect microphone

2008-11-10 Thread chaitanya pandit


On 10-Nov-08, at 4:55 PM, Graham Cox wrote:



On 10 Nov 2008, at 10:15 pm, chaitanya pandit wrote:


Well i tried this before but this doesn't work either



"Doesn't work" covers a multitude of sins; *what* doesn't work?

Oh, i was assuming that the AudioHardwareGetProperty method will  
return an error if there is no input device connected, but in this  
case as the mac mini has "Built in input" as the default input device,  
this method fails to detect if the MIcrophone is connected.


Also, do you know whether the Mac Mini can actually physically  
detect whether a microphone is plugged into the line-in socket?  
Maybe it can't - that would be a hardware feature. If the hardware  
doesn't know, the software sure won't.


I tried to record an audio with Quicktime player, it didn't warn me  
about absence of a microphone (Which ideally it should have) so i  
guess there really isn't a way to know of a connected mic.



--Graham


___

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

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

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

This email sent to [EMAIL PROTECTED]


Badged icons

2008-11-10 Thread Andy Bell
Hi,

Is there another way of creating badged icons other than creating a resource
fork for the file?  I am working on a project which monitors files and would
like to overlay a badge on the files being monitored so that the user can
easily identify them within Finder.

Thanks
Andy
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Inviting to comment on Cocoa categories

2008-11-10 Thread Kyle Sluder
On Mon, Nov 10, 2008 at 5:56 AM, Graham Cox <[EMAIL PROTECTED]> wrote:
> Yet you need to do this all the time if you do rotation of anything at all.
> Rotation around the origin is almost never in itself useful.

Eh, I beg to differ.  Rotation about the origin is one of the most
common operations in 3D graphics, since you typically treat the origin
as model space and just do one final translation to get your models
into world space.  This is essentially what OpenGL does when you build
your model and world transformation stacks.

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


Re: ObjC data structure for C++/ObjC++ objects?

2008-11-10 Thread Thomas Engelmeier


On 08.11.2008, at 02:41, Jonathan Bailey wrote:


I am trying to find a way to create a dynamically-growable objective C
data structure within objective C++ code, such as a
NSMutableDictionary, that can store values that are pointers to an
objective C++ or straight-up C++ object.


Personally, I'd use the PIMPL idiom + std::map. It avoids the mess  
only ObjC++ sources can include foo.h.


foo.h:

@class Foo
{
struct FooPriv *priv_;
};

foo.mm:

struct
{
std::map > value_map;
} FooPriv;

- (id) init
{
if( self = [super init] )
{
priv_ = new FooPriv();
}
}

- (void) dealloc
{
delete priv_;
[super dealloc];
}

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: Responder Chain & Multiple Windows

2008-11-10 Thread Todd Heberlein

What if you make the window controller the delegate of the window?


Ka-ching!  Thanks. that did it.

Todd

___

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]


Using NSAnimation

2008-11-10 Thread Hrishikesh Muruk
I have a basic question about using NSAnimation.  Here is what I am  
trying to do: My program shows a custom view and I want to animate an  
NSImage within that custom view. When the mouse is clicked within the  
program I want to move (animate) the image to a new point in the window.



I have subclassed NSAnimation  into MyAnim and I have overloaded the  
method "-(void)setCurrentProgress:(NSAnimationProgress)progress". My  
program is organized in this fashion.


I have a custom view class MyView which has pointers to my data  
objects (an NSImage in this case) and my animation object myAnim. It  
also has a pointer to my custom view object MyView.


On a mouse click I send the message
[myAnim startAnimation];

@interface MyView : NSView {

NSImage *myObj;
MyAnim *myAnim;
}


I want the animation to begin when the mouse is clicked so I have  
overloaded the "-mouseDown" method to call [myAnim startAnimation];.  
I plan to animate my image by changing its position from within - 
setCurrentProgress. My problem - how do I access myObj from within  
the method -setCurrentProgress (which is inside MyAnim). I could do  
something like:


(in file MyAnim.m)
-(void)setCurrentProgress:(NSAnimationProgress)progress {
NSImage * tmpImg = [super valueForKey:@"myObj"];
}

But it looks a little bit like a hack.

My questions:
1. Is there a better way to access myObj from MyAnim?
2. Once I change the position of myObj how do I get the view to  
redraw the image?


Hrishi

___

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]


advice needed please

2008-11-10 Thread Michael de Haan
I am repeating a post that I posted on the obj C group...realized that  
the traffic there is very low.

>>

Hi all,
May I ask the group the following...perhaps a little OT...if so, I  
apologize. I am just starting off in Obj C...have a basic   
understanding of C. Bought Kochan's book ("Programming in Objective- 
c"), and tried to download his exercise answers from this website. Has  
anyone here had any luck with  this. It seems totally messed up, with   
broken links etc. Any other  place that anyone knows of where this is  
obtainable.

Thanks in advance.


___

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]


duplicate decalration for protocol

2008-11-10 Thread pan xuan

Hi,
 
I have two classes that both conform to a protocol ABC. Now the third class 
needs to import those two classes and I got a warning duplicate declaration for 
protocol ABC. Could anybody tell me how to reduce this kind of warning?
 
Thanks
 
BR,
 
Pan
_
Stay up to date on your PC, the Web, and your mobile phone with Windows Live
http://clk.atdmt.com/MRT/go/119462413/direct/01/___

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]


Floating point pixel data / image handling confusion

2008-11-10 Thread Felix Ulber
Hi Folks,

I am working on an Cocoa Application whose main purpose is to display
some stuff in OpenGL.

In conjunction with that I need to be able to read in floating point
images (most likely from an exr file) and resize them. Unfortunately,
with NSImage and NSBitmapImage it seems I can get only 32 bpp/8bit per
channel bitmap data (as the example in the cocoa drawing guide).

So I did some research and stumbled upon things like Image I/O, Core
Image and vImage. But I have tom admit have absolutely no clue what to
use when and how.

Can someone probably give me a hint into the right direction? I am
fairly new to OSX development, sometimes kind of confused about all
these frameworks and maybe just not seeing the obvious.

Thanx

Felix

___

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: How to manage (My)SQL data in Cocoa

2008-11-10 Thread dreamcat7

Just to make even clearer what Quincey has said;

For NSTableView you MUST follow Quincey's conventions for the data  
representation. If you do not then simply the NSTableView control will  
not work. This is due to some very specific restrictions and  
limitations in the NSTableView Cocoa class. Its worthwhile to notice  
because otherwise you may have found necessary to rewrite some  
extensive amount of code for your data logic / or simply found this  
particular class unusable.


If sure that you dont need to see a TableView representation of the  
data (perhaps you have your mind set upon to use a different control  
such as NSOutlineView / or other ones ) then its probably be worth  
asking about those too. Certainly its going along the right lines to  
be asking about using an array or dictionary. Those representation  
will enable you to utilize some helper classes such as  
NSArrayController (and NSSortDescriptors for sorting) and perhaps  
certain parts of the Bindings / KVC will become relevant to you.


The following libraries are for executing basic SQL query from within  
the Cocoa environment and conveniently they can provide data into the  
NSArray etc;


Quicklite - http://www.webbotech.com/

FMDB -  http://flycode.googlecode.com/svn/trunk/fmdb/

http://code.google.com/p/flycode/source/browse/#svn/trunk/fmdb

PLDatabase -http://code.google.com/p/pldatabase/
(repackage of FMDB)


On 9 Nov 2008, at 17:47, Quincey Morris wrote:


On Nov 9, 2008, at 09:16, Michele Barboni wrote:

Currently I'm querying the database for a column at once, building  
an NSArray of them and add all NSArrays (the columns) in a  
NSMutableArray ("the table").
For editing I'm doing queries in the NSTableView controller (and I  
really don't like this).


So, I was wondering if there's a "standard" way for storing sql  
data (not sqlite and core data of course..) with Cocoa collections.


For example, I have thought to a NSDictionary with id integers as  
key and NSArrays with the rest of the *row* as values, sounds  
better but since I'm not an experienced programmer I'm asking..


If you're intending to read the entire database into memory, then  
the most natural "fit" with a NSTableView would probably be an array  
of dictionaries. The arrays would be rows, and each dictionary would  
contain the database column values for each row, keyed by a database  
column name. Then you could connect the table view columns to the  
dictionary with bindings, or use a data source where (say) the table  
column identifier was the dictionary key.


Or, instead of one dictionary per row, create a data model class  
that has a property (i.e. a setter and a getter, backed by a  
suitable instance variable) for each database column, and one object  
of this class per row. That would use slightly less memory than  
dictionaries, and allow you to customize the logic of data access.  
(The objects could keep track of what was changed, too, so that you  
could avoid queries at NSTableView editing time.)



___

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/dreamcat7%40googlemail.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]


MVC and Cocoa question

2008-11-10 Thread Steven Guitar
i am working on the challenge exercises for aaron hillegass' book, 3rd  
edition, for chapter 18 challenge. i have setup the application with a  
subclass of NSDocument (MyDocument), a subclass of NSView  
(DrawPadView), and a model component called Shape.


basically as the user uses the mouse to draw shapes, i have an  
NSMutableArray in DrawPadView that contains the various shapes drawn  
by the user.


when it comes time to save this file, MyDocument is going to do all  
the work, but the only way i can think of to get an NSMutableArray in  
MyDocument to have the values of the array in the DrawPadView is to  
use the NSNotificationCenter.


is this ok? should i have my NSDocument class register as an observer  
of the NSView class? i was not sure if this was going against MVC or  
any other cocoa design patterns.


i have been racking my brain to get this thing to save and really just  
keep hitting dead ends, but this path sounds logical to me... any  
thoughts?

___

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: A trapped keyDown event

2008-11-10 Thread Eric Gorr

I now have a simple test application which demonstrates this problem

http://ericgorr.net/CocoaWithPP.zip

Although, instead of Cmd-N, use Cmd-Q with the NSPanel active. The  
application won't quit.


If one clicks on the window and presses Cmd-Q, the application will  
quit.


I have entered a bug report:

rdar://6357260


On Nov 7, 2008, at 4:24 PM, Eric Gorr wrote:

The problem I am having is that when my NSPanel is the key window  
and I press Cmd-N to create a new document window, the event is not  
handled correctly and no new document window is created. If the  
NSPanel is not the key window, the event is handled correctly and I  
get a new document window.



I am working with NSPanel's in a Carbon based application using the  
10.5 SDK. A simple and similar test project can be found at:


http://ericgorr.net/CocoaWithCarbon.zip

However, there is at least one significant difference which allows  
that test project to work, but my real application to fail.


The real application was originally written in PowerPlant and that  
isn't going to change for awhile. This means that all of the menu  
events need to come from WaitNextEvent. For some reason,  
WaitNextEvent isn't giving me the keyDown event.


I do have a Carbon Event handler attached watching for  
kEventClassCommand / kEventCommandProcess. When my NSPanel is the  
key window and I press CMD-N, this event is send and I can set a  
breakpoint to see what happens. I have confirmed that the return  
value from the handler is eventNotHandledErr. However, as I step out  
and back to WaitNextEvent, WaitNextEvent returns false which should  
mean in this case that someone did handle the event.


I have attempted to set breakpoints throughout the application where  
I am also looking for kEventClassCommand / kEventCommandProcess or  
calling WaitNextEvent, but none of these are hit.


It is unclear to me why this is failing, unless there is a bug.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Detect microphone

2008-11-10 Thread Kyle Sluder
On Mon, Nov 10, 2008 at 6:44 AM, chaitanya pandit
<[EMAIL PROTECTED]> wrote:
> I tried to record an audio with Quicktime player, it didn't warn me about
> absence of a microphone (Which ideally it should have) so i guess there
> really isn't a way to know of a connected mic.

Electrically there's no difference between floating the line-in jack
and connecting it to a cheap microphone, like the kind most users
have.  So no, there's no way for the hardware, let alone the software,
to detect you have a mic connected.

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


Re: MVC Question . . .

2008-11-10 Thread Michael A. Crawford


On Nov 9, 2008, at 1:01 PM, Ken Thomases wrote:


On Nov 8, 2008, at 7:46 PM, Michael A. Crawford wrote:

I have a model-view-control class hierarchy that I'd like to add an  
auxiliary (test-only) view to.  I've created a 2nd NIB with an  
NSPanel instance associated with a sub-classed NSWindowController.   
I'm able to load the NIB and instantiate the panel but how to I  
associate the model class with the new view?  They are in separate  
NIBs.


Does that last sentence imply that your model is "in" a nib?  Except  
in very simple circumstances, your model should not be instantiated  
in a nib.


Well, it is in the NIB.  Guess I'll have to change that, thanks.



Usually, the model is instantiated by a controller.  If the model is  
application-wide, then it's usually your application controller  
which instantiates it.  If it's of a more narrow scope, then there's  
usually a controller that corresponds to that narrow scope, and it  
would instantiate the model.  For example, an NSDocument object  
would create the model holding and managing the state information  
for that document.



Logically, it seems like the easiest thing to do would be to create  
a second view in the same NIB as the first and have a model-view1- 
view2-controller setup.  I tried this by copying the NSPanel class  
into the MainMenu.xib file, from it's original NIB file, and then  
trying to reference it directly via IB connections.  In the process  
I left its associated controller behind in its private NIB,  
thinking I wouldn't need it.


Bottom line, I can't make any connections to the new outlet I  
defined in my main controller class.  This is still new to me and  
I'm confused.  Can someone please tell me how best to create a  
second (different) view to the same model that is modeless and can  
share a common controller?


My guess is that you're stuck thinking that you can (or should) only  
have the one controller.


There are a variety of different types of controllers.  There are  
model-controllers (e.g. NSDocument), which are primarily responsible  
for managing a model.  There are view-controllers which are primary  
responsible for managing views (including windows).  And there are  
controllers which aren't necessarily closer to the model or the  
view, but manage higher level logic about the way the two interact.   
Also, there are mediating controllers like NSObjectController and  
NSArrayController which are primary used with bindings to convey  
data between models and views.


The main nib often contains an application controller, because  
that's convenient.  Other types of nibs may contain mediating  
controllers but don't often contain coordinating controllers.   
Instead, the File's Owner of the nib is a window- or view- 
controller.  This object is not "in" the nib; it's not instantiated  
within the nib.  Instead, it's generally instantiated in code and is  
specified as the owner of the nib at the point when the nib is  
loaded.  Usually, NSWindowController or NSViewController (or  
subclasses) actually do the loading of the nib and make themselves  
the owner at that point.


An NSViewController has a representedObject property, which is a  
convenient reference it will have to (part of) the model.  Again,  
this is set by the code which instantiated the view controller.  If  
you subclass NSWindowController, your subclass can have a similar  
sort of reference to the model.


Similarly, a view/window controller may have a reference to another  
controller, usually the controller which chose to instantiate it.   
That controller is usually a "superior" which has a broader scope of  
responsibility.  The view/window controller may access parts of the  
model through that superior controller.  It might also forward  
action methods to it.  Etc.  The "document" property of  
NSWindowController is an example of this kind of relationship.


So, to get back to your question, I think your nib with the panel  
would have a subclass of NSWindowController as its File's Owner.   
The code which currently directly loads the nib should instead  
allocate and initialize an instance of your subclass, and have it do  
that.  If you need that controller to have a reference back to the  
rest of your application (either directly to the model or to another  
controller), you would define a property on your subclass to hold  
that reference.  You could pass in the reference as a parameter to a  
custom initializer on your subclass or set it immediately after the  
new object is instantiated.  Within the nib, if you want to bind a  
view to some property in your model, you would bind to File's Owner  
using a key path which goes through this new property to get to your  
ultimate destination (some property of your model or a superior  
controller, for example).


Cheers,
Ken




Thank you, Ken.  I like the custom initializer suggestion and will  
implement that immediately.  As for the rest, I'll give it some  
thoug

Re: How to manage (My)SQL data in Cocoa

2008-11-10 Thread mmalcolm crawford


On Nov 10, 2008, at 7:36 AM, dreamcat7 wrote:

For NSTableView you MUST follow Quincey's conventions for the data  
representation.



No, you don't.
Quincey's statement that "the most natural "fit" with a NSTableView  
would probably be an array of dictionaries" is true, but there is no  
*need* to follow that.



If you do not then simply the NSTableView control will not work.  
This is due to some very specific restrictions and limitations in  
the NSTableView Cocoa class.


NSTableView does not place any restriction on the way its data is  
*represented*, just how it is *provided*.



Those representation will enable you to utilize some helper classes  
such as NSArrayController (and NSSortDescriptors for sorting) and  
perhaps certain parts of the Bindings / KVC will become relevant to  
you.


Again, Quincey's suggestion will provide the most natural fit with the  
KVC-compliant accessory, but this API too is designed to be  
independent of the underlying data representation.


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]


GC and propertyListFromData:mutabilityOption:format:errorDescription:

2008-11-10 Thread Michael Link
The documentation for  
propertyListFromData:mutabilityOption:format:errorDescription: says  
that errorDescription needs to be released by the caller. In a garbage  
collected environment is this still the case? Should  
NSMakeCollectable() be called on errorDescription?


Is it safe to call NSMakeCollectable() multiple times on the same  
object (when in doubt)?


--
Michael
___

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: Detect microphone

2008-11-10 Thread chaitanya pandit

Well i tried this before but this doesn't work either

- (BOOL)micConnected
{
BOOL retVal = YES;
UInt32 size;
 OSStatus err =noErr;
 size = sizeof(AudioDeviceID);
 AudioDeviceID inputDeviceID;
   	 err =  
AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,

   &size,
   
&inputDeviceID);

 if (err)
retVal = NO;

return retVal;
}

On 10-Nov-08, at 4:24 PM, Kyle Sluder wrote:


On Mon, Nov 10, 2008 at 2:45 AM, chaitanya pandit
<[EMAIL PROTECTED]> wrote:
But on my Mac Mini which doesn't have a built in microphone it  
still returns

YES for isConnected and the device returned is "Built-in input"


That would be the line-in jack.

Have you tried asking on the coreaudio-api list?

--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 write a remote control app for Mac

2008-11-10 Thread David
Hello,
Can someone point me to general documentation that would give me an
idea how to write a remote control application for the Mac.

The hardest part seem to be how to capture what's currently on the
screen and when it changes.

I have no idea where to look. Is it even possible to do this while
using public APIs?

I've seen a variety of other programs which must do this, including
VNC, but I haven't found source for any yet that might give a clue.

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: Inviting to comment on Cocoa categories

2008-11-10 Thread Roland King

possibly drifting towards off topic here but ...

An Affine Transform (in the context we're talking about here here) is  
a transform which maps straight lines to straight lines. If it was  
straight when you started, it's straight after you're done. It also  
preserves the relative distance between points on a line, so if you  
have 3 points and the third one is 10x as far away from the first one  
as the second one is, after the transform, that's still true.


It consists of a linear transform (which doesn't move the origin) and  
a translation, which can. Linear would be scaling, shearing (ie  
scaling more on one axis than another) and rotation, but it's totally  
multiplicative and so the origin stays fixed. The translation  
afterwards then moves the origin around. So Affine Transform = Linear  
Transform + Translation.


You can actually represent an affine transform with a purely  
multiplicative matrix by adding an extra row and column to the Linear  
Transform matrix with the translation vector and a few carefully  
placed 0s and 1s and adding an extra 1 to the point you're moving  
around. This really just adds a dimension, moves your world off the  
origin of it and then the translation becomes a shear in a dimension  
you don't care about. The result you get is the projection back onto  
the original space.


So an Affine Transform can be represented by a pure matrix  
multiplication, including the transformation bit, and you can combine  
any number of them by multiplying matrices. No addition necessary.


On Nov 10, 2008, at 6:40 PM, Kyle Sluder wrote:

On Sun, Nov 9, 2008 at 10:58 PM, Michael Ash <[EMAIL PROTECTED]>  
wrote:

Whoops, you're right. Still, NSAffineTransform can obviously do
translations, so surely this objection does not make sense?


It's a gut reaction.  Not being a linear algebra guru, I'm wondering
if it's done to avoid confusion; perhaps it's rather easy to create a
case in which a set of rotations and translations looks like it should
map one way but does another.  If I remember correctly, matrix
multiplication does not distribute over matrix addition, and since a
transformation matrix stack is essentially a product of sums, the API
designers might, as you suggest, have simply left the functionality
out for the sake of clarity.

Interestingly enough, I can't recall seeing any graphics API that
provided rotation around a point.  I know DirectX doesn't.

--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/rols%40rols.org

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: Detect microphone

2008-11-10 Thread Kyle Sluder
On Mon, Nov 10, 2008 at 2:45 AM, chaitanya pandit
<[EMAIL PROTECTED]> wrote:
> But on my Mac Mini which doesn't have a built in microphone it still returns
> YES for isConnected and the device returned is "Built-in input"

That would be the line-in jack.

Have you tried asking on the coreaudio-api list?

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


Re: How to manage (My)SQL data in Cocoa

2008-11-10 Thread I. Savant
On Mon, Nov 10, 2008 at 1:48 PM, mmalcolm crawford <[EMAIL PROTECTED]> wrote:

> NSTableView does not place any restriction on the way its data is
> *represented*, just how it is *provided*.

  The more important point of focus here is that the
*NSTableDataSource protocol* exists precisely *because* the
representation of the data shouldn't matter.

--
I.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]


Re: How to write a remote control app for Mac

2008-11-10 Thread Charles Steinman
Vine Server is open-source (GPL).

http://sourceforge.net/projects/osxvnc/

Cheers,
Chuck


- Original Message 
> From: David <[EMAIL PROTECTED]>
> To: Cocoa-Dev Mail 
> Sent: Monday, November 10, 2008 11:49:58 AM
> Subject: How to write a remote control app for Mac
> 
> Hello,
> Can someone point me to general documentation that would give me an
> idea how to write a remote control application for the Mac.
> 
> The hardest part seem to be how to capture what's currently on the
> screen and when it changes.
> 
> I have no idea where to look. Is it even possible to do this while
> using public APIs?
> 
> I've seen a variety of other programs which must do this, including
> VNC, but I haven't found source for any yet that might give a clue.
> 
> 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/acharlieblue%40yahoo.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: How to manage (My)SQL data in Cocoa

2008-11-10 Thread dreamcat7

Hi,
Sorry maybe i should have clarified that but i believed that Quincey  
had already explained about the datasource methods. You *must* (if you  
dont want to end up in a heap of self-inflicted mess) represent your  
data in those way - WHEN you intend to link to an NSTableView using  
bindings. If you intend to implement the NSTableDataSource Protocol -   
then sure you can choose to represent your data in any ridiculous and  
obscure way that you want. However i dont believe the OP made out that  
they wanted to do that. And bear in mind that this whole discussion  
about NSTableView is only actually relevant to this thread if the OP  
intends to use an NSTableView. And they havent said that they are yet.


Surely its better to say that you are free to represent your data in  
any way that is most reasonable / efficient ? This is an important  
issue for any applications developer including those backing onto a  
MYSQL database. Or in other words - what if you would like to write a  
sensible app that doesnt pointlessly go around and around in circles ?  
C'mon we have all seen many such examples in our day.



On 10 Nov 2008, at 19:55, I. Savant wrote:

On Mon, Nov 10, 2008 at 1:48 PM, mmalcolm crawford <[EMAIL PROTECTED] 
> wrote:



NSTableView does not place any restriction on the way its data is
*represented*, just how it is *provided*.


 The more important point of focus here is that the
*NSTableDataSource protocol* exists precisely *because* the
representation of the data shouldn't matter.

--
I.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/dreamcat4%40gmail.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: MVC and Cocoa question

2008-11-10 Thread Kyle Sluder
On Mon, Nov 10, 2008 at 11:56 AM, Steven Guitar <[EMAIL PROTECTED]> wrote:
> basically as the user uses the mouse to draw shapes, i have an
> NSMutableArray in DrawPadView that contains the various shapes drawn by the
> user.

No.  Bad.  This is model information, it should be stored in the model.

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


Re: GC and propertyListFromData:mutabilityOption:format:errorDescription:

2008-11-10 Thread Quincey Morris

On Nov 10, 2008, at 11:04, Michael Link wrote:

The documentation for  
propertyListFromData:mutabilityOption:format:errorDescription: says  
that errorDescription needs to be released by the caller. In a  
garbage collected environment is this still the case? Should  
NSMakeCollectable() be called on errorDescription?


No, because it's a Cocoa data type (NSString*), you don't have to  
handle it specially. The only time you have to worry about it is for  
those very few Cocoa methods that return an object of CF data type  
(and for objects returned by non-Cocoa functions, of course).


This may seem strange because most common Cocoa and CF objects are  
toll-free bridged -- are, in fact, identical types. The difference is  
that the memory management is an attribute of the object, not the  
type. Objects returned as Cocoa types have slightly different memory  
management semantics.


Is it safe to call NSMakeCollectable() multiple times on the same  
object (when in doubt)?


It's absolutely not safe. NSMakeCollectable does a CFRelease on the  
object, which really decrements its retain count, even when garbage  
collection is in use. (Under garbage collection, CFRelease is not a no- 
op like 'release' is.)

___

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]


Stop NSFileManager copyFile in progress? Can you kill a thread?

2008-11-10 Thread David
I have NSFIleManager copying files in a secondary thread. The user can
select to cancel the copy.
Is there a way to force NSFileManager to stop copying a file? The
files could be of arbitrary size. A large file could take quite a
while to end. I currently check if the thread has been cancelled
between files, but I can't figure out how to stop it if its in the
middle of copying one file.

Is there a way to make NSFileManager stop a copy operation?
Is there a way to forcibly kill a thread and thereby stop NSFileManager?

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: How to manage (My)SQL data in Cocoa

2008-11-10 Thread mmalcolm crawford


On Nov 10, 2008, at 12:39 PM, dreamcat7 wrote:

Sorry maybe i should have clarified that but i believed that Quincey  
had already explained about the datasource methods. You *must* (if  
you dont want to end up in a heap of self-inflicted mess) represent  
your data in those way - WHEN you intend to link to an NSTableView  
using bindings.



Again, as I stated in my first reply, no, you don't.

All that's required is that you implement the relevant KVC-/KVO- 
compliant accessor methods.  Provided that you do, how you represent  
the data behind them is, as with the data source methods, entirely up  
to you -- for the same reason I.S. noted for the data source methods.
Per Quincey's reply, it's certainly the case that the most natural fit  
is going to be if you use an array, but that's not the same as saying  
that you *must* adopt a particular way of representing your data.


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]


variable sensitive to Active Build Configuration

2008-11-10 Thread JB
Hi all,

I'm building a small app that talks to a web service, so I would like use
different URLs for the DEBUG vs. RELEASE targets (staging and production
URLs, respectively). What is the best way to conditionally set a variable
based on the Active Build Configuration?

Many thanks!
JB
___

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]


Quicktime Movie View error

2008-11-10 Thread Christopher Kempke

I'm trying to create a very, very simple QuickTime viewer in Cocoa.

I create a new Application, add QTKit and Quicktime frameworks, and  
drag a QuickTime Movie View into the main window.All is well if I  
run now (although the movie view is blank).


Going back into Interface Builder, I select the Movie View and in the  
Inspector Attributes, I set the "Movie" field to point to a movie  
file:  "file:///Sample/sample.mov".All is well in Interface  
Builder (the movie shows and plays), but as soon as I save and try to  
run in XCode, I get this message:


/* com.apple.ibtool.errors */
Internal Error:
	Description: The document "MainMenu.xib" could not be opened.  
Operation could not be completed. (com.apple.InterfaceBuilder error -1.)

Recovery Suggestion: Check the console log for additional information.

The console log adds:

11/10/08 2:58:49 PM ibtool[1554] Exception raised while decoding  
document objects - CGSDisableUpdate returned error 1002d


This doesn't appear to depend on which movie I choose, and is  
completely reproducable.   Am I missing a step?

___

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: MVC and Cocoa question

2008-11-10 Thread Graham Cox


On 11 Nov 2008, at 3:56 am, Steven Guitar wrote:

i am working on the challenge exercises for aaron hillegass' book,  
3rd edition, for chapter 18 challenge. i have setup the application  
with a subclass of NSDocument (MyDocument), a subclass of NSView  
(DrawPadView), and a model component called Shape.


basically as the user uses the mouse to draw shapes, i have an  
NSMutableArray in DrawPadView that contains the various shapes drawn  
by the user.


when it comes time to save this file, MyDocument is going to do all  
the work, but the only way i can think of to get an NSMutableArray  
in MyDocument to have the values of the array in the DrawPadView is  
to use the NSNotificationCenter.


is this ok? should i have my NSDocument class register as an  
observer of the NSView class? i was not sure if this was going  
against MVC or any other cocoa design patterns.


It sure does go against MVC.

DrawPadView is a View. NSDocument is part of the model. The reason you  
are having trouble is that a) your model data is in the wrong place  
and b) you have no C (Controller).





If you put your mutable array in your document subclass, it becomes  
easy to archive for saving purposes. Then, your view can ask the  
document for the array when it needs to draw the existing shapes.  
Ideally you would interpose a controller between the two to act as a  
go-between (since this is a fairly simple situation, you could do it  
without a controller, but for the purposes of learning the MVC  
approach, it might be better to go with it). The controller can (to  
help make it earn its keep) also handle the creation of new shapes.  
You can instantiate the controller in your document nib, and hook it  
to the document and view using outlets. There's no reason to use  
notifications to 'synchronise' the data, just make sure the data is in  
the right place, and not duplicated - then it can't help but always be  
up to date.


hth,

Graham


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: variable sensitive to Active Build Configuration

2008-11-10 Thread Rob Keniger


On 11/11/2008, at 8:47 AM, JB wrote:

I'm building a small app that talks to a web service, so I would  
like use
different URLs for the DEBUG vs. RELEASE targets (staging and  
production
URLs, respectively). What is the best way to conditionally set a  
variable

based on the Active Build Configuration?



In Xcode, open the build settings for your target. Make sure you're  
editing the settings for the Debug target only and in the  
"Preprocessor Macros" section, add "DEBUG" (without the quotes).


You can then do this in your source:

#ifdef DEBUG
NSLog(@"Debug build");
#else
NSLog(@"Release build");
#endif

--
Rob Keniger



___

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

2008-11-10 Thread Barry Wark
On Sun, Nov 9, 2008 at 2:03 PM, Tommy Nordgren <[EMAIL PROTECTED]> wrote:
> Is it possible to open an Additional file for use by logging in Cocoa
> (I want it to contain ONLY the info logged from my App)

I would suggest you check out the Apple System Logging facility
(asl.h). It allows you to send messages to the console and/or to
additional files of your choice. It's relatively easy to wrap its
functionality in some NSLog-like macro.

> --
> "Home is not where you are born, but where your heart finds peace" -
> Tommy Nordgren, "The dying old crone"
> [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/barrywark%40gmail.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: Floating point pixel data / image handling confusion

2008-11-10 Thread Adam R. Maxwell


On Nov 10, 2008, at 4:53 AM, Felix Ulber wrote:


I am working on an Cocoa Application whose main purpose is to display
some stuff in OpenGL.

In conjunction with that I need to be able to read in floating point
images (most likely from an exr file) and resize them. Unfortunately,
with NSImage and NSBitmapImage it seems I can get only 32 bpp/8bit per
channel bitmap data (as the example in the cocoa drawing guide).


I'm not familiar with exr, but NSBitmapImageRep does support floating  
point images; I use it to read 32-bit float GeoTIFF files.  See  
NSFloatingPointSamplesBitmapFormat from the NSBitmapFormat enum, or  
the Quartz docs for bitmap contexts (Table 2-1):


http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/chapter_3_section_4.html


So I did some research and stumbled upon things like Image I/O, Core
Image and vImage. But I have tom admit have absolutely no clue what to
use when and how.


The easiest way to scale your image is probably to create a new bitmap  
context of the desired size and pixel format, draw the original image  
into it, then use the pixel data from your new context.  You can  
either use NSImage/NSBitmapImageRep or Quartz 2D for that.


http://developer.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_texturedata/chapter_10_section_5.html

Core Image would work as well, but I think getting the pixel data is  
more roundabout.  I wouldn't recommend vImage if you're not familiar  
with the higher level frameworks.


--
Adam

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: Stop NSFileManager copyFile in progress? Can you kill a thread?

2008-11-10 Thread Adam R. Maxwell


On Nov 10, 2008, at 1:45 PM, David wrote:


I have NSFIleManager copying files in a secondary thread. The user can
select to cancel the copy.
Is there a way to force NSFileManager to stop copying a file? The
files could be of arbitrary size. A large file could take quite a
while to end. I currently check if the thread has been cancelled
between files, but I can't figure out how to stop it if its in the
middle of copying one file.

Is there a way to make NSFileManager stop a copy operation?
Is there a way to forcibly kill a thread and thereby stop  
NSFileManager?


Killing the thread is generally not a good solution, even if you can  
work it out with pthread functions.  In your case, I'd switch to the  
Carbon File Manager [1] and its asynchronous copying functions.   
Specifically, look at FSCopyObjectAsync or FSPathCopyObjectAsync,  
which can evidently be cancelled with FSFileOperationCancel (I'm not  
sure if you also have to use FSFileOperationUnscheduleFromRunLoop).


--
Adam

[1] 
http://developer.apple.com/documentation/Carbon/Reference/File_Manager/Reference/reference.html

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]

Distributed Objects, proxy NSDistantObjects over-retained on OSX 10.5?

2008-11-10 Thread Dave Cox
eturn 0;
}



// client.mm

#import 
#import "shared.h"
#import "log.h"


int main (int argc, char * const argv[]) {
log("client...\n");

bool extraRelease = false;

if (argc > 1 && argv[1][0] == 'x') {
extraRelease = true;
}

NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

id factory = nil;

do {
// lookup server factory object
id proxy = [NSConnection
rootProxyForConnectionWithRegisteredName: @SERVER_NAME
host: nil ];
if (proxy == nil) {
log("client: error: proxy is nil (server not found?)\n");
break;
}

factory = (id)proxy;

id server;

char* activity;

// run the server until terminated
while (true) {
server = nil;

NSAutoreleasePool* innerPool = [[NSAutoreleasePool alloc] init];

@try {
// get a server object from factory
activity = "getServer";
int factoryResult = [factory getServer: &server];
if (factoryResult != 1) {
log("client: getServer returned %d\n", factoryResult);
break;
}
if (server == nil) {
log("client: getServer returned nil server\n");
break;
}

log( "client: server has retainCount %u\n",
 [server retainCount] );

// call server object
activity = "getInt";
int serverResult = [server getInt];
if (serverResult != 42) {
log("client: getInt returned %d\n", serverResult);
break;
}

} @catch (NSException* x) {
log("client: exception thrown from %s: %s\n",
activity,
[[x reason] UTF8String] );
}

[innerPool release];

if (extraRelease) {
// if out-param proxies are considered owned by the caller,
// then this would be appropriate:
[server release];
}

sleep(1);
}

} while (false);

[pool release];

return 0;
}



//  log.h

#ifndef __log_h__ // {
#define __log_h__

void log(const char* format, ...);

#endif // } ndef'd __log_h__



// log.cpp

#include "log.h"
#include 
#include 
#include 
#include 


static pid_t pid = getpid();


void log(const char* format, ...) {
time_t now = time(NULL);
struct tm* sNow = localtime(&now);
fprintf(stdout,
"%.4d%.2d%.2d %.2d:%.2d:%.2d [%5d] ",
sNow->tm_year + 1900,
sNow->tm_mon + 1,
sNow->tm_mday,
sNow->tm_hour,
sNow->tm_min,
sNow->tm_sec,
pid );

va_list args;
va_start(args, format);

vfprintf(stdout, format, args);

va_end(args);

fflush(stdout);
}

----

OverRetain Test OSX 10.4.11

Note that when the autorelease pool releases the proxy, the corresponding remote
server is released and dealloced.

--


./server &

[1] 236


 20081110 12:08:33 [  236] server...


./client

20081110 12:09:42 [  241] client...
20081110 12:09:42 [  241] client: server has retainCount 1
20081110 12:09:43 [  236] server: CServer dealloc
20081110 12:09:43 [  241] client: server has retainCount 1
20081110 12:09:44 [  236] server: CServer dealloc
20081110 12:09:44 [  241] client: server has retainCount 1
20081110 12:09:45 [  236] server: CServer dealloc
20081110 12:09:45 [  241] client: server has retainCount 1
20081110 12:09:46 [  236] server: CServer dealloc
20081110 12:09:46 [  241] client: server has retainCount 1
20081110 12:09:47 [  236] server: CServer dealloc
20081110 12:09:47 [  241] client: server has retainCount 1
^C // terminate client
20081110 12:09:48 [  236] server: CServer dealloc

--


./client x

20081110 12:12:05 [  247] client...
20081110 12:12:05 [  247] client: server has retainCount 1
20081110 12:12:06 [  236] server: CServer dealloc
Bus error // tried to release proxy that has already been destroyed

--

OverRetain Test OSX 10.5.5

Note that wh

Proxy NSDistantObject on broken connection returns zero rather than throwing exceptions on OSX 10.5?

2008-11-10 Thread Dave Cox
c > 1 && argv[1][0] == 'x') {
extraRelease = true;
}

NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

id factory = nil;

do {
// lookup server factory object
id proxy = [NSConnection
rootProxyForConnectionWithRegisteredName: @SERVER_NAME
host: nil ];
if (proxy == nil) {
log("client: error: proxy is nil (server not found?)\n");
break;
}

factory = (id)proxy;

id server;

char* activity;

// call server in loop until terminated
while (true) {
server = nil;

NSAutoreleasePool* innerPool = [[NSAutoreleasePool alloc] init];

@try {
// get a server object from factory
activity = "getServer";
int factoryResult = [factory getServer: &server];
if (factoryResult != 1) {
log("client: getServer returned %d\n", factoryResult);
break;
}
if (server == nil) {
log("client: getServer returned nil server\n");
break;
}

log( "client: server has retainCount %u\n",
 [server retainCount] );

// call server object
activity = "getInt";
int serverResult = [server getInt];
if (serverResult != 42) {
log("client: getInt returned %d\n", serverResult);
break;
}

} @catch (NSException* x) {
log("client: exception thrown from %s: %s\n",
activity,
[[x reason] UTF8String] );
}

[innerPool release];

if (extraRelease) {
// if out-param proxies are considered owned by the caller,
// then this would be appropriate:
[server release];
}

sleep(1);
}

} while (false);

[pool release];

return 0;
}



//  log.h

#ifndef __log_h__ // {
#define __log_h__

void log(const char* format, ...);

#endif // } ndef'd __log_h__



// log.cpp

#include "log.h"
#include 
#include 
#include 
#include 


static pid_t pid = getpid();


void log(const char* format, ...) {
time_t now = time(NULL);
struct tm* sNow = localtime(&now);
fprintf(stdout,
"%.4d%.2d%.2d %.2d:%.2d:%.2d [%5d] ",
sNow->tm_year + 1900,
sNow->tm_mon + 1,
sNow->tm_mday,
sNow->tm_hour,
sNow->tm_min,
sNow->tm_sec,
    pid );

va_list args;
va_start(args, format);

vfprintf(stdout, format, args);

    va_end(args);

fflush(stdout);
}

--------

Test run on OSX 10.4.11

> ./server &
[1] 257

20081110 12:14:21 [  257] server...

> ./client
20081110 12:14:34 [  259] client...
20081110 12:14:34 [  259] client: server has retainCount 1
20081110 12:14:35 [  257] server: CServer dealloc
20081110 12:14:35 [  259] client: server has retainCount 1
20081110 12:14:36 [  257] server: CServer dealloc
20081110 12:14:36 [  259] client: server has retainCount 1
20081110 12:14:37 [  257] server: CServer dealloc
20081110 12:14:37 [  259] client: server has retainCount 1
20081110 12:14:38 [  257] server: CServer dealloc
20081110 12:14:38 [  259] client: server has retainCount 1
20081110 12:14:39 [  257] server: CServer dealloc
20081110 12:14:39 [  259] client: server has retainCount 1
// kill server
20081110 12:14:40 [  259] client: exception thrown from getServer:
[NSMachPort sendBeforeDate:] destination port invalid
20081110 12:14:41 [  259] client: exception thrown from getServer:
NSDistantObject is invalid
20081110 12:14:42 [  259] client: exception thrown from getServer:
NSDistantObject is invalid
20081110 12:14:43 [  259] client: exception thrown from getServer:
NSDistantObject is invalid
^C // terminate client
[1]  + Terminated    ./server
--

Test run on OSX 10.5.5

> ./server &
[1] 15832

20081110 11:49:48 [15832] server...


> ./client
20081110 11:50:02 [15834] client...
20081110 11:50:02 [15834] client: server has retainCount 3
20081110 11:50:03 [15834] client: server has retainCount 3
20081110 11:50:04 [15834] client: server has retainCount 3
20081110 11:50:05 [15834] client: server h

Re: Quicktime Movie View error

2008-11-10 Thread Joey Hagedorn

On Nov 10, 2008, at 3:01 PM, Christopher Kempke wrote:

I'm trying to create a very, very simple QuickTime viewer in Cocoa.

I create a new Application, add QTKit and Quicktime frameworks, and  
drag a QuickTime Movie View into the main window.All is well if  
I run now (although the movie view is blank).


Going back into Interface Builder, I select the Movie View and in  
the Inspector Attributes, I set the "Movie" field to point to a  
movie file:  "file:///Sample/sample.mov".All is well in  
Interface Builder (the movie shows and plays), but as soon as I save  
and try to run in XCode, I get this message:


/* com.apple.ibtool.errors */
Internal Error:
	Description: The document "MainMenu.xib" could not be opened.  
Operation could not be completed. (com.apple.InterfaceBuilder error  
-1.)
	Recovery Suggestion: Check the console log for additional  
information.


The console log adds:

11/10/08 2:58:49 PM ibtool[1554] Exception raised while decoding  
document objects - CGSDisableUpdate returned error 1002d


Christopher,

You might be able to work around this specific problem by using nib  
files instead of xib files, so that ibtool doesn't need to compile  
them when you build your project with xcode.


-Joey

___

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: How to write a remote control app for Mac

2008-11-10 Thread Michael Ash
On Mon, Nov 10, 2008 at 2:49 PM, David <[EMAIL PROTECTED]> wrote:
> Hello,
> Can someone point me to general documentation that would give me an
> idea how to write a remote control application for the Mac.
>
> The hardest part seem to be how to capture what's currently on the
> screen and when it changes.
>
> I have no idea where to look. Is it even possible to do this while
> using public APIs?

You bet!

To capture the screen, look here:

http://www.cocoadev.com/index.pl?ScreenShotCode

That page shows many different approaches and discusses their various
tradeoffs. If speed is your goal, using OpenGL to capture the contents
is the way to go.

To find out when the screen changes, look through the functions in
CGRemoteOperation.h. That header has functions which can be used to
find out when portions of the screen change and where the change
happened.

However, if I may ask, given the existence of good, free VNC servers
(including one that ships with the OS), why reinvent the wheel?

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: Stop NSFileManager copyFile in progress? Can you kill a thread?

2008-11-10 Thread Michael Ash
On Mon, Nov 10, 2008 at 4:45 PM, David <[EMAIL PROTECTED]> wrote:
> I have NSFIleManager copying files in a secondary thread. The user can
> select to cancel the copy.
> Is there a way to force NSFileManager to stop copying a file? The
> files could be of arbitrary size. A large file could take quite a
> while to end. I currently check if the thread has been cancelled
> between files, but I can't figure out how to stop it if its in the
> middle of copying one file.
>
> Is there a way to make NSFileManager stop a copy operation?
> Is there a way to forcibly kill a thread and thereby stop NSFileManager?

Just for the sake of completeness, you can kill an individual thread
by using the pthread_cancel function. This is "just for the sake of
completeness" because the use of thread cancellation places extreme
restrictions on the activities of the target thread, and as such it's
nearly useless in practice.

There are actually two types of cancellation, but neither of them
really work for what you want:

- Asynchronous cancellation kills the target thread essentially at any
time. This makes it extremely difficult to write safe code in the
target thread, because it needs to die safely no matter when it dies,
even in between two lines of code in the same function, even in
between two instructions generated from a single line of code.

- Deferred cancellation kills the target thread the next time it hits
a "cancellation point", which is one of a small set of library
functions. (The full list can be found in the man page for
pthread_testcancel.) The fact that cancellation can only happen at
these defined points helps with writing a cancel-safe thread, since
you just have to ensure that things are in a good state to either
disappear or be cleaned up just before calling any of those functions.

The reason neither one helps you is because it's not your code that
you're worrying about, it's NSFileManager. Unless a library makes
explicit guarantees about its safety regarding thread cancellation,
you can't assume that it's safe. At the very least, you are virtually
guaranteed to leak memory if you cancel a thread that is in the middle
of executing NSFileManager code. You could also end up with corrupt
memory, with locks being held that never get freed, and with a number
of other problems that can hang or crash your app in rapid fashion.

You can cancel the thread safely by writing your own code to be cancel
safe, then disabling cancellation before you enter any Cocoa code, and
re-enabling it afterwards. But of course this brings you right back to
the original problem, which is that NSFileManager can take arbitrarily
long to finish its job and return you to a point where your thread can
be cancelled. At this point you've gained nothing over an explicit
cancellation check.

It's really too bad that it doesn't work, because it could be a useful
technique in scenarios like this, but so it goes.

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: duplicate decalration for protocol

2008-11-10 Thread Andrew Farmer

On 10 Nov 08, at 01:40, pan xuan wrote:
I have two classes that both conform to a protocol ABC. Now the  
third class needs to import those two classes and I got a warning  
duplicate declaration for protocol ABC. Could anybody tell me how to  
reduce this kind of warning?


Assuming that you're currently declaring the protocol in both header  
files, move the declaration to a new file and #import it from both of  
the headers.

___

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]