← Back to team overview

kicad-developers team mailing list archive

Re: Gerber files opened from main app GUI

 

I would like to get some answers to Cirilo's quesitons. I have successfully
been using the attached patch, just to make the kicad app render the icons
and open correctly for all gerber files in the tree.

Nick


2014-01-11 3:53 GMT+01:00 Cirilo Bernardo <cirilo_bernardo@xxxxxxxxx>:

> 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
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
=== modified file 'common/wildcards_and_files_ext.cpp'
--- common/wildcards_and_files_ext.cpp	2013-07-19 18:27:22 +0000
+++ common/wildcards_and_files_ext.cpp	2014-01-12 22:29:17 +0000
@@ -42,7 +42,7 @@
 const wxString SchematicFileExtension( wxT( "sch" ) );
 const wxString NetlistFileExtension( wxT( "net" ) );
 const wxString ComponentFileExtension( wxT( "cmp" ) );
-const wxString GerberFileExtension( wxT( "pho" ) );
+const wxString GerberFileExtension( wxT( ".((gbr|(gb|gt)[alops])|pho)" ) );
 
 const wxString LegacyPcbFileExtension( wxT( "brd" ) );
 const wxString KiCadPcbFileExtension( wxT( "kicad_pcb" ) );


Follow ups

References