Re: Dynamic Method Creation

2012-09-15 Thread Jean Suisse
Hi Steve, There seem to be a pattern in you methods: they all contain the name of a day of the week (monday) and you want them for all days. Then you could use macros. Example : #define SYTNHESIZE_WHATEVER_BUNCH_OF_FUNCTION_FOR_DAY(dayName) \ - (Shift *) dayName##Creat

NSColor contrasting color?

2012-09-15 Thread Martin Hewitson
Dear list, I'm not sure what the correct terminology is here. I have a text editor app and the user can set the background color of the editor. The user can also set the line length for wrapping. Past that length, I have been drawing a shaded rect (in the text view subclass' -drawViewBackground

Re: Dynamic Method Creation

2012-09-15 Thread Kyle Sluder
On Sep 14, 2012, at 10:49 PM, Steve Steinitz wrote: > Hi Ken, > > Thanks for your quick reply. > > On 15 Sep 12, at 3:16pm, Ken Thomases wrote: > >> No offense, but this seems like a terrible design. And your KVO hack method >> screams of papering over a bug. > > No offense but none of you

Re: Dynamic Method Creation

2012-09-15 Thread Steve Steinitz
Hi Jean, On 15 Sep 12, at 6:12pm, Jean Suisse wrote: > There seem to be a pattern in you methods: they all contain the name of a day > of the week (monday) and you want them for all days. Yes, that was intentional, just for this purpose :) > Then you could use macros. > > Example : > > #defi

Re: NSColor contrasting color?

2012-09-15 Thread Markus Spoettl
On 9/15/12 10:52 AM, Martin Hewitson wrote: I'm not sure what the correct terminology is here. I have a text editor app and the user can set the background color of the editor. The user can also set the line length for wrapping. Past that length, I have been drawing a shaded rect (in the text vie

Re: Dynamic Method Creation

2012-09-15 Thread Steve Steinitz
Hi Kyle, Thanks for your reply. On 15 Sep 12, at 7:02pm, Kyle Sluder wrote: > A shift is an object with a known number of instances per employee. You've > those instances and splayed out thir properties as methods on the employee. Yes. I've "splayed" them because cocoa sometimes throws "canno

choosing colors

2012-09-15 Thread Koen van der Drift
Maybe not so much a Cocoa question, but don't know where else to post it. I have a textview and am adding drawings it to annotate certain parts. I am having trouble selecting which colors I want to use for that. There can be 4 or 5 different colors, and they should all be distinguishable and not

Re: NSColor contrasting color?

2012-09-15 Thread Martin Hewitson
Works splendidly, thank you! I just check if my color is darker than 0.7 and use highlightWithLevel otherwise use shadowWithLevel. Martin On 15, Sep, 2012, at 11:14 AM, Markus Spoettl wrote: > On 9/15/12 10:52 AM, Martin Hewitson wrote: >> I'm not sure what the correct terminology is here. I

Re: choosing colors

2012-09-15 Thread Chuck Soper
Koen, If you google for: mac color scheme generator, you should find a number of options that address what you're looking for. Chuck On 9/15/12 4:26 AM, "Koen van der Drift" wrote: >Maybe not so much a Cocoa question, but don't know where else to post it. > >I have a textview and am adding dra

Re: Another sandboxing snafu

2012-09-15 Thread Mike Abdullah
On 15 Sep 2012, at 00:49, Graham Cox wrote: > > On 14/09/2012, at 7:07 PM, Mike Abdullah wrote: > >>> Anyone got this simple use of NSOpenPanel to work with sandboxing? >> >> Yes. Does this same code work OK outside the sandbox? Is there any likely >> looking preference file related to open

lion/mt. lion: preventing qtmovieview from taking key strokes

2012-09-15 Thread Matthew Weinstein
Dear programmers, I have a window with a nstextview and a qtmovieview.. The problem is that the movieview steals all of the keystrokes so the left and right arrow keys never make it to the nstextview. I have tried subclassing qtmovieview and capturing keydown and keyup, but that didn't work... H

Re: Dynamic Method Creation

2012-09-15 Thread Jean Suisse
Yes it is that simple ! I have been using it to synthesize a whole set of hardware interaction methods following a pattern. The more methods you have, the more time you save. Also, you can modify the whole code just by editing it in one place. Some (like Matt Gallagher and his SYNTHESIZE_SINGLE

Re: choosing colors

2012-09-15 Thread Koen van der Drift
On Sep 15, 2012, at 9:44 AM, Chuck Soper wrote: > If you google for: mac color scheme generator, you should find a number of > options that address what you're looking for. Thanks Chuck, I was missing the 'scheme' keyword in my own searches. - Koen. ___

Re: Sandboxing not so bad

2012-09-15 Thread James Merkel
On Sep 13, 2012, at 12:45 PM, James Merkel wrote: > Sandboxing is not as restrictive than I though it would be. > > For example, the documentation for the entitlement: > com.apple.security.files.user-selected.read-write says this entitlement > provides: "Read/write access to files the user h

Re: Sandboxing not so bad

2012-09-15 Thread koko
Yes, a piece of cake for a piece of cake app. Try doing something like iterating the file system so you can present to the user all files of unique types you understand that can be anywhere on the system. The sandbox is like a cat box … to be avoided at all costs. -koko On Sep 15, 2012, at 3

Re: Dynamic Method Creation

2012-09-15 Thread Jens Alfke
On Sep 14, 2012, at 10:49 PM, Steve Steinitz wrote: > No offense but none of your criticisms seem to hold water. No, I strongly agree with Ken. You’re creating a pile of redundant methods with variable parameters (day of week, start vs end etc.) baked into the method name. This is a red flag

Re: Dynamic Method Creation

2012-09-15 Thread Jens Alfke
On Sep 15, 2012, at 2:27 AM, Steve Steinitz wrote: > Yes. I've "splayed" them because cocoa sometimes throws "cannot remove > observer..." if you bind a value to x.y.z That’s a bug in your code, then — it probably means that your setX: or setY: methods aren’t posting KVO notifications. > Gu

Re: lion/mt. lion: preventing qtmovieview from taking key strokes

2012-09-15 Thread Eric Wing
On 9/15/12, Matthew Weinstein wrote: > Dear programmers, > I have a window with a nstextview and a qtmovieview.. The problem is that > the movieview steals all of the keystrokes so the left and right arrow keys > never make it to the nstextview. I have tried subclassing qtmovieview and > capturing

Re: Dynamic Method Creation

2012-09-15 Thread Alex Zavatone
On Sep 15, 2012, at 7:20 PM, Jens Alfke wrote: > > On Sep 15, 2012, at 2:27 AM, Steve Steinitz > wrote: > >> Yes. I've "splayed" them because cocoa sometimes throws "cannot remove >> observer..." if you bind a value to x.y.z > > That’s a bug in your code, then — it probably means that your

Re: Dynamic Method Creation

2012-09-15 Thread Steve Steinitz
Hi, Thanks to everyone for your, sometimes passionate, replies. I have decided not to further address your individual posits here, except to again thank Jean Suisse for providing a concrete example of using macros to generate binding methods. I would be delighted to pursue your interesting si