]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
Added further makefiles for wizard sample
[wxWidgets.git] / src / common / docview.cpp
index 95b489ee7d3c1744b8e2944555d023ff3d051836..317dbfbc7fb4bf02a763731ae409994928089338 100644 (file)
@@ -103,7 +103,7 @@ static inline wxString FindExtension(const wxChar *path);
 // local constants
 // ----------------------------------------------------------------------------
 
-static const char *s_MRUEntryFormat = wxT("&%d %s");
+static const wxChar *s_MRUEntryFormat = wxT("&%d %s");
 
 // ============================================================================
 // implementation
@@ -706,7 +706,6 @@ wxDocManager::wxDocManager(long flags, bool initialize)
     m_currentView = (wxView *) NULL;
     m_maxDocsOpen = 10000;
     m_fileHistory = (wxFileHistory *) NULL;
-    m_lastDirectory = wxT("") ;
     if (initialize)
         Initialize();
 }
@@ -1310,7 +1309,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
     }
 
     wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document template"), _("Templates"), n,
-            strings, (char **)data);
+            strings, (void **)data);
     delete[] strings;
     delete[] data;
     return theTemplate;
@@ -1333,7 +1332,7 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates,
         }
     }
     wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document view"), _("Views"), n,
-            strings, (char **)data);
+            strings, (void **)data);
     delete[] strings;
     delete[] data;
     return theTemplate;
@@ -1910,12 +1909,6 @@ void wxFileHistory::RemoveFileFromHistory(int i)
     {
         wxMenu* menu = (wxMenu*) node->Data();
 
-        // wxMenu::Delete() is missing from wxGTK, so this can't be done :-(
-#if 0
-        // delete the menu items
-        menu->Delete(wxID_FILE1 + i);
-#endif
-
         // delete the element from the array (could use memmove() too...)
         delete [] m_fileHistory[i];
 
@@ -1933,22 +1926,34 @@ void wxFileHistory::RemoveFileFromHistory(int i)
             menu->SetLabel(wxID_FILE1 + j, buf);
         }
 
-        // to be removed as soon as wxMenu::Delete() is implemented
-#if 1
-        menu->SetLabel(wxID_FILE1 + m_fileHistoryN - 1, wxT(""));
-#endif
-
         node = node->Next();
+
+        // delete the last menu item which is unused now
+        menu->Delete(wxID_FILE1 + m_fileHistoryN - 1);
+
+        // unfortunately, we can't delete separator (there is no function to
+        // delete item by position, only by id - and what if there are several
+        // separators in this menu?) - so we will be always left with at least
+        // one and, even worse, we will add another one if this was the last
+        // file... (FIXME)
     }
+
     m_fileHistoryN--;
 }
 
 wxString wxFileHistory::GetHistoryFile(int i) const
 {
-    if (i < m_fileHistoryN)
-        return wxString(m_fileHistory[i]);
+    wxString s;
+    if ( i < m_fileHistoryN )
+    {
+        s = m_fileHistory[i];
+    }
     else
-        return wxString("");
+    {
+        wxFAIL_MSG( wxT("bad index in wxFileHistory::GetHistoryFile") );
+    }
+
+    return s;
 }
 
 void wxFileHistory::UseMenu(wxMenu *menu)