Re: drawRect using a Category

2012-04-01 Thread Per Bull Holmen
Den 03:46 1. april 2012 skrev Peter Teeson ptee...@me.com følgende: Thanks very much for your input guys. David: I had carefully read the Categories and Extensions page in OBJ-C Programming Language. And, based on the first paragraph, assumed I could add functionality to drawRect for my

Re: Google maps-like zooming of NSScrollView's content view

2012-04-01 Thread Per Bull Holmen
Den 17:28 1. april 2012 skrev Nick eveningn...@gmail.com følgende: However, I can't figure out how to make zooming like google maps does, preserving that mouse anchor point's location. Could you give me a hint? Thank you I can't give you readymade example code, but here's the steps: 1)

Re: Google maps-like zooming of NSScrollView's content view

2012-04-01 Thread Per Bull Holmen
Den 18:51 1. april 2012 skrev Per Bull Holmen pbhol...@gmail.com følgende: Den 17:28 1. april 2012 skrev Nick eveningn...@gmail.com følgende: However, I can't figure out how to make zooming like google maps does, preserving that mouse anchor point's location. Could you give me a hint? Thank

Re: Getting the best frame rate for NSView drawing

2012-03-30 Thread Per Bull Holmen
Den 11:52 30. mars 2012 skrev jonat...@mugginsoft.com jonat...@mugginsoft.com følgende: On 29 Mar 2012, at 18:04, Kyle Sluder wrote: On Mar 29, 2012, at 5:12 AM, lbland lbl...@vvi.com wrote: ... look at the call stack. On the Mac fill most likely calls opengl in the end as Quartz GL has

Re: Getting the best frame rate for NSView drawing

2012-03-30 Thread Per Bull Holmen
Den 13:21 30. mars 2012 skrev Per Bull Holmen pbhol...@gmail.com følgende: If you need to use higher level APIs, you need to use glDrawPixels (which is slw) to transfer the data from an offscreen NSGraphicsContext/CGContext into the frame buffer object, THEN draw onto the screen using

Re: Getting the best frame rate for NSView drawing

2012-03-29 Thread Per Bull Holmen
Den 02:50 29. mars 2012 skrev Kenneth Baxter k.b.bax...@mac.com følgende: Thanks Graham, Yes, fully aware that CGLayer and CALayer are completely different. Interesting to hear about the z position needing to be a large number - will keep that in mind. Cool visualizer. I'm going to have

Re: Getting the best frame rate for NSView drawing

2012-03-29 Thread Per Bull Holmen
Den 19:04 29. mars 2012 skrev Kyle Sluder k...@ksluder.com følgende: On Mar 29, 2012, at 5:12 AM, lbland lbl...@vvi.com wrote: ... look at the call stack. On the Mac fill most likely calls opengl in the end as Quartz GL has gotten pretty good. Quartz GL is not enabled by default. Also,

Re: Getting the best frame rate for NSView drawing

2012-03-28 Thread Per Bull Holmen
Hi Ken, I'm sorry that I can't give you a great answer to your questions, I can only tell you what I do myself when I need high animation performance: I use OpenGL, even for 2D. I have wondered whether some of the more high level technologies are more suited, but judging from game programming web

Re: How to get max size of view according to constraints?

2012-03-21 Thread Per Bull Holmen
Den 01:13 21. mars 2012 skrev Charles Srstka cocoa...@charlessoft.com følgende: On Mar 20, 2012, at 7:00 PM, Peter Ammon wrote: 2. Establish another constraint that says the height of the document view equals the height of the scroll view. Give this constraint a priority lower than

Re: How to get max size of view according to constraints?

