Re: NSViewController and View Swapping

2008-07-14 Thread Scott Anguish

you can still do it with NSTabView

use setTabViewType to one of the following
NSNoTabsBezelBorder = 4, NSNoTabsLineBorder = 5, NSNoTabsNoBorder = 6


have your button actions change the visible tab using one of...

- (void)selectTabViewItemAtIndex:(NSInteger)index

- (void)selectTabViewItemWithIdentifier:(id)identifier


- (void)selectTabViewItem:(NSTabViewItem *)tabViewItem





On 14-Jul-08, at 2:04 AM, Brad Gibbs wrote:


Thanks for the quick response and the links.

NSTabView with tabs on the bottom is exactly what I'm looking for,  
except, I'm writing a fullscreen app with stylized NSImage buttons,  
rather than tabs.  I'm still looking through the ViewController  
sample code.  Given the number of single window apps out there  
today, it seems like swapping views should be one of those common  
things that is easy to accomplish with Cocoa, rather than an  
uncommon thing that's merely possible...




On Jul 13, 2008, at 10:46 PM, Nathan Kinsinger wrote:



On Jul 13, 2008, at 11:15 PM, Brad Gibbs wrote:

I'm trying to create a Cocoa app with a single window with a  
number of views that get swapped in and out, using an  
NSViewController for each of the views.


I have a series of buttons along the bottom of the UI in a custom  
view, and another custom view above the row of buttons.  When  
button A is pressed, view A should appear in the custom view above  
the row of buttons, and button A should be turned on.  When button  
B is pressed, view A should be replaced by View B, button A should  
turn off and button B should turn on.  Ultimately, I'd like to do  
this with an animation (view A fades out and view B fades in).   
For now, I'd be happy just replacing A with B.


I haven't been able to find much in the documentation about  
NSViewController for Cocoa.  I have the Hillegass book, but the  
view swapping example in Chapter 29 is done with a document-based  
application and the views there are contained in an NSBox:


...
NSView *v = [vc view];
[box setContentView:v];
...

I don't know Cocoa well enough to adapt this example for a non- 
document-based application without an NSBox.  Could someone please  
point me to documentation for NSViewController, other than the  
NSViewController Reference, or provide me with a quick explanation  
or example code that will do this?  I've read through the Katidev  
blog on XSViewController and XSWindowController, but, again,  
that's a document-based example, and it doesn't explicitly provide  
methods for replacing one view with another.



Thanks in advance.

Brad


There is an example at:
http://developer.apple.com/samplecode/ViewController/index.html

Also what you are describing sounds a lot like an NSTabView with  
the style set to Bottom Tabs. Try creating one in IB and playing  
with it. Also look at:

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/TabView/TabView.html
and an example with animation at:
http://developer.apple.com/samplecode/Reducer/index.html

--Nathan


___

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

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

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

This email sent to [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]


Questions about Core Data and SQLite

2008-07-14 Thread Jeff Brown
Hi Guys

I've got a cocoa app that is installed as a client on several machines and uses 
MySql as the database.

Is there any way I can incorporate Core Data into the app so that I can do away 
with using MySql? i.e. log into the app on one machine (using it's SQLite 
database) from the same app on a different machine?
 
If so, given that I know a some about Cocoa development but nothing about using 
Core Data, can anyone direct me to some good documentation that explains how to 
incorporate Core Data into an already existing Cocoa app. (It currently uses 
MySQL).

Thanks greatly for any help.

Jeff


  Start at the new Yahoo!7 for a better online experience. www.yahoo7.com.au
___

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: Creating the app menu from scratch

2008-07-14 Thread Bill Bumgarner

On Jul 13, 2008, at 11:35 PM, Jeff Johnson wrote:

On Jul 13, 2008, at 10:37 PM, Bill Bumgarner wrote:
And, no, exchanging class methods is not a typical pattern to be  
employed when developing a Cocoa application. In particular,  
replacing or exchanging method implementations found in Apple  
frameworks is completely unsupported and will quite likely break in  
the future.


b.bum
I fully admit that the use of the private methods -[NSApplication  
setAppleMenu:] and -[NSMenu _setMenuName:] is completely unsupported  
and may break in the future, though I hope that they don't and that  
in fact Apple provides public API for this functionality.


Any time you use private API, it isn't just that it might go away, it  
might change behavior or may change prerequisites or may have  
different side effects, etc...


On the other hand, the function method_exchangeImplementations()  
just became public API in Leopard, so I don't see how that can break  
anytime soon. It's not much different than subclassing or  
'categorizing'.


Correct.  However, it is what you are using  
method_exchangeImplementations() for that is problematic.  Namely, you  
are editing the method tables for an Apple supplied class.   This is  
unsupported and may be problematic for any number of reasons -- KVO,  
IMP caching, internal implementation details, etc...


It is quite a bit different than either subclassing or using categories.

For subclassing, you override behavior and, if you are doing it right,  
don't break encapsulation -- don't access your super's instance  
variables directly and do use API to manipulate super's state (unless,  
of course, super is actually a class of your own design -- then it is  
all fair game, but you should still consider carefully how the super/ 
sub relationship should be work).


For categories, all is well until the moment you override an existing  
method in a class other than your own.  At that point, you are asking  
for a world of maintenance headaches and a whole lot of fun debugging  
stuff.


b.bum



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: Remove overlap on NSBezierPath

2008-07-14 Thread Georg Seifert

Hello,

Thanks for you replies.

To clarify: I need it in a small drawing app, where you can draw  
shapes and then you should be able to combine them. There is no  
outline but the winding is quite important (there may be overlapping,  
clipping and self intersecting parts).


I did found DrawKit but as I need to keep the curves, this doesn’t  
seem to be an option.


the precision of the location of the intersection points is not to  
important,as they are rounded to full integers – the shape of the  
curve shouldn’t change to much.


I just had a short look at the Omni-OAExtensions. There are some  
functions to find intersections of paths, so I have to build my own  
merging routine out of it, right?


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


Re: Is there any way to show disclosure button always closed in NSOutlineView

2008-07-14 Thread Joan Lluch (casa)




El 14/07/2008, a las 7:49, Aman Alam escribió:

I am working on a project that needs the disclosure button of  
NSOutlineView always closed whether its row are expanded or not.


Does anyone know that how to do that?




Does not that violate the Apple Human Interface Guidelines?. I mean,  
what condition do you want to show.


Joan Lluch___

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: Is there any way to show disclosure button always closed in NSOutlineView

2008-07-14 Thread Aman Alam
I want to show some detail about items that is in child object without 
expanding the disclosure button.


On clicking disclosure button, there comes more detail that contained by 
some other child items without removing previous one.


Also the childs must contain disclosure button that will use to show there 
detail.


Is it possible to implement this scenario?



El 14/07/2008, a las 7:49, Aman Alam escribió:

I am working on a project that needs the disclosure button of 
NSOutlineView always closed whether its row are expanded or not.


Does anyone know that how to do that?




Does not that violate the Apple Human Interface Guidelines?. I mean,  what 
condition do you want to show.


Joan Lluch

No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 
270.4.10/1550 - Release Date: 7/13/2008 5:58 PM






___

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]


NSSliderCell subclass?

2008-07-14 Thread Damien Cooke

Hi All,
I want to be able to determine the value of the NSSlider whilst  
sliding it.  I am guessing I will have to subclass NSSliderCell but if  
anyone has an example or some direction as to which methods I need to  
override I would really appreciate it.



Regards
Damien



"We act as though comfort and luxury were the chief requirements of  
life, when all that we need to make us happy is something to be  
enthusiastic about."


-- Albert Einstein



___

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: NSSliderCell subclass?

2008-07-14 Thread Graham Cox
Just invoke [mySlider setContinuous:YES] and your action method will  
be called for every value change while sliding "live". Did you mean  
something else?


Graham


On 14 Jul 2008, at 9:02 pm, Damien Cooke wrote:


Hi All,
I want to be able to determine the value of the NSSlider whilst  
sliding it.  I am guessing I will have to subclass NSSliderCell but  
if anyone has an example or some direction as to which methods I  
need to override I would really appreciate it.


___

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: Is there any way to show disclosure button always closed in NSOutlineView

2008-07-14 Thread I. Savant

On Jul 14, 2008, at 7:07 AM, Aman Alam wrote:

I want to show some detail about items that is in child object  
without expanding the disclosure button.



  They're called "tooltips" and you should most definitely use them.  
Alternatively, selecting the parent can reveal summary child data in a  
separate "detail" view.


  Either way would be the expected UI in a Mac application but if  
your app behaved as you describe it, I'd consider it broken and join  
the flood of "bug" reports you're likely to get from users. Or I'd  
just delete the app if it wasn't otherwise excellent or indispensable.


--
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: Remove overlap on NSBezierPath

2008-07-14 Thread Graham Cox


On 14 Jul 2008, at 7:48 pm, Georg Seifert wrote:


Hello,

Thanks for you replies.

To clarify: I need it in a small drawing app, where you can draw  
shapes and then you should be able to combine them. There is no  
outline but the winding is quite important (there may be  
overlapping, clipping and self intersecting parts).


If you don't need to draw the stroke, things maybe much easier (you  
could keep a list of contributing paths as part of some object of your  
own device for example).


I did found DrawKit but as I need to keep the curves, this doesn’t  
seem to be an option.



Right now I use GPC and (optional) curve fitting. It keeps the curves  
in terms of their appearance but can greatly alter the number and  
location of the control points. I don't like it much either - one  
reason I'd love there to be a great solution built-in. Unfortunately  
I'm no mathematician and so I haven't been able to come up with a  
great way to do it from first principles, nor found any suitable code  
out there until...


I just had a short look at the Omni-OAExtensions. There are some  
functions to find intersections of paths, so I have to build my own  
merging routine out of it, right?



...this. I hadn't seen those before either. It looks as if they've  
given away the hardest part, finding the intersections and crossing  
directions of each intersection. On top of that you can build the set  
operations. I plan to have a very good look at doing this for DK as  
soon as I can - if it can be made to work it will be a much better  
solution than curve fitting. Props to the Omni guys for being prepared  
to give away this code like this :)




cheers, 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: NSSliderCell subclass?

2008-07-14 Thread Damien Cooke
Thanks Graham, You are a champion.  That saves me a lot of work.  I  
have no idea why I did not spot that in the docs.  I am sorry to  
trouble you.


Damien

On 14/07/2008, at 8:39 PM, Graham Cox wrote:

Just invoke [mySlider setContinuous:YES] and your action method will  
be called for every value change while sliding "live". Did you mean  
something else?


Graham


On 14 Jul 2008, at 9:02 pm, Damien Cooke wrote:


Hi All,
I want to be able to determine the value of the NSSlider whilst  
sliding it.  I am guessing I will have to subclass NSSliderCell but  
if anyone has an example or some direction as to which methods I  
need to override I would really appreciate it.




___

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: Remove overlap on NSBezierPath

2008-07-14 Thread Robert Clair


What the mathematicians balk at isn't the pathological cases; rather,
getting exact results.



But the real problem is that these two are related. I spent several  
years fixing the Boolean operations for a major CAD company's solid  
modeler (the long-gone ComputerVision) which is essentially the same  
problem made much more difficult by doing it in three dimensions.


The basic algorithm is conceptually simple:

1.) find all the intersections

2.) break into pieces at the intersections

3.) decide which pieces you need on the basis of some in/out tests and  
which set operation you are doing.


4.) assemble the final result

The hitch is that #3 is a bunch of yes/no decisions that you must make  
on the basis of imprecise floating point operations in #1. And all the  
results of #3 have to be consistent or #4 won't work properly. This is  
trivial in the easy cases (curves intersecting at reasonable angles,  
no tiny pieces) but *VERY* hard to get right for the arbitrary case  
(tangencies, near-tangencies, overlaps, pieces of curve that come out  
smaller than whatever numerical tolerance you are using for your  
floating point approximations, etc.). Essentially you have to have  
some checks on the final result and be prepared to fail gracefully.


RObert Clair
___

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: Creating and App menu from Scratch

2008-07-14 Thread Bill Royds


On 14-Jul-08, at 01:38 , Bill Bumgarner <[EMAIL PROTECTED] wrote:

Your application's menu isn't that big of a deal, but your  
application's integration with Mac OS X is a very big deal and that  
is most of the battle of doing "nib less" development.   It is much  
more than just populating the main menu.   Specifically, the  
application wrapper -- the .app -- typically contains all kinds of  
metadata that is used by Mac OS X to integrate the application into  
the system, both from the Finder's perspective and when the  
application is run.


Are there any good tools for porting Application menus and forms from  
other windowing systems (such as MS Windows or X or even Carbon) to  
Cocoa nibs? I have a number of applications that I would like to port,  
but redesigning  the form or menu layout completely seems to be rather  
pointless. I am quite willing to rewrite all the code that interacts  
with the forms or menus, but I am not a graphic designer so form  
layout is better left to experts who have already done it.
All I really want is a tool that will put objects without any  
connections or code on a form or menu by parsing a MS .RC file, for  
example


Being able to do this would lead to an large increase in the number of  
Macintosh applications available.


Bill Royds

___

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: Creating and App menu from Scratch

2008-07-14 Thread Kyle Sluder
On Mon, Jul 14, 2008 at 8:53 AM, Bill Royds <[EMAIL PROTECTED]> wrote:
> Being able to do this would lead to an large increase in the number of
> Macintosh applications available.

It would lead to a large increase in poorly-designed, auto-ported Mac
applications.  And then developers would wonder why nobody wants to
purchase their software, even though the Windows version did so well.

Part of developing for the Mac really involves appreciation for the
user experience.  To this effect, not employing the services of
someone talented in interface design will result in the application
failing to mesh with the rest of the ecosystem of applications.  Mac
users tend to  notice this.

--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: Questions about Core Data and SQLite

2008-07-14 Thread Kyle Sluder
On Mon, Jul 14, 2008 at 4:05 AM, Jeff Brown <[EMAIL PROTECTED]> wrote:
> Is there any way I can incorporate Core Data into the app so that I can do 
> away with using MySql? i.e. log into the app on one machine (using it's 
> SQLite database) from the same app on a different machine?

No.  Please read the Core Data documentation, which explicitly states
that this scenario is not supported.  As the documentation states,
"Core Data is Not a Database."  (Of course, "not supported" is
different from "impossible", but both are certainly "not
recommended").

That said, if you are willing to completely re-architect your
solution, you can go the Delicious Library 2 route, which would be to
decentralize your database and sync over Bonjour or some other
channel.  It depends on whether you really need ACID compliance.

--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: Creating and App menu from Scratch

2008-07-14 Thread Kevin Walzer

Bill Royds wrote:


Are there any good tools for porting Application menus and forms from 
other windowing systems (such as MS Windows or X or even Carbon) to 
Cocoa nibs? I have a number of applications that I would like to port, 
but redesigning  the form or menu layout completely seems to be rather 
pointless. I am quite willing to rewrite all the code that interacts 
with the forms or menus, but I am not a graphic designer so form layout 
is better left to experts who have already done it.
All I really want is a tool that will put objects without any 
connections or code on a form or menu by parsing a MS .RC file, for example


A "Carbon to Cocoa" tool would certainly be nice...

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating and App menu from Scratch

2008-07-14 Thread Bill Royds


On 14-Jul-08, at 09:20 , Kyle Sluder wrote:


It would lead to a large increase in poorly-designed, auto-ported Mac
applications.  And then developers would wonder why nobody wants to
purchase their software, even though the Windows version did so well.


Not necessarily. You are assuming that all other interfaces are  
inferior to Macintosh interfaces. Depending on the application, there  
may have been a great deal of work in designing an interface specifica  
to a particular discipline. The layout may be a "standard" form  
required by law or other convention. I am not suggesting that one port  
the code, just the forms and menu labels. Once they are ported to a  
nib, they can be modified to better conform to Mac HI guidelines.
   But until there is an pathway to port applications at all, there  
is no incentive to even create the applications on a Mac.

___

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: Is there any way to show disclosure button always closed in NSOutlineView

2008-07-14 Thread douglas welton

HI Aman,

Have you considered using custom cells in your NSOutlineView?

The parent cell could be used to display info about the children  
objects without having to display the actual children.  You could then  
use a different cell for the children objects to display the  
additional child-specific info you need to show.


Alternately,  have you considered using NSCollectionView?

I could easily see using this view as a way to create a progressive- 
disclosure-based display for hierarchical info.  This might be an  
approach that is more in line with what you want to do (my opinion),  
because it allows you to use the disclosure button as an information  
filter without being bound by the implicit behavior you inherit from  
NSOutlineView.


hope that helps.

regards,

douglas

On Jul 14, 2008, at 7:07 AM, Aman Alam wrote:

I want to show some detail about items that is in child object  
without expanding the disclosure button.


On clicking disclosure button, there comes more detail that  
contained by some other child items without removing previous one.


Also the childs must contain disclosure button that will use to show  
there detail.


Is it possible to implement this scenario?



El 14/07/2008, a las 7:49, Aman Alam escribió:

I am working on a project that needs the disclosure button of  
NSOutlineView always closed whether its row are expanded or not.


Does anyone know that how to do that?




Does not that violate the Apple Human Interface Guidelines?. I  
mean,  what condition do you want to show.


Joan Lluch


___

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: Creating and App menu from Scratch

2008-07-14 Thread Kyle Sluder
On Mon, Jul 14, 2008 at 9:37 AM, Bill Royds <[EMAIL PROTECTED]> wrote:
> Not necessarily. You are assuming that all other interfaces are inferior to
> Macintosh interfaces.

No, I am asserting that not following the conventions established on
the Mac is inferior to following those conventions, regardless of
whether you're following those of some other platform.

> Depending on the application, there may have been a
> great deal of work in designing an interface specifica to a particular
> discipline.

See Photoshop, Illustrator, 3DS Max... all of which are criticized for
behaving counter to user expectation.  And for an extreme example of
what happens when you let programmers make these sorts of decisions,
look at Blender.

> The layout may be a "standard" form required by law or other
> convention. I am not suggesting that one port the code, just the forms and
> menu labels.

I know of no statute that mandates Look & Feel, and I seriously doubt
one exists.  As for "other convention", typically people are talking
about fear of user re-education.  But we're talking about porting an
application to the Macintosh, which means either a version for the Mac
didn't exist before, or the one that did exist was considered
insufficient and needed to be replaced.

> Once they are ported to a nib, they can be modified to better
> conform to Mac HI guidelines.

This will require so much effort as to be pointless.  And it would
probably result in a poor interface with the design patterns that
permeate Cocoa.

>   But until there is an pathway to port applications at all, there is no
> incentive to even create the applications on a Mac.

Rubbish, poppycock, and an absolute falsehood.  You are assuming that
all applications written for the Mac are inferior to applications
written for other platforms.

--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: Trashing files and undo

2008-07-14 Thread Sean McBride
On 7/12/08 11:49 AM, Charles Srstka said:

>He's not referring to making an alias *file*, just an alias in memory.
>To do that, you make an FSRef first as I described, then you use
>FSNewAlias() with NULL as the first argument, a pointer to your FSRef
>as the second argument, and a pointer to an AliasHandle as the third
>argument. Later, you can use FSResolveAlias() to get the FSRef back,
>and then you resolve the FSRef into a file path.

Or you just use the NDAlias class:


--

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: Trigonometric Problem, Particularly tan() Function

2008-07-14 Thread Sean McBride
On 7/13/08 2:53 PM, Graham Cox said:

>Obviously the tan() function works as it should

Not necessarily so obvious. :) The log10() function was broken in 10.5.2:


--

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: NSViewController and View Swapping

2008-07-14 Thread Brad Gibbs
OK, thanks for the tip.  I think this will work well for the situation  
I described.


But, that screen (with its tab view and all of the custom views to be  
made available from within the tab view) is one of several screens  
like it.  The other tab views will contain different numbers of tabs.   
The user will be able to choose among the screens from a pop-up menu  
on a status bar at the top of the screen.  So, I still need a way to  
swap out one set of tab views with another, without using a box, in a  
non-document-based application.  So, I think I still need to solve the  
problem of how to change:


[box setContentView:v]

to swap out one custom tab view with another, so that when the user  
selects another set of tab views, the current tab view is swapped out  
and replaced by the newly-selected tab view.



Thanks again.

Brad




On Jul 14, 2008, at 12:17 AM, Scott Anguish wrote:


you can still do it with NSTabView

use setTabViewType to one of the following
NSNoTabsBezelBorder = 4, NSNoTabsLineBorder = 5, NSNoTabsNoBorder = 6


have your button actions change the visible tab using one of...

- (void)selectTabViewItemAtIndex:(NSInteger)index

- (void)selectTabViewItemWithIdentifier:(id)identifier


- (void)selectTabViewItem:(NSTabViewItem *)tabViewItem





On 14-Jul-08, at 2:04 AM, Brad Gibbs wrote:


Thanks for the quick response and the links.

NSTabView with tabs on the bottom is exactly what I'm looking for,  
except, I'm writing a fullscreen app with stylized NSImage buttons,  
rather than tabs.  I'm still looking through the ViewController  
sample code.  Given the number of single window apps out there  
today, it seems like swapping views should be one of those common  
things that is easy to accomplish with Cocoa, rather than an  
uncommon thing that's merely possible...




On Jul 13, 2008, at 10:46 PM, Nathan Kinsinger wrote:



On Jul 13, 2008, at 11:15 PM, Brad Gibbs wrote:

I'm trying to create a Cocoa app with a single window with a  
number of views that get swapped in and out, using an  
NSViewController for each of the views.


I have a series of buttons along the bottom of the UI in a custom  
view, and another custom view above the row of buttons.  When  
button A is pressed, view A should appear in the custom view  
above the row of buttons, and button A should be turned on.  When  
button B is pressed, view A should be replaced by View B, button  
A should turn off and button B should turn on.  Ultimately, I'd  
like to do this with an animation (view A fades out and view B  
fades in).  For now, I'd be happy just replacing A with B.


I haven't been able to find much in the documentation about  
NSViewController for Cocoa.  I have the Hillegass book, but the  
view swapping example in Chapter 29 is done with a document-based  
application and the views there are contained in an NSBox:


...
NSView *v = [vc view];
[box setContentView:v];
...

I don't know Cocoa well enough to adapt this example for a non- 
document-based application without an NSBox.  Could someone  
please point me to documentation for NSViewController, other than  
the NSViewController Reference, or provide me with a quick  
explanation or example code that will do this?  I've read through  
the Katidev blog on XSViewController and XSWindowController, but,  
again, that's a document-based example, and it doesn't explicitly  
provide methods for replacing one view with another.



Thanks in advance.

Brad


There is an example at:
http://developer.apple.com/samplecode/ViewController/index.html

Also what you are describing sounds a lot like an NSTabView with  
the style set to Bottom Tabs. Try creating one in IB and playing  
with it. Also look at:

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/TabView/TabView.html
and an example with animation at:
http://developer.apple.com/samplecode/Reducer/index.html

--Nathan


___

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

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

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

This email sent to [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: Creating the app menu from scratch

2008-07-14 Thread Jim Crafton
> Your application's menu isn't that big of a deal, but your application's
> integration with Mac OS X is a very big deal and that is most of the battle
> of doing "nib less" development.   It is much more than just populating the
> main menu.   Specifically, the application wrapper -- the .app -- typically
> contains all kinds of metadata that is used by Mac OS X to integrate the
> application into the system, both from the Finder's perspective and when the
> application is run.

Well that I understand. And I've made pains in my framework library to
account for that, and in fact have borrowed many ideas from Apple and
used them on Win32. In fact the resource loading works in much the
same way as resource bundles do on OS X, as well as the presence of
info.plist resource files.

>
> How do you bootstrap the framework?  I.e. what executable is run that uses
> the resources from the framework?  That is the most likely place to stick
> the MainMenu.nib and let Cocoa bootstrap the normal way.

Well you'd create your standard C++ app in Xcode (with standard app
settings, i.e. you're creating a full blown .app bundle, not a unix
command line utility), and then link to my libraries as Frameworks
(i'd like to offer the possibility to link statically, but I'm 100%
sure about how to do that). Given that I've created my libraries as
Frameworks, can I have a .nib as part of one of the Framework bundles?
My framework is laid out like so:

FoundationKit.framework
GraphicsKit.framework (depends on FoundationKit.framework)
ApplicationKit.framework (depends on GraphicsKit.framework)

If you're writing a GUI app, then you'd link to
ApplicationKit.framework (and GraphicsKit.framework +
FoundationKit.framework).  Can I have a MainMenu.nib file in the
ApplicationKit.framework? That way it's all built in and the developer
doesn't have to worry about creating it.

Cheers

Jim
___

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]


NSBezierPath fill pattern?

2008-07-14 Thread David Harper
Hello,

I'm hoping to find a way to fill an NSBezierPath with a bitmap pattern of 
arbitrary size - probably something like 32x32.  It will be a 2-color "on-off" 
(foreground-background) pattern where each color can be defined by the user.  
Looking through the NSBezierPath class documentation, nothing seemed to exist 
to help with this.  Line patterns were all I found.  Can anyone recommend an 
alternative approach, perhaps using Core Graphics or OpenGL?

Thanks,
 - Dave H.
___

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: NSBezierPath fill pattern?

2008-07-14 Thread Matt Gough
Sounds like you want to use [NSColor colorWithPatternImage] and use  
that as the fill color.


Matt
On 14 Jul 2008, at 4:48pm, David Harper wrote:


Hello,

I'm hoping to find a way to fill an NSBezierPath with a bitmap  
pattern of arbitrary size - probably something like 32x32.  It will  
be a 2-color "on-off" (foreground-background) pattern where each  
color can be defined by the user.  Looking through the NSBezierPath  
class documentation, nothing seemed to exist to help with this.   
Line patterns were all I found.  Can anyone recommend an alternative  
approach, perhaps using Core Graphics or OpenGL?


Thanks,
- Dave H.

___

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]


What is the best way?

2008-07-14 Thread Ronnie B
Hi.
I am seeking an advise.  I have an app that after loading a MainMenu.nib, it
checks the defaults for some data and if data is not there, the app will
request it via the other NIB  (modal window).  The Main window shall not be
blocked.  What would be a proper way of doing things like that?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating and App menu from Scratch

2008-07-14 Thread Gregory Weston

Bill Royds wrote:


On 14-Jul-08, at 09:20 , Kyle Sluder wrote:


It would lead to a large increase in poorly-designed, auto-ported Mac
applications.  And then developers would wonder why nobody wants to
purchase their software, even though the Windows version did so well.


Not necessarily. You are assuming that all other interfaces are
inferior to Macintosh interfaces.


No he's not. Long-time Mac developers know quite well that by and  
large Mac users are very averse to apps that simply don't fit. It's  
not a question of arguments about "better" or "worse" (although such  
arguments can certainly be had). The simple fact that an application  
gratuitously deviates from the standard user experience is a killer  
for almost any app that has competition. For what it's worth, Mac- 
like applications on Windows are just as bad.


I'll give an example: Part of the user experience *for me* is that  
Windows machines have 2-button mice and Macs have 1 or 3 buttons.  
Obviously I'm not saying this is a general truth, but certainly the  
vast majority of Windows installationshave 2 buttons, and the Macs  
*I* use every day have the original mice or a 3-button replacement.  
So here's the quirk:


When I sit down at a Mac with a 2-button mouse, if I right-click on a  
file I expect to see a Windows context menu. I expect, for example,  
to see a "Properties" item at the bottom of the menu, not a "Get  
Info" near the top. The time it takes to recover from that  
discrepancy is not just measurable; it's noticeable.




Depending on the application, there
may have been a great deal of work in designing an interface specific
to a particular discipline. The layout may be a "standard" form
required by law or other convention. I am not suggesting that one port
the code, just the forms and menu labels. Once they are ported to a
nib, they can be modified to better conform to Mac HI guidelines.


Kyle also didn't indicate that there was no possible way for a good  
app to result from the use of such a tool. He just worries -  
correctly in my opinion - that an awful lot of developers who would  
use that tool wouldn't expend the resources to actually clean it up  
after the fact. And when the app fails in that circumstance - not if,  
but when - it's always cast as a failing of the Mac or its market,  
rather than an acknowledgment that just possibly the app itself was  
crap. Elitist as it may sound on first blush, the reality is that  
software tends to be better when the developer is required to think.

___

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: Trigonometric Problem, Particularly tan() Function

2008-07-14 Thread glenn andreas


On Jul 14, 2008, at 9:06 AM, Sean McBride wrote:


On 7/13/08 2:53 PM, Graham Cox said:


Obviously the tan() function works as it should


Not necessarily so obvious. :) The log10() function was broken in  
10.5.2:





And vpowf had its parameters backwards on early Intel systems (which  
bit me big time):






Glenn Andreas  [EMAIL PROTECTED]
  wicked fun!
quadrium2 | build, mutate, evolve, animate  | images, textures,  
fractals, art



___

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: Remove overlap on NSBezierPath

2008-07-14 Thread Jens Alfke


On 14 Jul '08, at 5:26 AM, Robert Clair wrote:


The basic algorithm is conceptually simple:
1.) find all the intersections
2.) break into pieces at the intersections
3.) decide which pieces you need on the basis of some in/out tests  
and which set operation you are doing.

4.) assemble the final result
The hitch is that #3 is a bunch of yes/no decisions that you must  
make on the basis of imprecise floating point operations in #1. And  
all the results of #3 have to be consistent or #4 won't work  
properly. This is trivial in the easy cases (curves intersecting at  
reasonable angles, no tiny pieces) but *VERY* hard to get right for  
the arbitrary case


That was my experience exactly :) Task #3 is one of those things that  
seems obvious to a human, but is surprisingly complex to describe to a  
computer. Unfortunately I don't remember the name of the algorithm I  
used, but it took a good-sized academic article to describe. It was  
very prone to problems with edge [sic] cases, like two intersections  
at almost but not quite the same point, or intersections of almost- 
parallel lines. (An earlier algorithm I tried was simpler but turned  
out to fail on vertical lines!)


I don't mean to suggest this is impossible, but everyone's development  
resources are limited, and there are other features you [the OP] could  
implement instead that would give you more bang for the buck.


—Jens

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: Creating and App menu from Scratch

