Improve (de)serializing pinned tabs in wxAuiNotebook

Stop saving and restoring locked tabs: their semantics dictates that
their state can't be changed by the user, and so they must remain locked
no matter what, whereas it was possible to turn a locked tab into a
normal one via data given to the deserializer (e.g. by editing a config
file manually).

Also ensure that restoring the pinned tabs doesn't break the control
invariant, i.e. that they don't come after any normal tabs. If the
deserializer returns the data that puts pinned tabs on invalid
positions, just ignore it and don't make them pinned: this is better
than ending up in an invalid state and simpler than moving them before
the normal tabs.
This commit is contained in:
Vadim Zeitlin
2025-03-16 20:28:36 +01:00
parent 84438143e6
commit c1107c6be1
4 changed files with 119 additions and 47 deletions
-6
View File
@@ -1692,7 +1692,6 @@ public:
AddPagesList(node, "pages", tab.pages);
AddPagesList(node, "pinned", tab.pinned);
AddPagesList(node, "locked", tab.locked);
AddChild(node, "active", tab.active);
m_book->AddChild(node);
@@ -2045,11 +2044,6 @@ private:
for ( const auto& s : pageIndices )
tab.pinned.push_back(GetInt(s));
}
else if ( child->GetName() == "locked" )
{
for ( const auto& s : pageIndices )
tab.locked.push_back(GetInt(s));
}
else if ( child->GetName() == "active" )
{
tab.active = GetInt(child->GetNodeContent());