Library search path fixes, library configuration dialog fixes, and code cleaning.
Added application method to fix searching for user libraries. Fixed documentation search path bug. Moved auto pan setting from draw frame to draw panel were it is defined. Some minor device context drawing changes.
This commit is contained in:
parent
cf752a5812
commit
dfb88c6495
|
@ -38,7 +38,7 @@ int S3D_MASTER:: ReadData()
|
||||||
|
|
||||||
if( !fn.FileExists() )
|
if( !fn.FileExists() )
|
||||||
{
|
{
|
||||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullPath() );
|
tmp = wxGetApp().FindLibraryPath( fn );
|
||||||
|
|
||||||
if( !tmp )
|
if( !tmp )
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,8 +55,7 @@ BASE_SCREEN::~BASE_SCREEN()
|
||||||
|
|
||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
void
|
void BASE_SCREEN::InitDatas()
|
||||||
BASE_SCREEN::InitDatas()
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
{
|
{
|
||||||
if( m_Center )
|
if( m_Center )
|
||||||
|
@ -89,15 +88,13 @@ BASE_SCREEN::InitDatas()
|
||||||
* internal units used by the schematic screen is 1 mil (0.001"). Override
|
* internal units used by the schematic screen is 1 mil (0.001"). Override
|
||||||
* this in derived classes that require internal units other than 1 mil.
|
* this in derived classes that require internal units other than 1 mil.
|
||||||
*/
|
*/
|
||||||
int
|
int BASE_SCREEN::GetInternalUnits( void )
|
||||||
BASE_SCREEN::GetInternalUnits( void )
|
|
||||||
{
|
{
|
||||||
return EESCHEMA_INTERNAL_UNIT;
|
return EESCHEMA_INTERNAL_UNIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
wxSize
|
wxSize BASE_SCREEN::ReturnPageSize( void )
|
||||||
BASE_SCREEN::ReturnPageSize( void )
|
|
||||||
/************************************/
|
/************************************/
|
||||||
{
|
{
|
||||||
int internal_units = GetInternalUnits();
|
int internal_units = GetInternalUnits();
|
||||||
|
@ -113,8 +110,7 @@ BASE_SCREEN::ReturnPageSize( void )
|
||||||
* @param ScreenPos = the screen (in pixel) position co convert
|
* @param ScreenPos = the screen (in pixel) position co convert
|
||||||
*/
|
*/
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
wxPoint
|
wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
|
||||||
BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
{
|
{
|
||||||
wxPoint curpos = ScreenPos;
|
wxPoint curpos = ScreenPos;
|
||||||
|
@ -130,7 +126,7 @@ BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
|
||||||
* @param the the current scale used to draw items on screen
|
* @param the the current scale used to draw items on screen
|
||||||
* draw coordinates are user coordinates * GetScalingFactor( )
|
* draw coordinates are user coordinates * GetScalingFactor( )
|
||||||
*/
|
*/
|
||||||
void BASE_SCREEN::SetScalingFactor(double aScale )
|
void BASE_SCREEN::SetScalingFactor(double aScale )
|
||||||
{
|
{
|
||||||
int zoom = static_cast<int>( ceil(aScale * m_ZoomScalar) );
|
int zoom = static_cast<int>( ceil(aScale * m_ZoomScalar) );
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,6 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
|
||||||
WinEDA_DrawFrame::~WinEDA_DrawFrame()
|
WinEDA_DrawFrame::~WinEDA_DrawFrame()
|
||||||
/****************************************/
|
/****************************************/
|
||||||
{
|
{
|
||||||
if( DrawPanel ) // Required: in WinEDA3D_DrawFrame, DrawPanel == NULL !
|
|
||||||
wxGetApp().m_EDA_Config->Write( wxT( "AutoPAN" ),
|
|
||||||
DrawPanel->m_AutoPAN_Enable );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,8 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
|
||||||
ForceCloseManageCurseur = NULL;
|
ForceCloseManageCurseur = NULL;
|
||||||
|
|
||||||
if( wxGetApp().m_EDA_Config )
|
if( wxGetApp().m_EDA_Config )
|
||||||
m_AutoPAN_Enable = wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), true );
|
m_AutoPAN_Enable = wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ),
|
||||||
|
true );
|
||||||
|
|
||||||
m_AutoPAN_Request = FALSE;
|
m_AutoPAN_Request = FALSE;
|
||||||
m_Block_Enable = FALSE;
|
m_Block_Enable = FALSE;
|
||||||
|
@ -83,6 +84,14 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WinEDA_DrawPanel::~WinEDA_DrawPanel()
|
||||||
|
{
|
||||||
|
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
||||||
|
|
||||||
|
wxGetApp().m_EDA_Config->Write( wxT( "AutoPAN" ), m_AutoPAN_Enable );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BASE_SCREEN* WinEDA_DrawPanel::GetScreen()
|
BASE_SCREEN* WinEDA_DrawPanel::GetScreen()
|
||||||
{
|
{
|
||||||
WinEDA_DrawFrame* parentFrame = m_Parent;
|
WinEDA_DrawFrame* parentFrame = m_Parent;
|
||||||
|
@ -189,7 +198,11 @@ void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC )
|
||||||
DC->SetBackgroundMode( wxTRANSPARENT );
|
DC->SetBackgroundMode( wxTRANSPARENT );
|
||||||
#ifdef WX_ZOOM
|
#ifdef WX_ZOOM
|
||||||
double scale = GetScreen()->GetScalingFactor( );
|
double scale = GetScreen()->GetScalingFactor( );
|
||||||
|
wxPoint origin = GetScreen()->m_DrawOrg;
|
||||||
|
wxLogDebug( wxT( "DC user scale factor: %0.3f, X origin: %d, Y " \
|
||||||
|
"origin: %d" ), scale, origin.x, origin.y );
|
||||||
DC->SetUserScale( scale, scale );
|
DC->SetUserScale( scale, scale );
|
||||||
|
DC->SetLogicalOrigin( origin.x, origin.y );
|
||||||
DoPrepareDC( *DC );
|
DoPrepareDC( *DC );
|
||||||
#endif
|
#endif
|
||||||
SetBoundaryBox();
|
SetBoundaryBox();
|
||||||
|
@ -582,13 +595,12 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PaintClipBox.Offset( org );
|
|
||||||
|
|
||||||
#ifdef WX_ZOOM
|
#ifdef WX_ZOOM
|
||||||
BASE_SCREEN* screen = GetScreen();
|
BASE_SCREEN* screen = GetScreen();
|
||||||
screen->Unscale( m_ClipBox.m_Pos );
|
screen->Unscale( m_ClipBox.m_Pos );
|
||||||
screen->Unscale( m_ClipBox.m_Size );
|
screen->Unscale( m_ClipBox.m_Size );
|
||||||
#else
|
#else
|
||||||
|
PaintClipBox.Offset( org );
|
||||||
m_ClipBox.SetX( PaintClipBox.GetX() );
|
m_ClipBox.SetX( PaintClipBox.GetX() );
|
||||||
m_ClipBox.SetY( PaintClipBox.GetY() );
|
m_ClipBox.SetY( PaintClipBox.GetY() );
|
||||||
m_ClipBox.SetWidth( PaintClipBox.GetWidth() );
|
m_ClipBox.SetWidth( PaintClipBox.GetWidth() );
|
||||||
|
|
|
@ -541,14 +541,15 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add schematic doc file path (library/doc)to search path list. */
|
/* Add schematic doc file path (library/doc)to search path list. */
|
||||||
|
fn.RemoveLastDir();
|
||||||
fn.AppendDir( wxT( "doc") );
|
fn.AppendDir( wxT( "doc") );
|
||||||
|
|
||||||
if( fn.IsDirReadable() )
|
if( fn.IsDirReadable() )
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT( "Adding <%s> to library search path list" ),
|
wxLogDebug( wxT( "Adding <%s> to library search path list" ),
|
||||||
fn.GetPath().c_str() );
|
fn.GetPath().c_str() );
|
||||||
m_libSearchPaths.Add( fn.GetPath() );
|
m_libSearchPaths.Add( fn.GetPath() );
|
||||||
}
|
}
|
||||||
fn.RemoveLastDir();
|
|
||||||
|
|
||||||
/* Add kicad template file path to search path list. */
|
/* Add kicad template file path to search path list. */
|
||||||
fn.RemoveLastDir();
|
fn.RemoveLastDir();
|
||||||
|
@ -1009,6 +1010,23 @@ wxString WinEDA_App::GetLibraryFile( const wxString& filename )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kicad saves user defined library files that are not in the standard
|
||||||
|
* library search path list with the full file path. Calling the library
|
||||||
|
* search path list with a user library file will fail. This helper method
|
||||||
|
* solves that problem.
|
||||||
|
*
|
||||||
|
* Returns a wxEmptyString if library file is not found.
|
||||||
|
*/
|
||||||
|
wxString WinEDA_App::FindLibraryPath( const wxString& fileName )
|
||||||
|
{
|
||||||
|
if( wxFileName::FileExists( fileName ) )
|
||||||
|
return fileName;
|
||||||
|
else
|
||||||
|
return GetLibraryPathList().FindValidPath( fileName );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run Python scripts
|
* Run Python scripts
|
||||||
*
|
*
|
||||||
|
|
|
@ -401,17 +401,9 @@ void GRPutPixel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int Color )
|
||||||
void GRSPutPixel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int Color )
|
void GRSPutPixel( EDA_Rect* ClipBox, wxDC* DC, int x, int y, int Color )
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
{
|
{
|
||||||
if( ClipBox ) /* suppression des pixels hors ecran */
|
if( ClipBox && !ClipBox->Inside( x, y ) )
|
||||||
{
|
return;
|
||||||
if( x < ClipBox->GetX() )
|
|
||||||
return;
|
|
||||||
if( y < ClipBox->GetY() )
|
|
||||||
return;
|
|
||||||
if( x > ( ClipBox->GetRight() ) )
|
|
||||||
return;
|
|
||||||
if( y > ( ClipBox->GetBottom() ) )
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GRSetColorPen( DC, Color );
|
GRSetColorPen( DC, Color );
|
||||||
DC->DrawPoint( x, y );
|
DC->DrawPoint( x, y );
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ static void auto_associe( WinEDA_CvpcbFrame* frame )
|
||||||
fn = g_ListName_Equ[ii];
|
fn = g_ListName_Equ[ii];
|
||||||
fn.SetExt( EquivFileExtension );
|
fn.SetExt( EquivFileExtension );
|
||||||
|
|
||||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
tmp = wxGetApp().FindLibraryPath( fn );
|
||||||
|
|
||||||
if( !tmp )
|
if( !tmp )
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,7 +72,7 @@ bool listlib()
|
||||||
fn = g_LibName_List[ii];
|
fn = g_LibName_List[ii];
|
||||||
fn.SetExt( ModuleFileExtension );
|
fn.SetExt( ModuleFileExtension );
|
||||||
|
|
||||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
tmp = wxGetApp().FindLibraryPath( fn );
|
||||||
|
|
||||||
if( !tmp )
|
if( !tmp )
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,7 @@ MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName )
|
||||||
fn = g_LibName_List[ii];
|
fn = g_LibName_List[ii];
|
||||||
fn.SetExt( ModuleFileExtension );
|
fn.SetExt( ModuleFileExtension );
|
||||||
|
|
||||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
tmp = wxGetApp().FindLibraryPath( fn );
|
||||||
|
|
||||||
if( !tmp )
|
if( !tmp )
|
||||||
{
|
{
|
||||||
|
|
|
@ -197,11 +197,7 @@ void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event )
|
||||||
wxArrayString Filenames;
|
wxArrayString Filenames;
|
||||||
|
|
||||||
ii = m_ListLibr->GetSelection();
|
ii = m_ListLibr->GetSelection();
|
||||||
if( event.GetId() == ADD_LIB ) /* Ajout apres selection */
|
if( ii == wxNOT_FOUND && event.GetId() != ADD_LIB )
|
||||||
{
|
|
||||||
ii++;
|
|
||||||
}
|
|
||||||
if( ii < 0 )
|
|
||||||
ii = 0;
|
ii = 0;
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
|
@ -231,9 +227,12 @@ void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event )
|
||||||
tmp = fn.GetName();
|
tmp = fn.GetName();
|
||||||
|
|
||||||
// Add or insert new library name.
|
// Add or insert new library name.
|
||||||
if( g_LibName_List.Index( tmp ) == wxNOT_FOUND )
|
if( g_LibName_List.Index( tmp, fn.IsCaseSensitive() ) == wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
g_LibName_List.Insert( tmp, ii++ );
|
if( event.GetId() == ADD_LIB )
|
||||||
|
g_LibName_List.Add( tmp );
|
||||||
|
else
|
||||||
|
g_LibName_List.Insert( tmp, ii++ );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -197,32 +197,23 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||||
* the selection
|
* the selection
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
wxString FullLibName, ShortLibName, Mask;
|
wxString tmp;
|
||||||
|
wxFileName fn;
|
||||||
|
|
||||||
ii = m_ListLibr->GetSelection();
|
ii = m_ListLibr->GetSelection();
|
||||||
if( ii < 0 )
|
if( ii == wxNOT_FOUND && event.GetId() != ID_ADD_LIB )
|
||||||
ii = 0;
|
ii = 0;
|
||||||
|
|
||||||
if( event.GetId() == ID_ADD_LIB )
|
|
||||||
{
|
|
||||||
if( m_ListLibr->GetCount() != 0 )
|
|
||||||
ii++; /* Add after selection */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString libpath = m_LibDirCtrl->GetValue();
|
wxString libpath = m_LibDirCtrl->GetValue();
|
||||||
if ( libpath.IsEmpty() )
|
if ( libpath.IsEmpty() )
|
||||||
libpath = g_RealLibDirBuffer;
|
libpath = g_RealLibDirBuffer;
|
||||||
|
|
||||||
Mask = wxT( "*" ) + CompLibFileExtension;
|
|
||||||
|
|
||||||
wxFileDialog FilesDialog( this, _( "Library files:" ), libpath,
|
wxFileDialog FilesDialog( this, _( "Library files:" ), libpath,
|
||||||
wxEmptyString, Mask,
|
wxEmptyString, CompLibFileWildcard,
|
||||||
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
|
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
|
||||||
|
|
||||||
int diag = FilesDialog.ShowModal();
|
if( FilesDialog.ShowModal() != wxID_OK )
|
||||||
if( diag != wxID_OK )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxArrayString Filenames;
|
wxArrayString Filenames;
|
||||||
|
@ -230,29 +221,35 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||||
|
|
||||||
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
|
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
FullLibName = Filenames[jj];
|
fn = Filenames[jj];
|
||||||
ShortLibName = MakeReducedFileName( FullLibName, libpath, CompLibFileExtension );
|
|
||||||
if( ShortLibName.IsEmpty() ) //Just in case...
|
/* If the library path is already in the library search paths
|
||||||
continue;
|
* list, just add the library name to the list. Otherwise, add
|
||||||
|
* the library name with the full path. */
|
||||||
|
if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) == wxNOT_FOUND )
|
||||||
|
tmp = fn.GetPathWithSep() + fn.GetName();
|
||||||
|
else
|
||||||
|
tmp = fn.GetName();
|
||||||
|
|
||||||
//Add or insert new library name, if not already in list
|
//Add or insert new library name, if not already in list
|
||||||
#ifdef __WINDOWS__
|
if( m_ListLibr->FindString( tmp, fn.IsCaseSensitive() ) == wxNOT_FOUND )
|
||||||
bool case_sensitive = false;
|
|
||||||
#else
|
|
||||||
bool case_sensitive = true;
|
|
||||||
#endif
|
|
||||||
if( m_ListLibr->FindString( ShortLibName, case_sensitive ) == wxNOT_FOUND )
|
|
||||||
{
|
{
|
||||||
m_LibListChanged = TRUE;
|
m_LibListChanged = TRUE;
|
||||||
m_ListLibr->Insert( ShortLibName, ii );
|
if( event.GetId() == ID_ADD_LIB )
|
||||||
|
g_LibName_List.Add( tmp );
|
||||||
|
else
|
||||||
|
g_LibName_List.Insert( tmp, ii++ );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg = wxT( "<" ) + tmp + wxT( "> : " ) +
|
||||||
msg << wxT( "<" ) << ShortLibName << wxT( "> : " ) << _( "Library already in use" );
|
_( "Library already in use" );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_ListLibr->Clear();
|
||||||
|
m_ListLibr->InsertItems( g_LibName_List, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ void LoadLibraries (WinEDA_DrawFrame* frame)
|
||||||
|
|
||||||
if( !fn.FileExists() )
|
if( !fn.FileExists() )
|
||||||
{
|
{
|
||||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
tmp = wxGetApp().FindLibraryPath( fn );
|
||||||
if( !tmp )
|
if( !tmp )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Library file <%s> not found." ),
|
msg.Printf( _( "Library file <%s> not found." ),
|
||||||
|
|
|
@ -132,6 +132,11 @@ public:
|
||||||
void SetTitle( const wxString& title ) { m_Title = title; }
|
void SetTitle( const wxString& title ) { m_Title = title; }
|
||||||
|
|
||||||
wxPathList& GetLibraryPathList() { return m_libSearchPaths; }
|
wxPathList& GetLibraryPathList() { return m_libSearchPaths; }
|
||||||
|
wxString FindLibraryPath( const wxString& fileName );
|
||||||
|
wxString FindLibraryPath( const wxFileName& fileName )
|
||||||
|
{
|
||||||
|
return FindLibraryPath( fileName.GetFullPath() );
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -212,7 +212,7 @@ public:
|
||||||
*/
|
*/
|
||||||
double GetScalingFactor()
|
double GetScalingFactor()
|
||||||
{
|
{
|
||||||
return (double) m_ZoomScalar / GetZoom();
|
return (double) m_ZoomScalar / (double) GetZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,9 @@ public:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructor and destructor
|
// Constructor and destructor
|
||||||
WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size );
|
WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos,
|
||||||
~WinEDA_DrawPanel() { }
|
const wxSize& size );
|
||||||
|
~WinEDA_DrawPanel();
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
BASE_SCREEN* GetScreen();
|
BASE_SCREEN* GetScreen();
|
||||||
|
|
|
@ -29,7 +29,7 @@ void WinEDA_MainFrame::CreateNewProject( const wxString PrjFullFileName )
|
||||||
wxFileName newProjectName = PrjFullFileName;
|
wxFileName newProjectName = PrjFullFileName;
|
||||||
|
|
||||||
// Init default config filename
|
// Init default config filename
|
||||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( wxT( "kicad.pro" ) );
|
tmp = wxGetApp().FindLibraryPath( wxT( "kicad.pro" ) );
|
||||||
|
|
||||||
if( !wxFileName::FileExists( tmp ) )
|
if( !wxFileName::FileExists( tmp ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -461,33 +461,26 @@ void KiConfigPcbnewFrame::LibDelFct( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
/*************************************************************
|
||||||
|
* Insert or add a library to the existing library list:
|
||||||
|
* New library is put in list before (insert) or after (add)
|
||||||
|
* the selection.
|
||||||
|
*
|
||||||
|
*************************************************************/
|
||||||
void KiConfigPcbnewFrame::LibInsertFct( wxCommandEvent& event )
|
void KiConfigPcbnewFrame::LibInsertFct( wxCommandEvent& event )
|
||||||
/*************************************************************/
|
|
||||||
|
|
||||||
/* Insert or add a library to the existing library list:
|
|
||||||
* New library is put in list before (insert) or after (add)
|
|
||||||
* the selection
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
|
|
||||||
ii = m_ListLibr->GetSelection();
|
ii = m_ListLibr->GetSelection();
|
||||||
if( ii < 0 )
|
if( ii == wxNOT_FOUND && event.GetId() == INSERT_LIB )
|
||||||
ii = 0;
|
ii = 0;
|
||||||
if( event.GetId() == ADD_LIB )
|
|
||||||
{
|
|
||||||
if( g_LibName_List.GetCount() != 0 )
|
|
||||||
ii++; /* Add after selection */
|
|
||||||
}
|
|
||||||
|
|
||||||
SetNewOptions();
|
SetNewOptions();
|
||||||
g_RealLibDirBuffer.Replace( wxT( "\\" ), wxT( "/" ) );
|
|
||||||
|
|
||||||
wxFileDialog FilesDialog( this, _( "Foot Print Library Files" ),
|
wxFileDialog FilesDialog( this, _( "Foot Print Library Files" ),
|
||||||
g_RealLibDirBuffer, wxEmptyString,
|
wxEmptyString, wxEmptyString,
|
||||||
ModuleFileWildcard, wxFD_OPEN | wxFD_MULTIPLE );
|
ModuleFileWildcard, wxFD_OPEN | wxFD_MULTIPLE );
|
||||||
|
|
||||||
if( FilesDialog.ShowModal() != wxID_OK )
|
if( FilesDialog.ShowModal() != wxID_OK )
|
||||||
|
@ -509,10 +502,13 @@ void KiConfigPcbnewFrame::LibInsertFct( wxCommandEvent& event )
|
||||||
tmp = fn.GetName();
|
tmp = fn.GetName();
|
||||||
|
|
||||||
// Add or insert new library name.
|
// Add or insert new library name.
|
||||||
if( g_LibName_List.Index( tmp ) == wxNOT_FOUND )
|
if( g_LibName_List.Index( tmp, fn.IsCaseSensitive() ) == wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
m_LibModified = TRUE;
|
m_LibModified = TRUE;
|
||||||
g_LibName_List.Insert( tmp, ii++ );
|
if( event.GetId() == ADD_LIB )
|
||||||
|
g_LibName_List.Add( tmp );
|
||||||
|
else
|
||||||
|
g_LibName_List.Insert( tmp, ii++ );
|
||||||
m_ListLibr->Clear();
|
m_ListLibr->Clear();
|
||||||
m_ListLibr->InsertItems( g_LibName_List, 0 );
|
m_ListLibr->InsertItems( g_LibName_List, 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,9 +199,10 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( const wxString& aLibraryFullF
|
||||||
if ( one_lib )
|
if ( one_lib )
|
||||||
fn = aLibraryFullFilename;
|
fn = aLibraryFullFilename;
|
||||||
else
|
else
|
||||||
fn = wxFileName( wxEmptyString, g_LibName_List[ii], ModuleFileExtension );
|
fn = wxFileName( wxEmptyString, g_LibName_List[ii],
|
||||||
|
ModuleFileExtension );
|
||||||
|
|
||||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
tmp = wxGetApp().FindLibraryPath( fn );
|
||||||
|
|
||||||
if( !tmp )
|
if( !tmp )
|
||||||
{
|
{
|
||||||
|
@ -352,7 +353,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List(
|
||||||
else
|
else
|
||||||
fn = aLibraryFullFilename;
|
fn = aLibraryFullFilename;
|
||||||
|
|
||||||
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
tmp = wxGetApp().FindLibraryPath( fn );
|
||||||
|
|
||||||
if( !tmp )
|
if( !tmp )
|
||||||
{
|
{
|
||||||
|
|
|
@ -204,8 +204,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib,
|
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib,
|
||||||
ModuleFileExtension );
|
ModuleFileExtension );
|
||||||
wxString full_libraryfilename =
|
wxString full_libraryfilename = wxGetApp().FindLibraryPath( fn );
|
||||||
wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
|
||||||
if( wxFileName::FileExists( full_libraryfilename ) )
|
if( wxFileName::FileExists( full_libraryfilename ) )
|
||||||
Delete_Module_In_Library( full_libraryfilename );
|
Delete_Module_In_Library( full_libraryfilename );
|
||||||
break;
|
break;
|
||||||
|
@ -233,7 +232,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
|
fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
|
||||||
wxString full_filename = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
wxString full_filename = wxGetApp().FindLibraryPath( fn );
|
||||||
Save_Module_In_Library( full_filename, GetBoard()->m_Modules,
|
Save_Module_In_Library( full_filename, GetBoard()->m_Modules,
|
||||||
true, true, true );
|
true, true, true );
|
||||||
GetScreen()->ClrModify();
|
GetScreen()->ClrModify();
|
||||||
|
@ -352,9 +351,9 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib,
|
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib,
|
||||||
ModuleFileExtension );
|
ModuleFileExtension );
|
||||||
full_libraryfilename =
|
full_libraryfilename = wxGetApp().FindLibraryPath( fn );
|
||||||
wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->ClearUndoRedoList();
|
GetScreen()->ClearUndoRedoList();
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
Clear_Pcb( true );
|
Clear_Pcb( true );
|
||||||
|
|
Loading…
Reference in New Issue