Re: Superimposing NSViews over an SKView

2013-10-31 Thread Eric Wing
On 10/30/13, Charles Srstka  wrote:
> In Apple's Sprite Kit documentation, it claims:
>
> "Because Sprite Kit content is rendered by a view object, you can combine
> this view with other views in the view hierarchy. For example, you can use
> standard button controls and place them above your Sprite Kit view. Or, you
> can add interactivity to sprites to implement your own buttons; the choice
> is up to you."
>
> https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/GettingStarted/GettingStarted.html
>
> However, I have so far had no success getting NSButtons and other
> NSView-based views to appear on top of an SKView. I've tried making the view
> a subview of the SKView, making it an overlapping sibling view, building it
> programmatically, putting it in the XIB — in all cases, the NSView-based
> object is not drawn.
>
> Am I missing something here? Is there some flag somewhere that I need to set
> for this to work? Or is the documentation here incorrect?
>
> Thanks,
> Charles
>

I haven't tried it myself, but stupid question, did you remember to
enable layer backed views?

I've spent many years trying to get native controls to render on top
of (non-SpriteKit) OpenGL and there's always something that goes
wrong. In the past couple of years I shifted over to CAOpenGLLayer
instead of NSOpenGLView. That also had a list of problems, but in the
end (and after multiple Apple bug fixes), it was working much better
for me. But I guess I should assume Apple didn't provide a SKLayer
class.

Thanks,
Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

NSSearchField and CR

2013-10-31 Thread Gerriet M. Denkmann
I have an NSSearchField with sendsWholeSearchString = NO in order to do 
incremental searches.
But if the content of the search field is a regular expression, I only want to 
process it when the regular expression is complete, i.e. when the user enters 
CR (aka "return").

Is there a way to distinguish between actionMethod is called because some 
character was added, or because the user hit CR?

Gerriet.

OS X 10.9


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

10.9 Bug in Core Data : Entity Description methods

2013-10-31 Thread Jerry Krinock
When you send -objectForKey: to the dictionary returned by 
-[NSManagedObjectModel entitiesByName], -objectForKey: returns the expected 
result if the passed-in key is a literal constant such as @“foo”. But if you 
instead pass in a local variable whose value is constructed to be equal to 
@“foo”, -objectForKey: returns nil in Mac OS X 10.9.

In Mac OS X 10.8, it returns the expected value, whether the key is a constant 
or not.
 
Method +[NSEntityDescription entityForName:inManagedObjectContext:] exhibits 
similar misbehavior.

I posted this a few days ago on Developer Forums.  For more info or discussion, 
go there…

https://devforums.apple.com/message/912837#912837

I’ll file a bug if no one from here can explain it either.

Jerry


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSSearchField and CR

2013-10-31 Thread Kyle Sluder
> On Oct 31, 2013, at 6:10 AM, "Gerriet M. Denkmann"  
> wrote:

> 
> I have an NSSearchField with sendsWholeSearchString = NO in order to do 
> incremental searches.
> But if the content of the search field is a regular expression, I only want 
> to process it when the regular expression is complete, i.e. when the user 
> enters CR (aka "return").
> 
> Is there a way to distinguish between actionMethod is called because some 
> character was added, or because the user hit CR?

How do you determine whether the user is entering a regex? All plain strings 
are valid regexes.

I would think the best approach is to offer a checkbox to switch between plain 
text and regex search. Then the user won't be confused why "hello." matches 
"hellos", or why search-as-you-type just stopped working in the middle of a 
string just because they typed some punctuation. In that case, you can just 
change the sendsWholeSearchString property depending on the search mode.

If you're dead-set on not offering a toggle, you could always ignore regex 
searches in the action method and implement 
-control:textView:doCommandBySelector: to process regexes when the field editor 
gets insertNewline:.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Superimposing NSViews over an SKView

2013-10-31 Thread Charles Srstka
On Oct 31, 2013, at 4:02 AM, Eric Wing  wrote:

