[Dagnabit, did reply instead of reply all]
On Aug 19, 2010, at 1:45 PM, Quincey Morris wrote: > On Aug 19, 2010, at 07:16, Brian Postow wrote: > >> so, are you suggesting that I manually control the "zoom-to-fit" >> functionality, and change the size of the image as the window changes size >> myself so I can keep track of the "desired display scale"? or is there some >> other way of getting that? > > The desired display scale comes directly from the relationship between the > size of the content view frame and the size of the (unscaled) image. It's > hard to be more specific, because it all depends on what you're trying to > achieve and how you're trying to achieve it. If you're trying to use a > specific scale (like 100% or 200%), then you'll size the document view based > on the image size, and the content view doesn't come into the calculation. If > you're trying to zoom to fit, you'll size the document view based in the > content view frame. Once you've decided the document view size, you'll > arrange for the image to be drawn in the document view, scaled (in any of > various possible ways) to the document view size. > What I want is 4 buttons: zoom in a fixed amount, zoom out a fixed amount (currently 1.4% and .7%) zoom to fit, and zoom to 1-1 image pixel - screen pixel. It would also be nice if I could display the current zoomfactor somewhere... >> So, the content view should go INSIDE the document view? I should have 3 >> views? a scrollview, a document view and an NSImageView? > > The view hierarchy of a scroll view *is* like this: > > scroll view (NSScrollView) > content view (NSClipView) > document view (whatever you want to use, possibly a > NSImageView, or a custom NSView, or an entire subview hierarchy) > > (plus scrollers and rulers, if used). > > So it's just a matter of keeping the terminology straight. I was just > pointing out the possible confusion, since it's really the document view that > supplies what you'd normally think of as "contents", not the content view. > Setting the document view to (say) a NSImageView is valid, but setting the > content view at all is almost certainly a mistake. > > Ok, the NSScrollView came with an NSView in it. I changed that to NSClipView, and added an NSImageView in the clipview. How big do I make the imageview? Currently, it's the same size as the clipview. The way I'm testing is by zooming in on the image with: [imageView scaleUnitSquareToSize: NSMakeSize(zoomFactor, zoomFactor)] thanks Brian Postow Senior Software Engineer Acordex Imaging Systems _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com