2008-07-14 Thread Gregory Weston

Kyle Sluder wrote:


On Mon, Jul 14, 2008 at 9:37 AM, Bill Royds <[EMAIL PROTECTED]> wrote:


The layout may be a "standard" form required by law or other
convention. I am not suggesting that one port the code, just the  
forms and

menu labels.


I know of no statute that mandates Look & Feel, and I seriously doubt
one exists.


While I'm not aware of any legal requirements that regarding on- 
screen presentation, there are fields that have standard or even  
required forms and document layouts. It's certainly reasonable to  
argue that depending on the proficiencies of your audience the best  
solution for data entry *could* be to mimic the appearance of those  
standards. It'd be nice to also offer a more streamlined, assisted  
entry view, somewhat like what Macintax/Turbotax has done.


  But until there is an pathway to port applications at all, there  
is no

incentive to even create the applications on a Mac.



Rubbish, poppycock, and an absolute falsehood.  You are assuming that
all applications written for the Mac are inferior to applications
written for other platforms.


No. He's just saying that the lack of tools that make it easy to port  
apps to the Mac stops some specific apps from migrating to the Mac.  
And he's right. The real issue is whether that's automatically a bad  
thing, given that the same laziness that keeps people from porting  
*without* those tools is very likely to keep them from performing the  
necessary post-processing on the output of them. In my experience  
it's a very rare interface where "add items to the window" is going  
to consume significant resources relative to "and then arrange them  
visually and logically in a way that conforms to user needs and  
expectations."


G
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Questions about Core Data and SQLite

2008-07-14 Thread Jens Alfke


On 14 Jul '08, at 1:05 AM, Jeff Brown wrote:

Is there any way I can incorporate Core Data into the app so that I  
can do away with using MySql? i.e. log into the app on one machine  
(using it's SQLite database) from the same app on a different machine?


There are two problems with this —

First, sqlite isn't a db server like MySQL. It's an in-process library  
that directly manipulates the database file. It's possible to write a  
server around sqlite, that will respond to SQL queries over a socket  
(and I think it's been done) but the API to use such a server wouldn't  
look like the sqlite API, so you wouldn't be able to get CoreData to  
use it.


Second, CoreData really isn't meant for having two clients (whether  
users or processes) accessing the database at once. I think it's  
possible to do this, but it requires extra work to get each client to  
detect when the other has changed the db, and invalidate its caches.


—Jens

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: KVO notifications and threads

2008-07-14 Thread Dave Dribin

On Jul 11, 2008, at 2:36 PM, Bill Bumgarner wrote:
If you have specific enhancement requests, please file a bug via http://bugreporter.apple.com 
.   If your request is "make MVC and KVO play nicely with threads",  
you will need to provide details on exactly what you mean -- exactly  
how that is to be achieved.


I've got a bug filed along these lines: rdar://5953181 (mistakenly  
filed under OS X Server :/).  The main times I've come across this  
problem is when I want to show the progress of a background operation  
by binding some property to a progress indicator.  Thus, instead of  
doing this:


self.progress = newProgress;

I resort to setting "progress" on the main thread using  
performSelectonOnMainThread: + no wait, similar to Clark's  
suggestion.  I figure not waiting allows the background thread to  
continue to maintain decent concurrency. [1]


I'm not sure of the best way to make threads + Cocoa bindings play  
nice.  My current thinking is to have AppKit bounce all KVO  
notifications over to the main thread.  It could use NSThread's  
isMainThread to conditionally bounce the notification to the main  
thread.  It could even coalesce notifications, as Ben suggested.


Another possibility is to have have another @property option which  
forces that property to only be updated on the main thread.  Or maybe  
just have the willChange/didChange happen on the main thread.


Or finally, maybe NSController should take care of bouncing model KVO  
notifications to the main thread.


My gut tells me this should be done in AppKit.  The model and the view  
should be completely isolated from each other.  Forcing the model to  
so stuff on the main thread because the view (i.e AppKit) is not  
thread safe seems like breach of MVC.  If AppKit is not thread safe,  
then AppKit should be responsible for not crashing in the face of  
threads.  Making AppKit thread is not at all the right solution, but  
bouncing KVO notifications seems to be a decent one.  While it may be  
a performance bottleneck, it's certainly better than nondeterministic  
crashing, which is what we get with the current behavior.  I can  
always Shark it to improve performance, which I'd rather do than hunt  
down some non-100%-reproducible crasher.


-Dave

[1]: I've written a little helper to make performing on the main  
thread a little easier, especially when dealing with primitive types:


  


Thus, you can write:

[[self dd_invokeOnMainThread] setProgress:newProgress];

without having to box up newProgress as an NSNumber.  It's done for  
you by forwardInvocation:.


___

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: Creating the app menu from scratch

2008-07-14 Thread Jeff Johnson

On Jul 14, 2008, at 3:16 AM, Bill Bumgarner wrote:


On Jul 13, 2008, at 11:35 PM, Jeff Johnson wrote:


On the other hand, the function method_exchangeImplementations()  
just became public API in Leopard, so I don't see how that can  
break anytime soon. It's not much different than subclassing or  
'categorizing'.


Correct.  However, it is what you are using  
method_exchangeImplementations() for that is problematic.  Namely,  
you are editing the method tables for an Apple supplied class.
This is unsupported and may be problematic for any number of  
reasons -- KVO, IMP caching, internal implementation details, etc...


It is quite a bit different than either subclassing or using  
categories.


For subclassing, you override behavior and, if you are doing it  
right, don't break encapsulation -- don't access your super's  
instance variables directly and do use API to manipulate super's  
state (unless, of course, super is actually a class of your own  
design -- then it is all fair game, but you should still consider  
carefully how the super/sub relationship should be work).


For categories, all is well until the moment you override an  
existing method in a class other than your own.  At that point, you  
are asking for a world of maintenance headaches and a whole lot of  
fun debugging stuff.


b.bum



I can't imagine much use for method_exchangeImplementations() with my  
own classes, because I can write the implementations myself. You  
certainly need to be careful, but my example seemed pretty innocuous.  
Calling at the beginning of main() should avoid IMP caching issues,  
should it not?


As I said, I was just doing a proof of concept. I haven't shipped any  
apps with that code, though I know plenty of developers who have  
shipped much 'worse'. Even published API sometimes break, so  
development always involves the assessment of risk and reward, and as  
far as I know, Apple provides no official support for developers  
apart from paid DTS incidents.


-Jeff

___

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: PDFDocument Subclass and Undo Manager Redux

2008-07-14 Thread Kevin Ross
Well after making some tweaks I seem to have it working.  I'm not sure  
if it was something that I did or if the 10.5.4 update could have  
fixed the undo manager bug in PDFView.  Anyway, I've got it working,  
thanks!


- Kevin

On Jul 11, 2008, at 3:31 PM, Kevin Ross wrote:

Hello cocoa-devs!  I'm not sure if I'm heading in the right  
direction here or if I'm running off into the brush...


I have a PDFDocument subclass that has it's own undoManager.  This  
is so it can perform transformations upon itself and undo/redo.  The  
trouble is when I try to integrate it into my NSDocument class.   
I'll try to return the PDF's undoManager like so:


- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)window; {
return [(KRPDFDocument *)[pdfView document] undoManager];
}

While this returns an NSUndoManager which != NULL, it doesn't  
actually hook into the responder chain so when I make a change it  
doesn't register in the menu.  Is this because PDFDocument does not  
inherit from NSResponder?


Is the proper way to have the undoManager *in* the PDFDocument  
sublcass?  Or is it better to use the undoManager provided by  
NSDocument?


It seems like I'm missing something that's right in front of my  
nose, but if anyone has some insight out there, please let me know!   
Thanks!



- Kevin
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoa.beans%40sbcglobal.net

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]


[PDFDocument documentRef] internal method questions.

2008-07-14 Thread Kevin Ross
In my subclassing PDFDocument adventures I wanted to add a method to  
my subclass like so:


- (CGPDFDocumentRef)documentRef;

I realized that it was overriding an internal PDFDocument method that  
I was unaware of.  This actually helps a big performance bottleneck in  
the application because I can use it instead of creating my own docRef  
from scratch each time.  What I'm not sure about though is how safe I  
am using this in my application since it might break on future OS  
updates.  I'm planning on filing an enhancement request since it is  
useful to be able to get a CGPDFDocumentRef directly from a  
PDFDocument object.  How safe am I using this method in my application?



Namasté,

Kevin___

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: NSUserDefaultsController, when does value change?

2008-07-14 Thread Matt Neuburg
On Sun, 13 Jul 2008 21:29:56 -0700, "James W. Walker" <[EMAIL PROTECTED]>
said:
>I have a preferences dialog that I'm using with an
>NSUserDefaultsController instance, my first use of bindings, and it
>works.  But I want to post a notification when a certain setting
>changes.  In my method that shows the dialog, I record the old value
>of the setting.  In my action method for the OK button, I send a save
>message to the defaults controller  (the "applies immediately" option
>is off), send a synchronize message to the NSUserDefaults, then check
>the value of the setting and compare it to the old value.  But the
>value has not changed!  It obviously gets changed at some point,
>because the next time I bring up the dialog, the new value has is
>there.  What am I missing?

What you're doing is unnecessarily complicated. Just use KVO to observe the
desired value within the standardUserDefaults. You get a notification
contining the old value and the new value. Welcome to the world of bindings.
m. 

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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 detect NSTextAttachment deletion

2008-07-14 Thread chaitanya pandit

Hi,
I am using a NSTextView and i programatically insert images as  
NSTextAttachments in the textView. These attachments are shown in an  
NSTextAttachmentCell by the NSTextView.
I want to do some background processing just before the user deletes  
the image from the textView. This can happen if the user simply hits  
the delete key or replaces the image with some string.
How can i detect if an NSTextAttachment or it's NSTextAttachmentCell  
is about to be removed from the textView?

Any help would be appreciated.
thanks 
___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: What is the best way?

2008-07-14 Thread Scott Ribe
> The Main window shall not be
> blocked.  What would be a proper way of doing things like that?

What do you mean? The main window should not be covered up? Or events should
still be processed by the main window? Because if it's the latter, then
don't run the second window as modal.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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: Creating the app menu from scratch

2008-07-14 Thread Bill Bumgarner

On Jul 14, 2008, at 8:58 AM, Jeff Johnson wrote:
I can't imagine much use for method_exchangeImplementations() with  
my own classes, because I can write the implementations myself. You  
certainly need to be careful, but my example seemed pretty  
innocuous. Calling at the beginning of main() should avoid IMP  
caching issues, should it not?


You are changing the implementation of a class that you did not  
write.   It violates implementation encapsulation and, thus, there is  
risk therein.


It is likely that this particular use is innocuous.  But maybe not.
The class could do something fun in +load or +initialize.  Or the  
class could change in some future release to dynamically provide the  
method implementation.   Or the class could insist upon only using its  
particular implementation of that particular method (security comes to  
mind).


The issue is that the behavior is not guaranteed.

Yes, this kind of breakage does happen...

As I said, I was just doing a proof of concept. I haven't shipped  
any apps with that code, though I know plenty of developers who have  
shipped much 'worse'. Even published API sometimes break, so  
development always involves the assessment of risk and reward, and  
as far as I know, Apple provides no official support for developers  
apart from paid DTS incidents.


...  and every release of Mac OS X includes a huge amount of  
engineering effort ensuring that the published APIs do not break as  
documented by the bugs filed during the development cycle.   Rarely is  
a published API broken in a final release vs. the previous release for  
applications compiled against that previous release (i.e. there may be  
documented behavioral changes -- should be documented -- if you  
recompile targeting the new release).


No such support exists or will exist for use of implementation details  
directly (i.e. unpublished methods).


b.bum

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: What is the best way?

2008-07-14 Thread Ronnie B
Thats correct.  The main window is not covered up.  The second window is not
modal I agree.  In the second window I just need to collect some additional
info that will go the the second's window controller.  There will be OK and
Cancel buttons on that window to close it.  The main window will not change
after.


On Mon, Jul 14, 2008 at 12:53 PM, Scott Ribe <[EMAIL PROTECTED]>
wrote:

> > The Main window shall not be
> > blocked.  What would be a proper way of doing things like that?
>
> What do you mean? The main window should not be covered up? Or events
> should
> still be processed by the main window? Because if it's the latter, then
> don't run the second window as modal.
>
> --
> Scott Ribe
> [EMAIL PROTECTED]
> http://www.killerbytes.com/
> (303) 722-0567 voice
>
>
>
___

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]


CALayer transform, setting the Y value of rotation causes side-effects

2008-07-14 Thread John Clayton

Hi All,

I'm setting the rotation values of a CALayer, and notice that when  
setting the Y component of rotation of a CATransform3D structure via  
the :

[layer setValue:someValue forKeyPath:@"transform.rotation.y"]

call, that in certain cases of 'someValue' (the y rotation), the X and  
Z rotation values are modified as well.


I set the value of the transform.rotation.Y using the standard  
setValue:forKeyPath: method, and logged the resulting X, Y and Z  
rotation values.  Here's the code and logging results:


- (void) awakeFromNib {
CALayer* testLayer = [CALayer new];
NSLog(@"before: x, y, x = %@ / %@ / %@",
  [testLayer valueForKeyPath:@"transform.rotation.x"],
  [testLayer valueForKeyPath:@"transform.rotation.y"],
  [testLayer valueForKeyPath:@"transform.rotation.z"]);

// but this breaks the X and Z, how come?
	[testLayer setValue:[NSNumber numberWithDouble:2.12041]  
forKeyPath:@"transform.rotation.y"];

NSLog(@"after: x, y, x = %@ / %@ / %@",
  [testLayer valueForKeyPath:@"transform.rotation.x"],
  [testLayer valueForKeyPath:@"transform.rotation.y"],
  [testLayer valueForKeyPath:@"transform.rotation.z"]);

[testLayer release];
}

2008-07-14 17:48:23.555 Annotate[42997:10b] before: x, y, x = 0 / -0 / 0
2008-07-14 17:48:23.562 Annotate[42997:10b] after: x, y, x =  
3.141593 / 1.021183 / 3.141593


Huh?

Question 1: Why do X and Z get very close to PI?
Question 2: Why does Y end up being 1.02 when I set it to 2.12041?

Does anyone know what's going on here?  I'm a little stumped by this  
one.


Thanks
--
John Clayton
Skype: johncclayton




___

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]


KVV and the missing Discard Changes button

2008-07-14 Thread Steve Green

Developers,

In several of my applications I use key value validation.  In one of  
my applications in particular, the error sheet that gets displayed  
only has the OK button.  In the other apps, I see the OK button as  
well as a Discard Changes button.  I'm sure I must be overlooking  
something simple, but I just can't figure out how to get the Discard  
Changes button to appear in that one app.  Any clues would be greatly  
appreciated.

___

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 detect NSTextAttachment deletion

2008-07-14 Thread Aki Inoue

Chaitanya,

In general, whenever you want to detect user initiated editing, you  
can use -textView:shouldChangeTextInRanges:replacementStrings:.  In  
this delegate method, look for NSTextAttachmentAttributeName in the  
editing range.


Aki

On 2008/07/14, at 9:37, chaitanya pandit wrote:


Hi,
I am using a NSTextView and i programatically insert images as  
NSTextAttachments in the textView. These attachments are shown in an  
NSTextAttachmentCell by the NSTextView.
I want to do some background processing just before the user deletes  
the image from the textView. This can happen if the user simply hits  
the delete key or replaces the image with some string.
How can i detect if an NSTextAttachment or it's NSTextAttachmentCell  
is about to be removed from the textView?

Any help would be appreciated.
thanks___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/aki%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: How to detect NSTextAttachment deletion

2008-07-14 Thread Todd Ransom

Hello,

Take a look at the NSTextView delegate method  
shouldChangeTextInRange:replacementString:


The replacementString parameter will be blank (@"") on deletes, nil  
for attribute changes, and have a string on inserts or replacements of  
existing text.


This method is called before the actual change, so you can use the  
range passed in to determine whether an attachment will be deleted,  
then act on that information in the didChangeText method.


hope that helps,
Todd Ransom
StoryMill & Montage Development
Mariner Software




On Jul 14, 2008, at 12:37 PM, chaitanya pandit wrote:


Hi,
I am using a NSTextView and i programatically insert images as  
NSTextAttachments in the textView. These attachments are shown in an  
NSTextAttachmentCell by the NSTextView.
I want to do some background processing just before the user deletes  
the image from the textView. This can happen if the user simply hits  
the delete key or replaces the image with some string.
How can i detect if an NSTextAttachment or it's NSTextAttachmentCell  
is about to be removed from the textView?

Any help would be appreciated.
thanks___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/toddransom%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: What is the best way?

2008-07-14 Thread Shawn Erickson
On Mon, Jul 14, 2008 at 9:57 AM, Ronnie B <[EMAIL PROTECTED]> wrote:
> Thats correct.  The main window is not covered up.  The second window is not
> modal I agree.  In the second window I just need to collect some additional
> info that will go the the second's window controller.  There will be OK and
> Cancel buttons on that window to close it.  The main window will not change
> after.

Sounds like you already know your answer... What is the problem again?

-Shawn
___

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: Creating the app menu from scratch

2008-07-14 Thread Bill Bumgarner

On Jul 14, 2008, at 7:29 AM, Jim Crafton wrote:
How do you bootstrap the framework?  I.e. what executable is run  
that uses
the resources from the framework?  That is the most likely place to  
stick

the MainMenu.nib and let Cocoa bootstrap the normal way.


Well you'd create your standard C++ app in Xcode (with standard app
settings, i.e. you're creating a full blown .app bundle, not a unix
command line utility), and then link to my libraries as Frameworks
(i'd like to offer the possibility to link statically, but I'm 100%
sure about how to do that). Given that I've created my libraries as
Frameworks, can I have a .nib as part of one of the Framework bundles?
My framework is laid out like so:

FoundationKit.framework
GraphicsKit.framework (depends on FoundationKit.framework)
ApplicationKit.framework (depends on GraphicsKit.framework)

If you're writing a GUI app, then you'd link to
ApplicationKit.framework (and GraphicsKit.framework +
FoundationKit.framework).  Can I have a MainMenu.nib file in the
ApplicationKit.framework? That way it's all built in and the developer
doesn't have to worry about creating it.


Yes, you can.

If you look at NSApplication's documentation, you can replace main()  
in a Cocoa project with:


int main(int argc, char *argv[])
{
[NSApplication sharedApplication];
[NSBundle loadNibNamed:@"MainMenu" owner:NSApp];
[NSApp run];
return 0;
}

(I just tested it :).

So, replace the -loadNibNamed:owner: with the loading of the NIB from  
your framework.


Actually, reading the docs for +loadNibNamed:owner:, I think it is  
even easier (but you'll want to test it).  The owner is used to  
determine where to look for the NIB.


If you were to create a subclass of NSApplication that lives within  
the framework that has your generic MainMenu.nib and then set the  
application class of your application to that subclass, then the  
standard means of bringing up Cocoa -- i.e. the call to  
NSApplicationMain() -- should "just work".


That is, clients of your framework should be able to:

- create a new Cocoa application project

- delete MainMenu.nib

- set the application class to your custom NSApplication subclass

- link against your framework

Build & run.

b.bum




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: KVV and the missing Discard Changes button

2008-07-14 Thread Kyle Sluder
On Mon, Jul 14, 2008 at 12:58 PM, Steve Green <[EMAIL PROTECTED]> wrote:
> I'm sure I must be overlooking something simple, but I just
> can't figure out how to get the Discard Changes button to appear in that one
> app.  Any clues would be greatly appreciated.

Create a recovery attempter and add it to the NSError you return from
-validateKey:error:.

--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: Questions about Core Data and SQLite

2008-07-14 Thread Chris Hanson

On Jul 14, 2008, at 8:12 AM, Jens Alfke wrote:

Second, CoreData really isn't meant for having two clients (whether  
users or processes) accessing the database at once. I think it's  
possible to do this, but it requires extra work to get each client  
to detect when the other has changed the db, and invalidate its  
caches.


Core Data does support multiple simultaneous access to a SQLite  
persistent store.  That's why each NSManagedObjectContext has a  
staleness interval and a merge policy associated with it, and also why  
it supports refreshing in-memory objects with the option to merge  
changes into the refreshed objects.


However, managing simultaneous access by *different users* to a SQLite  
persistent store is slightly trickier -- they must all access the  
persistent store in ways that have compatible file locking.  This is  
necessary to maintain database integrity.  However, if all you have  
are a couple of users on a LAN working with a database stored on a  
shared AFP (AppleShare, Personal File Sharing) volume, that should be  
fine.


The real difficulty is scaling.  Any database that works via a shared  
filesystem will have significant limits to its scalability.  You won't  
want to have more than a few users sharing the same file.


  -- Chris

___

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: Creating the app menu from scratch

2008-07-14 Thread Jeff Johnson

On Jul 14, 2008, at 12:05 PM, Bill Bumgarner wrote:


On Jul 14, 2008, at 7:29 AM, Jim Crafton wrote:
How do you bootstrap the framework?  I.e. what executable is run  
that uses
the resources from the framework?  That is the most likely place  
to stick

the MainMenu.nib and let Cocoa bootstrap the normal way.


Well you'd create your standard C++ app in Xcode (with standard app
settings, i.e. you're creating a full blown .app bundle, not a unix
command line utility), and then link to my libraries as Frameworks
(i'd like to offer the possibility to link statically, but I'm 100%
sure about how to do that). Given that I've created my libraries as
Frameworks, can I have a .nib as part of one of the Framework  
bundles?

My framework is laid out like so:

FoundationKit.framework
GraphicsKit.framework (depends on FoundationKit.framework)
ApplicationKit.framework (depends on GraphicsKit.framework)

If you're writing a GUI app, then you'd link to
ApplicationKit.framework (and GraphicsKit.framework +
FoundationKit.framework).  Can I have a MainMenu.nib file in the
ApplicationKit.framework? That way it's all built in and the  
developer

doesn't have to worry about creating it.


Yes, you can.

If you look at NSApplication's documentation, you can replace main 
() in a Cocoa project with:


int main(int argc, char *argv[])
{
[NSApplication sharedApplication];
[NSBundle loadNibNamed:@"MainMenu" owner:NSApp];
[NSApp run];
return 0;
}

(I just tested it :).

So, replace the -loadNibNamed:owner: with the loading of the NIB  
from your framework.


Actually, reading the docs for +loadNibNamed:owner:, I think it is  
even easier (but you'll want to test it).  The owner is used to  
determine where to look for the NIB.


If you were to create a subclass of NSApplication that lives within  
the framework that has your generic MainMenu.nib and then set the  
application class of your application to that subclass, then the  
standard means of bringing up Cocoa -- i.e. the call to  
NSApplicationMain() -- should "just work".


That is, clients of your framework should be able to:

- create a new Cocoa application project

- delete MainMenu.nib

- set the application class to your custom NSApplication subclass

- link against your framework

Build & run.

b.bum



Based on my analysis of Cocoa nib loading, I had the same thought and  
agree with Bill that this should work. However, I wasn't sure why Jim  
was talking about a C++ application and whether that makes a difference.


-Jeff

___

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: Creating the app menu from scratch

2008-07-14 Thread Jim Crafton
>
>
> Based on my analysis of Cocoa nib loading, I had the same thought and agree
> with Bill that this should work. However, I wasn't sure why Jim was talking
> about a C++ application and whether that makes a difference.

Well the framework is C++ (it's here if you care:
http://vcf-online.org), so the intended audience is C++ devs. I'd
previously done the Mac port with Carbon, but since that has been
killed off by the good folks in Cupertino, I'm now migrating to using
Cocoa.
___

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: Creating the app menu from scratch

2008-07-14 Thread Jim Crafton
> Actually, reading the docs for +loadNibNamed:owner:, I think it is even
> easier (but you'll want to test it).  The owner is used to determine where
> to look for the NIB.
>
> If you were to create a subclass of NSApplication that lives within the
> framework that has your generic MainMenu.nib and then set the application
> class of your application to that subclass, then the standard means of
> bringing up Cocoa -- i.e. the call to NSApplicationMain() -- should "just
> work".
>

Cool, I have some of this already in place, so now I know where to
build from there.

> That is, clients of your framework should be able to:
>
> - create a new Cocoa application project
>
> - delete MainMenu.nib
>
> - set the application class to your custom NSApplication subclass
>
> - link against your framework
>

The only difference is that by and large they'd be building a C++ app
- the framework is C++ with the Mac specific parts implemented in
ObjeciveC++ and Cocoa. So they wouldn't even need to delete the
MainMenu.nib, since it wouldn't exist. I have project templates to
create the skeleton project and properly link to my framework.


Thanks !!

Cheers

Jim
___

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: CALayer transform, setting the Y value of rotation causes side-effects

2008-07-14 Thread David Duncan

On Jul 14, 2008, at 9:57 AM, John Clayton wrote:


Huh?

Question 1: Why do X and Z get very close to PI?
Question 2: Why does Y end up being 1.02 when I set it to 2.12041?

Does anyone know what's going on here?  I'm a little stumped by this  
one.



The simple answer is that with a 4x4 rotation matrix, there are a  
number of distinct matrices that are mathematically equivalent. Note  
that 3.14 - 2.12 = 1.02 and that X & Z were flipped 180 degrees.  
Effectively your seeing the solver for reversing an arbitrary 4x4  
matrix into x/y/z rotations making certain simplifying assumptions  
that don't match what you are expecting.

--
David Duncan
Apple DTS Animation and Printing
[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: KVV and the missing Discard Changes button

2008-07-14 Thread Steve Green

On Jul 14, 2008, at 1:42 PM, Kyle Sluder wrote:
On Mon, Jul 14, 2008 at 12:58 PM, Steve Green <[EMAIL PROTECTED]>  
wrote:

I'm sure I must be overlooking something simple, but I just
can't figure out how to get the Discard Changes button to appear in  
that one

app.  Any clues would be greatly appreciated.


Create a recovery attempter and add it to the NSError you return from
-validateKey:error:.


I did see that as a possible solution but I'm not sure why it's  
necessary in one app and it's not necessary in another.  I've created  
a test project with a single text field that's bound to the exact same  
model object that I use in the real app.  In the test app I see 2  
buttons on the error sheet.

___

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: Remove overlap on NSBezierPath

2008-07-14 Thread Greg Titus


On Jul 14, 2008, at 4:24 AM, Graham Cox wrote:
Right now I use GPC and (optional) curve fitting. It keeps the  
curves in terms of their appearance but can greatly alter the number  
and location of the control points. I don't like it much either -  
one reason I'd love there to be a great solution built-in.  
Unfortunately I'm no mathematician and so I haven't been able to  
come up with a great way to do it from first principles, nor found  
any suitable code out there until...


I just had a short look at the Omni-OAExtensions. There are some  
functions to find intersections of paths, so I have to build my own  
merging routine out of it, right?



...this. I hadn't seen those before either. It looks as if they've  
given away the hardest part, finding the intersections and crossing  
directions of each intersection. On top of that you can build the  
set operations. I plan to have a very good look at doing this for DK  
as soon as I can - if it can be made to work it will be a much  
better solution than curve fitting. Props to the Omni guys for being  
prepared to give away this code like this :)


You're welcome!

The set operations are still quite a bit of work even given all that  
as a substrate. Beware of the complications of shared line/curve  
segments between the two paths (places where they overlap for more  
than just a single point at a time). That makes things quite a bit  
more difficult.


- Greg
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Servicing Core Animations?

2008-07-14 Thread Bill Dudney

Hi Chilton,

The animator does not commit its transaction until back in the event  
loop so you won't see any animation until you return to the main event  
loop.


You can of course override this but in the example below you are doing  
the animation yourself so there is no reason for CA. i.e. tracking  
mouse movements is not something you want to do with CA animations  
anyway.


HTH,

-bd-
http://bill.dudney.net/roller/objc

On Jul 12, 2008, at 4:54 PM, Chilton Webb wrote:


Hi Professor Savant,

Confirmation that it should work was what I was after, so after  
reading your email, I decided to write up a test app, and it happens  
there, too. This is the problem distilled to its simplest form. I  
welcome any feedback, mockery, etc.


If I use the option in (1) below, it works fine. If I use the option  
in (2), which is what I WANT to use, no animation occurs until after  
the mouseup happens.


-Chilton

- (void) mouseDown: (NSEvent *) theEvent
{
while (1) {

   theEvent = [[self window] nextEventMatchingMask: 
(NSAnyEventMask)];

if (([theEvent type]==NSLeftMouseDragged) ||
([theEvent type]==NSLeftMouseUp) ||
([theEvent type]==NSLeftMouseDown))
{


// (1) If I use this, it works fine. No zooom zooom 
though.
//[button setFrameOrigin:[theEvent locationInWindow]];

// (2) If I use this, it doesn't work.
//[[button animator] setFrameOrigin:[theEvent 
locationInWindow]];

if ([theEvent type]==NSLeftMouseUp) {
break;
}
}

}

}


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bdudney%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]


Trouble with performSelector afterDelay

2008-07-14 Thread James Trankelson
Hi,

I've been experiencing some strangeness that I can't seem to
understand surrounding my use of performSelector afterDelay.

The situation is as follows. I have a class, 'Listener', that, when
initialized, spawns a thread to listen on a port:

class Listener:

- (id) init
{
  self = [super init];
  [NSThread detachNewThreadSelector:@selector(startAsyncListener:)
toTarget:self withObject:nil];
  return self;
}

- (void)startAsyncListener:(id)arg
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

aSyncUpdatePort = (NSMachPort *)[NSMachPort port];
[aSyncUpdatePort setDelegate:self];
[[NSRunLoop currentRunLoop] addPort:aSyncUpdatePort
forMode:NSDefaultRunLoopMode];

for(;;) [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];<===*

[pool release];
}


Now, on my main thread, I first allocate (and initialize) an instance
of Listener, and then spawn another thread to do some work in another
class which I'll call "Worker". Sometimes during the execution of this
other thread, I decide I want to perform a selector after some delay,
and the way I do this is to package up a little message that I send to
the port on my Listener class that basically says "you should do a
performSelector afterDelay". So, my Listener class gets this message,
calls performSelector afterDelay and before the selector is invoked,
my Worker class gets its dealloc method called and everything
explodes. My Listener class handles messages all day long, but when it
tries to call performSelector afterDelay, it causes the Worker to
deallocate itself. I have no idea why.