2012-03-21 Thread Per Bull Holmen
Den 18:09 21. mars 2012 skrev Charles Srstka cocoa...@charlessoft.com følgende: On Mar 21, 2012, at 8:54 AM, Per Bull Holmen wrote: I am old school and know nothing about constraints, but given your descriptions, perhaps you can tie the document view size to the clip view size (which is also

Re: How to get max size of view according to constraints?

2012-03-21 Thread Per Bull Holmen
Den 19:26 21. mars 2012 skrev Charles Srstka cocoa...@charlessoft.com følgende: It seems to be the same in testing; however, is it guaranteed to be that way anywhere in the documentation? The fact that NSClipView actually has a separate property named -documentVisibleRect seems to imply that

Re: How to get max size of view according to constraints?

2012-03-21 Thread Per Bull Holmen
Den 01:35 22. mars 2012 skrev Per Bull Holmen pbhol...@gmail.com følgende: The whole purpose of the clip view is to clip the document view to show only the visible portion. Therefore, its size will always be equal to the visible prtion of the document view. It serves no purpose outside

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-15 Thread Per Bull Holmen
Den 22:09 14. mars 2012 skrev Wade Tregaskis wadesli...@mac.com følgende: I don't like the idea of a multithreaded aproach by default, because as a general rule, you should not make your application multithreaded unless you have a good reason. a) The reality is that Cocoa already exposes

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-15 Thread Per Bull Holmen
Den 12:03 15. mars 2012 skrev Per Bull Holmen pbhol...@gmail.com følgende: I agree with what you are saying, but remember that we MAY also move towards new concepts and abstractions that make todays concept of multithreading an antiquated way of achieving parallelism. For example

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-15 Thread Per Bull Holmen
Den 18:06 15. mars 2012 skrev Wade Tregaskis wadesli...@mac.com følgende: Highly subjective, though, I recognise that.  I think we've pretty much run this discussion to its end now, and it doesn't appear I've swayed you.  That's okay. Yes we have, but you have actually swayed me... :) You

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Per Bull Holmen
Den 17:19 14. mars 2012 skrev Wade Tregaskis wadesli...@mac.com følgende: The reality is of course more of a compromise.  It's quite common to do drawing across multiple threads, though you still synchronise the final blits around a single thread (i.e. the main thread). Isn't that still

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Per Bull Holmen
Den 20:00 14. mars 2012 skrev Wade Tregaskis wadesli...@mac.com følgende: On the other hand, you could have an event handling framework which dispatched events to any of multiple threads/queues/whatever for you.  For example, each window might have its own queue.  This actually makes a lot

Re: Accessing array in thread safe way

2012-03-08 Thread Per Bull Holmen
Den 23:10 6. mars 2012 skrev Marco Tabini mtab...@me.com følgende: On 2012-03-06, at 2:51 PM, Jan E. Schotsman wrote: Hello, I have an array of progress values (number objects) for subprojects, from which I calculate the overall progress . The array is an atomic property of the project

Re: Accessing array in thread safe way

2012-03-08 Thread Per Bull Holmen
Den 23:48 6. mars 2012 skrev Conrad Shultz con...@synthetiqsolutions.com følgende: Personally, I try to the maximum extent possible to make properties be of immutable types for exactly this reason.  It allows you to centralize management of locking/synchronization thus wipe out a whole

Re: Accessing array in thread safe way

2012-03-08 Thread Per Bull Holmen
Den 14:33 7. mars 2012 skrev Per Bull Holmen pbhol...@gmail.com følgende: Den 23:48 6. mars 2012 skrev Conrad Shultz con...@synthetiqsolutions.com følgende: Personally, I try to the maximum extent possible to make properties be of immutable types for exactly this reason.  It allows you

Re: Accessing array in thread safe way

2012-03-08 Thread Per Bull Holmen
Den 23:55 7. mars 2012 skrev Don Quixote de la Mancha quix...@dulcineatech.com følgende: If you possibly can replace locking algorithms with what are commonly but incorrectly called lock free algorithms.  They use Atomic Arithmetic Primitives provided by the CPU Instruction Set  Archetector

Re: NSURL and NSRegularExpression

2012-03-04 Thread Per Bull Holmen
Den 04:27 4. mars 2012 skrev R r4eem...@gmail.com følgende: All good, valid and useful points. However, I would at least like to maintain the same functionality of the Twitter App for iPhone. The app does does a pretty good job of detecting and reviewing the URL to determine if it can be

Re: NSURL and NSRegularExpression

2012-03-04 Thread Per Bull Holmen
Den 17:43 4. mars 2012 skrev R r4eem...@gmail.com følgende: Take a look at the Twitter iPhone app.  Enter a URL and watch how it deals with character counts. I don't have an iPhone, I don't use Twitter, and we are not a paid heldesk company. If you want help, you have to specify precisely the

Re: NSURL and NSRegularExpression

2012-03-03 Thread Per Bull Holmen
Den 02:06 4. mars 2012 skrev R r4eem...@gmail.com følgende: Thanks Conrad, much cleaner indeed.  But, this does not solve my invalid internet URL issues still accepts pretty much any URL. Just a little suggestion: How about not trying to be perfect? My mail client (Google mail) also accepts

Re: NSURL and NSRegularExpression

2012-03-03 Thread Per Bull Holmen
Den 02:55 4. mars 2012 skrev Jens Alfke j...@mooseyard.com følgende: I’d much rather people used a system library, or at least searched around to find a really good and well-tested regexp that other apps have used. It’s annoying when an app can’t highlight a URL properly, especially on iOS

Who is responsible for removing observers in longer key paths

2012-03-01 Thread Per Bull Holmen
Hi In my current project I have a controller object, that the view can bind to, with the following key path: parameterInfo.parameterName.attributeName parameterInfo is a literal key name, parameterName maps to a parameter in a plug-in, and must be resolved at run-time. attributeName is one of

Re: Who is responsible for removing observers in longer key paths

2012-03-01 Thread Per Bull Holmen
Den 21:42 1. mars 2012 skrev Quincey Morris quinceymor...@rivergatesoftware.com følgende: No, it's nothing to do with the mutability of the parameterInfo object. The problem is likely caused by lack of KVO compliance of your key path either at the parameterName or the attributeName level, or

Re: Who is responsible for removing observers in longer key paths [solved]

2012-03-01 Thread Per Bull Holmen
Den 22:58 1. mars 2012 skrev Quincey Morris quinceymor...@rivergatesoftware.com følgende: You can *try* dealloc voodoo, but I think it's crucial to look at the observerInfo in the debugger. And, the number of remaining observers may be more informative than what they are. Hi Sorry it took a

Question about KVC-compliance and bindings

2012-02-28 Thread Per Bull Holmen
Hi Suppose I want to make a controller, which allows a view to bind to the keyPath: mainBranch.subBranch.attribute There will be a large range of theoretical subBranch.attribute combinations, but only a few of these will actually be bound to by the user. Other combinations will therefore be

Re: Question about KVC-compliance and bindings

2012-02-28 Thread Per Bull Holmen
Den 18:05 28. februar 2012 skrev Keary Suska cocoa-...@esoteritech.com følgende: On Feb 28, 2012, at 8:24 AM, Per Bull Holmen wrote: This all leads to a question, though, which is: what is the problem you are trying to solve? Is this a case of premature optimization? Why not just have

Re: Question about KVC-compliance and bindings

2012-02-28 Thread Per Bull Holmen
Den 20:24 28. februar 2012 skrev Quincey Morris quinceymor...@rivergatesoftware.com følgende: I don't think there's no shortcut. :) It's not clear from your description, but you seem to saying that there *is* a value object (of some custom class?) for mainBranch. And a subBranch object? In

Re: Question about KVC-compliance and bindings

2012-02-28 Thread Per Bull Holmen
Den 23:41 28. februar 2012 skrev Keary Suska cocoa-...@esoteritech.com følgende: I would say that there really isn't anything wrong with the controller knowing ahead of time what keys in the model will be needed by the UI. In fact, it needs to, and in fact does when you establish a binding.

Re: Question about KVC-compliance and bindings