> On 10/30/13, Charles Srstka  wrote:
>> In Apple's Sprite Kit documentation, it claims:
>> 
>> "Because Sprite Kit content is rendered by a view object, you can combine
>> this view with other views in the view hierarchy. For example, you can use
>> standard button controls and place them above your Sprite Kit view. Or, you
>> can add interactivity to sprites to implement your own buttons; the choice
>> is up to you."
>> 
>> https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/GettingStarted/GettingStarted.html
>> 
>> However, I have so far had no success getting NSButtons and other
>> NSView-based views to appear on top of an SKView. I've tried making the view
>> a subview of the SKView, making it an overlapping sibling view, building it
>> programmatically, putting it in the XIB — in all cases, the NSView-based
>> object is not drawn.
>> 
>> Am I missing something here? Is there some flag somewhere that I need to set
>> for this to work? Or is the documentation here incorrect?
>> 
>> Thanks,
>> Charles
>> 
> 
> I haven't tried it myself, but stupid question, did you remember to
> enable layer backed views?
> 
> I've spent many years trying to get native controls to render on top
> of (non-SpriteKit) OpenGL and there's always something that goes
> wrong. In the past couple of years I shifted over to CAOpenGLLayer
> instead of NSOpenGLView. That also had a list of problems, but in the
> end (and after multiple Apple bug fixes), it was working much better
> for me. But I guess I should assume Apple didn't provide a SKLayer
> class.

That's it! I didn't have layers turned on. Brilliant. Now it's showing up 
perfectly. Thanks!

Charles

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: 10.9 Bug in Core Data : Entity Description methods

2013-10-31 Thread Mike Abdullah
Sounds to me like the dictionary is somehow internally set up to use pointer 
equality. For the literal syntax, perhaps that happens to work out as Core Data 
is using the same underlying string objects?

An interesting test would be to first make a copy of the dictionary (both using 
-copy and +dictionaryWithDictionary:). How does that affect things?

On 31 Oct 2013, at 14:17, Jerry Krinock  wrote:

> When you send -objectForKey: to the dictionary returned by 
> -[NSManagedObjectModel entitiesByName], -objectForKey: returns the expected 
> result if the passed-in key is a literal constant such as @“foo”. But if you 
> instead pass in a local variable whose value is constructed to be equal to 
> @“foo”, -objectForKey: returns nil in Mac OS X 10.9.
> 
> In Mac OS X 10.8, it returns the expected value, whether the key is a 
> constant or not.
> 
> Method +[NSEntityDescription entityForName:inManagedObjectContext:] exhibits 
> similar misbehavior.
> 
> I posted this a few days ago on Developer Forums.  For more info or 
> discussion, go there…
> 
> https://devforums.apple.com/message/912837#912837
> 
> I’ll file a bug if no one from here can explain it either.
> 
> Jerry
> 
> 
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/mabdullah%40karelia.com
> 
> This email sent to mabdul...@karelia.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: 10.9 Bug in Core Data : Entity Description methods

2013-10-31 Thread Jerry Krinock

On 2013 Oct 31, at 08:51, Mike Abdullah  wrote:

> Sounds to me like the dictionary is somehow internally set up to use pointer 
> equality. For the literal syntax, perhaps that happens to work out as Core 
> Data is using the same underlying string objects?

That’s what I thought too, Mike.  It’s all in that Developer Forum post I 
referenced,

https://devforums.apple.com/message/912837#912837

Sorry for the cross-referenced-post.  I wish Apple would eliminate one of these 
fora!

> An interesting test would be to first make a copy of the dictionary (both 
> using -copy and +dictionaryWithDictionary:). How does that affect things?

Ditto on the Developer Forum.  Indeed, +dictionaryWithDictionary: is the 
workaround.

So it looks like I should file a bug.



___

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

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

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

This email sent to arch...@mail-archive.com

Re: NSSearchField and CR

2013-10-31 Thread Jerry Krinock

On 2013 Oct 31, at 08:07, Kyle Sluder  wrote:

> I would think the best approach is to offer a checkbox to switch between 
> plain text and regex search.

It’s a no-brainer, for all the reasons Kyle said.  Xcode, AppCode, BBEdit all 
do it this way.



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Minimizing NSTableView redraws

2013-10-31 Thread livinginlosangeles
I have an NSTableView with as many as 40 rows and 12 columns. Each row in my 
tableview represents one of my model objects. I use a detail view to edit 
objects that are displayed in the tableview. I have an NSTextView that is set 
to continuously update when a user modifies the NSAttributed string of my model 
object.

As my list of rows grows, text entry in my NSTextView crawls to a slow. I have 
profiled my code and it appears that "set to continuously update" marks the 
whole table view for update. On every keypress, the whole entire NSTableView is 
redrawn.

Is there any strategy to minimize this full redraw?

Patrick
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: 10.9: Some Async Saving is ON even if you say NO?

2013-10-31 Thread Sean McBride
On Wed, 30 Oct 2013 16:00:23 -0700, Jerry Krinock said:

>I am surprised because this is actually a Core Data
>NSPersistentDocument, and following Apple recommendations I have implemented
>-[MyDocument canAsynchronouslyWriteToURL:ofType:forSaveOperation:]
>to return NO.

Where do they recommend that?  The NSPersistentDocument class reference docs 
for canAsynchronouslyWriteToURL:ofType:forSaveOperation: say 
"NSPersistentDocument does not support asynchronous save operations. You should 
not override this method"

(NSPersistentDocument is infuriating.  No support for async save, no support 
for packages/bundles, and no love at all in recent OSes.)

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: 10.9: Some Async Saving is ON even if you say NO?

2013-10-31 Thread Jerry Krinock

On 2013 Oct 31, at 12:18, Sean McBride  wrote:

> On Wed, 30 Oct 2013 16:00:23 -0700, Jerry Krinock said:
> 
>> I am surprised because this is actually a Core Data
>> NSPersistentDocument, and following Apple recommendations I have implemented
>> -[MyDocument canAsynchronouslyWriteToURL:ofType:forSaveOperation:]
>> to return NO.
> 
> Where do they recommend that?  The NSPersistentDocument class reference docs 
> for canAsynchronouslyWriteToURL:ofType:forSaveOperation: say 
> "NSPersistentDocument does not support asynchronous save operations. You 
> should not override this method”

Hello, Sean.  Maybe you read my post too fast.  I have overridden it to return 
NO.  Just:  return NO ;

I was one of the guinea pigs back in 2011, who learned along with Apple that 
NSPersistentDocument doesn’t like asynchronous save.  Originally, the 
documentation did not say that, and actually, it almost worked.  There were 
only one or two unsolvable edge cases that would give one of those damned 
autosave hangs a few times a day :))  I’d implemented that override so I could 
play with it YES and NO, before ultimately being told that the correct answer 
was unconditionally NO.

> (NSPersistentDocument is infuriating.  No support for async save, no support 
> for packages/bundles, and no love at all in recent OSes.)

The main thing that keeps me coming back for more Core Data is that it does 
Undo and Redo, which has been trouble-free since I starting using GCUndoManager 
in place of NSUndoManager.



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: 10.9: Some Async Saving is ON even if you say NO?

2013-10-31 Thread Sean McBride
On Thu, 31 Oct 2013 12:54:04 -0700, Jerry Krinock said:

>>> I am surprised because this is actually a Core Data
>>> NSPersistentDocument, and following Apple recommendations I have
>implemented
>>> -[MyDocument canAsynchronouslyWriteToURL:ofType:forSaveOperation:]
>>> to return NO.
>> 
>> Where do they recommend that?  The NSPersistentDocument class
>reference docs for canAsynchronouslyWriteToURL:ofType:forSaveOperation:
>say "NSPersistentDocument does not support asynchronous save operations.
>You should not override this method”
>
>Hello, Sean.  Maybe you read my post too fast.  I have overridden it to
>return NO.  Just:  return NO ;

No, I read it correctly.  I was worried that there actually was such a 
recommendation to override it, because I am not doing such an override, and was 
worried I needed to.

>> (NSPersistentDocument is infuriating.  No support for async save, no
>support for packages/bundles, and no love at all in recent OSes.)
>
>The main thing that keeps me coming back for more Core Data is that it
>does Undo and Redo, which has been trouble-free since I starting using
>GCUndoManager in place of NSUndoManager.

Yeah, I like Core Data too.  But to be pedantic, NSPersistentDocument is 
AppKit, and seems to suffer from being at the edge of two worlds. :(

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Minimizing NSTableView redraws

2013-10-31 Thread Jens Alfke

On Oct 31, 2013, at 10:01 AM, livinginlosange...@mac.com wrote:

> As my list of rows grows, text entry in my NSTextView crawls to a slow. I 
> have profiled my code and it appears that "set to continuously update" marks 
> the whole table view for update. On every keypress, the whole entire 
> NSTableView is redrawn.

It should only be redrawing the row corresponding to the model object that 
changed. What KVO notifications in your object model get triggered as a result 
of the text field changing?

—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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Minimizing NSTableView redraws

2013-10-31 Thread Graham Cox

On 31 Oct 2013, at 6:01 pm, livinginlosange...@mac.com wrote:

> I have profiled my code and it appears that "set to continuously update" 
> marks the whole table view for update. On every keypress, the whole entire 
> NSTableView is redrawn.
> 
> Is there any strategy to minimize this full redraw?


You don’t mention how the text view is coupled to the table view. If you are 
doing this through a data source controller of your own, it’s up to you how to 
handle the update, for example by only calling for the relevant row to be 
reloaded. If you’re using bindings, you’re at the mercy of its implementation, 
so that might not be the best way forward for this case.

—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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: 10.9: Some Async Saving is ON even if you say NO?

2013-10-31 Thread Mike Abdullah

On 31 Oct 2013, at 19:18, Sean McBride  wrote:

> (NSPersistentDocument is infuriating.  No support for async save, no support 
> for packages/bundles, and no love at all in recent OSes.)

Indeed. Brief self-promotion, BSManagedDocument does both of these: 
https://github.com/karelia/BSManagedDocument


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: 10.9: Some Async Saving is ON even if you say NO?

2013-10-31 Thread Jerry Krinock

On 2013 Oct 31, at 15:08, Mike Abdullah  wrote:

> Indeed. Brief self-promotion, BSManagedDocument does both of these: 
> https://github.com/karelia/BSManagedDocument

Mike, I see you derived that from Sasmito Adibowo’s work.  I'd found Sasmito's 
in an internet search yesterday, but when I saw he was returning YES to 
asynchronous saving, alarm bells went off.

However indeed it makes sense after reading your description.  Since child 
managed object contexts were, I think, introduced to do uploads and downloads 
with servers on background threads, hey, use the same idea to save to the local 
disk.

Lots of other good stuff in there too.  Looks very nice.  Thanks for the tip!
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSSearchField and CR

2013-10-31 Thread Gerriet M. Denkmann

On 31 Oct 2013, at 22:07, Kyle Sluder  wrote:

>> On Oct 31, 2013, at 6:10 AM, "Gerriet M. Denkmann"  
>> wrote:
> 
>> 
>> I have an NSSearchField with sendsWholeSearchString = NO in order to do 
>> incremental searches.
>> But if the content of the search field is a regular expression, I only want 
>> to process it when the regular expression is complete, i.e. when the user 
>> enters CR (aka "return").
>> 
>> Is there a way to distinguish between actionMethod is called because some 
>> character was added, or because the user hit CR?
> 
> How do you determine whether the user is entering a regex? All plain strings 
> are valid regexes.
My regexes must start with some special character (e.g. '@', which is not part 
of the regex).

> I would think the best approach is to offer a checkbox to switch between 
> plain text and regex search.
Agreed, but there are too many switches already in my case.

> If you're dead-set on not offering a toggle, you could always ignore regex 
> searches in the action method and implement 
> -control:textView:doCommandBySelector: to process regexes when the field 
> editor gets insertNewline:.

This is an excellent idea and works perfectly for me. Thank you very much 
indeed!


Kind regards,

Gerriet.


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com