- m_fileHistoryN ++;
- }
- // Shuffle filenames down
- for (i = (m_fileHistoryN-1); i > 0; i--)
- {
- m_fileHistory[i] = m_fileHistory[i-1];
- }
- m_fileHistory[0] = copystring(file);
-
- for (i = 0; i < m_fileHistoryN; i++)
- if (m_fileHistory[i])
- {
- wxString buf;
- buf.Printf("&%d %s", i+1, m_fileHistory[i]);
- wxNode* node = m_fileMenus.First();
- while (node)
- {
+
+ // Add to the project file history:
+ // Move existing files (if any) down so we can insert file at beginning.
+
+ // First delete filename that has popped off the end of the array (if any)
+ if (m_fileHistoryN == m_fileMaxFiles)
+ {
+ delete[] m_fileHistory[m_fileMaxFiles-1];
+ m_fileHistory[m_fileMaxFiles-1] = (wxChar *) NULL;
+ }
+ if (m_fileHistoryN < m_fileMaxFiles)
+ {
+ wxNode* node = m_fileMenus.First();
+ while (node)
+ {
+ wxMenu* menu = (wxMenu*) node->Data();
+ if (m_fileHistoryN == 0)
+ menu->AppendSeparator();
+ menu->Append(wxID_FILE1+m_fileHistoryN, _("[EMPTY]"));
+ node = node->Next();
+ }
+ m_fileHistoryN ++;
+ }
+ // Shuffle filenames down
+ for (i = (m_fileHistoryN-1); i > 0; i--)
+ {
+ m_fileHistory[i] = m_fileHistory[i-1];
+ }
+ m_fileHistory[0] = copystring(file);
+
+ for (i = 0; i < m_fileHistoryN; i++)
+ if (m_fileHistory[i])
+ {
+ wxString buf;
+ buf.Printf(s_MRUEntryFormat, i+1, m_fileHistory[i]);
+ wxNode* node = m_fileMenus.First();
+ while (node)
+ {
+ wxMenu* menu = (wxMenu*) node->Data();
+ menu->SetLabel(wxID_FILE1+i, buf);
+ node = node->Next();
+ }
+ }
+}
+
+void wxFileHistory::RemoveFileFromHistory(int i)
+{
+ wxCHECK_RET( i < m_fileHistoryN,
+ wxT("invalid index in wxFileHistory::RemoveFileFromHistory") );
+
+ wxNode* node = m_fileMenus.First();
+ while ( node )
+ {