If I set a breakpoint in the dealloc of my Worker class, I see the
following backtrace when this happens:

#0  0x0002606d in -[Worker release] at Worker.m:155
#1  0x94e8502a in __delayedPerformCleanup
#2  0x9390d92b in CFRunLoopTimerInvalidate
#3  0x9390e879 in CFRunLoopRunSpecific
#4  0x9390ecf8 in CFRunLoopRunInMode
#5  0x94e734a5 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
#6  0x000fea26 in -[Listener startAsyncListener:] at Listener.m:141
#7  0x94e3ef1d in -[NSThread main]
#8  0x94e3eac4 in __NSThread__main__
#9  0x96bfb6f5 in _pthread_start
#10 0x96bfb5b2 in thread_start


Where, Worker.m:155 is the line in startAsyncListener marked (<===) above.

Does anyone have any ideas what I might be doing wrong?

Thanks.

-jt
___

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: Remove overlap on NSBezierPath

2008-07-14 Thread Greg Titus

Thanks!

- Greg

On Jul 14, 2008, at 4:24 AM, Graham Cox wrote:


On 14 Jul 2008, at 7:48 pm, Georg Seifert wrote:


Hello,

Thanks for you replies.

To clarify: I need it in a small drawing app, where you can draw  
shapes and then you should be able to combine them. There is no  
outline but the winding is quite important (there may be  
overlapping, clipping and self intersecting parts).


If you don't need to draw the stroke, things maybe much easier (you  
could keep a list of contributing paths as part of some object of  
your own device for example).


I did found DrawKit but as I need to keep the curves, this doesn’t  
seem to be an option.



Right now I use GPC and (optional) curve fitting. It keeps the  
curves in terms of their appearance but can greatly alter the number  
and location of the control points. I don't like it much either -  
one reason I'd love there to be a great solution built-in.  
Unfortunately I'm no mathematician and so I haven't been able to  
come up with a great way to do it from first principles, nor found  
any suitable code out there until...


I just had a short look at the Omni-OAExtensions. There are some  
functions to find intersections of paths, so I have to build my own  
merging routine out of it, right?



...this. I hadn't seen those before either. It looks as if they've  
given away the hardest part, finding the intersections and crossing  
directions of each intersection. On top of that you can build the  
set operations. I plan to have a very good look at doing this for DK  
as soon as I can - if it can be made to work it will be a much  
better solution than curve fitting. Props to the Omni guys for being  
prepared to give away this code like this :)




cheers, 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/greg%40omnigroup.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: Creating and App menu from Scratch

2008-07-14 Thread Bill Royds


On 14-Jul-08, at 12:38 , Gregory Weston <[EMAIL PROTECTED]>wrote:




No he's not. Long-time Mac developers know quite well that by and  
large Mac users are very averse to apps that simply don't fit. It's  
not a question of arguments about "better" or "worse" (although such  
arguments can certainly be had). The simple fact that an application  
gratuitously deviates from the standard user experience is a killer  
for almost any app that has competition. For what it's worth, Mac- 
like applications on Windows are just as bad.


Forms layout is not part of the "standard user experience" in general,  
although forms look and feel is. Are you saying that all Carbon  
applications are not Mac compatible since there is no conversion of  
Carbon nibs to Cocoa?


I'll give an example: Part of the user experience *for me* is that  
Windows machines have 2-button mice and Macs have 1 or 3 buttons.  
Obviously I'm not saying this is a general truth, but certainly the  
vast majority of Windows installationshave 2 buttons, and the Macs  
*I* use every day have the original mice or a 3-button replacement.  
So here's the quirk:
When I sit down at a Mac with a 2-button mouse, if I right-click on  
a file I expect to see a Windows context menu. I expect, for  
example, to see a "Properties" item at the bottom of the menu, not a  
"Get Info" near the top. The time it takes to recover from that  
discrepancy is not just measurable; it's noticeable.




What has this go to do with the layout of a form?





Depending on the application, there
may have been a great deal of work in designing an interface specific
to a particular discipline. The layout may be a "standard" form
required by law or other convention. I am not suggesting that one  
port

the code, just the forms and menu labels. Once they are ported to a
nib, they can be modified to better conform to Mac HI guidelines.


Kyle also didn't indicate that there was no possible way for a good  
app to result from the use of such a tool. He just worries -  
correctly in my opinion - that an awful lot of developers who would  
use that tool wouldn't expend the resources to actually clean it up  
after the fact. And when the app fails in that circumstance - not  
if, but when - it's always cast as a failing of the Mac or its  
market, rather than an acknowledgment that just possibly the app  
itself was crap. Elitist as it may sound on first blush, the reality  
is that software tends to be better when the developer is required  
to think.


Software is also worse when the developer has to re-invent the wheel  
for each version.





Bill Royds



___

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: CALayer transform, setting the Y value of rotation causes side-effects

2008-07-14 Thread Dmitri Goutnik

John,

You're rotating layer around Y axis by 2.12041 which is greater than  
PI/2. So after rotation you're looking at the "back side" of the  
layer, that's why X and Z get close to PI (i.e. flipped).


- Dmitri

On Jul 14, 2008, at 8:57 PM, John Clayton wrote:


Hi All,

I'm setting the rotation values of a CALayer, and notice that when  
setting the Y component of rotation of a CATransform3D structure via  
the :

[layer setValue:someValue forKeyPath:@"transform.rotation.y"]

call, that in certain cases of 'someValue' (the y rotation), the X  
and Z rotation values are modified as well.


I set the value of the transform.rotation.Y using the standard  
setValue:forKeyPath: method, and logged the resulting X, Y and Z  
rotation values.  Here's the code and logging results:


- (void) awakeFromNib {
CALayer* testLayer = [CALayer new];
NSLog(@"before: x, y, x = %@ / %@ / %@",
  [testLayer valueForKeyPath:@"transform.rotation.x"],
  [testLayer valueForKeyPath:@"transform.rotation.y"],
  [testLayer valueForKeyPath:@"transform.rotation.z"]);

// but this breaks the X and Z, how come?
	[testLayer setValue:[NSNumber numberWithDouble:2.12041]  
forKeyPath:@"transform.rotation.y"];

NSLog(@"after: x, y, x = %@ / %@ / %@",
  [testLayer valueForKeyPath:@"transform.rotation.x"],
  [testLayer valueForKeyPath:@"transform.rotation.y"],
  [testLayer valueForKeyPath:@"transform.rotation.z"]);

[testLayer release];
}

2008-07-14 17:48:23.555 Annotate[42997:10b] before: x, y, x = 0 /  
-0 / 0
2008-07-14 17:48:23.562 Annotate[42997:10b] after: x, y, x =  
3.141593 / 1.021183 / 3.141593


Huh?

Question 1: Why do X and Z get very close to PI?
Question 2: Why does Y end up being 1.02 when I set it to 2.12041?

Does anyone know what's going on here?  I'm a little stumped by this  
one.


Thanks
--
John Clayton
Skype: johncclayton



___

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: CALayer transform, setting the Y value of rotation causes side-effects

2008-07-14 Thread Frédéric Testuz

Le 14 juil. 08 à 18:57, John Clayton a écrit :


Hi All,

I'm setting the rotation values of a CALayer, and notice that when  
setting the Y component of rotation of a CATransform3D structure via  
the :

[layer setValue:someValue forKeyPath:@"transform.rotation.y"]

call, that in certain cases of 'someValue' (the y rotation), the X  
and Z rotation values are modified as well.


I set the value of the transform.rotation.Y using the standard  
setValue:forKeyPath: method, and logged the resulting X, Y and Z  
rotation values.  Here's the code and logging results:


- (void) awakeFromNib {
CALayer* testLayer = [CALayer new];
NSLog(@"before: x, y, x = %@ / %@ / %@",
  [testLayer valueForKeyPath:@"transform.rotation.x"],
  [testLayer valueForKeyPath:@"transform.rotation.y"],
  [testLayer valueForKeyPath:@"transform.rotation.z"]);

// but this breaks the X and Z, how come?
	[testLayer setValue:[NSNumber numberWithDouble:2.12041]  
forKeyPath:@"transform.rotation.y"];

NSLog(@"after: x, y, x = %@ / %@ / %@",
  [testLayer valueForKeyPath:@"transform.rotation.x"],
  [testLayer valueForKeyPath:@"transform.rotation.y"],
  [testLayer valueForKeyPath:@"transform.rotation.z"]);

[testLayer release];
}

2008-07-14 17:48:23.555 Annotate[42997:10b] before: x, y, x = 0 /  
-0 / 0
2008-07-14 17:48:23.562 Annotate[42997:10b] after: x, y, x =  
3.141593 / 1.021183 / 3.141593


Huh?

Question 1: Why do X and Z get very close to PI?
Question 2: Why does Y end up being 1.02 when I set it to 2.12041?

Does anyone know what's going on here?  I'm a little stumped by this  
one.


Hello,

I never used CALayer but if I understand correctly the rotation, there  
is no difference between


rotation (A) : x, y, x = 0 / 2.12041 / 0

and

rotation (B) : x, y, x = 3.141593 / 1.021183 / 3.141593

It's because a rotation of pi is a half-circle rotation and 1.021183  
is equal to pi-2.12041. So the two transformation are equals. But why  
the layer transform the rotation like this. It has to be a internal  
check like in 2D when you want the angle of rotation to stay between - 
pi and pi.


You can check the equality by doing the transformation for an  
arbitrary point, or calculating the transformation matrix.


rot(A) : x,y,z = 0 , a , 0

(cos a  0  -sin a  0)
R(A) =  (0  1   0  0)
(sin a  0   cos a  0)
(0  0   0  1)

rot(B) : x,y,z = pi, pi-a, pi

(10   0  0) (cos pi-a  0  -sin pi-a  0) ( cos pi   
sin pi  0  0)
R(B) =  (0   cos pi  sin pi  0) (0 1  0  0) (-sin pi   
cos pi  0  0)
(0  -sin pi  cos pi  0) (sin pi-a  0   cos pi-a  0)  
(  0   0  1  0)
(00   0  1) (0 0  0  1)  
(  0   0  0  1)


(1   0   0  0) (-cos a  0  -sin a  0) (-1   0  0  0)
R(B) =  (0  -1   0  0) ( 0  1   0  0) ( 0  -1  0  0)
(0   0  -1  0) ( sin a  0  -cos a  0) ( 0   0  1  0)
(0   0   0  1) ( 0  0   0  1) ( 0   0  0  1)

(-cos a   0  -sin a  0) (-1   0  0  0)
R(B) =  ( 0  -1   0  0) ( 0  -1  0  0)
(-sin a   0   cos a  0) ( 0   0  1  0)
( 0   0   0  1) ( 0   0  0  1)

(cos a  0  -sin a  0)
R(B) =  (0  1   0  0)
(sin a  0   cos a  0)
(0  0   0  1)

And you have R(A) = R(B)

Frédéric Testuz___

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]


Rounded NSWindow corners?

2008-07-14 Thread Chad Harrison
My main window in IB has a "square" bottom both when I edit it in IB,  
and when I simulate the interface. But in my compiled app, it has the  
"rounded" bottom like in the 10.5 Finder and iTunes. Why is there this  
inconsistency between windows?


+Chad
___

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: NSViewController and View Swapping

2008-07-14 Thread Jonathan Dann

NSView has a method -replaceSubview:with:

see:
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#/ 
/apple_ref/occ/instm/NSView/replaceSubview:with:


So you need to have some setup where you can keep track of you view  
controllers, even in a non-document based app, if the app is non- 
trivial you'll end up subclassing NSWindowController, so keep an array  
or any collection of view controllers in the window controller.


Then make some method (be it an IBAction, or whatever) that is invoked  
by your button which gets the new view from its view controller and  
passes that (and the current view) to -replaceSubview:with:


If the view you want to replace it the content view of the window you  
can just call something like [window setContentView:[myViewController  
view]];


Still, I'd have a look at NSTabView, you can still use view  
controllers for each of the views in the tab view.


HTH

Jon


On 14 Jul 2008, at 15:26, Brad Gibbs wrote:

OK, thanks for the tip.  I think this will work well for the  
situation I described.


But, that screen (with its tab view and all of the custom views to  
be made available from within the tab view) is one of several  
screens like it.  The other tab views will contain different numbers  
of tabs.  The user will be able to choose among the screens from a  
pop-up menu on a status bar at the top of the screen.  So, I still  
need a way to swap out one set of tab views with another, without  
using a box, in a non-document-based application.  So, I think I  
still need to solve the problem of how to change:


[box setContentView:v]

to swap out one custom tab view with another, so that when the user  
selects another set of tab views, the current tab view is swapped  
out and replaced by the newly-selected tab view.



Thanks again.

Brad




On Jul 14, 2008, at 12:17 AM, Scott Anguish wrote:


you can still do it with NSTabView

use setTabViewType to one of the following
NSNoTabsBezelBorder = 4, NSNoTabsLineBorder = 5, NSNoTabsNoBorder = 6


have your button actions change the visible tab using one of...

- (void)selectTabViewItemAtIndex:(NSInteger)index

- (void)selectTabViewItemWithIdentifier:(id)identifier


- (void)selectTabViewItem:(NSTabViewItem *)tabViewItem





On 14-Jul-08, at 2:04 AM, Brad Gibbs wrote:


Thanks for the quick response and the links.

NSTabView with tabs on the bottom is exactly what I'm looking for,  
except, I'm writing a fullscreen app with stylized NSImage  
buttons, rather than tabs.  I'm still looking through the  
ViewController sample code.  Given the number of single window  
apps out there today, it seems like swapping views should be one  
of those common things that is easy to accomplish with Cocoa,  
rather than an uncommon thing that's merely possible...




On Jul 13, 2008, at 10:46 PM, Nathan Kinsinger wrote:



On Jul 13, 2008, at 11:15 PM, Brad Gibbs wrote:

I'm trying to create a Cocoa app with a single window with a  
number of views that get swapped in and out, using an  
NSViewController for each of the views.


I have a series of buttons along the bottom of the UI in a  
custom view, and another custom view above the row of buttons.   
When button A is pressed, view A should appear in the custom  
view above the row of buttons, and button A should be turned  
on.  When button B is pressed, view A should be replaced by View  
B, button A should turn off and button B should turn on.   
Ultimately, I'd like to do this with an animation (view A fades  
out and view B fades in).  For now, I'd be happy just replacing  
A with B.


I haven't been able to find much in the documentation about  
NSViewController for Cocoa.  I have the Hillegass book, but the  
view swapping example in Chapter 29 is done with a document- 
based application and the views there are contained in an NSBox:


...
NSView *v = [vc view];
[box setContentView:v];
...

I don't know Cocoa well enough to adapt this example for a non- 
document-based application without an NSBox.  Could someone  
please point me to documentation for NSViewController, other  
than the NSViewController Reference, or provide me with a quick  
explanation or example code that will do this?  I've read  
through the Katidev blog on XSViewController and  
XSWindowController, but, again, that's a document-based example,  
and it doesn't explicitly provide methods for replacing one view  
with another.



Thanks in advance.

Brad


There is an example at:
http://developer.apple.com/samplecode/ViewController/index.html

Also what you are describing sounds a lot like an NSTabView with  
the style set to Bottom Tabs. Try creating one in IB and playing  
with it. Also look at:

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/TabView/TabView.html
and an example with animation at:
http://developer.apple.com/samplecode/Reducer/index.html

--Nathan


___

Cocoa-dev mailing 

NSTextField labels and URLs

2008-07-14 Thread Dmitri Goutnik

Hi,

I'm almost positive I've seen this asked here a few weeks back, but  
search turned up nothing so here goes...


I have About panel with copyright label (NSTextField) that have URL in  
it. Label is set to allow rich text and be selectable, copyright  
string is loaded from Credits.rtf and assigned to label with  
setAttributedStringValue. The problem is that when About is shown, I  
have to click on copyright to make URL underlined and hover cursor  
changed to pointingHandCursor.


Is there anything special that needs to be done to get NSTextField to  
display links underlined ?


Thanks,
- Dmitri

___

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: Rounded NSWindow corners?

2008-07-14 Thread Jonathan Dann
Have a look and see if the window is textured or not, it a window  
setting in IB.  Non-textured windows have no bottom border by  
default.  Its in the AppKit release notes


http://developer.apple.com/releasenotes/Cocoa/AppKit.html

under the NSWindow heading.

Often this is used in conjunction with the  - 
setContentBorderThickness:forEdge: and - 
setAutorecalculatesContentBorderThickness:flag forEdge:edge methods to  
give a window that iCal/iTunes etc look.


HTH

Jon

On 14 Jul 2008, at 20:47, Chad Harrison wrote:

My main window in IB has a "square" bottom both when I edit it in  
IB, and when I simulate the interface. But in my compiled app, it  
has the "rounded" bottom like in the 10.5 Finder and iTunes. Why is  
there this inconsistency between windows?


+Chad
___

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/j.p.dann%40gmail.com

This email sent to [EMAIL PROTECTED]




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: [PDFDocument documentRef] internal method questions.

2008-07-14 Thread John Calhoun

On Jul 14, 2008, at 9:04 AM, Kevin Ross wrote:
In my subclassing PDFDocument adventures I wanted to add a method to  
my subclass like so:


- (CGPDFDocumentRef)documentRef;

I realized that it was overriding an internal PDFDocument method  
that I was unaware of.  This actually helps a big performance  
bottleneck in the application because I can use it instead of  
creating my own docRef from scratch each time.  What I'm not sure  
about though is how safe I am using this in my application since it  
might break on future OS updates.  I'm planning on filing an  
enhancement request since it is useful to be able to get a  
CGPDFDocumentRef directly from a PDFDocument object.  How safe am I  
using this method in my application?


Hmmm  Best of course to check for the symbol and have a fallback  
(presuably though a slower fallback method).  But I believe you'll  
find the symbol you found exists back to Tiger and may be made public  
in SnowLeopard.  It is something PDF Kit could benefit from — I just  
need to make sure the headers don't break (since we'd be declaring a  
CoreGraphics type in essentially a Cocoa-universe header).


So, be safe, but stay tuned.

John Calhoun—___

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: What is the best way?

2008-07-14 Thread Scott Ribe
> Thats correct.  The main window is not covered up.  The second window is not
> modal I agree.  In the second window I just need to collect some additional
> info that will go the the second's window controller.  There will be OK and
> Cancel buttons on that window to close it.  The main window will not change
> after.
> 

OK, so I think the bits you are looking for are:

- the screen method of NSWindow to find what screen your main window is on

- the visibleFrame method of NSScreen to get the bounds of that screen, less
the menu bar and dock

- the frame method of NSWindow to get the location of your main window

- the setFrame:display: method of NSWindow to adjust the locations of your
main & settings windows so they don't overlap

You may also want to look at the awakeFromNib method in your controller,
because that's a good point to do all this, the window size and location
will be set from the nib, but it won't be displayed yet, and you can
position it there, and it will be displayed at the location you set with any
visible blink or move.

Personally, I would consider displaying the settings window as a sheet on
the main window, and require the user to choose the settings before
proceeding--unless you think the user needs to see the main window while
making the settings...

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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 Patching

2008-07-14 Thread Jonathan Dann

Have you seen this

http://katidev.com/blog/2008/04/17/nsviewcontroller-the-new-c-in-mvc-pt-2-of-3/

and this thread

http://www.cocoabuilder.com/archive/message/cocoa/2008/3/19/201743

All of this is covered, with automatic insertion of view controllers  
into the responder chain.


If you want to set up the view controller as the next responder of the  
view (not done in the above) then you might be better with this code  
(thanks, Ali Lalani)



#import "MyViewController.h"


@implementation MyViewController
- (void)loadView;
{
[super loadView];

[[self view] addObserver:self forKeyPath:@"nextResponder"  
options:0 context:NULL];

}

- (void)dealloc;
{
[[self view] removeObserver:self forKeyPath:@"nextResponder"];
[super dealloc];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject: 
(id)object change:(NSDictionary *)change context:(void *)context

{
if ([keyPath isEqualToString:@"nextResponder"])
{
// when we get called due to setting next responder as  
ourselves we ignore it (could also unobserve right before and re- 
observe right after...)

if ([[self view] nextResponder] != self)
{
[self setNextResponder:[[self view] nextResponder]];
[[self view] setNextResponder:self];
}
}
else
{
[super observeValueForKeyPath:keyPath ofObject:object  
change:change context:context];

}
}
@end



In this way the view controller will 'jump' in whenever the view's  
nextResponder is set.


HTH

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: What is the best way?

2008-07-14 Thread Seth Willits

On Jul 14, 2008, at 9:57 AM, Ronnie B wrote:

Thats correct.  The main window is not covered up.  The second  
window is not
modal I agree.  In the second window I just need to collect some  
additional
info that will go the the second's window controller.  There will be  
OK and
Cancel buttons on that window to close it.  The main window will not  
change

after.



If you have OK and Cancel buttons in the second window, you're  
implying to your user that it's modal. If you still want the main  
window to be accessible/usable while the second window is open, just  
display it as a regular window with a close widget (red dot upper left).


Without knowing what you're asking for, why the main window still  
needs to be accessible etc, it's really not possible to give any  
better advice. Upload screenshots somewhere and explain what you're  
doing.



--
Seth Willits




___

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

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

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

This email sent to [EMAIL PROTECTED]


[Q] Any document that shows differences of Cocoa programming for Mac and for the iPhone/iPod touch?

2008-07-14 Thread JongAm Park

Hello, all.

Because the final SDK for the iPhone came out, I started to take a look 
at it.
Although I knew that Window/View hierarchies are different on the Mac 
and the iPhone, I found that there were some fundamental difference in 
programming model.


For example, this code from 
http://developer.apple.com/iphone/gettingstarted/docs/creatingiphoneapps.action,

it creates a view controller and add its view as a window's sub view.

Listing 2. Creating the content view

- (void) applicationDidFinishLaunching:(UIApplication *)application
{
   // Set up the view controller
   UIViewController *aViewController = [[UIViewController alloc] 
initWithNibName:@"MoveMeView"

   bundle:[NSBundle 
mainBundle]];

   self.viewController = aViewController;
   [aViewController release];

   // Add the view controller's view as a subview of the window
   UIView *controllersView = [viewController view];
   [window addSubView:controllersView];
   [window makeKeyAndVisible];
}


However, for the Mac, something like the view controller was not 
necessary, right? and a content view is not added manually like the code 
above. ( I don't mean that "Oh, there is no UIViewController and 
UIView". I know that those are made for the iPhone. )
When a window and its view are made using the Interface Builder, they 
were handled automatically for the Mac.

Isn't this true for the iPhone?

(Well, I just looked up "NSViewController" document and it says that it 
was added to the Leopard.
Is there any document which explains why it is added and how the 
programming model is changed due to the addition of it? )


Thank you.


___

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: Servicing Core Animations?

2008-07-14 Thread Jens Alfke


On 14 Jul '08, at 11:52 AM, Bill Dudney wrote:

You can of course override this but in the example below you are  
doing the animation yourself so there is no reason for CA. i.e.  
tracking mouse movements is not something you want to do with CA  
animations anyway.


It's fine to use CA while tracking mouse movements — that's how you  
let the user drag a layer around. But you should disable animations on  
that layer while doing so, at least on the 'position' property, as the  
animations are really counterproductive. They cause the layer to lag  
behind the mouse.


My GeekGameBoard sample code shows how to do this. Look at the  
BoardView class.



—Jens

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: [Q] Any document that shows differences of Cocoa programming for Mac and for the iPhone/iPod touch?

2008-07-14 Thread Bill Bumgarner
The iPhone SDK, including all APIs, is still under NDA.  It can't be  
discussed here, nor can it be discussed in any other public forum.


b.bum

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: Trouble with performSelector afterDelay

2008-07-14 Thread Jens Alfke


On 14 Jul '08, at 11:53 AM, James Trankelson wrote:


#0  0x0002606d in -[Worker release] at Worker.m:155
#1  0x94e8502a in __delayedPerformCleanup
#2  0x9390d92b in CFRunLoopTimerInvalidate
#3  0x9390e879 in CFRunLoopRunSpecific
#4  0x9390ecf8 in CFRunLoopRunInMode
#5  0x94e734a5 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
#6  0x000fea26 in -[Listener startAsyncListener:] at Listener.m:141


It looks like the listener thread has just finished executing the  
delayed perform. The Worker object is probably being released because  
it was passed as one of the "withObject" arguments to the delayed- 
perform call, since those get retained until the perform finishes. The  
fact that this release is dealloc'ing the Worker means there must be  
some other unbalanced refcounting going on for that object. You should  
carefully look through the code the delayed perform is running to make  
sure all the retains and releases balance.


—Jens

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: [Q] Any document that shows differences of Cocoa programming for Mac and for the iPhone/iPod touch?

2008-07-14 Thread Waqar Malik



Still under NDA.

--Waqar
On Jul 14, 2008, at 3:15 PM, JongAm Park wrote:


Hello, all.

Because the final SDK for the iPhone came out, I started to take a  
look at it.
Although I knew that Window/View hierarchies are different on the  
Mac and the iPhone, I found that there were some fundamental  
difference in programming model.


For example, this code from http://developer.apple.com/iphone/gettingstarted/docs/creatingiphoneapps.action 
,

it creates a view controller and add its view as a window's sub view.

Listing 2. Creating the content view

- (void) applicationDidFinishLaunching:(UIApplication *)application
{
  // Set up the view controller
  UIViewController *aViewController = [[UIViewController alloc]  
initWithNibName:@"MoveMeView"
  bundle 
:[NSBundle mainBundle]];

  self.viewController = aViewController;
  [aViewController release];

  // Add the view controller's view as a subview of the window
  UIView *controllersView = [viewController view];
  [window addSubView:controllersView];
  [window makeKeyAndVisible];
}


However, for the Mac, something like the view controller was not  
necessary, right? and a content view is not added manually like the  
code above. ( I don't mean that "Oh, there is no UIViewController  
and UIView". I know that those are made for the iPhone. )
When a window and its view are made using the Interface Builder,  
they were handled automatically for the Mac.

Isn't this true for the iPhone?

(Well, I just looked up "NSViewController" document and it says that  
it was added to the Leopard.
Is there any document which explains why it is added and how the  
programming model is changed due to the addition of it? )


Thank you.


___

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: [Q] Any document that shows differences of Cocoa programming for Mac and for the iPhone/iPod touch?

2008-07-14 Thread JongAm Park
I'm sorry. I thought that the announcement of the final Xcode 3.1 also 
covered the iPhone SDK issue automatically.


Thanks for reminding me of that.

Waqar Malik wrote:



Still under NDA.


___

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: KVV and the missing Discard Changes button

2008-07-14 Thread Kyle Sluder
On Mon, Jul 14, 2008 at 2:40 PM, Steve Green <[EMAIL PROTECTED]> wrote:
> I did see that as a possible solution but I'm not sure why it's necessary in
> one app and it's not necessary in another.  I've created a test project with
> a single text field that's bound to the exact same model object that I use
> in the real app.  In the test app I see 2 buttons on the error sheet.

Probably because the app in which it works displays this message as
part of the bindings machinery, specifically NSEditor and
NSEditorRegistration.  Is it the case that one of your apps uses
bindings and the other does not?

--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: Creating and App menu from Scratch

2008-07-14 Thread Kyle Sluder
On Mon, Jul 14, 2008 at 3:06 PM, Bill Royds <[EMAIL PROTECTED]> wrote:
> Forms layout is not part of the "standard user experience" in general,
> although forms look and feel is.

Wrong.  Otherwise the Apple HIG, the Windows interface guidelines, the
Gnome HIG, etc. all would lack sections on the positioning and spacing
of controls.  The Apple HIG in particular is the odd one out because
it advocates center-aligning controls inside of windows.

> Are you saying that all Carbon applications
> are not Mac compatible since there is no conversion of Carbon nibs to Cocoa?

You're being a bit deceptive with "Mac compatible."  I think you meant
that in the sense of "compatible with the expectations of a typical
Mac user."  Applications written for OS 9 and ported straight to OS X
were horrible violators of the Aqua look and feel, so in one sense,
yes, they were incompatible with the environment.

> Software is also worse when the developer has to re-invent the wheel for
> each version.

Not necessarily worse.  More expensive, yes.  Perhaps to the point of
requiring additional team members, some of whom might not even be
programmers.  But what's worth doing is worth doing right; those
people whose jobs have strange titles like "analyst" and "vice
president" have to make decisions about whether it's worth the extra
expense to invest in a new platform.  To wit Gregory makes a very good
point; the cost of recreating the user interface elements according to
the expectations of the platform's user is negligible compared to the
loss in perceived value of an application that looks, feels, and
smells like it was machine-translated.

The most valuable part of almost any application from the author's
perspective is its business logic; the guts of the app that fulfill
the requirements.  However, the user doesn't see any of that; the user
quite literally only sees the interface.  I believe that investing the
additional money upfront in proper development for the Mac, rather
than treating it as a second-class citizen, will pay for itself in
perceived value and user satisfaction.

Before you consider me to be some dogmatic evangelist, I'm well aware
that there exist circumstances in which my argument is foolish.
Internal apps, for example, don't benefit nearly as much from polish
as shrinkwrap apps.  This is especially true for scientific apps --
I've seen some horribe offenses against usability on Windows, Mac, and
Linux in math and engineering labs, but the software's utility lies in
such a niche, and interaction with the software is so minimal, that
investing in the user interface at the expense of the software's core
functionality would be unthinkable.  But that argument is not
universal; the Adobe, Macromedia, and MS Office suites were for years
decried as examples of products whose designers cared not about the
users.  The spin controls on the Adobe dialogs were awful, Office (and
Excel 2004 especially) looked like it was still designed for typefaces
half the size of the very readable 13pt Lucida Grande default, and
Macromedia changed its interface so many times that nobody knew if a
control still behaved the same way from version to version.  And let's
all remember the fun of Java AWT UIs, and the abomination that is its
replacement Swing!

I suppose the question I should be asking you is, who is your
audience?  What does your product do?  Why do you want to
auto-generate your user interface in a serialized object graph form
from a textual template?  That certainly wouldn't be my first choice.
If I were the president of an American auto manufacturer and decided
that I wanted to start selling cars in the UK, my first instinct
wouldn't be to design a mirror-image of one of my cars and fix what
broke.  It would be to design a car from the ground up for my target
market that had the same soul as my original model, taking into
consideration the tastes of my audience in the process.

--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: NSTextField labels and URLs

2008-07-14 Thread Stefan Arentz


On Jul 14, 2008, at 4:01 PM, Dmitri Goutnik wrote:


Hi,

I'm almost positive I've seen this asked here a few weeks back, but  
search turned up nothing so here goes...


I have About panel with copyright label (NSTextField) that have URL  
in it. Label is set to allow rich text and be selectable, copyright  
string is loaded from Credits.rtf and assigned to label with  
setAttributedStringValue. The problem is that when About is shown, I  
have to click on copyright to make URL underlined and hover cursor  
changed to pointingHandCursor.


Is there anything special that needs to be done to get NSTextField  
to display links underlined ?


What about ...

 http://www.cocoabuilder.com/archive/message/cocoa/2006/8/25/170133

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]


NSSearchField and NSTokenFieldCell?

2008-07-14 Thread Colin Cornaby
I have a program where I'd like the user to be able to drag in a  
NSTokenFieldCell into an NSSearchField. What would be the best  
strategy in implementing this? I'm assuming that I'm probably going to  
have to subclass the search field.


In addition, I'm binding to the search field's predicate, so I'd  
assume I'm going to have to generate the predicate myself...


Thanks,
Colin
___

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: Trouble with performSelector afterDelay

2008-07-14 Thread James Trankelson
Hi Jens,

You're suggesting that my Worker instance is being deallocated because
it's retain count is going to zero after the performSelector is
invoked, right?

The funny thing about my Worker class is that it's a singleton,
implementing the following method:

- (unsigned)retainCount
{
return UINT_MAX;  //Never release
}

Are there other ways objects can get released if not by retainCount?

-jt


On Mon, Jul 14, 2008 at 4:33 PM, Jens Alfke <[EMAIL PROTECTED]> wrote:
>
> On 14 Jul '08, at 11:53 AM, James Trankelson wrote:
>
>> #0  0x0002606d in -[Worker release] at Worker.m:155
>> #1  0x94e8502a in __delayedPerformCleanup
>> #2  0x9390d92b in CFRunLoopTimerInvalidate
>> #3  0x9390e879 in CFRunLoopRunSpecific
>> #4  0x9390ecf8 in CFRunLoopRunInMode
>> #5  0x94e734a5 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
>> #6  0x000fea26 in -[Listener startAsyncListener:] at Listener.m:141
>
> It looks like the listener thread has just finished executing the delayed
> perform. The Worker object is probably being released because it was passed
> as one of the "withObject" arguments to the delayed-perform call, since
> those get retained until the perform finishes. The fact that this release is
> dealloc'ing the Worker means there must be some other unbalanced refcounting
> going on for that object. You should carefully look through the code the
> delayed perform is running to make sure all the retains and releases
> balance.
>
> —Jens
___

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: Trouble with performSelector afterDelay

2008-07-14 Thread Ken Thomases

On Jul 14, 2008, at 5:25 PM, James Trankelson wrote:


The funny thing about my Worker class is that it's a singleton,
implementing the following method:

- (unsigned)retainCount
{
return UINT_MAX;  //Never release
}

Are there other ways objects can get released if not by retainCount?


The implementation of NSObject's -retain, -release, and -retainCount  
are private.  However, I've always thought that -retainCount was a  
means for outsiders to query what's going on -- it does not _control_  
what happens, it just _reveals_ something about what happens.  That's  
my guess, anyway.


So, I would not expect that overriding -retainCount would be a means  
to "neutralize" -release.  And, from what you're seeing, indeed it is  
not.


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]


Re: Creating and App menu from Scratch

2008-07-14 Thread Georg Seifert

Hello,
I hope this is appropriate on this this list:

As the discussion goes around Interface design, would it be for any  
interest for developers with no time or experience in interface design  
if I offer my services?


I’m a graphic designer with focus on interface design. And I’m  
programming in XCode/cocoa.

my biggest project:
http://www.pantografer.de/info/Pantografer_edit.png

I also contributed some interface tweaks to vlc.

If there is any interest from either opensource or commercial projects  
please contact me.


Georg Seifert


___

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: Trouble with performSelector afterDelay

2008-07-14 Thread James Trankelson
Thanks, Ken,

I had a suspicion that's what was going on there, so I just added a
few extra [Worker retain] messages before I sent the message to be
handled. Still, the object gets released.

I have yet to find an explanation about any other reasons an object
might get released even after sending it several extraneous retain
messages.

-jt


On Mon, Jul 14, 2008 at 6:40 PM, Ken Thomases <[EMAIL PROTECTED]> wrote:
> On Jul 14, 2008, at 5:25 PM, James Trankelson wrote:
>
>> The funny thing about my Worker class is that it's a singleton,
>> implementing the following method:
>>
>> - (unsigned)retainCount
>> {
>>return UINT_MAX;  //Never release
>> }
>>
>> Are there other ways objects can get released if not by retainCount?
>
> The implementation of NSObject's -retain, -release, and -retainCount are
> private.  However, I've always thought that -retainCount was a means for
> outsiders to query what's going on -- it does not _control_ what happens, it
> just _reveals_ something about what happens.  That's my guess, anyway.
>
> So, I would not expect that overriding -retainCount would be a means to
> "neutralize" -release.  And, from what you're seeing, indeed it is not.
>
> 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]


