persistent_frame.pl -- Save/restore layout of XPCE windows
This library defines the class persistent_frame, a subclass of class frame remembering its geometry and optionally (by default on) the subwindow layout.
This class cooperates with the library(pce_config), a generic package for managing application preferences. It collects the locations of user frames in the file <profile-dir>/Geometry.cnf
Geometry information is stored in the internal configuration DB (see library(pce_config)) if a frame is closed or on exit from the application. The internal database is written to tehe above mentioned file on exit from the application.
Somehow the system must identify the frame to decide which geometry to use. This is done using the <->geometry_key. If not set, this is the classname or, if the class is not subclassed it is the <-label of the frame.
Exploiting this library is very simple, just make your toplevel windows for which you want the geometry remembered a subclass of class persistent_frame rather than class frame. Note that this implies you have to create your frame explitely:
... new(F, persistent_frame('Pretty Application')), send(F, geometry_key, pretty_app), send(F, append, new(D, dialog)), send(new(V, view), right, D), ...
- get_tile_layout(+Tile, -Layout)[private]
- Create a Prolog term representing the subwindow (tile) layout. Note that we only save the width/height of resizeable subwindows, leaving the others to the application. This ensures proper behaviour if the application is modified.
- has_specifier(+Layout)[private]
- See whether there is a specification somewhere, otherwise there is no use storing it.
- apply_tile_layout(+Tile, +Layout)[private]
- Apply a previously saved layout description, sending ->width or ->height messages to resizeable tiles.