Commit d9ed8a30 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: automatic selection of plugin when loading a file with .kicad_pcb...

Pcbnew: automatic selection of plugin when loading a file with .kicad_pcb extension from history list.
Very minor other fixes
parent b59cebb2
...@@ -185,27 +185,24 @@ const wxString GetPCBDefaultLayerName( int aLayerNumber ) ...@@ -185,27 +185,24 @@ const wxString GetPCBDefaultLayerName( int aLayerNumber )
{ {
const wxChar* txt; const wxChar* txt;
// These are only default layer names. For Pcbnew the copper names
// may be over-ridden in the BOARD (*.brd) file.
// Use a switch to explicitly show the mapping more clearly // Use a switch to explicitly show the mapping more clearly
switch( aLayerNumber ) switch( aLayerNumber )
{ {
case LAYER_N_FRONT: txt = _( "Front" ); break; case LAYER_N_FRONT: txt = _( "Front" ); break;
case LAYER_N_2: txt = _( "Inner2" ); break; case LAYER_N_2: txt = _( "Inner1" ); break;
case LAYER_N_3: txt = _( "Inner3" ); break; case LAYER_N_3: txt = _( "Inner2" ); break;
case LAYER_N_4: txt = _( "Inner4" ); break; case LAYER_N_4: txt = _( "Inner3" ); break;
case LAYER_N_5: txt = _( "Inner5" ); break; case LAYER_N_5: txt = _( "Inner4" ); break;
case LAYER_N_6: txt = _( "Inner6" ); break; case LAYER_N_6: txt = _( "Inner5" ); break;
case LAYER_N_7: txt = _( "Inner7" ); break; case LAYER_N_7: txt = _( "Inner6" ); break;
case LAYER_N_8: txt = _( "Inner8" ); break; case LAYER_N_8: txt = _( "Inner7" ); break;
case LAYER_N_9: txt = _( "Inner9" ); break; case LAYER_N_9: txt = _( "Inner8" ); break;
case LAYER_N_10: txt = _( "Inner10" ); break; case LAYER_N_10: txt = _( "Inner9" ); break;
case LAYER_N_11: txt = _( "Inner11" ); break; case LAYER_N_11: txt = _( "Inner10" ); break;
case LAYER_N_12: txt = _( "Inner12" ); break; case LAYER_N_12: txt = _( "Inner11" ); break;
case LAYER_N_13: txt = _( "Inner13" ); break; case LAYER_N_13: txt = _( "Inner12" ); break;
case LAYER_N_14: txt = _( "Inner14" ); break; case LAYER_N_14: txt = _( "Inner13" ); break;
case LAYER_N_15: txt = _( "Inner15" ); break; case LAYER_N_15: txt = _( "Inner14" ); break;
case LAYER_N_BACK: txt = _( "Back" ); break; case LAYER_N_BACK: txt = _( "Back" ); break;
case ADHESIVE_N_BACK: txt = _( "Adhes_Back" ); break; case ADHESIVE_N_BACK: txt = _( "Adhes_Back" ); break;
case ADHESIVE_N_FRONT: txt = _( "Adhes_Front" ); break; case ADHESIVE_N_FRONT: txt = _( "Adhes_Front" ); break;
...@@ -220,7 +217,7 @@ const wxString GetPCBDefaultLayerName( int aLayerNumber ) ...@@ -220,7 +217,7 @@ const wxString GetPCBDefaultLayerName( int aLayerNumber )
case ECO1_N: txt = _( "Eco1" ); break; case ECO1_N: txt = _( "Eco1" ); break;
case ECO2_N: txt = _( "Eco2" ); break; case ECO2_N: txt = _( "Eco2" ); break;
case EDGE_N: txt = _( "PCB_Edges" ); break; case EDGE_N: txt = _( "PCB_Edges" ); break;
default: txt = _( "BAD INDEX" ); break; default: txt = wxT( "BAD INDEX" ); break;
} }
return wxString( txt ); return wxString( txt );
......
...@@ -660,8 +660,8 @@ bool DIALOG_LAYERS_SETUP::testLayerNames() ...@@ -660,8 +660,8 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
// 3) cannot have " chars // 3) cannot have " chars
// 4) cannot be 'signal' // 4) cannot be 'signal'
// 5) must be unique. // 5) must be unique.
// 6) cannot have illegal chars in filenames ( some filenames are built from layer names )
static const wxString badchars( wxT("%$\" ") ); static const wxString badchars( wxT("%$\" /\\.") );
if( name == wxEmptyString ) if( name == wxEmptyString )
{ {
......
...@@ -176,10 +176,12 @@ the changes?" ) ) ) ...@@ -176,10 +176,12 @@ the changes?" ) ) )
// load a BOARD. Order is subject to change as KICAD plugin matures. // load a BOARD. Order is subject to change as KICAD plugin matures.
// User may occasionally use the wrong plugin to load a *.brd file, // User may occasionally use the wrong plugin to load a *.brd file,
// but eventually *.kicad_pcb will be more common than legacy *.brd files. // but eventually *.kicad_pcb will be more common than legacy *.brd files.
static const struct { static const struct
{
const wxString& filter; const wxString& filter;
IO_MGR::PCB_FILE_T pluginType; IO_MGR::PCB_FILE_T pluginType;
} loaders[] = { } loaders[] =
{
{ LegacyPcbFileWildcard, IO_MGR::LEGACY }, { LegacyPcbFileWildcard, IO_MGR::LEGACY },
{ PcbFileWildcard, IO_MGR::KICAD }, { PcbFileWildcard, IO_MGR::KICAD },
{ EaglePcbFileWildcard, IO_MGR::EAGLE }, { EaglePcbFileWildcard, IO_MGR::EAGLE },
...@@ -216,6 +218,12 @@ the changes?" ) ) ) ...@@ -216,6 +218,12 @@ the changes?" ) ) )
int chosenFilter = dlg.GetFilterIndex(); int chosenFilter = dlg.GetFilterIndex();
pluginType = loaders[chosenFilter].pluginType; pluginType = loaders[chosenFilter].pluginType;
} }
else // if a filename is given, force IO_MGR::KICAD if the file est is kicad_pcb
// for instance if the filename comes from file history
{
if( fileName.GetExt() == IO_MGR::GetFileExtension( IO_MGR::KICAD ) )
pluginType = IO_MGR::KICAD;
}
PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) ); PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) );
......
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