Porting ResEdit Text Resources to OS X

2011-06-19 Thread Robert Hard
Cocoa list I want to port a System 9 tutorial to an OSX using Cocoa. This tutorial consists of a series of units, each in turn consisting of a series of short RTF text panels that appear in relation to animated drawing sequences in a separate window when the user clicks a button. The RTF text o

Setting the firstResponder in a view

2011-06-19 Thread Andre Masse
Hi List, I've been banging my head on this for awhile... I'm using a non document, non core data application. At this point this is a fairly common (I think) master/detail single window design. The window has a NSTabView with the master on one tab and detail on another, and a SourceView (like M

Re: Tab Bar iPad App With Table View(Conrad Shultz)

2011-06-19 Thread Sivakumar Kandappan
Hi For the the kind of view which you were mentioning you should create a standard or customised tableview controller and set the tabbar controllers property.After setting this add the tabbar view to the view which will show the tab bar. Once you click the tab bar button. Tableview controller load

Re: Porting ResEdit Text Resources to OS X

2011-06-19 Thread Graham Cox
On 19/06/2011, at 3:18 AM, Robert Hard wrote: > I have RFT TextEdit files of each panel. Just use the files as resources. They can simply be added to the project and will be copied into your app's bundle. At runtime, load the one you want into a NSTextView. One line of code, pretty much. I w

CATransactions having no effect in CALayer draw delegate

2011-06-19 Thread Ken Tozier
HI I'm writing a subclass of CALayer and what I'm seeing is that regardless of whether I wrap CG drawing commands in a CATransaction, or not, it still animates. One of the properties of the subclass is a "suppressAnimations" BOOL which, if set, is used in the draw method to dispatch the incomin

Re: Tab Bar iPad App With Table View

2011-06-19 Thread Conrad Shultz
(Somehow your mail client inserted my name in the subject line.) Let's not get ahead of ourselves here. The OP stated they're totally new to the platform and as such it's probably ill-advised to have them start building a view hierarchy in code when it could be done satisfactorily in Interface

making a clickable link in NSTableView

2011-06-19 Thread Rick C.
Hello, I currently have a NSTableView which displays a list of files and normally the table view is not clickable or selectable. In this list of files I actually display the file path as a subtitle to the file name. What I would like to do is to turn that file path into a clickable link that

Re: Setting the firstResponder in a view

2011-06-19 Thread Andre Masse
Hi, Well after a good night sleep, found the problem. I was using this call on my controller: [[[self view] window] makeFirstResponder:myFirstResponderField] I found that this kind of one liner is bad because it assumes too many things. I'll be more careful now. In this case, the probl

How to redraw a view in slow-motion

2011-06-19 Thread Matthias Arndt
In a document-based app my custom view draws some thousand paths in drawRect: with a good performance. Now I'd like to offer a "slow-motion" animation, so the user can actually watch the paths being drawn (not each single one, but e. g. in steps of 100 paths per sec). I though of several approa

Re: making a clickable link in NSTableView

2011-06-19 Thread Houdah - ML Pierre Bernard
Hi! Here is the solution I got from DTS: http://dl.dropbox.com/u/2381634/DTS/TableViewLinks-updated.zip At a later WWDC they introduced a more evolved version of the same code: http://developer.apple.com/library/mac/#samplecode/CocoaTipsAndTricks/Introduction/Intro.html Best, Pierre Bernard Ho

Re: How to redraw a view in slow-motion

2011-06-19 Thread Ken Tozier
Have you tried CALayer/CAAnimation? They have a lot of power and are specifically designed for animation. If for some reason, you don't want to go that route, the following is a bit hokey, but it might work Add a "subsetRange" property to your view class Create a "setSubsetRange:(NSRange) inRan

Non-rectangular image of NSView for dragging

2011-06-19 Thread Martin Hewitson
Dear list, I have a view which contains a set of subviews. This control is a little like a collection view. I have drag-n-drop implemented but I'm having some trouble getting a decent image for dragging. The problem is that the subviews are not rectangular but have rounded corners. So far I'm u

Re: How to redraw a view in slow-motion

2011-06-19 Thread Matthias Arndt
Hi Ken, Am 19.06.2011 um 15:40 schrieb Ken Tozier: > - (void)observeValueForKeyPath:(NSString *) inKeyPath > ofObject:(id) inObject > change:(NSDictionary *) inChange > context:(void *) inContext > { > if ([inKeyPath isEqualToString: @"subsetRange"

Re: Synthesised properties and additional actions

2011-06-19 Thread Eeyore
Here is a trick I saw somewhere else that might do what you need. On the other hand, i'm still learning cocoa myself so it may have drawbacks that I'm unaware of. Create a private property (like internal_foo below) to handle memory. Then have a public property to do the other stuff. So users of

This code is leaking...

2011-06-19 Thread Tony Cate
- (NSImage *)illustration { if ( illustrationData != nil ){ NSImage* thisImage = [NSImage new]; NSBitmapImageRep* bitmapImageRep = [[NSBitmapImageRep alloc] initWithData:illustrationData]; NSPICTImageRep* pictImageRep = [[NSPICTImageRep alloc] initWithData:illustratio

Re: How to redraw a view in slow-motion

2011-06-19 Thread Ken Tozier
If you keep the animation short (say 1.5 to 2 seconds) the freezes might not be too irksome to the user, but eliminating them altogether would require adding NSOperationQueues and NSInvocationOperations to the mix and this is even too hokey for me :) With CALayers, you could create 10 different

Re: This code is leaking...

2011-06-19 Thread Mike Abdullah
NEVER test for memory leaks using -retainCount. ALWAYS use the supplied tools instead. On 19 Jun 2011, at 15:29, Tony Cate wrote: > - (NSImage *)illustration > { >if ( illustrationData != nil ){ >NSImage* thisImage = [NSImage new]; You never (auto)release this image, so it's getting

Re: Non-rectangular image of NSView for dragging

2011-06-19 Thread Sivakumar Kandappan
I assume you are using the draw rect function. The following is my opinion and my way of doing When the user selects the objects; create path from the non rectangular image with respect to any frame of reference like frame or bounds of the shape. You can use path to clip the region by using mask o

Automatically mirroring folders

2011-06-19 Thread Leonardo
Problem: I have to automatically mirror 2 folders, /A and /B, such a way they contains the same files and folders. - So I FSEventStreamCreate with kFSEventStreamEventIdSinceNow, kFSEventStreamCreateFlagWatchRoot and a 2 seconds latency time. - I get a notification: there is a new file to copy fro

Re: making a clickable link in NSTableView

2011-06-19 Thread Lee Ann Rucker
Look at "TableViewLinks/NSAttributedStringAdditions.m" in the sample code. - Original Message - From: "Rick C." To: "Cocoa Development" Sent: Sunday, June 19, 2011 4:08:11 AM Subject: making a clickable link in NSTableView Hello, I currently have a NSTableView which displays a list of

Re: How to Management Bytes?

2011-06-19 Thread Fritz Anderson
On 19 Jun 2011, at 10:28 AM, Bing Li wrote: > I got another problem in the following method. A byte array is used to save > data transmitted from a remote node and the size is different for each > message. I think I need to release the byte array after it is used. However, > the system got crashed

Re: How to Management Bytes?

2011-06-19 Thread Scott Ribe
On Jun 19, 2011, at 9:28 AM, Bing Li wrote: > One more issue is that there was no memory leaking even if I didn't add the > line, free(receivedBytes). Why? Because it's stack-allocated, not allocated with any version of malloc. I pointed out the same mistake in my first email to you, yet here yo

How to Management Bytes?

2011-06-19 Thread Bing Li
Dear all, First, I appreciate so much for your replies in the past days. Those replies help me a lot when implementing my system. I got another problem in the following method. A byte array is used to save data transmitted from a remote node and the size is different for each message. I think I n

Re: CATransactions having no effect in CALayer draw delegate

2011-06-19 Thread Kyle Sluder
On Sun, Jun 19, 2011 at 12:38 AM, Ken Tozier wrote: > HI > > I'm writing a subclass of CALayer and what I'm seeing is that regardless of > whether I wrap CG drawing commands in a CATransaction, or not, it still > animates. One of the properties of the subclass is a "suppressAnimations" > BOOL w

Re: Non-rectangular image of NSView for dragging

2011-06-19 Thread Kyle Sluder
On Sun, Jun 19, 2011 at 6:46 AM, Martin Hewitson wrote: > I have a view which contains a set of subviews. This control is a little like > a collection view. I have drag-n-drop implemented but I'm having some trouble > getting a decent image for dragging. The problem is that the subviews are not

Re: Automatically mirroring folders

2011-06-19 Thread Scott Ribe
On Jun 19, 2011, at 10:48 AM, Leonardo wrote: > 2) During the period of time the stream is off, if some new files arrive > within the folder /A, I lose the notification to copy it. I think you have to leave the event streams active all the time, keep track of your own actions, and filter out tho

Re: How to Management Bytes?

2011-06-19 Thread Bing Li
Dear Scott and Fritz, Actually, my system made a lot of progresses according to your replies. I really don't have enough experiences on C. So I need to improve. I appreciate so much for your help! Best regards, Bing On Mon, Jun 20, 2011 at 12:13 AM, Scott Ribe wrote: > On Jun 19, 2011, at 9:28

Re: Non-rectangular image of NSView for dragging

2011-06-19 Thread Martin Hewitson
I got an off-list reply suggesting clipping the final image with a bezier path. So I used NSBezierPath's addClip with the same path used in drawRect: for clipping my final image. Works perfectly. Thanks to all for the suggestions! Martin On 19, Jun, 2011, at 07:06 PM, Kyle Sluder wrote: > On

Re: audiounit instrument with cocoa view

2011-06-19 Thread Stephen Blinkhorn
On 18 Jun 2011, at 17:09, ben kamen wrote: ok, so it seems like my problem is actually in getting it to load the bundle in the first place. what am i missing? the bundle identifier in the plist is set to : com.olympia-noise- co.RO_CocoaViewFactory and in the main cpp file i have this,

Re: Synthesised properties and additional actions

2011-06-19 Thread Matt Neuburg
On Sun, 19 Jun 2011 15:12:31 +1000, Graham Cox said: >If I synthesize a property, is it possible to also directly invoke some other >code when that property is set (other than the usual KVO)? That is, I need to >do something like: > > >@synthesize foo; > > >- (void) setFoo:(id) new

Re: CATransactions having no effect in CALayer draw delegate

2011-06-19 Thread Ken Tozier
On Jun 19, 2011, at 1:03 PM, Kyle Sluder wrote: > You're mixing conceptual layers here. > > CG drawing isn't animated at all. The animation happens at the Core > Animation layer. When CA asks your layer to -drawInContext: that's an > atomic operation from CA's perspective. The thing getting anima

Re: Synthesised properties and additional actions

2011-06-19 Thread Dave DeLong
On Jun 19, 2011, at 11:01 AM, Matt Neuburg wrote: > I provide a good (I think) technique for doing this in my book (p. 275, > example 12-5 "Overriding synthesized accessors"). You can also download > sample code here: > > https://github.com/mattneub/Programming-iOS-4-Book-Examples/tree/master/

Re: Writing extremely large RTF or .doc files

2011-06-19 Thread Dave DeLong
Thanks for the suggestions, everyone. I ended up generating HTML files, and they seem to be working fine. Cheers, Dave On Jun 18, 2011, at 8:06 AM, Douglas Davidson wrote: > I might point out that NSAttributedString has a facility for writing out HTML > that has options flexible enough to do

Re: audiounit instrument with cocoa view

2011-06-19 Thread Stephen Blinkhorn
Sorry, seems I sent this to the wrong list. On 19 Jun 2011, at 11:54, Stephen Blinkhorn wrote: On 18 Jun 2011, at 17:09, ben kamen wrote: ok, so it seems like my problem is actually in getting it to load the bundle in the first place. what am i missing? the bundle identifier in the plis

Re: Writing extremely large RTF or .doc files

2011-06-19 Thread Mike Abdullah
BTW we have code for streamed generation of HTML files here: https://github.com/karelia/KSHTMLWriter On 19 Jun 2011, at 19:03, Dave DeLong wrote: > Thanks for the suggestions, everyone. I ended up generating HTML files, and > they seem to be working fine. > > Cheers, > > Dave > > On Jun 18,

Re: Release a NSWindowController after the window is closed

2011-06-19 Thread Marc Respass
Hi Brian, The technique that I have been using for a long time is to alloc/init the window controller, make the window controller the delegate of the window, and invoke [self autorelease] in windowWillClose:. It's essentially the same thing you are doing with less code. The thing that I love a

Re: Tab Bar iPad App With Table View

2011-06-19 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 6/19/11 10:59 AM, Julie Seif wrote: > Conrad, > > Could you please tell me more about your idea with a > UINavigationController hosing a UITableView > > Thanks. > julie. (Putting back on list.) As I stated previously you will really want to

Re: CATransactions having no effect in CALayer draw delegate

2011-06-19 Thread Kyle Sluder
On Sun, Jun 19, 2011 at 11:01 AM, Ken Tozier wrote: > On Jun 19, 2011, at 1:03 PM, Kyle Sluder wrote: > >> You're mixing conceptual layers here. >> >> CG drawing isn't animated at all. The animation happens at the Core >> Animation layer. When CA asks your layer to -drawInContext: that's an >> ato

Progress Indicators Spin vs Bar

2011-06-19 Thread James Merkel
I am trying to do an indeterminate progress indicator in a small NSPanel window similar to that shown in Figure 15-57 of the OSXHIGuidelines. The NSPanel and NSProgresssIndicator are in a nib file and I'm pretty sure the IB connections are correct. If I use a spin progress indicator, I can

Re: Progress Indicators Spin vs Bar

2011-06-19 Thread Kyle Sluder
On Sun, Jun 19, 2011 at 1:14 PM, James Merkel wrote: > Then use the progress  indicator as follows; > >        ProgressController * progressController = nil; >        progressController =[[ProgressController alloc] init]; >        NSLog(@"Progress window: %@\n", [progressController window]); >    

Re: Progress Indicators Spin vs Bar

2011-06-19 Thread Quincey Morris
On Jun 19, 2011, at 13:14, James Merkel wrote: > ProgressController * progressController = nil; > progressController =[[ProgressController alloc] init]; > NSLog(@"Progress window: %@\n", [progressController window]); > [progressController startProgressAnimation]; >

Re: Progress Indicators Spin vs Bar

2011-06-19 Thread James Merkel
On Jun 19, 2011, at 1:27 PM, Quincey Morris wrote: On Jun 19, 2011, at 13:14, James Merkel wrote: ProgressController * progressController = nil; progressController =[[ProgressController alloc] init]; NSLog(@"Progress window: %@\n", [progressController window]);

Re: How to redraw a view in slow-motion

2011-06-19 Thread Matthias Arndt
Am 19.06.2011 um 19:05 schrieb cocoa-dev-requ...@lists.apple.com: > If you keep the animation short (say 1.5 to 2 seconds) the freezes might not > be too irksome to the user [...] CALayer look like an attractive option. Even with only 0.01 seconds sleep after drawing each path the UI froze comp

Re: Synthesised properties and additional actions

2011-06-19 Thread Tony Romano
Of course they are not designed for atomic operations, you have to add all the critical sections to make it so. If you argue that you don't need the multi threaded robustness, then you could argue the value hooking the setter diminishes the benefit of using the synthesis feature since you are writi

Re: CATransactions having no effect in CALayer draw delegate

2011-06-19 Thread Ken Tozier
On Jun 19, 2011, at 3:57 PM, Kyle Sluder wrote: > Core Animation's view of the world ends when it hands you a CGContext > and says "fill this with bits." It can't animate the contents of a > CGContext because a CGContext really is just an opaque bit receiver > and associated drawing state. Even t

Re: This code is leaking...

2011-06-19 Thread Jens Alfke
On Jun 19, 2011, at 7:29 AM, Tony Cate wrote: > bitmapImageRep is leaking. Actually it looks like thisImage is what’s leaking (and the imageReps leak too because they’re retained by it.) You initialize thisImage from a +new call (which is shorthand for alloc+init), but you don’t autorelease it

Re: Automatically mirroring folders

2011-06-19 Thread Greg Guerin
Leonardo wrote: 2) During the period of time the stream is off, if some new files arrive within the folder /A, I lose the notification to copy it. How to workaround that? Make a directory adjacent to /A and /B to use as a staging area for copying. Only copy into the staging area. http

Re: Release a NSWindowController after the window is closed

2011-06-19 Thread Roland King
How about adding an instance variable to your window controller subclass which keeps a strong reference to itself. Also register as your own delegate, and nil the strong reference in your windowWillClose: (or perhaps windowDidClose:) Effectively you now have your delegate (yourself) retaining th

Re: How to redraw a view in slow-motion

2011-06-19 Thread Graham Cox
On 19/06/2011, at 10:46 PM, Matthias Arndt wrote: > In a document-based app my custom view draws some thousand paths in drawRect: > with a good performance. Now I'd like to offer a "slow-motion" animation, so > the user can actually watch the paths being drawn (not each single one, but > e. g.

Bindings don't work with cut and paste

2011-06-19 Thread Chris Idou
I have a NSTextView's value bound to an object. I do not have "Continuous update" turned on. The binding works when I type into the field and exit the field. However if I *paste* text into the field, then exit the field, the binding set: method is never called. What am I missing?

Re: making a clickable link in NSTableView

2011-06-19 Thread Rick C.
Great thanks all for pointing me in the right direction. I'll post back if I have any further questions... On Jun 20, 2011, at 12:55 AM, Lee Ann Rucker wrote: > Look at "TableViewLinks/NSAttributedStringAdditions.m" in the sample code. > > - Original Message - > From: "Rick C." > To:

Re: Release a NSWindowController after the window is closed

2011-06-19 Thread Marc Respass
Hi Roland, I don't follow you. You want to add MyWindowController *strongRefToKeepARCHappy and set it to [self retain]? I don't see an advantage to that. I suppose it would work but you'd want to give it a name like I did or include a comment for why you are retaining an instance of yourself. I

Loop between observers with KVO from UIScrollView

2011-06-19 Thread Tales Pinheiro de Andrade
Hello, I've the following situation: I have 3 UIScrollViews in an app. The first is like a table (centerTable). The second a row (firstRow) and the last a column (firstColumn). The column must scroll only in vertical, the row only in horizontal and the table in any direction. And the movement m

Re: Bindings don't work with cut and paste

2011-06-19 Thread Scott Anguish
are you binding to an object controller? or just an object? use an object controller if not. On Jun 19, 2011, at 8:33 PM, Chris Idou wrote: > > > I have a NSTextView's value bound to an object. I do not have "Continuous > update" turned on. The binding works when I type into the field and ex

Weird behavior of -URLByAppendingPathComponent:

2011-06-19 Thread Jens Alfke
Something seems wrong with -[NSURL URLByAppendingPathComponent:] -- (gdb) po baseURL http://127.0.0.1:5984/ (gdb) po [baseURL URLByAppendingPathComponent: @"foo"] http://127.0.0.1:5984/foo (gdb) po [baseURL URLByAppendingPathComponent: @"foo/"] http://127.0.0.1:5984/foo// Why the doubled slash at

Re: Weird behavior of -URLByAppendingPathComponent:

2011-06-19 Thread Tony Romano
I can repro that as well, and I'd say it's a bug. I also tried this as well: Using: NSURL *baseURL = [NSURL URLWithString:@"http://129.0.0.1/";]; (gdb) po [baseURL URLByAppendingPathComponent: @"/foo"] http://129.0.0.1//foo according to the discussion for URLAppendingPathComponent: "If the

Re: Loop between observers with KVO from UIScrollView

2011-06-19 Thread Quincey Morris
On Jun 19, 2011, at 11:59, Tales Pinheiro de Andrade wrote: >if ([keyPath isEqualToString:@"contentOffset"]) { >CGPoint newContentOffset = [(UIScrollView *)object contentOffset]; >newContentOffset.y = self.contentOffset.y; >self.contentOffset = newContentOffset; >}

NSArrayController loses selection upon CoreData refreshObject.

2011-06-19 Thread Motti Shneor
Hello everyone. I'm experiencing rather weird behavior of NSArrayController, and I wonder if any of you have a clue. Background: I use an NSTableView with an NSArrayController to display a list of CoreData entity instances (say instances of "Note" entity). I DO NOT configure the array contro

Re: How to redraw a view in slow-motion

2011-06-19 Thread Matthias Arndt
Hi Graham, Am 20. Jun 2011 um 02:24 schrieb Graham Cox : > Your (4) is looking like the best approach - use a timer to schedule a > periodic update of the view, and during that update, draw only some portion > of the content on top of what you've drawn already. That leaves the issue of > view

Re: How to redraw a view in slow-motion

2011-06-19 Thread Uli Kusterer
On 19.06.2011, at 14:46, Matthias Arndt wrote: > 1. Sleeping the drawing loop in drawRect: (or make the runLoop wait for some > time) and use [... flushGraphics]: Freezes the GUI, as the app is > single-threaded sleep() will block the thread you're in. That's never a good idea (unless the alte

Re: Porting ResEdit Text Resources to OS X

2011-06-19 Thread Uli Kusterer
On 19.06.2011, at 09:18, Graham Cox wrote: > Just use the files as resources. Just to avoid any potential for confusion: What Graham means here are lower-case resources, i.e. files in a "Resources" folder in your application. The original stuff you probably have are upper-case Resources, i.e. l