Theme Preferences, Save Files overwrites all components after asking

This commit is contained in:
Paul Licameli 2016-05-30 16:30:39 -04:00
parent 8da61cdbb1
commit efc0e67934
1 changed files with 30 additions and 16 deletions

View File

@ -960,27 +960,41 @@ void ThemeBase::SaveComponents()
if( (mBitmapFlags[i] & resFlagInternal)==0)
{
FileName = FileNames::ThemeComponent( mBitmapNames[i] );
if( !wxFileExists( FileName ))
if( wxFileExists( FileName ))
{
if( !mImages[i].SaveFile( FileName, wxBITMAP_TYPE_PNG ))
{
wxMessageBox(
wxString::Format(
_("Audacity could not save file:\n %s"),
FileName.c_str() ));
return;
}
n++;
++n;
break;
}
}
}
if( n==0 )
if (n > 0)
{
wxMessageBox(
wxString::Format(
_("All required files in:\n %s\nwere already present."),
FileNames::ThemeComponentsDir().c_str() ));
return;
auto result =
wxMessageBox(
wxString::Format(
_("Some required files in:\n %s\nwere already present. Overwrite?"),
FileNames::ThemeComponentsDir().c_str()),
wxMessageBoxCaptionStr,
wxYES_NO | wxNO_DEFAULT);
if(result == wxNO)
return;
}
for(i=0;i<(int)mImages.GetCount();i++)
{
if( (mBitmapFlags[i] & resFlagInternal)==0)
{
FileName = FileNames::ThemeComponent( mBitmapNames[i] );
if( !mImages[i].SaveFile( FileName, wxBITMAP_TYPE_PNG ))
{
wxMessageBox(
wxString::Format(
_("Audacity could not save file:\n %s"),
FileName.c_str() ));
return;
}
}
}
wxMessageBox(
wxString::Format(