Re: Round corners of borderless NSWindow without set it transparent
Thank you for the answer. Il giorno 28/feb/2012, alle ore 06:36, Seth Willits ha scritto: > On Feb 27, 2012, at 5:45 AM, Andrea3000 wrote: > >> Then, if I set my NSWindow non-opaque I correctly get rounded corners but >> the window becomes very slow expecially during resize. > > Mmm…. that doesn't sound right. You shouldn't notice anything being slow. When the window is small it's as fast as if it were opaque but when it occupies quite all the screen (1920x1080) it becomes noticeably slow during resize. >> Therefore I'm looking for a way to mimic QuickTime X window which is (or >> seems at least) a borderless window and still has rounded corners. > > QuickTime Player uses a custom NSFrameView. It's not a typical borderless > window, it does private internal stuff to draw the titlebar as it pleases. > > > >> I've found some tutorials online that subclass NSThemeFrame in order to draw >> the content view with rounded corners and then use the method of NSWindow: >> -setBottomCornerRounded:YES. >> Unfortunately this solution works only on a regular NSWindow. > > And uses private APIs so it wouldn't work for MAS and is generally a no no. I'm not intersted in MAS because the application will be "private" and used only by myself so I can still be intersted in using private API. This because I haven't told you the all story. The app is a movie player (precisely a bluray player) and when I was saying that I intend to mimic QuickTime X window I meant that I would like to have a borderless window with rounded corner that can host a view (a NSOpenGLView in my case) which extends for all the window frame, even below the title bar. Acually I'm not even interested in mimic quicktime x title bar, I already have my own which is made with an auxiliary NSView. Just for completeness, the app has a borderless NSWindow with a transparent NSOpenGLView which has a transparent NSOpenGLContext. Is there a way to obtain what I need? ___ 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: sudden errors
On 28. Feb 2012, at 0:54, Keary Suska wrote: > Are you saying that you have not made any changes whatsoever to the project > in any way, nor did you change the version of Xcode you were using, but you > get a slew of errors when you clean/compile? i was editing Viewmanager.m, and .h, but i didn't go anywhere near that outlet or import statement. i was trying to get a method to work the way i want it to work. and suddenly, from one build to the next, i get the errors. i was using xcode 4.3 when the errors appeared, and because i thought something was screwed up in 4.3, (wouldn't be the first time) i went back to 4.2.1, but that didn't help :-( > Otherwise, in most cases, it is programmer error. Are the error messages you > quote the *only* errors and warnings you are getting? nope, i get the following errors (and i think the first is the root) Unknown type name 'ViewManager' Property with 'retain (or strong)' attribute must be of object type here's my viewmanager.h // // ViewManager.h // #import #import #import @interface ViewManager : NSObject { BOOL logScale, compAxis; NSDate *date, *firstDate; double min, max, hLW; double a, b, x1,x2; } @property double height; @property double rightMargin; @property double leftMargin; @property double topMargin; @property double bottomMargin; @property double lineWidth; @property BOOL logAxis; @property BOOL compressedAxis; @property (retain) NSColor *backgroundColor; @property (retain) NSColor *bearColor; @property (retain) NSColor *bullColor; @property (retain) NSColor *axisColor; @property (retain) IBOutlet AppController *controller; @property (retain) NSDate *date; @property (retain) NSDate *firstDate; -(void)resetMargins; //-(double)getXFromIndex:(int)currentIndex; @end in my AppController.h i have #import "ViewManager.h" and further down @property (retain) IBOutlet ViewManager *viewManager; and this is one of the lines that get the errors. the other 2 lines are in another .m file, but they get the same errors. ___ 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: sudden errors
i just ran a little test: i went into my appcontroller.h and turned the #import "ViewManager.h" line into a comment, then tried to build. result: EXACTLY the same errors. it's like that line isn't even there. WTF? ___ 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: sudden errors
you're importing AppController.h in ViewManager.h and vice-versa, I assume you just added that, or just put the ViewController instance inside AppController. So when you import ViewController it imports AppController (before ViewController is defined) which doesn't reimport ViewController (because you were already importing it) and so ViewController isn't defined when you use it. Pretty common error. Move the ViewController import into the AppController.m file and put @class ViewController; instead. On Feb 28, 2012, at 5:21 PM, H. Miersch wrote: > > On 28. Feb 2012, at 0:54, Keary Suska wrote: > >> Are you saying that you have not made any changes whatsoever to the project >> in any way, nor did you change the version of Xcode you were using, but you >> get a slew of errors when you clean/compile? > > i was editing Viewmanager.m, and .h, but i didn't go anywhere near that > outlet or import statement. i was trying to get a method to work the way i > want it to work. and suddenly, from one build to the next, i get the errors. > i was using xcode 4.3 when the errors appeared, and because i thought > something was screwed up in 4.3, (wouldn't be the first time) i went back to > 4.2.1, but that didn't help :-( > > >> Otherwise, in most cases, it is programmer error. Are the error messages you >> quote the *only* errors and warnings you are getting? > > nope, i get the following errors (and i think the first is the root) > > Unknown type name 'ViewManager' > > Property with 'retain (or strong)' attribute must be of object type > > > > here's my viewmanager.h > > // > // ViewManager.h > // > > #import > #import > #import > > @interface ViewManager : NSObject { > BOOL logScale, compAxis; > NSDate *date, *firstDate; > double min, max, hLW; > double a, b, x1,x2; > } > > > > @property double height; > @property double rightMargin; > @property double leftMargin; > @property double topMargin; > @property double bottomMargin; > @property double lineWidth; > @property BOOL logAxis; > @property BOOL compressedAxis; > > @property (retain) NSColor *backgroundColor; > @property (retain) NSColor *bearColor; > @property (retain) NSColor *bullColor; > @property (retain) NSColor *axisColor; > @property (retain) IBOutlet AppController *controller; > @property (retain) NSDate *date; > @property (retain) NSDate *firstDate; > > -(void)resetMargins; > //-(double)getXFromIndex:(int)currentIndex; > > @end > > in my AppController.h i have > > #import "ViewManager.h" > > and further down > > @property (retain) IBOutlet ViewManager *viewManager; > > and this is one of the lines that get the errors. the other 2 lines are in > another .m file, but they get the same errors. > > ___ > > 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/rols%40rols.org > > This email sent to r...@rols.org ___ 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: sudden errors
I'd suggest that you check that the target for your ViewManager .h and .m files is (still) correctly set. Get info on the files in XCode (in XCode 3 using a ctrl-click on the file) and check the target. Am 28.02.2012 um 10:45 schrieb H. Miersch: > > i just ran a little test: i went into my appcontroller.h and turned the > #import "ViewManager.h" line into a comment, then tried to build. result: > EXACTLY the same errors. it's like that line isn't even there. WTF? > ___ > > 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/magnard%40web.de > > This email sent to magn...@web.de > ___ 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: sudden errors
Is ViewManager.h still in your projects file list? Am 28.02.2012 um 10:45 schrieb H. Miersch: > > i just ran a little test: i went into my appcontroller.h and turned the > #import "ViewManager.h" line into a comment, then tried to build. result: > EXACTLY the same errors. it's like that line isn't even there. WTF? ___ 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: sudden errors - fixed
On 28. Feb 2012, at 10:01, Roland King wrote: > Move the ViewController import into the AppController.m file and put > > @class ViewController; > > instead. that fixed the appcontroller, thanks. looks like i have a lot to learn... ___ 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: Accelerate/vDSP.h question
On Feb 28, 2012, at 6:36 AM, Don Thompson wrote: Have the vDSP functions vDSP_vabs and vDSP_vabsD recently changed? They seem to be no longer working other than to simply return an unchanged version of an input. Here is a simple, Cocoa test routine I used to prove the point: unsigned intii; double aa[10], bb[10]; for( ii=0; ii<10; ii++ ) { aa[ii]=1.1, bb[ii]=0; } aa[1]=aa[3]=aa[6]=-2.2; vDSP_vabsD( aa, 1, bb, 1, 10 ); ii = 0; with breakpoints set at the "aa[1] ..." and "ii=0" lines. The aa array is as expected at the 1st breakpoint; unfortunately, at the 2nd breakpoint, the bb array matches aa rather than an absolute value version of aa. This is a question for the performance-dev list. Does the problem go away if you malloc the arrays? Jan E. ___ 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: Accelerate/vDSP.h question
I put that code in a main() function in a new 10.7 project with Xcode 4.2.1 (no idea why I'm still on that version) and at the breakpoint, bb has the abs of aa. Tried debug and release builds, works fine. On Feb 28, 2012, at 8:43 PM, Jan E. Schotsman wrote: > > On Feb 28, 2012, at 6:36 AM, Don Thompson wrote: > >> Have the vDSP functions vDSP_vabs and vDSP_vabsD recently changed? They >> seem to be no longer working other than to simply return an unchanged >> version of an input. >> >> Here is a simple, Cocoa test routine I used to prove the point: >> unsigned intii; >> double aa[10], bb[10]; >> for( ii=0; ii<10; ii++ ) { aa[ii]=1.1, bb[ii]=0; } >> aa[1]=aa[3]=aa[6]=-2.2; >> vDSP_vabsD( aa, 1, bb, 1, 10 ); >> ii = 0; >> with breakpoints set at the "aa[1] ..." and "ii=0" lines. >> >> The aa array is as expected at the 1st breakpoint; unfortunately, at the 2nd >> breakpoint, the bb array matches aa rather than an absolute value version of >> aa. > > This is a question for the performance-dev list. > Does the problem go away if you malloc the arrays? > > Jan E. > > ___ > > 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/rols%40rols.org > > This email sent to r...@rols.org ___ 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
Question about KVC-compliance and bindings
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 uninteresting. The attributes will be read-only and mostly static, values like minValue/maxValue or isEditable. No actual control values. Suppose it is much easier for me to have my controller produce these attributes on-the-fly, in valueForKeyPath:, than to produce a tree structure to hold all the information. The attributes will rarely change (typically once per session), and when they do, the entire mainBranch will be switched out. My question is: Must I ensure KVC-compliance for every subpath of the key path? So that querying the controller for mainBranch.subBranch MUST return a KVC-compliant object with all the attributes, and querying for only mainBranch MUST return an object that can be queried for subBranch.attribute, or only subBranch etc...? Even if it doesn't make sense to bind anything to these subpaths? Per ___ 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: Question about KVC-compliance and bindings
On Feb 28, 2012, at 8:24 AM, Per Bull Holmen wrote: > 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 uninteresting. The > attributes will be read-only and mostly static, values like > minValue/maxValue or isEditable. No actual control values. Suppose it > is much easier for me to have my controller produce these attributes > on-the-fly, in valueForKeyPath:, than to produce a tree structure to > hold all the information. The attributes will rarely change (typically > once per session), and when they do, the entire mainBranch will be > switched out. > > My question is: Must I ensure KVC-compliance for every subpath of the > key path? So that querying the controller for mainBranch.subBranch > MUST return a KVC-compliant object with all the attributes, and > querying for only mainBranch MUST return an object that can be queried > for subBranch.attribute, or only subBranch etc...? Even if it doesn't > make sense to bind anything to these subpaths? I find it more useful to focus on KVO (Key Value Observing) compliance rather than KVC compliance, as although KVC compliance ensures KVO compliance, the reverse is not always true. That being said, every object on a key path should be KVO compliant for the called key. I.e., your controller should be KVO compliant for the key "mainBranch", that returned object must be KVO compliant for the key "subBranch", and that object in turn should be KVO compliant for the key "attribute." 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 the whole tree in memory? Overriding KVC methods is rarely a good way to go, especially if performance is a concern. If you want dynamism and scalability, you have a good case for using Core Data. HTH, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ___ 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: Question about KVC-compliance and bindings
Den 18:05 28. februar 2012 skrev Keary Suska 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 > the whole tree in memory? > > Overriding KVC methods is rarely a good way to go, especially if performance > is a concern. If you want dynamism and scalability, you have a good case for > using Core Data. Thanks for your help. The problem I am trying to solve is, I want to make a controller which lets me bind Cocoa controls to a plug-in interface (audio units). This way, I can bind most of the controls directly to audio unit parameters and properties, and set up fairly complex UI logic for my audio unit the way I am used to in IB. Though it would be nowhere as powerful as in an all-cocoa app. But, as the people on the coreaudio-api list warned me, the interface to talk to and set parameters/properties for an audio unit (through a straight C api, and integer parameter-IDs instead of string keys etc...) does not map easily to the Cocoa bindings way... :) In this case, an audio unit instance (which is a plug-in) is the model, but it doesn't talk Cocoa. Binding to the VALUES did still turn out pretty well now. But the Audio Unit plugin API also has a standardized way for Audio Units to give the hosts and GUI some static information about each parameter such as min/max value, readonly or writable etc. To be able to bind to this information too, it would be much easier for me to let the controller just fetch this information on the fly, and notify observers the few times it changes. Building a tree in memory would require more bookkeeping, and would be harder because the controller can not know in advance what string keys (which maps to parameters IDs) it will be queried for, the controller is supposed to not have any knowledge in advance of the possible model keys. But yeah, I'll solve it either way. So now I know, there is no shortcut, I must make every property on the key path KVC and KVO compliant. I'm not complaining... :) Thanks for your help. Per ___ 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: Question about KVC-compliance and bindings
On 28 Feb 2012, at 17:05, Keary Suska wrote: > I find it more useful to focus on KVO (Key Value Observing) compliance rather > than KVC compliance, as although KVC compliance ensures KVO compliance, the > reverse is not always true. Whoah! Wrong way round! To be KVO-compliant, you must be KVC-compliant too. There are tons of examples of KVC-compliance without KVO-compliance though. ___ 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: Accelerate/vDSP.h question
Jan, Thanks for the reply, I will send my question to the performance-dev list. The problem is the same with a malloc array--I found it there first (in some old code that once ran OK) and then wrote the simple test routine to see if my suspicions bore out. Roland, Thanks for your reply also. I ran the test under OS 10.6.8 / Xcode version 3.2.3. It would appear that I may be now forced to upgrade. ___ 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: Round corners of borderless NSWindow without set it transparent
On Feb 27, 2012, at 11:51 PM, Andrea3000 wrote: > Thank you for the answer. > > Il giorno 28/feb/2012, alle ore 06:36, Seth Willits ha scritto: > >> On Feb 27, 2012, at 5:45 AM, Andrea3000 wrote: >> >>> Then, if I set my NSWindow non-opaque I correctly get rounded corners but >>> the window becomes very slow expecially during resize. >> >> Mmm…. that doesn't sound right. You shouldn't notice anything being slow. > > When the window is small it's as fast as if it were opaque but when it > occupies quite all the screen (1920x1080) it becomes noticeably slow during > resize. Did you sample it or use Instruments? What is slow? corbin ___ 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: Question about KVC-compliance and bindings
On Feb 28, 2012, at 07:24 , Per Bull Holmen wrote: > 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 uninteresting. The > attributes will be read-only and mostly static, values like > minValue/maxValue or isEditable. No actual control values. Suppose it > is much easier for me to have my controller produce these attributes > on-the-fly, in valueForKeyPath:, than to produce a tree structure to > hold all the information. The attributes will rarely change (typically > once per session), and when they do, the entire mainBranch will be > switched out. On Feb 28, 2012, at 09:47 , Per Bull Holmen wrote: > Binding to the VALUES did still turn out pretty well now. But the > Audio Unit plugin API also has a standardized way for Audio Units to > give the hosts and GUI some static information about each parameter > such as min/max value, readonly or writable etc. To be able to bind to > this information too, it would be much easier for me to let the > controller just fetch this information on the fly, and notify > observers the few times it changes. Building a tree in memory would > require more bookkeeping, and would be harder because the controller > can not know in advance what string keys (which maps to parameters > IDs) it will be queried for, the controller is supposed to not have > any knowledge in advance of the possible model keys. But yeah, I'll > solve it either way. So now I know, there is no shortcut, I must make > every property on the key path KVC and KVO compliant. 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 that case, you don't have to override the controller's valueForKeyPath: to intercept "mainBranch.subBranch.nonExistentAttribute". Instead, override the subbranch object's valueForUndefinedKey: -- and also, if there are non-existent subbranches, the main branch's valueForUndefinedKey:. That allows you to avoid messing with the higher-traffic valueForKeyPath:. However, if the above is not feasible, I'd suggest you go ahead and override your controller's valueForKeyPath:. There's no particular reason to think it would cause a performance problem beyond the obvious effect of requiring some string comparisons as often as anything controller-dependent in the UI needs to update. (It probably *would* be a problem if you were trying to update, say, a volume meter in more or less real time using bindings, but you could do that a different way.) You would would invoke [super valueForKeyPath:] for all the normal cases anyway, so I wouldn't worry about "breaking" KVC. That should take care of KVC compliance. KVO compliance should be pretty easy, too. Since you switch out "the entire mainBranch", then -- assuming you do *that* KVO-compliantly as you should be doing -- any UI element bound to "mainBranch.subBranch.nonExistentAttribute" is going to get updated for free. If necessary, you can also generate notifications for "nonExistentAttribute" by sending a [subBranch will/didChangeValueForKey:] pair after something changes, but it doesn't sound like you need this. ___ 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: Round corners of borderless NSWindow without set it transparent
Il giorno 28/feb/2012, alle ore 20:20, Corbin Dunn ha scritto: > > On Feb 27, 2012, at 11:51 PM, Andrea3000 wrote: >> >> When the window is small it's as fast as if it were opaque but when it >> occupies quite all the screen (1920x1080) it becomes noticeably slow during >> resize. > > Did you sample it or use Instruments? What is slow? The resize is slow. When the window is small I can resize it as fast as I want and the resize animation is smooth, the window changes size gradually with continuity. On the other hand, when the window occupies a big portion of the screen and I resize it fast (I mean, not like a mad..just not slowly) it is sluggish during resize animation and the bottom right corner of the window doesn't follow the mouse pointer immediatly, there is always a little delay. This happens regardless of what I display in the NSOpenGLView, it happens even with only a uniform color background. Just for completeness, I use a CVDisplayLink to draw to the OpenGLContext and the context is set to flush buffers in sync with the refresh of the monitor. ___ 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: Question about KVC-compliance and bindings
Den 20:24 28. februar 2012 skrev Quincey Morris 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 that case, you don't have to override the controller's > valueForKeyPath: to intercept "mainBranch.subBranch.nonExistentAttribute". > Instead, override the subbranch object's valueForUndefinedKey: -- and also, > if there are non-existent subbranches, the main branch's > valueForUndefinedKey:. That allows you to avoid messing with the > higher-traffic valueForKeyPath:. Thanks. I try to tell myself, either give enough information, or give no information at all. I clearly didn't give enough this time. Currently there is no value object for mainBranch, because I haven't started programming that part yet. My plan, my proposed Evil Shortcut, was to have no objects at all to represent this chain of properties... because there is virtually no custom behaviour associated with it. In the meanwhile I've been thinking about it, and thought that there isn't really much added complexity to making my own objects to represent each link in the chain. Thanks for reminding me about valueForUndefinedKey: , probably I will instead override valueForKey: , and call super at the end if I don't find an associated parameter for the plug-in. So, the two key paths for the controller will be: values.customAudioUnitPropertyName parameterInfo.customAudioUnitPropertyName.[ minValue | maxValue | isWritable | parameterName ] The first path is the complex part and is already implemented. My question was concerning the second path, the easy part, and I will do pretty much what you suggested. The user of the controller will have to provide a delegate which translates between customAudioUnitPropertyName and an integer propertyID or parameterID (coreaudio lingo) which is needed to talk to the plug-in. When a name is translated once, it is inserted into an NSMapTable so valueForKey: will be very efficient the second time for the same key. The parameter info (second path) will be very rarely accessed, so performance is probably of no concern. Thanks for your help! Per ___ 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: Question about KVC-compliance and bindings
On Feb 28, 2012, at 11:46 AM, Mike Abdullah wrote: > On 28 Feb 2012, at 17:05, Keary Suska wrote: > >> I find it more useful to focus on KVO (Key Value Observing) compliance >> rather than KVC compliance, as although KVC compliance ensures KVO >> compliance, the reverse is not always true. > > Whoah! Wrong way round! To be KVO-compliant, you must be KVC-compliant too. > There are tons of examples of KVC-compliance without KVO-compliance though. Although it is always best approach your statement is not completely true. Attribute and to-one relationships do not have to be fully KVC compliant to be KVO compliant. Consider dynamic/dependent properties as the most obvious example: they do *not* require a -set method to be mutable. You don't even need to use the automatic dependent key tracking. There are even necessary reasons to bypass pure KVC, which is at least one reason that willChange/didChange exist at all. And further if you decide to override the KVC methods (-valueForKey: etc) you are bypassing KVC compliance significantly. Given that, you point is well taken that my advice may be poor for those who do not understand KVC compliance sufficiently, but on the other hand I don't see any problem with the logic of going in reverse--i.e. first determining what needs to be KVO compliant and then ensuring that compliance, which most often includes ensuring KVC compliance but not always, especially when one wants dynamic properties without ivar/property backing, which may have been a solution for the OP. Best, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ___ 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: Question about KVC-compliance and bindings
On Feb 28, 2012, at 10:47 AM, Per Bull Holmen wrote: > Binding to the VALUES did still turn out pretty well now. But the > Audio Unit plugin API also has a standardized way for Audio Units to > give the hosts and GUI some static information about each parameter > such as min/max value, readonly or writable etc. To be able to bind to > this information too, it would be much easier for me to let the > controller just fetch this information on the fly, and notify > observers the few times it changes. Building a tree in memory would > require more bookkeeping, and would be harder because the controller > can not know in advance what string keys (which maps to parameters > IDs) it will be queried for, the controller is supposed to not have > any knowledge in advance of the possible model keys. But yeah, I'll > solve it either way. So now I know, there is no shortcut, I must make > every property on the key path KVC and KVO compliant. I'm not > complaining... :) I don't have much to add to Quincy's response--overriding -valueForUndefinedKey: is a good approach. 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. It is simply abstract enough that it is easy to forget ;-) Best, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ___ 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: Question about KVC-compliance and bindings
Den 23:41 28. februar 2012 skrev Keary Suska 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. It is > simply abstract enough that it is easy to forget ;-) > 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 for the plug-in, puts it in an NSMapTable. Is this the right place for the controller to determine that a binding is established? Is there a more appropriate place? Anyway, I can not see anywhere in the docs that they guarantee that the view that does the binding does not call valueForKey: on the bound object before it registers the object as an observer. Therefore I ended up, in my valueForKey: override (more on that later), to FIRST check if the key is in the map table, THEN if the key is not in the map table, check if it still does correspond to a parameter in the plug-in. That is almost the same thing as my addObserver method does. That's not elegant, but I think it should be guaranteed that valueForKey: behaves the same way regardless of whether a property is being observed or not. If valueForKey: does not find a corresponding parameter ID, it calls super. Regarding overriding valueForKey: (not valueForKeyPath:) I don't see what's wrong that, since 99% of the time valueForKey: is called, it will be with a key that correspond's to a parameter ID, and not one that corresponds to an accessor, ivar or obj-c property. Either way it will call super if it doesn't find a corresponding parameter ID. What I meant when I wrote that my controller should not know beforehand what keys will be needed, was that the possible keys should not be part of the implementation, ie. hardcoded. Also, the user supplied delegate method that translates between string keys and integer parameter-IDs, should be as easy to implement, yet as flexible as possible. Therefore I just let it take a string value as arg and translate to an integer ID, rather than requiring that it returns, say, a complete dictionary with all the keys and associated info at once. Per ___ 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: Question about KVC-compliance and bindings
Den 00:53 29. februar 2012 skrev Per Bull Holmen 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 for the plug-in, puts it in an NSMapTable. Is this the right place > for the controller to determine that a binding is established? Is > there a more appropriate place? Sorry, I need to clarify a few things, to avoid further misunderstandings. When I write "my controller", I don't mean an NSObjectController, NSArrayController etc. subclass, but an object that corresponds to the controller layer in the MVC model and supports bindings. It happens to be an NSController subclass. Second, it is not in the controller itself I override the addObserver or valueForKey: methods, but in the object that represents what I called the mainBranch in my original post. That is, an object that's contained in the controller and created in the controller's init method. This object is not really meant to have any other KVC-compliant properties than those that correspond to the plug-in's parameters/properties. It acts as a "stand in" since the plug-in can't speak Cocoa. So to speak... :) Per ___ 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
How are views supposed to reload after being nillified by memory warnings?
Hi all. View controllers that are buried in the navigation stack (or otherwise have their views obscured) set their views to nil when they receive a memory warning. This makes sense temporarily, because the views aren't visible. But when the overlapping views are dismissed, how is the nillified view supposed to reload itself? Currently, ours doesn't, and this leaves a blank white screen and a permanently disabled app (until the user force-quits). I've found that viewWillAppear is not called on the blanked view controller, as it is when no memory warning has occurred. So when exactly are these blanked views supposed to recover? This view is loaded from a XIB, by the way. Thanks for any insight! Gavin ___ 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
How to: NSTableView redisplay
Learning a new language makes me humble. NSTableView - I have an NSTableViewDataSource with an array holding the objects to be represented in the table. I add a new object to the array, I call [table reloadData]; and I follow that with [table setNeedsDisplay:YES]; Bupkiss. Nada. However, when I tap a column header to resort the view, presto. Content. What am I missing ? - (void) appendRule:(NSNotification *) note { RSTrixieRule * rule = [note object]; [_rules addObject: rule]; [table reloadData]; [table setNeedsDisplay:YES]; } Erik Stainsby erik.stain...@roaringsky.ca - Consistently place constants on the LHS of an expression: you cannot accidentally assign when you meant to compare. ___ 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
iBook integration
All, Has anyone information on embedding iBook viewing in an iOS application? Forgive me if this has already been answered. Thanks, Jamie ___ 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: How to: NSTableView redisplay
On 29/02/2012, at 3:39 PM, Erik Stainsby wrote: > Learning a new language makes me humble. > > NSTableView - I have an NSTableViewDataSource with an array holding the > objects to be represented in the table. > I add a new object to the array, I call [table reloadData]; and I follow that > with [table setNeedsDisplay:YES]; > Bupkiss. Nada. However, when I tap a column header to resort the view, > presto. Content. > > What am I missing ? > > - (void) appendRule:(NSNotification *) note { > RSTrixieRule * rule = [note object]; > [_rules addObject: rule]; > [table reloadData]; > [table setNeedsDisplay:YES]; > } You don't need to call -setNeedsDisplay: on the table, -reloadData: does that for you. So it should work. Is definitely correct? How does your data source object obtain that? A common way is to have an IBOutlet and just hook it up in the nib. But check that it's not nil, which would indicate that you didn't hook it up. Another common error is to define the datasource in the nib but then instantiate another copy of it in code, so check that as well. And just for completeness, you have implemented -numberOfRowsInTableView: and -tableView:objectValueForTableColumn:row: ??? --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: How to: NSTableView redisplay
My code: #import #import @interface RSTrixieTable : NSWindowController < NSTableViewDataSource > @property (retain) IBOutlet NSMutableArray * rules; @property (retain) IBOutlet NSTableView * table; - (void) appendRule:(NSNotification*)note; - (NSInteger) numberOfRowsInTableView:(NSTableView *)aTableView; @end #import "RSTrixieTable.h" @interface RSTrixieTable () @end @implementation RSTrixieTable @synthesize rules = _rules; @synthesize table; - (id)init { self = [super initWithWindowNibName:@"RSTrixieTable" owner:self]; if (self) { NSLog(@"%s- [%04d] %@", __PRETTY_FUNCTION__, __LINE__, @""); _rules = [[NSMutableArray alloc] init]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appendRule:) name:nnRSTrixieStoreNewRuleNotification object:nil]; } return self; } - (void)windowDidLoad { [super windowDidLoad]; } - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView { NSInteger ret = 0; if([_rules count]) ret = [_rules count]; return ret; } - (void) appendRule:(NSNotification*)note { RSTrixieRule * rule = [note object]; [_rules addObject: rule]; [table reloadData]; [table setNeedsDisplay:YES]; } @end Erik Stainsby erik.stain...@roaringsky.ca - Consistently place constants on the LHS of an expression: you cannot accidentally assign when you meant to compare. On 2012-02-28, at 9:50 PM, Brian Lambert wrote: > Post your code. > > On Tue, Feb 28, 2012 at 8:39 PM, Erik Stainsby > wrote: > Learning a new language makes me humble. > > NSTableView - I have an NSTableViewDataSource with an array holding the > objects to be represented in the table. > I add a new object to the array, I call [table reloadData]; and I follow that > with [table setNeedsDisplay:YES]; > Bupkiss. Nada. However, when I tap a column header to resort the view, > presto. Content. > > What am I missing ? > > - (void) appendRule:(NSNotification *) note { >RSTrixieRule * rule = [note object]; >[_rules addObject: rule]; >[table reloadData]; >[table setNeedsDisplay:YES]; > } > > > > > Erik Stainsby > erik.stain...@roaringsky.ca > - > Consistently place constants on the LHS of an expression: you cannot > accidentally assign when you meant to compare. > > > > > > ___ > > 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/brianlambert%40gmail.com > > This email sent to brianlamb...@gmail.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