2012-02-28 Thread Per Bull Holmen
Den 00:53 29. februar 2012 skrev Per Bull Holmen pbhol...@gmail.com følgende: Yes, it does know it when you establish a binding, I agree. That's what I am currently doing, in the controller's addObserver method, it registers the keys, and if there is a corresponding integer parameter ID

Re: Sending messages without knowing number of args and types at compile time

2010-02-02 Thread Per Bull Holmen
Greg Parker wrote: On Feb 1, 2010, at 3:30 AM, Per Bull Holmen wrote: I've been playing around with the idea of making a simple bridge between Objective-C (running under Cocoa) and a script language. /.../ I'd like to know whether there are any other ways than NSInvocation to send

Sending messages without knowing number of args and types at compile time

2010-02-01 Thread Per Bull Holmen
Hi I've been playing around with the idea of making a simple bridge between Objective-C (running under Cocoa) and a script language. Not for the API, that is, but for user defined classes and methods. For this reason, I'd like to know whether there are any other ways than NSInvocation to send

Re: Blocking for input during a loop?

2010-01-19 Thread Per Bull Holmen
Ben Haller wrote: On 18-Jan-10, at 9:29 PM, Per Bull Holmen wrote: ...Again, I have clearly not explained what I wanted to do properly. No, I did not want what you describe. I have done it now, I chose to use threads, and it got far cleaner than the standard Cocoa way. No, I don't have

Re: Blocking for input during a loop? (Yahoo mail destroyed my indentation)

2010-01-19 Thread Per Bull Holmen
Hi all Sorry that Yahoo mail (my mail service) destroyed my indentation on the last post. I guess that wasn't easy to read... :( Actually I don't know how to send the code properly with Yahoo Mail. If I find it out I might repost. Perhaps pasting it into XCode would restore the indentation.

Re: Blocking for input during a loop? (Yahoo mail destroyed my indentation)

2010-01-19 Thread Per Bull Holmen
Greg Guerin wrote: Per Bull Holmen wrote: Sorry that Yahoo mail (my mail service) destroyed my indentation on the last post. I guess that wasn't easy to read... :( Actually I don't know how to send the code properly with Yahoo Mail. If I find it out I might repost. Perhaps pasting

Re: Blocking for input during a loop?

2010-01-19 Thread Per Bull Holmen
Jens Afke wrote: You've basically implemented coroutines, actually a simple form of an actor, using multiple threads. Each coroutine is running an event loop, and the game one blocks waiting for incoming events from the UI one. /.../ This is a fine way to do things, except that you can't

Re: Blocking for input during a loop?

2010-01-19 Thread Per Bull Holmen
Jens Afke wrote: The listserv stripped the links from that sentence. They were: http://en.wikipedia.org/wiki/Coroutine http://en.wikipedia.org/wiki/Actor_model Thanks. This is will be very useful as I learn more about game programming. :) Per

Re: Blocking for input during a loop?

2010-01-18 Thread Per Bull Holmen
- Original Message From: Kyle Sluder kyle.slu...@gmail.com To: Per Bull Holmen pbhol...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Mon, January 18, 2010 6:29:32 AM Subject: Re: Blocking for input during a loop? On Sun, Jan 17, 2010 at 1:59 PM, Per Bull Holmen pbhol

Re: Blocking for input during a loop?

2010-01-18 Thread Per Bull Holmen
it better... Jens Alfke wrote: On Jan 18, 2010, at 3:38 AM, Per Bull Holmen wrote: You say my initially proposed loop is a bad idea - but lots of applications use this type of loop. The difference is that they do it only inside one window, and block user access to all other parts

Blocking for input during a loop?

2010-01-17 Thread Per Bull Holmen
Hi Is it possible, in Cocoa, do program a loop which goes something like this: for i=1 to 20 do something block for GUI user input do something with the input repeat It is for a simple game that plays tones etc, and lets the user guess what was played. Originally, I had implemented it without