Fix paths for Copy default global library table.
This commit is contained in:
parent
a0236113da
commit
a872ed11bf
|
@ -28,12 +28,13 @@
|
||||||
|
|
||||||
|
|
||||||
DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG( wxWindow* aParent,
|
DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG( wxWindow* aParent,
|
||||||
const wxString& aTableName ) :
|
const wxString& aTableName,
|
||||||
|
const KIWAY::FACE_T aFaceType ) :
|
||||||
DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE( aParent ),
|
DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE( aParent ),
|
||||||
m_defaultFileFound( false )
|
m_defaultFileFound( false ),
|
||||||
|
m_faceType( aFaceType ),
|
||||||
|
m_tableName( aTableName )
|
||||||
{
|
{
|
||||||
m_tableName = aTableName;
|
|
||||||
|
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
|
|
||||||
tmp.Printf( _( "Configure Global %s Library Table" ), aTableName.Capitalize() );
|
tmp.Printf( _( "Configure Global %s Library Table" ), aTableName.Capitalize() );
|
||||||
|
@ -106,7 +107,7 @@ bool DIALOG_GLOBAL_LIB_TABLE_CONFIG::TransferDataToWindow()
|
||||||
|
|
||||||
SEARCH_STACK ss;
|
SEARCH_STACK ss;
|
||||||
|
|
||||||
SystemDirsAppend( &ss );
|
GlobalPathsAppend( &ss, m_faceType );
|
||||||
|
|
||||||
wxString templatePath =
|
wxString templatePath =
|
||||||
Pgm().GetLocalEnvVariables().at( wxT( "KICAD7_TEMPLATE_DIR" ) ).GetValue();
|
Pgm().GetLocalEnvVariables().at( wxT( "KICAD7_TEMPLATE_DIR" ) ).GetValue();
|
||||||
|
|
|
@ -28,77 +28,12 @@
|
||||||
#include <search_stack.h>
|
#include <search_stack.h>
|
||||||
#include <systemdirsappend.h>
|
#include <systemdirsappend.h>
|
||||||
|
|
||||||
/// Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings.
|
|
||||||
/// A non-member function so it an be moved easily, plus it's nobody's business.
|
|
||||||
static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
|
|
||||||
{
|
|
||||||
SEARCH_STACK bases;
|
|
||||||
|
|
||||||
SystemDirsAppend( &bases );
|
|
||||||
aDst->Clear();
|
|
||||||
|
|
||||||
for( unsigned i = 0; i < bases.GetCount(); ++i )
|
|
||||||
{
|
|
||||||
wxFileName fn( bases[i], wxEmptyString );
|
|
||||||
|
|
||||||
// Add schematic library file path to search path list.
|
|
||||||
// we must add <kicad path>/library and <kicad path>/library/doc
|
|
||||||
if( aId == KIWAY::FACE_SCH )
|
|
||||||
{
|
|
||||||
// Add schematic doc file path (library/doc) to search path list.
|
|
||||||
|
|
||||||
fn.AppendDir( wxT( "library" ) );
|
|
||||||
aDst->AddPaths( fn.GetPath() );
|
|
||||||
|
|
||||||
fn.AppendDir( wxT( "doc" ) );
|
|
||||||
aDst->AddPaths( fn.GetPath() );
|
|
||||||
|
|
||||||
fn.RemoveLastDir();
|
|
||||||
fn.RemoveLastDir(); // "../../" up twice, removing library/doc/
|
|
||||||
|
|
||||||
fn.AppendDir( wxT( "symbols" ) );
|
|
||||||
aDst->AddPaths( fn.GetPath() );
|
|
||||||
|
|
||||||
fn.AppendDir( wxT( "doc" ) );
|
|
||||||
aDst->AddPaths( fn.GetPath() );
|
|
||||||
|
|
||||||
fn.RemoveLastDir();
|
|
||||||
fn.RemoveLastDir(); // "../../" up twice, removing symbols/doc/
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add PCB library file path to search path list.
|
|
||||||
if( aId == KIWAY::FACE_PCB || aId == KIWAY::FACE_CVPCB )
|
|
||||||
{
|
|
||||||
fn.AppendDir( wxT( "modules" ) );
|
|
||||||
aDst->AddPaths( fn.GetPath() );
|
|
||||||
fn.RemoveLastDir();
|
|
||||||
|
|
||||||
fn.AppendDir( wxT( "footprints" ) );
|
|
||||||
aDst->AddPaths( fn.GetPath() );
|
|
||||||
fn.RemoveLastDir();
|
|
||||||
|
|
||||||
// Add 3D module library file path to search path list.
|
|
||||||
fn.AppendDir( wxT( "3dmodels" ) );
|
|
||||||
aDst->AddPaths( fn.GetPath() );
|
|
||||||
fn.RemoveLastDir();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add KiCad template file path to search path list.
|
|
||||||
fn.AppendDir( wxT( "template" ) );
|
|
||||||
aDst->AddPaths( fn.GetPath() );
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef __WXMAC__
|
|
||||||
aDst->AddPaths( wxT( "/usr/local/share" ) );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool KIFACE_BASE::start_common( int aCtlBits )
|
bool KIFACE_BASE::start_common( int aCtlBits )
|
||||||
{
|
{
|
||||||
m_start_flags = aCtlBits;
|
m_start_flags = aCtlBits;
|
||||||
m_bm.Init();
|
m_bm.Init();
|
||||||
setSearchPaths( &m_bm.m_search, m_id );
|
GlobalPathsAppend( &m_bm.m_search, m_id );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
|
#include <systemdirsappend.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <kiplatform/environment.h>
|
#include <kiplatform/environment.h>
|
||||||
#include <search_stack.h>
|
#include <search_stack.h>
|
||||||
|
@ -172,3 +173,67 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack )
|
||||||
aSearchStack->Show( __func__ );
|
aSearchStack->Show( __func__ );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GlobalPathsAppend( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
|
||||||
|
{
|
||||||
|
SEARCH_STACK bases;
|
||||||
|
|
||||||
|
SystemDirsAppend( &bases );
|
||||||
|
aDst->Clear();
|
||||||
|
|
||||||
|
for( unsigned i = 0; i < bases.GetCount(); ++i )
|
||||||
|
{
|
||||||
|
wxFileName fn( bases[i], wxEmptyString );
|
||||||
|
|
||||||
|
// Add schematic library file path to search path list.
|
||||||
|
// we must add <kicad path>/library and <kicad path>/library/doc
|
||||||
|
if( aId == KIWAY::FACE_SCH )
|
||||||
|
{
|
||||||
|
// Add schematic doc file path (library/doc) to search path list.
|
||||||
|
|
||||||
|
fn.AppendDir( wxT( "library" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
|
||||||
|
fn.AppendDir( wxT( "doc" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
fn.RemoveLastDir(); // "../../" up twice, removing library/doc/
|
||||||
|
|
||||||
|
fn.AppendDir( wxT( "symbols" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
|
||||||
|
fn.AppendDir( wxT( "doc" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
fn.RemoveLastDir(); // "../../" up twice, removing symbols/doc/
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add PCB library file path to search path list.
|
||||||
|
if( aId == KIWAY::FACE_PCB || aId == KIWAY::FACE_CVPCB )
|
||||||
|
{
|
||||||
|
fn.AppendDir( wxT( "modules" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
|
||||||
|
fn.AppendDir( wxT( "footprints" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
|
||||||
|
// Add 3D module library file path to search path list.
|
||||||
|
fn.AppendDir( wxT( "3dmodels" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add KiCad template file path to search path list.
|
||||||
|
fn.AppendDir( wxT( "template" ) );
|
||||||
|
aDst->AddPaths( fn.GetPath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef __WXMAC__
|
||||||
|
aDst->AddPaths( wxT( "/usr/local/share" ) );
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -22,13 +22,14 @@
|
||||||
|
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <kiface_base.h>
|
#include <kiface_base.h>
|
||||||
|
#include <kiway.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
||||||
#include "symbol_lib_table.h"
|
#include "symbol_lib_table.h"
|
||||||
|
|
||||||
|
|
||||||
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG( wxWindow* aParent ) :
|
DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG( wxWindow* aParent ) :
|
||||||
DIALOG_GLOBAL_LIB_TABLE_CONFIG( aParent, _( "symbol" ) )
|
DIALOG_GLOBAL_LIB_TABLE_CONFIG( aParent, _( "symbol" ), KIWAY::FACE_SCH )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,15 @@
|
||||||
|
|
||||||
#include "dialog_global_lib_table_config_base.h"
|
#include "dialog_global_lib_table_config_base.h"
|
||||||
|
|
||||||
|
#include <kiway.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
|
||||||
|
|
||||||
class DIALOG_GLOBAL_LIB_TABLE_CONFIG : public DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE
|
class DIALOG_GLOBAL_LIB_TABLE_CONFIG : public DIALOG_GLOBAL_LIB_TABLE_CONFIG_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DIALOG_GLOBAL_LIB_TABLE_CONFIG( wxWindow* aParent, const wxString& aTableName );
|
DIALOG_GLOBAL_LIB_TABLE_CONFIG( wxWindow* aParent, const wxString& aTableName,
|
||||||
|
const KIWAY::FACE_T aFaceType );
|
||||||
virtual ~DIALOG_GLOBAL_LIB_TABLE_CONFIG();
|
virtual ~DIALOG_GLOBAL_LIB_TABLE_CONFIG();
|
||||||
|
|
||||||
virtual wxFileName GetGlobalTableFileName() = 0;
|
virtual wxFileName GetGlobalTableFileName() = 0;
|
||||||
|
@ -42,6 +44,7 @@ protected:
|
||||||
|
|
||||||
wxString m_tableName;
|
wxString m_tableName;
|
||||||
bool m_defaultFileFound;
|
bool m_defaultFileFound;
|
||||||
|
KIWAY::FACE_T m_faceType;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DIALOG_GLOBAL_LIB_TABLE_CONFIG_H_
|
#endif // _DIALOG_GLOBAL_LIB_TABLE_CONFIG_H_
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#ifndef INCLUDE__SYSTEM_DIRS_APPEND_H_
|
#ifndef INCLUDE__SYSTEM_DIRS_APPEND_H_
|
||||||
#define INCLUDE__SYSTEM_DIRS_APPEND_H_
|
#define INCLUDE__SYSTEM_DIRS_APPEND_H_
|
||||||
|
|
||||||
|
#include <kiway.h>
|
||||||
|
|
||||||
class SEARCH_STACK;
|
class SEARCH_STACK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,4 +39,10 @@ class SEARCH_STACK;
|
||||||
*/
|
*/
|
||||||
void SystemDirsAppend( SEARCH_STACK* aSearchStack );
|
void SystemDirsAppend( SEARCH_STACK* aSearchStack );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings.
|
||||||
|
* Adds libraries, docs, template paths to the search stack.
|
||||||
|
*/
|
||||||
|
void GlobalPathsAppend( SEARCH_STACK* aDst, KIWAY::FACE_T aId );
|
||||||
|
|
||||||
#endif // INCLUDE__SYSTEM_DIRS_APPEND_H_
|
#endif // INCLUDE__SYSTEM_DIRS_APPEND_H_
|
||||||
|
|
|
@ -22,12 +22,13 @@
|
||||||
|
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <kiface_base.h>
|
#include <kiface_base.h>
|
||||||
|
#include <kiway.h>
|
||||||
|
|
||||||
#include "fp_lib_table.h"
|
#include "fp_lib_table.h"
|
||||||
|
|
||||||
|
|
||||||
DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG( wxWindow* aParent ) :
|
DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG( wxWindow* aParent ) :
|
||||||
DIALOG_GLOBAL_LIB_TABLE_CONFIG( aParent, _( "footprint" ) )
|
DIALOG_GLOBAL_LIB_TABLE_CONFIG( aParent, _( "footprint" ), KIWAY::FACE_PCB )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue