← Back to team overview

kicad-developers team mailing list archive

Gerber files opened from main app GUI

 

I've been looking into the issue of the main kicad GUI not associating GB?, GT? files with Gerbview and I have a few observations and questions:

1. the string GerberFileExtension is currently defined in common/wildcards_and_files_ext.cpp but it is only used in the kicad main app.

2. likewise, GerberFileWildCard is defined in the same file and only used in the main app.

3. in kicad/tree_project_frame.{cpp,h}, TREE_PROJECT_FRAME::GetFileWildcard does not appear to be used anywhere in the KiCad tree.


My questions:

1. Current definition of GerberFileExtension is:

const wxString GerberFileExtension( wxT( "pho" ) );

If I change it to this line:

const wxString GerberFileExtension( wxT( ".((gbr|(gb|gt)[alops])|pho)" ) );

then the kicad main app correctly associates the various gerber file extensions with gerbview.
Is is a good idea to make this change? After all, only TREE_PROJECT_FRAME in kicad/ makes use of it.

1b. The leading '.' in the string is essential since the string is used to form a regexp by adding it to a regexp string beginning with "^.*\" In fact, I wonder if the regexp part (line 497 of tree_project_frame.cpp):

            reg.Compile( wxString::FromAscii( "^.*\\" ) + ext +
                         wxString::FromAscii( "$" ), wxRE_ICASE );

should actually be:

            reg.Compile( wxString::FromAscii( "^.*\\." ) + ext +
                         wxString::FromAscii( "$" ), wxRE_ICASE );

This way we are assured that there is a '.' before the extension. Any comments?


2. Since no other app makes use of GerberFileExtension/GerberFileWildCard, should we simply move these definitions to tree_project_frame.cpp ?


3. Is TREE_PROJECT_FRAME::GetFileWildcard cruft which can be removed or is it part of code in development?

Cheers,
Cirilo



Follow ups