Re: How to make 'filter' child panels?
Re: How to make 'filter' child panels?
- Subject: Re: How to make 'filter' child panels?
- From: Ryan Stevens <email@hidden>
- Date: Tue, 23 Jan 2007 08:10:19 -0800
On Jan 22, 2007, at 12:51 PM, Cem Karan wrote:
1) Has this been done already in some neat manner that I can use?
2) If it hasn't been done, is this a reasonable approach to take?
3) Aside from memory (which isn't a problem, we can throw more
hardware at it), are there any other gotchas to consider?
I don't have any experience to speak of with Cocoa (I have a 1st
edition copy of Cocoa Programming for Mac OS X, but have only done
about 1/2 of it, and lots of not-even-half-finished projects)
Based on your Cocoa experience, I think you will find yourself way
over your
head with this project. In any case I would recommend a different
approach:
using a custom NSView. This approach seems easier and more
sensible to me,
although I confess I have never tried to do anything similar to
what you
describe.
I thought about that, but that also means that I have to track what
needs to be drawn, as well as what needs to be erased. By creating
multiple overlapping windows with scrollviews (with invisible
scroll thumbs) I don't have to think about hiding/showing
anything. In addition, if I have to do any other strange behavior,
it will be encapsulated to a particular window. That lets me debug
a layer at a time.
For example, you could have a custom object that tracks properties
about an
image such as image content & visibility, put them into an array
or other
collection object to also track drawing order, and then draw the
lot into
the view based on these options. You could have a number of
controls that
mimic the layer behavior and editing focus.
Or better yet, tell your colleague to grab a copy of Photoshop,
which can do
what he wants/needs and a whole lot more. Why reinvent the wheel?
I think you missed the part where he wants to have only portions of
the data visible at a time, but not across the whole visible
window. Here is the ugly ASCII art version of what I'm doing:
+------------------------
| |
| +-----+ |
| |* | |
| | 2 | +-----+|
| | | 1 | 3 ||
| +-----+ +-----+|
| |
+-----------------------+
|
V
+------------------------
| |
| +-----+ |
| | | |
| | 2 *| +-----+|
| | | 1 | 3 ||
| +-----+ +-----+|
| |
+-----------------------+
Region 1 is the full window. Regions 2 and 3 are child windows.
Region 1 displays the basic data (imagine that this is mapping
application; it isn't, but it is a good analogy). The basic data
might be a satellite picture of some place. Region 2 might be an
overlay of all the rabbits in that area, and region 3 might be
roads. As I drag region 2 around, I want to display the data and
key it to region 1. That way, my floating window will always show
the rabbit data that is a enclosed by region 2. If I overlap 2 and
3, then I show both sets of data. I attempted to show what I mean
by the * in the images. As window 2 was dragged right, the rabbit
that was in view went out of view, and then was promptly no longer
shown. However, as it moved, the rabbit that was just out of view
suddenly became visible. Does that make sense?
Thanks,
Cem Karan
It's been a while but something like this, I think..
- (void)redrawChildWindow
{
NSPoint parentScreenOrigin = [parentWindow convertBaseToScreen:
[parentWindow frame].origin];
NSPoint imageOrigin = [childWindow
convertScreenToBase:parentScreenOrigin];
//draw the child window's image at imageOrigin
}
This should keep the image pinned at the parent window's origin so
that when you draw the image the child window shows the proper
portion automagically.
HTH, YMMV, correct me if I'm wrong ;)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden