+ // un-maximize and hide all other panes
+ for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i)
+ {
+ wxAuiPaneInfo& p = m_panes.Item(i);
+ if (!p.IsToolbar() && !p.IsFloating())
+ {
+ p.Restore();
+
+ // save hidden state
+ p.SetFlag(wxAuiPaneInfo::savedHiddenState,
+ p.HasFlag(wxAuiPaneInfo::optionHidden));
+
+ // hide the pane, because only the newly
+ // maximized pane should show
+ p.Hide();
+ }
+ }
+
+ // mark ourselves maximized
+ paneInfo.Maximize();
+ paneInfo.Show();
+ m_hasMaximized = true;
+
+ // last, show the window
+ if (paneInfo.window && !paneInfo.window->IsShown())
+ {
+ paneInfo.window->Show(true);
+ }
+}
+
+void wxAuiManager::RestorePane(wxAuiPaneInfo& paneInfo)
+{
+ int i, pane_count;
+
+ // restore all the panes
+ for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i)
+ {
+ wxAuiPaneInfo& p = m_panes.Item(i);
+ if (!p.IsToolbar() && !p.IsFloating())
+ {
+ p.SetFlag(wxAuiPaneInfo::optionHidden,
+ p.HasFlag(wxAuiPaneInfo::savedHiddenState));
+ }
+ }
+
+ // mark ourselves non-maximized
+ paneInfo.Restore();
+ m_hasMaximized = false;
+
+ // last, show the window
+ if (paneInfo.window && !paneInfo.window->IsShown())
+ {
+ paneInfo.window->Show(true);
+ }
+}
+
+void wxAuiManager::RestoreMaximizedPane()
+{
+ int i, pane_count;
+
+ // restore all the panes
+ for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i)
+ {
+ wxAuiPaneInfo& p = m_panes.Item(i);
+ if (p.IsMaximized())
+ {
+ RestorePane(p);
+ break;
+ }
+ }
+}
+
+// EscapeDelimiters() changes ";" into "\;" and "|" into "\|"
+// in the input string. This is an internal functions which is
+// used for saving perspectives
+static wxString EscapeDelimiters(const wxString& s)
+{
+ wxString result;
+ result.Alloc(s.length());
+ const wxChar* ch = s.c_str();
+ while (*ch)
+ {
+ if (*ch == wxT(';') || *ch == wxT('|'))
+ result += wxT('\\');
+ result += *ch;
+ ++ch;
+ }
+ return result;
+}
+
+wxString wxAuiManager::SavePaneInfo(wxAuiPaneInfo& pane)
+{
+ wxString result = wxT("name=");
+ result += EscapeDelimiters(pane.name);
+ result += wxT(";");
+
+ result += wxT("caption=");
+ result += EscapeDelimiters(pane.caption);
+ result += wxT(";");
+
+ result += wxString::Format(wxT("state=%u;"), pane.state);
+ result += wxString::Format(wxT("dir=%d;"), pane.dock_direction);
+ result += wxString::Format(wxT("layer=%d;"), pane.dock_layer);
+ result += wxString::Format(wxT("row=%d;"), pane.dock_row);
+ result += wxString::Format(wxT("pos=%d;"), pane.dock_pos);
+ result += wxString::Format(wxT("prop=%d;"), pane.dock_proportion);
+ result += wxString::Format(wxT("bestw=%d;"), pane.best_size.x);
+ result += wxString::Format(wxT("besth=%d;"), pane.best_size.y);
+ result += wxString::Format(wxT("minw=%d;"), pane.min_size.x);
+ result += wxString::Format(wxT("minh=%d;"), pane.min_size.y);
+ result += wxString::Format(wxT("maxw=%d;"), pane.max_size.x);
+ result += wxString::Format(wxT("maxh=%d;"), pane.max_size.y);
+ result += wxString::Format(wxT("floatx=%d;"), pane.floating_pos.x);
+ result += wxString::Format(wxT("floaty=%d;"), pane.floating_pos.y);
+ result += wxString::Format(wxT("floatw=%d;"), pane.floating_size.x);
+ result += wxString::Format(wxT("floath=%d"), pane.floating_size.y);
+
+ return result;
+}
+
+// Load a "pane" with the pane infor settings in pane_part
+void wxAuiManager::LoadPaneInfo(wxString pane_part, wxAuiPaneInfo &pane)
+{
+ // replace escaped characters so we can
+ // split up the string easily
+ pane_part.Replace(wxT("\\|"), wxT("\a"));
+ pane_part.Replace(wxT("\\;"), wxT("\b"));
+
+ while(1)