- // this is the directory of the last opened file
- wxString pathCurrent;
- wxSplitPath( m_fileHistory[0], &pathCurrent, NULL, NULL );
- for (i = 0; i < m_fileHistory.GetCount(); i++)
- {
- // if in same directory just show the filename; otherwise the full
- // path
- wxString pathInMenu, path, filename, ext;
- wxSplitPath( m_fileHistory[i], &path, &filename, &ext );
- if ( path == pathCurrent )
- {
- pathInMenu = filename;
- if ( !ext.empty() )
- pathInMenu = pathInMenu + wxFILE_SEP_EXT + ext;
- }
- else
- {
- // absolute path; could also set relative path
- pathInMenu = m_fileHistory[i];
- }
+ // insert the new file in the beginning of the file history
+ m_fileHistory.insert(m_fileHistory.begin(), file);
+ numFiles++;
+
+ // update the labels in all menus
+ for ( i = 0; i < numFiles; i++ )
+ {
+ // if in same directory just show the filename; otherwise the full path
+ const wxFileName fnOld(m_fileHistory[i]);