-void wxCommandProcessor::ClearCommands()
-{
- wxNode *node = m_commands.First();
- while (node)
- {
- wxCommand *command = (wxCommand *)node->Data();
- delete command;
- delete node;
- node = m_commands.First();
- }
- m_currentCommand = (wxNode *) NULL;
-}
-
-// ----------------------------------------------------------------------------
-// File history processor
-// ----------------------------------------------------------------------------
-
-wxFileHistory::wxFileHistory(int maxFiles)
-{
- m_fileMaxFiles = maxFiles;
- m_fileHistoryN = 0;
- m_fileHistory = new wxChar *[m_fileMaxFiles];
-}
-
-wxFileHistory::~wxFileHistory()
-{
- int i;
- for (i = 0; i < m_fileHistoryN; i++)
- delete[] m_fileHistory[i];
- delete[] m_fileHistory;
-}
-
-// File history management
-void wxFileHistory::AddFileToHistory(const wxString& file)
-{
- int i;
- // Check we don't already have this file
- for (i = 0; i < m_fileHistoryN; i++)
- {
- if (m_fileHistory[i] && wxString(m_fileHistory[i]) == file)
- return;
- }
-
- // 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])
- {