From 1320116514558cf465247b15f2458a8b23ee7724 Mon Sep 17 00:00:00 2001 From: Alex Bligh Date: Tue, 25 Jul 2006 13:16:41 +0000 Subject: [PATCH] wxAUI: fixed pane saving design thinko git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/aui/framemanager.h | 2 +- src/aui/framemanager.cpp | 117 +++++++++++++++++----------------- 2 files changed, 59 insertions(+), 60 deletions(-) diff --git a/include/wx/aui/framemanager.h b/include/wx/aui/framemanager.h index daf771a946..d91bc6e60f 100644 --- a/include/wx/aui/framemanager.h +++ b/include/wx/aui/framemanager.h @@ -429,7 +429,7 @@ public: bool DetachPane(wxWindow* window); wxString SavePaneInfo(wxPaneInfo& pane); - wxString LoadPaneInfo(wxString pane_part, wxPaneInfo &pane); + void LoadPaneInfo(wxString pane_part, wxPaneInfo &pane); wxString SavePerspective(); diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 701e97f739..367bd69858 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -958,66 +958,68 @@ wxString wxFrameManager::SavePaneInfo(wxPaneInfo& pane) return result; } -// Load a "pane" with the pane infor settings in pane_part; return the remainder of the -// string -wxString wxFrameManager::LoadPaneInfo(wxString pane_part, wxPaneInfo &pane) +// Load a "pane" with the pane infor settings in pane_part +void wxFrameManager::LoadPaneInfo(wxString pane_part, wxPaneInfo &pane) { // replace escaped characters so we can // split up the string easily pane_part.Replace(wxT("\\|"), wxT("\a")); pane_part.Replace(wxT("\\;"), wxT("\b")); - wxString val_part = pane_part.BeforeFirst(wxT(';')); - pane_part = pane_part.AfterFirst(wxT(';')); - wxString val_name = val_part.BeforeFirst(wxT('=')); - wxString value = val_part.AfterFirst(wxT('=')); - val_name.MakeLower(); - val_name.Trim(true); - val_name.Trim(false); - value.Trim(true); - value.Trim(false); - - if (val_name.empty()) - return wxEmptyString; - - if (val_name == wxT("name")) - pane.name = value; - else if (val_name == wxT("caption")) - pane.caption = value; - else if (val_name == wxT("state")) - pane.state = (unsigned int)wxAtoi(value.c_str()); - else if (val_name == wxT("dir")) - pane.dock_direction = wxAtoi(value.c_str()); - else if (val_name == wxT("layer")) - pane.dock_layer = wxAtoi(value.c_str()); - else if (val_name == wxT("row")) - pane.dock_row = wxAtoi(value.c_str()); - else if (val_name == wxT("pos")) - pane.dock_pos = wxAtoi(value.c_str()); - else if (val_name == wxT("prop")) - pane.dock_proportion = wxAtoi(value.c_str()); - else if (val_name == wxT("bestw")) - pane.best_size.x = wxAtoi(value.c_str()); - else if (val_name == wxT("besth")) - pane.best_size.y = wxAtoi(value.c_str()); - else if (val_name == wxT("minw")) - pane.min_size.x = wxAtoi(value.c_str()); - else if (val_name == wxT("minh")) - pane.min_size.y = wxAtoi(value.c_str()); - else if (val_name == wxT("maxw")) - pane.max_size.x = wxAtoi(value.c_str()); - else if (val_name == wxT("maxh")) - pane.max_size.y = wxAtoi(value.c_str()); - else if (val_name == wxT("floatx")) - pane.floating_pos.x = wxAtoi(value.c_str()); - else if (val_name == wxT("floaty")) - pane.floating_pos.y = wxAtoi(value.c_str()); - else if (val_name == wxT("floatw")) - pane.floating_size.x = wxAtoi(value.c_str()); - else if (val_name == wxT("floath")) - pane.floating_size.y = wxAtoi(value.c_str()); - else { - wxFAIL_MSG(wxT("Bad Perspective String")); + while(1) + { + wxString val_part = pane_part.BeforeFirst(wxT(';')); + pane_part = pane_part.AfterFirst(wxT(';')); + wxString val_name = val_part.BeforeFirst(wxT('=')); + wxString value = val_part.AfterFirst(wxT('=')); + val_name.MakeLower(); + val_name.Trim(true); + val_name.Trim(false); + value.Trim(true); + value.Trim(false); + + if (val_name.empty()) + break; + + if (val_name == wxT("name")) + pane.name = value; + else if (val_name == wxT("caption")) + pane.caption = value; + else if (val_name == wxT("state")) + pane.state = (unsigned int)wxAtoi(value.c_str()); + else if (val_name == wxT("dir")) + pane.dock_direction = wxAtoi(value.c_str()); + else if (val_name == wxT("layer")) + pane.dock_layer = wxAtoi(value.c_str()); + else if (val_name == wxT("row")) + pane.dock_row = wxAtoi(value.c_str()); + else if (val_name == wxT("pos")) + pane.dock_pos = wxAtoi(value.c_str()); + else if (val_name == wxT("prop")) + pane.dock_proportion = wxAtoi(value.c_str()); + else if (val_name == wxT("bestw")) + pane.best_size.x = wxAtoi(value.c_str()); + else if (val_name == wxT("besth")) + pane.best_size.y = wxAtoi(value.c_str()); + else if (val_name == wxT("minw")) + pane.min_size.x = wxAtoi(value.c_str()); + else if (val_name == wxT("minh")) + pane.min_size.y = wxAtoi(value.c_str()); + else if (val_name == wxT("maxw")) + pane.max_size.x = wxAtoi(value.c_str()); + else if (val_name == wxT("maxh")) + pane.max_size.y = wxAtoi(value.c_str()); + else if (val_name == wxT("floatx")) + pane.floating_pos.x = wxAtoi(value.c_str()); + else if (val_name == wxT("floaty")) + pane.floating_pos.y = wxAtoi(value.c_str()); + else if (val_name == wxT("floatw")) + pane.floating_size.x = wxAtoi(value.c_str()); + else if (val_name == wxT("floath")) + pane.floating_size.y = wxAtoi(value.c_str()); + else { + wxFAIL_MSG(wxT("Bad Perspective String")); + } } // replace escaped characters so we can @@ -1029,7 +1031,7 @@ wxString wxFrameManager::LoadPaneInfo(wxString pane_part, wxPaneInfo &pane) pane_part.Replace(wxT("\a"), wxT("|")); pane_part.Replace(wxT("\b"), wxT(";")); - return pane_part; + return; } @@ -1133,10 +1135,7 @@ bool wxFrameManager::LoadPerspective(const wxString& layout, bool update) pane_part.Replace(wxT("\a"), wxT("|")); pane_part.Replace(wxT("\b"), wxT(";")); - while (!pane_part.empty()) - { - pane_part = LoadPaneInfo(pane_part, pane); - } + LoadPaneInfo(pane_part, pane); wxPaneInfo& p = GetPane(pane.name); if (!p.IsOk()) -- 2.45.2