Re: NSSlider and timers

2008-07-14 Thread Joseph Kelly
Would it be easy to re-factor your usb stuff to run on a separate  
thread? In my mind, that's clearly the most robust solution.


Joe K.

On Apr 14, 2006, at 5:50 PM, John Goodman wrote:

I have a timer than needs to fire while the user drags an NSSlider.  
I have seen solutions that use the NSRunLoop method  
addTimer:myNSTimer forMode:NSEventTrackingRunLoopMode but my timer  
is not an NSTimer, it's an MPTimer.


Is there some equivalent solution that will work in my case? I am  
using the MPTimer API because I need repeatability to a mSec or  
better, and NSTimer doesn't come close.


What I need to do is both regularly monitor the NSSlider value (I  
have a custom subclass of NSTimer for other reasons, using a custom  
NSSliderCell) and regularly write to the USB port (which I'm doing  
with MPTimer and a MPSetTimerNotify using an MPSemaphore.) It is not  
critical for me to read the slider completely regularly, but I  
really need to send data to the USB port as regularly as possible.


This question is going to the cocoa-dev, the mt-smp, and just for  
the hell of it, the usb list. Thanks to all of you for your  
help.___

Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list  (Cocoa-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/joeman%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: Trouble with performSelector afterDelay

2008-07-14 Thread Shawn Erickson
On Mon, Jul 14, 2008 at 3:59 PM, James Trankelson <[EMAIL PROTECTED]> wrote:
> Thanks, Ken,
>
> I had a suspicion that's what was going on there, so I just added a
> few extra [Worker retain] messages before I sent the message to be
> handled. Still, the object gets released.

release != dealloc

It looks like you override release in your "Worker" object (based on
the back trace you posted). Are you thinking -[Worker release] is the
place to free resources? If so it isn't the right place. You want
-[Worker dealloc].

Review...



-Shawn
___

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: KVV and the missing Discard Changes button

2008-07-14 Thread Steve Green

On Jul 14, 2008, at 5:25 PM, Kyle Sluder wrote:
On Mon, Jul 14, 2008 at 2:40 PM, Steve Green <[EMAIL PROTECTED]>  
wrote:
I did see that as a possible solution but I'm not sure why it's  
necessary in
one app and it's not necessary in another.  I've created a test  
project with
a single text field that's bound to the exact same model object  
that I use

in the real app.  In the test app I see 2 buttons on the error sheet.


Probably because the app in which it works displays this message as
part of the bindings machinery, specifically NSEditor and
NSEditorRegistration.  Is it the case that one of your apps uses
bindings and the other does not?


It is not the case.. they both use bindings but in the case where I  
only see 1 button, the NSTextField and bindings are created  
programatically.  Neither bind through controllers.

___

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: Creating and App menu from Scratch

2008-07-14 Thread Bill Royds


On 14-Jul-08, at 17:55 , Kyle Sluder wrote:


I suppose the question I should be asking you is, who is your
audience?  What does your product do?  Why do you want to
auto-generate your user interface in a serialized object graph form
from a textual template?  That certainly wouldn't be my first choice.
If I were the president of an American auto manufacturer and decided
that I wanted to start selling cars in the UK, my first instinct
wouldn't be to design a mirror-image of one of my cars and fix what
broke.  It would be to design a car from the ground up for my target
market that had the same soul as my original model, taking into
consideration the tastes of my audience in the process.


Thank you for your very insightful comments. My target audience is  
people who wish to use a common tool on multiple platforms without re- 
learning how to use it from scratch.
I do agree that one can not port software from one system directly to  
another. A good example (or a horrible example) is the Wireshark  
packet sniffer. Even though it uses X11 on Linux and OS-X, it uses the  
Windows key conventions (CTRL+C for copy instead of CMD+C, etc.) on my  
Mac. Key bindings crucially need to be OS centric, since the OS itself  
may be using ones that your app uses on another system. But other  
controls are less system centric and more particular application  
centric. FOr example a form for filling in a request for a government  
may have a format that is legally required. You cannot just put some  
field in different places on the screen, because the assumption is  
that you complementary fields will be tied to each other in fixed ways.


My most common reason for wanting to port forms and menus is simply  
that I wish to use the same wording on labels and descriptions. There  
has been a lot of effort in writing these so as to be meaningful to  
our users and there should be no need to type hundreds of them into  
another interface designer. A tool that allows one to get a rough port  
from one to another saves money from mundane clerical tasks like this  
to allow for money to be used for better design.



___

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: Trouble with performSelector afterDelay

2008-07-14 Thread Jens Alfke


On 14 Jul '08, at 4:12 PM, Shawn Erickson wrote:


It looks like you override release in your "Worker" object (based on
the back trace you posted). Are you thinking -[Worker release] is the
place to free resources? If so it isn't the right place. You want
-[Worker dealloc].


Right. -release just decrements the refcount; it's the counterpart to - 
retain.


I'm uncomfortable with the idea of overriding retain/release/ 
retainCount. I know that some Apple docs suggest doing so for  
singleton objects, but I don't think it's necessary. All you really  
need to do is provide a +sharedInstance method like


+ (Worker*) sharedInstance {
static Worker *sInstance;
if( ! sInstance ) sInstance = [[self alloc] init];
return sInstance;
}

—Jens

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]

Design question

2008-07-14 Thread Phillip Hall
Hi all,

As a developer entering the cocoa world for the first time one of the things I 
am finding difficult is how to start structuring an application, I mean what 
classes should I create to make an OK application design.

I have a simple application I am working on at the moment, and am hoping 
someone can give me some pointers on the classes I should write.  The 
application will be using the "Quicklite" framework to connect to SQLite 
databases and display a selection list of all tables in the database, with a 
table view to show the data from the selected table.

A first attempt at designing the application has come up with the following,

- I will need a class to open and maintain the connection to the database.  I 
was thinking of using an Application Delegate class to do this and then expose 
the connection via a property.
- I will need a view controller class for the table list UI object.  This 
controller class will goto the Application delegate for the database connection 
and ask it a list of tables in the database.  It will also maintain the current 
selected table.  Any changes to the selection will trigger a call to the table 
view controller to make an update.
- I will need a view controller class for the table view UI object.  This 
controller class will goto the application delegate for the database connection 
and ask for table/row information as needed to display in the table.  The 
current selected table is read from the table list controller object.
- I will need to provide outlets in the controller classes so interface builder 
can bind them all together.

Does anyone have any comments on my design so far? 

Thanks

Phillip Hall
___

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: Questions about Core Data and SQLite

2008-07-14 Thread Steve Steinitz

Hi,

On 14/7/08, [EMAIL PROTECTED] wrote:


On Jul 14, 2008, at 8:12 AM, Chris Hanson wrote:


However, managing simultaneous access by *different users* to a 
SQLite  persistent store is slightly trickier -- they must all 
access the  persistent store in ways that have compatible file 
locking.  This is  necessary to maintain database integrity.  
However, if all you have  are a couple of users on a LAN 
working with a database stored on a  shared AFP (AppleShare, 
Personal File Sharing) volume, that should be  fine.


The real difficulty is scaling.  Any database that works via a 
shared  filesystem will have significant limits to its 
scalability.  You won't  want to have more than a few users 
sharing the same file.


I use a little gigabit Thecus Network Drive which is just about 
as fast as using the internal disk.  Humorously, my database 
currently fits in the Thecus' cache so it runs even faster.


The only problem I have with multiple users accessing the 
database is that the app throws optimistic locking exceptions.  
They don't seem to result in anything bad but they are 
worrying.  I've tried running this code before saving:


[context processPendingChanges];// added 4 Jul 08
double stalenessInterval = [context stalenessInterval];
[context setStalenessInterval: 1];
@try
{
[context refreshObject: sale mergeChanges: YES];
}
@catch (id e) ...
[context setStalenessInterval: stalenessInterval];

But it doesn't seem to do the merge: the in-memory object 
remains different than the store.


Other than that it all works well and might scale OK too.

Cheers,

Steve

___

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

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

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

This email sent to [EMAIL PROTECTED]


Mouse events in NSTextFieldCell

2008-07-14 Thread Damien Cooke

Hi all,
I have an NSTableView that lists names of images.  I want to pop up a  
thumbnail image as I roll the mouse over the cells.  I thought I could  
do this by sub-classing the NSTextFieldCell.  However I am stumped as  
to how to get it to acknowledge  mouse events obviously I have not  
enabled it to accept mouse events and I have no idea how to.  Having  
studied the docs I was wondering if someone could point me in the  
correct direction.


Thanks and Regards
Damien



I Remenber When Synthesizers were Analogue
Programs were somthing you watched on T.V
and a hard drive was from Sydney to Adelaide!





___

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: Design question

2008-07-14 Thread I. Savant

Does anyone have any comments on my design so far?


  Overcomplicated. :-) If I were writing a quick utility to do as  
you're looking to do, I'd probably implement it all in a single  
application controller. There's no real design advantage in something  
with so few requirements and simple is always best.


  If your project becomes more complicated (the app controller is too  
big to manage mentally / textually, or some parts of your controller  
layer need to be reusable), you can decide what to parcel out into  
more logical divisions. For now, though, there's nothing wrong with  
using a single controller and nothing to gain from using multiple ones.


  Also, the general advice (with which I concur whole-heartedly) is  
to steer clear of Cocoa Bindings until you've masted the Cocoa Basics.  
That is, for your tables, try the NSTableDataSource protocol to see  
the nuts and bolts of tables before worrying about the more  
complicated Bindings machinery.


  Good luck and happy coding!

--
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: NSUserDefaultsController, when does value change?

2008-07-14 Thread James W. Walker


On Jul 14, 2008, at 9:34 AM, Matt Neuburg wrote:

