Author Topic: hidden state of undocked windows not saved  (Read 2792 times)

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
hidden state of undocked windows not saved
« on: June 08, 2008, 04:48:48 pm »
I just filed a bug-report and a patch at berlios.

Text of the bug-report is:

Quote
If a layout with an undocked windows was saved (either automatically on close or manually) and the undocked window gets closed, C::B does not recognize the change of the layout, that means the "layout changed"-dialog does not pop up on close.
The next time C::B is opened the closed undocked window is open again.

This happens, because the function that checks for changes does not look at the "state=" parameter of the layouts, because it also reflects if the window is active or not and that leads to popping up the "layout changed"-dialog even if nothing changed substantially.

The patch:

Code
--- codeblocks-1.0svn.orig/src/src/main.cpp     2008-06-07 12:04:42.000000000 +0200
+++ codeblocks-1.0svn.work/src/src/main.cpp     2008-06-08 15:12:39.000000000 +0200
@@ -1220,6 +1221,7 @@
 bool MainFrame::LayoutDifferent(const wxString& layout1,const wxString& layout2,const wxString& delimiter)
 {
     wxStringTokenizer strTok;
+    unsigned long j;

     strTok.SetString(layout1, delimiter);
     wxArrayString arLayout1;
@@ -1229,7 +1231,14 @@
         while(strTokColon.HasMoreTokens())
         {
             wxString theToken = strTokColon.GetNextToken();
-            if (!theToken.StartsWith(_T("state="))) arLayout1.Add(theToken);
+            if (theToken.StartsWith(_T("state=")))
+            {
+               theToken=theToken.Right(theToken.Len() - wxString(_T("state=")).Len());
+               theToken.ToULong(&j);
+               // we filter out the hidden/show state
+               theToken=wxString::Format(_("state=%d"),j &  wxAuiPaneInfo::optionHidden);
+            }
+               arLayout1.Add(theToken);
         }
     }

@@ -1241,7 +1250,14 @@
         while(strTokColon.HasMoreTokens())
         {
             wxString theToken = strTokColon.GetNextToken();
-            if (!theToken.StartsWith(_T("state="))) arLayout2.Add(theToken);
+            if (theToken.StartsWith(_T("state=")))
+            {
+               theToken=theToken.Right(theToken.Len() - wxString(_T("state=")).Len());
+               theToken.ToULong(&j);
+               // we filter out the hidden/show state
+               theToken=wxString::Format(_("state=%d"),j &  wxAuiPaneInfo::optionHidden);
+            }
+               arLayout2.Add(theToken);
         }
     }