-wxString wxFileHistory::GetHistoryFile(int i) const
-{
- wxString s;
- if ( i < m_fileHistoryN )
- {
- s = m_fileHistory[i];
- }
- else
- {
- wxFAIL_MSG( wxT("bad index in wxFileHistory::GetHistoryFile") );
- }
-
- return s;
-}
-
-void wxFileHistory::UseMenu(wxMenu *menu)
-{
- if (!m_fileMenus.Member(menu))
- m_fileMenus.Append(menu);
-}
-
-void wxFileHistory::RemoveMenu(wxMenu *menu)
-{
- m_fileMenus.DeleteObject(menu);
-}
-
-#if wxUSE_CONFIG
-void wxFileHistory::Load(wxConfigBase& config)
-{
- m_fileHistoryN = 0;
- wxString buf;
- buf.Printf(wxT("file%d"), m_fileHistoryN+1);
- wxString historyFile;
- while ((m_fileHistoryN <= m_fileMaxFiles) && config.Read(buf, &historyFile) && (historyFile != wxT("")))
- {
- m_fileHistory[m_fileHistoryN] = copystring((const wxChar*) historyFile);
- m_fileHistoryN ++;
- buf.Printf(wxT("file%d"), m_fileHistoryN+1);
- historyFile = wxT("");
- }
- AddFilesToMenu();
-}
-
-void wxFileHistory::Save(wxConfigBase& config)
-{
- int i;
- for (i = 0; i < m_fileHistoryN; i++)
- {
- wxString buf;
- buf.Printf(wxT("file%d"), i+1);
- config.Write(buf, wxString(m_fileHistory[i]));
- }
-}
-#endif // wxUSE_CONFIG
-
-void wxFileHistory::AddFilesToMenu()
-{
- if (m_fileHistoryN > 0)
- {
- wxNode* node = m_fileMenus.First();
- while (node)
- {
- wxMenu* menu = (wxMenu*) node->Data();
- menu->AppendSeparator();
- int i;
- for (i = 0; i < m_fileHistoryN; i++)
- {
- if (m_fileHistory[i])
- {
- wxString buf;
- buf.Printf(s_MRUEntryFormat, i+1, m_fileHistory[i]);
- menu->Append(wxID_FILE1+i, buf);
- }
- }
- node = node->Next();