On Sun, 13 Jul 2008 21:29:56 -0700, "James W. Walker" <[EMAIL PROTECTED] 
>

said:

I have a preferences dialog that I'm using with an
NSUserDefaultsController instance, my first use of bindings, and it
works.  But I want to post a notification when a certain setting
changes.  In my method that shows the dialog, I record the old value
of the setting.  In my action method for the OK button, I send a save
message to the defaults controller  (the "applies immediately" option
is off), send a synchronize message to the NSUserDefaults, then check
the value of the setting and compare it to the old value.  But the
value has not changed!  It obviously gets changed at some point,
because the next time I bring up the dialog, the new value has is
there.  What am I missing?


What you're doing is unnecessarily complicated. Just use KVO to  
observe the

desired value within the standardUserDefaults. You get a notification
contining the old value and the new value. Welcome to the world of  
bindings.



I think I considered KVO, but I looked in the NSUserDefaults  
reference, and didn't see any indication that it conforms to  
NSKeyValueObserving.  Does the "Conforms To" section of a class  
reference only list formal protocols, not informal protocols?


I still wish I understood why the default hadn't changed after the  
save and synchronize.  But thanks for the suggestion of a slicker  
approach.

___

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: Questions about Core Data and SQLite

2008-07-14 Thread Colin Cornaby
You might want to look into Postgresql instead. It's much nicer than  
MySQL at doing desktop applications stuff, and you can even  
"subscribe" to rows and have the server notify you when changes occur.  
This makes it much easier to keep clients in sync. MySQL is not great  
for doing desktop apps.


CoreData can't really be centralized on a server. You could try using  
distributed objects, but you're going to loose KVO if you go that route.


-Colin

On Jul 14, 2008, at 1:05 AM, Jeff Brown wrote:


Hi Guys

I've got a cocoa app that is installed as a client on several  
machines and uses MySql as the database.


Is there any way I can incorporate Core Data into the app so that I  
can do away with using MySql? i.e. log into the app on one machine  
(using it's SQLite database) from the same app on a different machine?


If so, given that I know a some about Cocoa development but nothing  
about using Core Data, can anyone direct me to some good  
documentation that explains how to incorporate Core Data into an  
already existing Cocoa app. (It currently uses MySQL).


Thanks greatly for any help.

Jeff


 Start at the new Yahoo!7 for a better online experience. www.yahoo7.com.au
___

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/colin.cornaby%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: Design question

2008-07-14 Thread Michael Fey
I'd agree with what I.S. said, make sure you read up on and run  
through some tutorials for coding a table and its data source by  
hand.  Aaron Hillegass does a great job of this in Cocoa Programming  
for Mac OS X.  As a Cocoa newbie this is a great book to hit the  
ground running.  It assumes prior programming knowledge, but starts at  
the basics (like table data sources) and goes right up through to the  
advanced.  I'm not the first to recommend his book on this list and I  
know I won't be the last.


Regards,
 Michael


On Jul 14, 2008, at 9:35 PM, I. Savant wrote:


Does anyone have any comments on my design so far?


 Overcomplicated. :-) If I were writing a quick utility to do as  
you're looking to do, I'd probably implement it all in a single  
application controller. There's no real design advantage in  
something with so few requirements and simple is always best.


 If your project becomes more complicated (the app controller is too  
big to manage mentally / textually, or some parts of your controller  
layer need to be reusable), you can decide what to parcel out into  
more logical divisions. For now, though, there's nothing wrong with  
using a single controller and nothing to gain from using multiple  
ones.


 Also, the general advice (with which I concur whole-heartedly) is  
to steer clear of Cocoa Bindings until you've masted the Cocoa  
Basics. That is, for your tables, try the NSTableDataSource protocol  
to see the nuts and bolts of tables before worrying about the more  
complicated Bindings machinery.


 Good luck and happy coding!

--
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/michaelfey%40fruitstandsoftware.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: [Q] Any document that shows differences of Cocoa programming for Mac and for the iPhone/iPod touch?

2008-07-14 Thread Stefan Arentz


On Jul 14, 2008, at 4:15 PM, JongAm Park wrote:

...

(Well, I just looked up "NSViewController" document and it says that  
it was added to the Leopard.
Is there any document which explains why it is added and how the  
programming model is changed due to the addition of it? )


The NSViewController documentation does a good job. The Overview  
section outlines three things that the NSViewController will handle  
for you.


I have not used the NSViewController in my project. But I think it is  
mostly useful when you want to load a (custom) view from a NIB/XIB  
file and hook it up to a bindings enabled data source.


For me the class reference is a bit dry. I would love to read more in  
the style of WHY you would want to use a certain class. A more  
pragmatic 'recipe' style documentation.


 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]


Hillegass, Third Edition, Chapter 18

2008-07-14 Thread Jon Buys
Hello All,
I'm working through the challenge app at the end of Chapter 18 of Cocoa
Programming, Third Edition.  I've got my app to the point where it can draw
ovals, but each time I click in the window it seems like the view redraws
itself.  I'm sure that this is a very simple question with a very simple
answer, but I'm stuck.  I've been looking at it for three days now, and I
think its time to let another set of eyes look at it.

Any help would be greatly appreciated.

Thanks,

Jon

On a separate note, anyone else working through this book, please feel free
to get in touch.  Maybe we can help each other out!

code follows:

ChalkBoard.m:

//

//  ChalkBoard.m

//  OvalDraw

//

//  Created by Jon on 7/10/08.

//  Copyright 2008 __MyCompanyName__. All rights reserved.

//


#import "ChalkBoard.h"



@implementation ChalkBoard


- (void)drawRect:(NSRect)rect

{

NSRect bounds = [self bounds];

[[NSColor blackColor] set];

[NSBezierPath fillRect:bounds];

 NSRect ovalRect = [self currentRect];  //OK, so this should not be here,
but where can I put it so the window will remember it and not redraw?

[[NSColor whiteColor] set];

[[NSBezierPath bezierPathWithOvalInRect:ovalRect] stroke];


 [oval stroke];

}



#pragma mark Events


- (void)mouseDown:(NSEvent *)event

{

NSLog(@"mouseDown: %d", [event clickCount]);

NSPoint p = [event locationInWindow];

downPoint = [self convertPoint:p fromView:nil];

currentPoint = downPoint;

[self setNeedsDisplay:YES];

}



- (void)mouseDragged:(NSEvent *)event

{

NSPoint p = [event locationInWindow];

NSLog(@"mouseDragged:%@", NSStringFromPoint(p));

currentPoint = [self convertPoint:p fromView:nil];

 [self setNeedsDisplay:YES];


}


- (void)mouseUp:(NSEvent *)event

{

NSPoint p = [event locationInWindow];

NSLog(@"mouseUp:%@", NSStringFromPoint(p));

currentPoint = [self convertPoint:p fromView:nil];


 [self setNeedsDisplay:YES];


}



#pragma mark Accessors




- (NSRect)currentRect

{

float minX = MIN(downPoint.x, currentPoint.x);

float maxX = MAX(downPoint.x, currentPoint.x);

float minY = MIN(downPoint.y, currentPoint.y);

float maxY = MAX(downPoint.y, currentPoint.y);

 return NSMakeRect(minX, minY, maxX-minX, maxY-minY);

}


@end
___

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: KVO notifications and threads

2008-07-14 Thread Ron Lue-Sang


On Jul 14, 2008, at 8:58 AM, Dave Dribin wrote:


On Jul 11, 2008, at 2:36 PM, Bill Bumgarner wrote:
If you have specific enhancement requests, please file a bug via http://bugreporter.apple.com 
.   If your request is "make MVC and KVO play nicely with threads",  
you will need to provide details on exactly what you mean --  
exactly how that is to be achieved.


I've got a bug filed along these lines: rdar://5953181 (mistakenly  
filed under OS X Server :/).  The main times I've come across this  
problem is when I want to show the progress of a background  
operation by binding some property to a progress indicator.


Totally reasonable.


Thus, instead of doing this:

self.progress = newProgress;

I resort to setting "progress" on the main thread using  
performSelectonOnMainThread: + no wait, similar to Clark's  
suggestion.  I figure not waiting allows the background thread to  
continue to maintain decent concurrency. [1]


Yep. That's a good way to do it. And yes, "no wait" means the call  
returns immediately so you don't end up serializing work between  
threads needlessly.





I'm not sure of the best way to make threads + Cocoa bindings play  
nice.


For the case you've described above, the solution you've described is  
a great solution in terms of correctness, even if it's not a one-click  
solution.


 My current thinking is to have AppKit bounce all KVO notifications  
over to the main thread.  It could use NSThread's isMainThread to  
conditionally bounce the notification to the main thread.  It could  
even coalesce notifications, as Ben suggested.


That'd be great as a solution for just the one problem you're  
describing (well, actually, I think it sounds great at first and then  
it would lead to much pain down the line). But then you've got  
something that's easy, but isn't quite correct. This is what a lot of  
the replies to your initial question have implied. Bill's already said  
you don't want a "thread safe" AppKit. At least It sounds like you've  
realized that as well.


The argument I'm trying to make is that you, as the app implementor,  
have everything you need to do what you mean and do it correctly.


Imagine this (this is kinda long winded, so buckle up):
 - You have a view bound to property foo of DataObject.
 - You also have WorkerObject bound to property foo of DataObject
 - You have the same view bound to a property "bar" of WorkerObject  
which depends on DataObject.foo
 - WorkerObject is doing it's work with DataObject in a background  
thread, and the view is drawing in the main thread


In the scenario you're asking for, DataObject.foo changes and the view  
"bounces" the KVO notification over to the main thread.


//
// for anyone reading who doesn't realize, this would really mean doing
// [self performSelectorOnMainThread:@selector(observeValueForKeyPath: 
…)… ], and forwarding the method arguments.

//

Now WorkerObject gets the notification (again, observeValueForKeyPath  
gets invoked), and it changes it's bar property. This happens in the  
same thread that the change to DataObject happened. So it could happen  
before the main thread gets a chance to run and handle that  
performSelectorOnMainThread call earlier (assuming no wait).


But the behaviour or contents of the bound view depends on BOTH  
DataObject.foo and WorkerObject.bar. Does the order in which these  
notifications arrive make a difference? Maybe. AppKit would never  
know, and the ordering would be indeterminate. So this wouldn't work.  
What would be a better way to do this?


Coalesce the notifications on the background thread yourself. Post  
both notifications, or just one über notification, in just the order  
you need. Then, this (sorta contrived) example would work with your  
KVO-bouncing AppKit, right? Well, it would also work great with our  
existing regular AppKit too. Because what you meant to happen isn't  
obvious, so you didn't leave it up to AppKit to infer.


Does that make sense?





Another possibility is to have have another @property option which  
forces that property to only be updated on the main thread.  Or  
maybe just have the willChange/didChange happen on the main thread.


I'm not sure it would make sense to treat the main thread so specially  
in Foundation/ObjC API. I think this encourages the wrong kind of  
laziness.





Or finally, maybe NSController should take care of bouncing model  
KVO notifications to the main thread.


This wouldn't help in all cases, like when you create your own non- 
NSController controller. You'd be back to doing what everyone has  
already suggested - take care of this in your own controller code.





My gut tells me this should be done in AppKit.


I'm not trying to be snide (not this time at least) but that would  
imply that your gut is outnumbered - at least on this list.


The model and the view should be completely isolated from each  
other.  Forcing the model to so stuff on the main thread because the  
view

Re: Questions about Core Data and SQLite

2008-07-14 Thread Jens Alfke


On 14 Jul '08, at 6:05 PM, Steve Steinitz wrote:

I use a little gigabit Thecus Network Drive which is just about as  
fast as using the internal disk. Humorously, my database currently  
fits in the Thecus' cache so it runs even faster.


The scalability problem isn't the I/O speed, but the fact that the  
clients are using filesystem locks for mutual exclusion, and polling  
the lock for scheduling. Typically if the file is locked the process  
will wait a few seconds, then try again. As the percentage of busy  
time of the file increases, the delay to access it gets unacceptably  
long.


At that point you really want a database server that can queue  
requests and schedule them efficiently and fairly.


—Jens

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: Questions about Core Data and SQLite

2008-07-14 Thread Chris Hanson

On Jul 14, 2008, at 9:08 PM, Jens Alfke wrote:


On 14 Jul '08, at 6:05 PM, Steve Steinitz wrote:

I use a little gigabit Thecus Network Drive which is just about as  
fast as using the internal disk. Humorously, my database currently  
fits in the Thecus' cache so it runs even faster.


The scalability problem isn't the I/O speed, but the fact that the  
clients are using filesystem locks for mutual exclusion, and polling  
the lock for scheduling. Typically if the file is locked the process  
will wait a few seconds, then try again. As the percentage of busy  
time of the file increases, the delay to access it gets unacceptably  
long.


On filesystems that support them properly, SQLite will use byte-range  
locks which can provide much better performance for this type of  
situation than full-file locks.


That's part of why it's important that every user of a SQLite database  
that's on a networked filesystem access it through a compatible  
mechanism:  If the clients use different protocols to access the file,  
depending on the server implementation, they may not actually share  
lock state.


This is fundamentally the same as putting a FileMaker or Access  
database on a file server and having multiple users open it.


  -- Chris


___

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: CALayer transform, setting the Y value of rotation causes side-effects

2008-07-14 Thread John Clayton

Hi Duncan

Thanks for the answer - it does make sense (also in light of the other  
replies to the same post).  In my app, I've attached a simple 360  
degree slider to the Y property, and I'd like that to rotate my layer  
smoothly through the Y axis by 360 degrees.  What I'm seeing then, is  
that as soon as I get past 90 degrees, the solver returns these  
'flipped' values for all three properties and the image jitters badly.


I must have stuffed something up though; because if the solver is  
returning matrices that are 'equivalent' or mathematically equal -  
then I should not see any visual difference in the rotation of the  
layer on screen.  But I do see visual differences.


The best way to see what i mean is a short vid; I first set the Y  
rotation to 5 degrees, it looks OK, then I move the slider past 90,  
and its this jitter that I want to eliminate.  The video is at:

http://gallery.me.com/john_clayton#100148

The code is pretty simple, its a binding that goes through a  
ValueTransformer - converting degrees to radians for a range of 0 >  
degrees < 360, which then drives a simple setter on the CALayer  
instance, that in turn modifies the "transform.rotation.x/y/z"  
properties in turn.


Cheers - your help is [hugely] appreciated.

--
John Clayton

On 14/07/2008, at 8:35 PM, David Duncan wrote:


On Jul 14, 2008, at 9:57 AM, John Clayton wrote:


Huh?

Question 1: Why do X and Z get very close to PI?
Question 2: Why does Y end up being 1.02 when I set it to 2.12041?

Does anyone know what's going on here?  I'm a little stumped by  
this one.



The simple answer is that with a 4x4 rotation matrix, there are a  
number of distinct matrices that are mathematically equivalent. Note  
that 3.14 - 2.12 = 1.02 and that X & Z were flipped 180 degrees.  
Effectively your seeing the solver for reversing an arbitrary 4x4  
matrix into x/y/z rotations making certain simplifying assumptions  
that don't match what you are expecting.

--
David Duncan
Apple DTS Animation and Printing
[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]


  1   2   >