]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
Added "enabled" support for submenus
[wxWidgets.git] / src / common / docview.cpp
index ce47e57dd5f012ed56eaff1aaac40d27083091ce..152b8102eaa789a91423e7fd032947473ce0a619 100644 (file)
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "docview.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -571,7 +567,7 @@ bool wxDocument::DoSaveDocument(const wxString& file)
         msgTitle = wxString(_("File error"));
 
 #if wxUSE_STD_IOSTREAM
-    wxSTD ofstream store(file.mb_str());
+    wxSTD ofstream store(file.mb_str(), wxSTD ios::binary);
     if (store.fail() || store.bad())
 #else
     wxFileOutputStream store(file);
@@ -597,7 +593,7 @@ bool wxDocument::DoSaveDocument(const wxString& file)
 bool wxDocument::DoOpenDocument(const wxString& file)
 {
 #if wxUSE_STD_IOSTREAM
-    wxSTD ifstream store(file.mb_str());
+    wxSTD ifstream store(file.mb_str(), wxSTD ios::binary);
     if (!store.fail() && !store.bad())
 #else
     wxFileInputStream store(file);
@@ -2165,6 +2161,8 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
                 pathInMenu = m_fileHistory[i];
             }
 
+            // we need to quote '&' characters which are used for mnemonics
+            pathInMenu.Replace(_T("&"), _T("&&"));
             wxString buf;
             buf.Printf(s_MRUEntryFormat, i + 1, pathInMenu.c_str());
             wxList::compatibility_iterator node = m_fileMenus.GetFirst();
@@ -2217,10 +2215,10 @@ void wxFileHistory::RemoveFileFromHistory(size_t i)
         // delete the last separator too if no more files are left
         if ( m_fileHistoryN == 1 )
         {
-            wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetLast();
-            if ( node )
+            wxMenuItemList::compatibility_iterator nodeLast = menu->GetMenuItems().GetLast();
+            if ( nodeLast )
             {
-                wxMenuItem *menuItem = node->GetData();
+                wxMenuItem *menuItem = nodeLast->GetData();
                 if ( menuItem->IsSeparator() )
                 {
                     menu->Delete(menuItem);