Corrected template names shown in the dialog when creating a new file

This commit is contained in:
Zane U. Ji 2013-10-26 21:21:47 +08:00
parent 9b385e7caa
commit e39638ea3b
1 changed files with 4 additions and 16 deletions

View File

@ -2856,24 +2856,11 @@ void MyFrame::OnNew ( wxCommandEvent& WXUNUSED ( event ) )
if ( wxFileName::DirExists ( templateDir ) )
{
wxString templateMask, name, extension, entry;
wxFileName fn;
templateMask = templateDir + wxFileName::GetPathSeparator() + _T ( "*.*" );
templateFile = wxFindFirstFile ( templateMask, wxFILE );
wxFileName fn;
if ( !templateFile.empty() )
while ( !templateFile.empty() )
{
fn.Assign ( templateFile );
name = fn.GetName();
extension = fn.GetExt();
entry.Printf ( _T ( "%s (*.%s)" ), name.c_str(), extension.c_str() );
templateArray.Add ( entry );
for ( ;; )
{
templateFile = wxFindNextFile();
if ( templateFile.empty() )
break;
templateFile.Replace ( _T("_"), _T(" ") );
fn.Assign ( templateFile );
name = fn.GetName();
@ -2881,7 +2868,8 @@ void MyFrame::OnNew ( wxCommandEvent& WXUNUSED ( event ) )
entry.Printf ( _T ( "%s (*.%s)" ), name.c_str(), extension.c_str() );
templateArray.Add ( entry );
}
templateFile = wxFindNextFile();
}
templateArray.Sort();
templateArray.Insert ( defaultSelection, 0 );