Quoting Ted Gould <ted@...11...>:
I think what I want to do is be able to find every window that references a particular document, and figure out what their current layer is. I couldn't figure out a way to do that.
Well, it sounds like what you're doing is tearing down the old document and basically rebuilding a new one in place?
It's probably better if you arrange for some notification mechanism (i.e. a pair of additional signals on SPDocument) that all attached SPViews can watch in turn to know when to save and restore state like the id of the current layer, etc.
i.e.:
1. call "save view state" signal on SPDocument (all attached SPViews save state automatically)
2. teardown/rebuild document
3. call "restore view state" signal on SPDocument (all attached SPViews restore their state automatically, the best they can)
Much cleaner than grovelling through SPViews from the top down.
SPViews potentially have more intrinsic state than just the current layer -- it's best if you let them look after themselves in this regard. Otherwise, you're going to open up a nightmare can of architectural spaghetti.
-mental