Index: wxcasframe.cpp
===================================================================
--- wxcasframe.cpp	(revisão 5413)
+++ wxcasframe.cpp	(cópia de trabalho)
@@ -350,24 +350,54 @@
 {
 	wxImage * statImage = GetStatImage ();
 
-	wxString saveFileName = wxFileSelector ( _( "Save Statistics Image" ),
-	                        wxFileName::GetHomeDir (),
-	                        WxCasCte::AMULESIG_IMG_NAME,
-	                        ( const wxChar * ) NULL,
-	                        wxT ( "PNG files (*.png)|*.png|" )
-	                        wxT ( "JPEG files (*.jpg)|*.jpg|" )
-	                        wxT ( "BMP files (*.bmp)|*.bmp|" ),
-	                        wxSAVE );
+	wxFileDialog saveFileDialog ( this, _( "Save Statistics Image" ),
+				      wxFileName::GetHomeDir (),
+				      WxCasCte::AMULESIG_IMG_NAME,
+				      wxT ( "PNG files (*.png)|*.png|" )
+				      wxT ( "JPEG files (*.jpg)|*.jpg|" )
+				      wxT ( "BMP files (*.bmp)|*.bmp" ),
+				      wxSAVE | wxOVERWRITE_PROMPT );
 
-	if ( !saveFileName.empty () ) {
-		// This one guesses image format from filename extension
-		// (it may fail if the extension is not recognized):
-
-		if ( !statImage->SaveFile ( saveFileName ) ) {
-			wxMessageBox ( _( "No handler for this file type." ),
-			               _( "File was not saved" ), wxOK | wxCENTRE, this );
+	if ( saveFileDialog.ShowModal () == wxID_OK )
+	{
+	 	wxString saveFileName = saveFileDialog.GetPath ();
+		wxString saveFileExt = saveFileName.AfterLast ( wxT('.') );
+		saveFileExt.MakeLower ();
+		
+		// Checking for the file extension
+		if ( saveFileExt == saveFileDialog.GetPath ().MakeLower () ||
+		     ( saveFileExt != wxT ( "bmp" ) &&
+		       saveFileExt != wxT ( "jpg" ) &&
+		       saveFileExt != wxT ( "png" ) ) )
+		{
+			// No "valid" extension found. I'll just pretend the user didn't put one.
+			wxMessageBox ( saveFileExt, wxT("Testing2"), wxOK, this);
+			switch ( saveFileDialog.GetFilterIndex () )
+			{
+				case 0:
+					saveFileName += wxT ( ".png" );
+					break;
+				case 1:
+					saveFileName += wxT ( ".jpg" );
+					break;
+				case 2:
+					saveFileName += wxT ( ".bmp" );
+					break;
+			};
 		}
+		
+		// Saving
+		if ( !saveFileName.empty () )
+		{
+			wxMessageBox ( saveFileName, wxT("Just testing: "),
+					wxOK | wxCENTRE, this );
+			if ( !statImage->SaveFile ( saveFileName ) ) {
+				wxMessageBox ( _( "No handler for this file type." ),
+				               _( "File was not saved" ), wxOK | wxCENTRE, this );
+			}
+		}
 	}
+
 	delete statImage;
 }
 
