|
wxMaxima
|
Declares RepairAuiPerspective(), which makes a stored wxAUI layout safe to load. More...
#include <wx/string.h>Go to the source code of this file.
Functions | |
| wxString | RepairAuiPerspective (const wxString &perspective) |
Returns perspective with any invalid centre-pane geometry corrected. | |
Declares RepairAuiPerspective(), which makes a stored wxAUI layout safe to load.
| wxString RepairAuiPerspective | ( | const wxString & | perspective | ) |
Returns perspective with any invalid centre-pane geometry corrected.
wxAUI requires the centre pane to sit at dock layer, row and position 0; wxAuiPaneInfo::IsValid() asserts otherwise. wxMaxima used to declare the worksheet pane with both .Center() and .Row(2), which was fixed in the code – but every perspective saved before that fix still says row=2, and those live in users' config files indefinitely.
Loading one is not harmless. wxAuiManager::LoadPerspective() hands each stored pane to wxAuiPaneInfo::SafeSet(), which validates it and discards it entirely if it is invalid – so the worksheet's stored geometry is silently thrown away in a release build, and the assert aborts wxMaxima outright in a debug one. Neither is something the user can act on, and neither is fixed by correcting the pane afterwards: by then LoadPerspective() has already rejected it.
Repairing the string before it is ever handed to wxAUI is what makes an old config load cleanly instead. Anything this function does not recognise is passed through untouched – a perspective is opaque, versioned, wxAUI-owned data, and the goal is only to correct the one field wxMaxima itself is known to have written wrong.
| perspective | A perspective string as stored by wxAuiManager::SavePerspective(). |