composite window size & position not always saved
It would be nice if the position and size of a window for a composite actor were saved. I thought this was done in the past, but I went back as far as Ptolemy 7.0.1 and Kepler 2.0, and it does not work.
1. start Ptolemy or Kepler
2. put composite actor on canvas
3. open composite actor
4. resize and move composite actor's window
5. close composite actor's window
6. save model
The size and position of the composite actor's window are not saved in the model. This configuration is stored in a WindowPropertiesAttribute called "_windowProperties", and is only stored for the top-level composite actor.
However, I have many existing models that do store the size and position for composite actor windows. After some testing, I found that before closing the window in step 5, running File->Save (Ptolemy) or File->Export->XML (Kepler) in the composite actor window does store the size and position for the composite.
To fix this would be to store the size and position for all open composite actor windows regardless if File->Save is used.
Note that in Kepler, File->Save saves the model as a KAR, and this also does not save window size and position, but this is a different problem - see bug 5188.
#1 Updated by Christopher Brooks over 7 years ago
To save the location of a subcomposite, do File -> Save in the subcomposite.
The contsructor in ptolemy/actor/gui/WindowPropertiesAttribute.java says:
// The following line, if uncommented, results in
// icons that are defined in an external file always being
// exported along with the model that defines them. This bloats
// the MoML files with information that is not needed. I suspect
// the line was put there because it wasn't clear that you need
// to invoke File->Save in a submodel if you want the location
// and position of the submodel window to be saved. It is not
// sufficient to invoke save just at the top level.
It certainly is arguable that the design should be such that
File->Save saves the location of all the open windows, but that's
not how the system is designed, so I'm dropping this to a slightly lower
priority and to an enhancement.
This would be good to discuss with Edward.
#2 Updated by Christopher Brooks over 7 years ago
I consulted with Edward and he was fine with fixing this.
If I now open a composite, zoom in, the close it
and reopen it, it doesn't remember the zoom factor.
I don't think this is new.
In Ptolemy II 8.0.1:
1. cd /Applications/Ptolemy/ptII8.0.1
2. export PTII=`pwd`
4. Create a model that has a composite, open the composite, zoom in
5. Close the composite by hitting the red button
6. Open the composite.
Note that the last zoom changes are not present.
The same is true in the devel branch.
This is fixed in r64361 in the ptII tree. I added
_updateWindowAttributes() to BasicGraphFrame. This method might
be useful for Kar files.
I'm assigning this to Daniel for review for closure.
#4 Updated by Christopher Brooks over 7 years ago
I'm repopening this because the change results in the user being
prompted to save the model while exiting when all the user did
was resize or zoom in a model.
For example, if the model is a large model and there is an error
and the user clicks on "Go To Actor", then the model may be zoomed.
When the user closes the model, they will be prompted to save.
Even worse, it appears that the size and location of windows can
be slightly different between different platforms.
Thus, I'm reverting this change.