Commit c5d16c85 authored by jerryjacobs's avatar jerryjacobs

Improve filetypes for opening gerber

parent 7de19cb6
...@@ -112,8 +112,10 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) ...@@ -112,8 +112,10 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
/*******************************************************************************************/ /*******************************************************************************************/
bool WinEDA_GerberFrame::LoadOneGerberFile( const wxString& FullFileName, bool
wxDC* DC, int mode ) WinEDA_GerberFrame::LoadOneGerberFile( const wxString& FullFileName,
wxDC* DC,
int mode )
/*******************************************************************************************/ /*******************************************************************************************/
/* /*
...@@ -123,36 +125,57 @@ bool WinEDA_GerberFrame::LoadOneGerberFile( const wxString& FullFileName, ...@@ -123,36 +125,57 @@ bool WinEDA_GerberFrame::LoadOneGerberFile( const wxString& FullFileName,
* 1 si OK * 1 si OK
*/ */
{ {
wxString wildcard; wxString filetypes;
wxFileName fn = FullFileName; wxFileName filename = FullFileName;
ActiveScreen = GetScreen(); ActiveScreen = GetScreen();
if( !fn.IsOk() ) if( !filename.IsOk() )
{ {
wildcard.Printf( _( "Gerber files (.%s .gbr .gbx .lgr .ger .pho)| \ wxString current_path = filename.GetPath();
*.%s;*.gbr;*.gbx;*.lgr;*.ger;*.pho|" ),
g_PenFilenameExt.c_str(), g_PenFilenameExt.c_str()); /* Standard gerber filetypes */
wildcard += AllFilesWildcard; filetypes += _("Gerber files (.gbr .gbx .lgr .ger .pho)| \
*.gbr;*.GBR;*.gbx;*.GBX;*.lgr;*.LGR;*.ger;*.GER;*.pho;*.PHO|");
wxString currpath = fn.GetPath();
if ( currpath.IsEmpty() ) /* Special gerber filetypes */
currpath = wxGetCwd(); filetypes += _("Top layer (*.GTL)|*.GTL;*.gtl|");
wxFileDialog dlg( this, _( "Open Gerber File" ), currpath, filetypes += _("Bottom solder resist (*.GBS)|*.GBS;*.gbs|");
fn.GetFullName(), wildcard, filetypes += _("Top solder resist (*.GTS)|*.GTS;*.gts|");
filetypes += _("Bottom overlay (*.GBO)|*.GBO;*.gbo|");
filetypes += _("Top overlay (*.GTO)|*.GTO;*.gto|");
filetypes += _("Bottom paste (*.GBP)|*.GBP;*.gto|");
filetypes += _("Top paste (*.GTP)|*.GTP;*.gtp|");
filetypes += _("Keep-out layer (*.GKO)|*.GKO;*.gko|");
filetypes += _("Mechanical layers (*.GMx)|*.GM1;*.gm1;*.GM2;*.gm2;*.GM3;*.gm3|");
filetypes += _("Top Pad Master (*.GPT)|*.GPT;*.gpt|");
filetypes += _("Bottom Pad Master (*.GPB)|*.GPB;*.gpb|");
/* All filetypes */
filetypes += AllFilesWildcard;
/* Get current path if emtpy */
if ( current_path.IsEmpty() )
current_path = wxGetCwd();
wxFileDialog dlg( this,
_( "Open Gerber File" ),
current_path,
filename.GetFullName(),
filetypes,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return false; return false;
fn = dlg.GetPath(); filename = dlg.GetPath();
} }
GetScreen()->m_FileName = fn.GetFullPath(); GetScreen()->m_FileName = filename.GetFullPath();
wxSetWorkingDirectory( fn.GetPath() ); wxSetWorkingDirectory( filename.GetPath() );
fn.SetExt( g_PenFilenameExt ); filename.SetExt( g_PenFilenameExt );
if( Read_GERBER_File( DC, GetScreen()->m_FileName, fn.GetFullPath() ) ) if( Read_GERBER_File( DC, GetScreen()->m_FileName, filename.GetFullPath() ) )
SetLastProject( GetScreen()->m_FileName ); SetLastProject( GetScreen()->m_FileName );
Zoom_Automatique( FALSE ); Zoom_Automatique( FALSE );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment