Commit 20cb87a8 authored by charras's avatar charras

better handling of libraries paths (removed g_RealLibraryBuffer that had no...

better handling of libraries paths (removed g_RealLibraryBuffer that had no sense with the new code), mainly in Eeschema
TODO: better handling of user lib paths (more than one path)
parent 89e7f965
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#define BUILD_VERSION wxT("(20090406-unstable)") #define BUILD_VERSION wxT("(20090414-unstable)")
wxString g_BuildVersion wxString g_BuildVersion
......
...@@ -66,7 +66,6 @@ const wxString AllFilesWildcard( _( "All files (*)|*") ); ...@@ -66,7 +66,6 @@ const wxString AllFilesWildcard( _( "All files (*)|*") );
wxString g_ProductName = wxT( "KiCad E.D.A. " ); wxString g_ProductName = wxT( "KiCad E.D.A. " );
bool g_ShowPageLimits = true; bool g_ShowPageLimits = true;
int g_GridColor = DARKGRAY; int g_GridColor = DARKGRAY;
wxString g_RealLibDirBuffer;
wxString g_UserLibDirBuffer; wxString g_UserLibDirBuffer;
int g_DebugLevel; int g_DebugLevel;
int g_MouseOldButtons; int g_MouseOldButtons;
...@@ -96,6 +95,11 @@ int g_UnitMetric; // display units mm = 1, inches = 0, cm = 2 ...@@ -96,6 +95,11 @@ int g_UnitMetric; // display units mm = 1, inches = 0, cm = 2
/* Draw color for moving objects: */ /* Draw color for moving objects: */
int g_GhostColor; int g_GhostColor;
/* predefined colors used in kicad.
* Please: if you change a value, remember these values are carefully chosen
* to have good results in pcbnew, that uses the ORed value of basic colors
* when displaying superimposed objects
*/
StructColors ColorRefs[NBCOLOR] = StructColors ColorRefs[NBCOLOR] =
{ {
{ 0, 0, 0, BLACK, wxT("BLACK"), DARKDARKGRAY}, { 0, 0, 0, BLACK, wxT("BLACK"), DARKDARKGRAY},
......
...@@ -700,7 +700,7 @@ void WinEDA_App::SaveSettings() ...@@ -700,7 +700,7 @@ void WinEDA_App::SaveSettings()
m_EDA_Config->Write( wxT( "SdtFontType" ), g_StdFont->GetFaceName() ); m_EDA_Config->Write( wxT( "SdtFontType" ), g_StdFont->GetFaceName() );
#if wxCHECK_VERSION( 2, 9, 0 ) #if wxCHECK_VERSION( 2, 9, 0 )
#warning under wxWidgets 3.0, see how to replace the next lines #warning TODO: under wxWidgets 3.0, see how to replace the next lines
#else #else
m_EDA_Config->Write( wxT( "SdtFontStyle" ), g_StdFont->GetStyle() ); m_EDA_Config->Write( wxT( "SdtFontStyle" ), g_StdFont->GetStyle() );
m_EDA_Config->Write( wxT( "SdtFontWeight" ), g_StdFont->GetWeight() ); m_EDA_Config->Write( wxT( "SdtFontWeight" ), g_StdFont->GetWeight() );
...@@ -1030,23 +1030,78 @@ wxString WinEDA_App::GetLibraryFile( const wxString& filename ) ...@@ -1030,23 +1030,78 @@ wxString WinEDA_App::GetLibraryFile( const wxString& filename )
return FindFileInSearchPaths( filename, &subdirs ); return FindFileInSearchPaths( filename, &subdirs );
} }
/** ReturnLastVisitedLibraryPath
* Returns the last visited library directory, or (if void) the first
* path in lib path list ( but not the CWD )
* @param aSubPathToSearch = Prefered sub path to search in path list (defualt = empty string)
*/
wxString s_LastVisitedLibPath; // Last lib directoty used when adding libraries
wxString WinEDA_App::ReturnLastVisitedLibraryPath( const wxString & aSubPathToSearch )
{
if ( ! s_LastVisitedLibPath.IsEmpty() )
return s_LastVisitedLibPath;
/** wxString path;
/* Initialize default path to the main default lib path
* this is the second path in list (the first is the project path)
*/
unsigned pcount = wxGetApp().GetLibraryPathList().GetCount();
if ( pcount )
{
unsigned ipath = 0;
if ( wxGetApp().GetLibraryPathList()[0] == wxGetCwd() )
ipath = 1;
// First choice fo path:
if ( ipath < pcount )
path = wxGetApp().GetLibraryPathList()[ipath];
// Search a sub path matching aSubPathToSearch
if ( ! aSubPathToSearch.IsEmpty() )
{
for ( ; ipath < pcount; ipath++ )
{
if ( wxGetApp().GetLibraryPathList()[ipath].Contains( aSubPathToSearch ) )
{
path = wxGetApp().GetLibraryPathList()[ipath];
break;
}
}
}
}
if ( path.IsEmpty() )
path = wxGetCwd();
return path;
}
void WinEDA_App::SaveLastVisitedLibraryPath( const wxString & aPath)
{
s_LastVisitedLibPath = aPath;
}
/** FindLibraryPath
* Kicad saves user defined library files that are not in the standard * Kicad saves user defined library files that are not in the standard
* library search path list with the full file path. Calling the library * 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 * search path list with a user library file will fail. This helper method
* solves that problem. * solves that problem.
* * @param fileName
* Returns a wxEmptyString if library file is not found. * @return a wxEmptyString if library file is not found.
*/ */
wxString WinEDA_App::FindLibraryPath( const wxString& fileName ) wxString WinEDA_App::FindLibraryPath( const wxString& aFileName )
{ {
if( wxFileName::FileExists( fileName ) ) if( wxFileName::FileExists( aFileName ) )
return fileName; return aFileName;
else else
return m_libSearchPaths.FindValidPath( fileName ); return m_libSearchPaths.FindValidPath( aFileName );
} }
/** Function RemoveLibraryPath
* Removes the given ptah from the libary path list
* @param path = the path to remove
*/
void WinEDA_App::RemoveLibraryPath( const wxString& path ) void WinEDA_App::RemoveLibraryPath( const wxString& path )
{ {
if( m_libSearchPaths.Index( path, wxFileName::IsCaseSensitive() ) != wxNOT_FOUND ) if( m_libSearchPaths.Index( path, wxFileName::IsCaseSensitive() ) != wxNOT_FOUND )
......
...@@ -1462,67 +1462,6 @@ void GRSFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, ...@@ -1462,67 +1462,6 @@ void GRSFilledRect( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
} }
/*******************************/
/* Routines used to draw texts */
/*******************************/
/*********************************************/
void GRSetFont( wxDC* DC, wxFont* Font )
/*********************************************/
/* Routine to set the current font */
{
DC->SetFont( *Font );
}
/*********************************************************/
void GRSetTextFgColor( wxDC* DC, int Color )
/*********************************************************/
/* Set the foreground color used to draw texts */
{
DC->SetTextForeground( wxColour( ColorRefs[Color].m_Red,
ColorRefs[Color].m_Green,
ColorRefs[Color].m_Blue ) );
}
void GRSetTextFgColor( wxDC* DC, wxFont*, int Color )
{
DC->SetTextForeground( wxColour( ColorRefs[Color].m_Red,
ColorRefs[Color].m_Green,
ColorRefs[Color].m_Blue ) );
}
/********************************/
void GRResetTextFgColor( wxDC* DC )
/********************************/
/* Set the foreground color used to draw texts to the default value */
{
GRSetTextFgColor( DC, Text_Color );
}
/*********************************************************/
void GRSetTextBgColor( wxDC* DC, int Color )
/*********************************************************/
/* Set the background color used to draw texts */
{
Color &= MASKCOLOR; // keep only the bits used to select the color
DC->SetTextBackground( wxColour( ColorRefs[Color].m_Red,
ColorRefs[Color].m_Green,
ColorRefs[Color].m_Blue ) );
}
void GRSetTextBgColor( wxDC* DC, wxFont*, int Color )
{
Color &= MASKCOLOR; // keep only the bits used to select the color
DC->SetTextBackground( wxColour( ColorRefs[Color].m_Red,
ColorRefs[Color].m_Green,
ColorRefs[Color].m_Blue ) );
}
#ifdef USE_CLIP_FILLED_POLYGONS #ifdef USE_CLIP_FILLED_POLYGONS
/** Function ClipAndDrawFilledPoly /** Function ClipAndDrawFilledPoly
......
...@@ -340,7 +340,7 @@ PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam, ...@@ -340,7 +340,7 @@ PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
/** ReadParam /** ReadParam
* read the value of parameter thi stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig )
...@@ -357,7 +357,7 @@ void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) ...@@ -357,7 +357,7 @@ void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig )
/** SaveParam /** SaveParam
* the the value of parameter thi stored in aConfig * save the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig )
...@@ -394,7 +394,7 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup, ...@@ -394,7 +394,7 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
/** ReadParam /** ReadParam
* read the value of parameter thi stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig )
...@@ -410,7 +410,7 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) ...@@ -410,7 +410,7 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig )
/** SaveParam /** SaveParam
* the the value of parameter thi stored in aConfig * save the the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig )
...@@ -451,7 +451,7 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup, ...@@ -451,7 +451,7 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
/** ReadParam /** ReadParam
* read the value of parameter thi stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig )
...@@ -475,7 +475,7 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) ...@@ -475,7 +475,7 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig )
/** SaveParam /** SaveParam
* the the value of parameter thi stored in aConfig * save the the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig )
...@@ -511,7 +511,7 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup, ...@@ -511,7 +511,7 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup,
/** ReadParam /** ReadParam
* read the value of parameter thi stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig )
...@@ -525,7 +525,7 @@ void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) ...@@ -525,7 +525,7 @@ void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig )
/** SaveParam /** SaveParam
* the the value of parameter thi stored in aConfig * save the the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig )
...@@ -557,7 +557,7 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident, ...@@ -557,7 +557,7 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
/** ReadParam /** ReadParam
* read the value of parameter thi stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig )
...@@ -569,7 +569,7 @@ void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) ...@@ -569,7 +569,7 @@ void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig )
/** SaveParam /** SaveParam
* the the value of parameter thi stored in aConfig * save the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig )
...@@ -591,7 +591,7 @@ PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident, ...@@ -591,7 +591,7 @@ PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
/** ReadParam /** ReadParam
* read the value of parameter thi stored in aConfig * read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter * @param aConfig = the wxConfigBase that store the parameter
*/ */
void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig )
...@@ -615,7 +615,7 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) ...@@ -615,7 +615,7 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig )
/** SaveParam /** SaveParam
* the the value of parameter thi stored in aConfig * save the value of parameter this in aConfig (list of parameters)
* @param aConfig = the wxConfigBase that can store the parameter * @param aConfig = the wxConfigBase that can store the parameter
*/ */
void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig )
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "protos.h" #include "protos.h"
#include "cvstruct.h" #include "cvstruct.h"
/*****************************************/ /*****************************************/
/* classe pour la frame de Configuration */ /* classe pour la frame de Configuration */
/*****************************************/ /*****************************************/
...@@ -202,7 +201,24 @@ void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event ) ...@@ -202,7 +201,24 @@ void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event )
Update(); Update();
wxFileDialog dlg( this, _( "Foot Print Library Files" ), g_RealLibDirBuffer, wxString libpath = m_LibDirCtrl->GetValue();
if ( libpath.IsEmpty() )
libpath = wxGetApp().ReturnLastVisitedLibraryPath();
if ( libpath.IsEmpty() )
{ /* Initialize default path to the main default lib path
* this is the second path in list (the first is the project path)
*/
ii = wxGetApp().GetLibraryPathList().GetCount();
if ( ii > 2 )
ii = 2;
if ( ii > 0 )
libpath = wxGetApp().GetLibraryPathList()[ii-1];
else
libpath = wxGetCwd();
}
wxFileDialog dlg( this, _( "Foot Print Library Files" ), libpath,
wxEmptyString, ModuleFileWildcard, wxEmptyString, ModuleFileWildcard,
wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST );
...@@ -218,7 +234,10 @@ void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event ) ...@@ -218,7 +234,10 @@ void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event )
{ {
fn = Filenames[jj]; fn = Filenames[jj];
/* If the library path is already in the library search paths if ( jj == 0 )
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
/* If the library path is already in the library search paths
* list, just add the library name to the list. Otherwise, add * list, just add the library name to the list. Otherwise, add
* the library name with the full path. */ * the library name with the full path. */
if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) == wxNOT_FOUND ) if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) == wxNOT_FOUND )
...@@ -281,8 +300,24 @@ void KiConfigCvpcbFrame::EquAddFct( wxCommandEvent& event ) ...@@ -281,8 +300,24 @@ void KiConfigCvpcbFrame::EquAddFct( wxCommandEvent& event )
Update(); Update();
wxString libpath = m_LibDirCtrl->GetValue();
if ( libpath.IsEmpty() )
libpath = wxGetApp().ReturnLastVisitedLibraryPath();
if ( libpath.IsEmpty() )
{ /* Initialize default path to the main default lib path
* this is the second path in list (the first is the project path)
*/
ii = wxGetApp().GetLibraryPathList().GetCount();
if ( ii > 2 )
ii = 2;
if ( ii > 0 )
libpath = wxGetApp().GetLibraryPathList()[ii-1];
else
libpath = wxGetCwd();
}
wxFileDialog dlg( this, _( "Open Footprint Alias Files" ), wxFileDialog dlg( this, _( "Open Footprint Alias Files" ),
g_RealLibDirBuffer, wxEmptyString, EquivFileWildcard, libpath, wxEmptyString, EquivFileWildcard,
wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
...@@ -298,6 +333,9 @@ void KiConfigCvpcbFrame::EquAddFct( wxCommandEvent& event ) ...@@ -298,6 +333,9 @@ void KiConfigCvpcbFrame::EquAddFct( wxCommandEvent& event )
{ {
fn = Filenames[jj]; fn = Filenames[jj];
if ( jj == 0 )
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
/* Use the file name without extension if the library path is /* Use the file name without extension if the library path is
* already in the default library search path. Otherwise, use * already in the default library search path. Otherwise, use
* the full path and file name without the extension. */ * the full path and file name without the extension. */
......
...@@ -1037,6 +1037,7 @@ void LibDrawPin::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -1037,6 +1037,7 @@ void LibDrawPin::DisplayInfo( WinEDA_DrawFrame* frame )
} }
frame->MsgPanel->Affiche_1_Parametre( 62, _( "Orient" ), Text, MAGENTA ); frame->MsgPanel->Affiche_1_Parametre( 62, _( "Orient" ), Text, MAGENTA );
wxMessageBox(wxT("Pin!"));
} }
......
...@@ -77,6 +77,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include ...@@ -77,6 +77,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include
if( Pin ) if( Pin )
{ {
/* Force display pin infos (the previous display could be a component info) */ /* Force display pin infos (the previous display could be a component info) */
Pin->Display_Infos( this ); Pin->Display_Infos( this );
if( LibItem ) if( LibItem )
...@@ -187,7 +188,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin ...@@ -187,7 +188,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
LibItem->GetRef( GetSheet() ), LibItem->GetRef( GetSheet() ),
LibItem->GetField( VALUE )->m_Text, LibItem->GetField( VALUE )->m_Text,
CYAN ); CYAN );
if( IncludePin == TRUE ) if( IncludePin )
return LibItem; return LibItem;
} }
......
...@@ -33,15 +33,16 @@ private: ...@@ -33,15 +33,16 @@ private:
private: private:
// Virtual event handlers, overide them in your derived class // event handlers, overiding the fbp handlers
void Init(); void Init();
virtual void OnCloseWindow( wxCloseEvent& event ); void OnCloseWindow( wxCloseEvent& event );
virtual void OnSaveCfgClick( wxCommandEvent& event ); void OnSaveCfgClick( wxCommandEvent& event );
virtual void OnRemoveLibClick( wxCommandEvent& event ); void OnRemoveLibClick( wxCommandEvent& event );
virtual void OnAddOrInsertLibClick( wxCommandEvent& event ); void OnAddOrInsertLibClick( wxCommandEvent& event );
virtual void OnLibPathSelClick( wxCommandEvent& event ); void OnLibPathSelClick( wxCommandEvent& event );
virtual void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
virtual void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void OnRemoveUserPath( wxCommandEvent& event );
public: public:
...@@ -154,8 +155,9 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event ) ...@@ -154,8 +155,9 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event )
// Set new default path lib // Set new default path lib
if ( g_UserLibDirBuffer != m_LibDirCtrl->GetValue() ) if ( g_UserLibDirBuffer != m_LibDirCtrl->GetValue() )
{ {
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
g_UserLibDirBuffer = m_LibDirCtrl->GetValue(); g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
wxGetApp().SetDefaultSearchPaths( ); wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
m_LibListChanged = true; m_LibListChanged = true;
} }
...@@ -223,7 +225,7 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event ) ...@@ -223,7 +225,7 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
wxString libpath = m_LibDirCtrl->GetValue(); wxString libpath = m_LibDirCtrl->GetValue();
if ( libpath.IsEmpty() ) if ( libpath.IsEmpty() )
libpath = g_RealLibDirBuffer; libpath = wxGetApp().ReturnLastVisitedLibraryPath();
wxFileDialog FilesDialog( this, _( "Library files:" ), libpath, wxFileDialog FilesDialog( this, _( "Library files:" ), libpath,
wxEmptyString, CompLibFileWildcard, wxEmptyString, CompLibFileWildcard,
...@@ -235,9 +237,11 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event ) ...@@ -235,9 +237,11 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick( wxCommandEvent& event )
wxArrayString Filenames; wxArrayString Filenames;
FilesDialog.GetPaths( Filenames ); FilesDialog.GetPaths( Filenames );
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ ) for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
{ {
fn = Filenames[jj]; fn = Filenames[jj];
if ( jj == 0 )
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
/* If the library path is already in the library search paths /* If the library path is already in the library search paths
* list, just add the library name to the list. Otherwise, add * list, just add the library name to the list. Otherwise, add
...@@ -296,7 +300,7 @@ void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event ) ...@@ -296,7 +300,7 @@ void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event )
{ {
wxString path = m_LibDirCtrl->GetValue(); wxString path = m_LibDirCtrl->GetValue();
if ( path.IsEmpty() ) if ( path.IsEmpty() )
path = g_RealLibDirBuffer; path = wxGetApp().ReturnLastVisitedLibraryPath();
bool select = EDA_DirectorySelector( _( " Default Path for libraries" ), /* Titre de la fenetre */ bool select = EDA_DirectorySelector( _( " Default Path for libraries" ), /* Titre de la fenetre */
path, /* Chemin par defaut */ path, /* Chemin par defaut */
...@@ -308,4 +312,14 @@ void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event ) ...@@ -308,4 +312,14 @@ void DIALOG_EESCHEMA_CONFIG::OnLibPathSelClick( wxCommandEvent& event )
return; return;
m_LibDirCtrl->SetValue( path ); m_LibDirCtrl->SetValue( path );
wxGetApp().SaveLastVisitedLibraryPath( path );
} }
/***********************************************************************/
void DIALOG_EESCHEMA_CONFIG::OnRemoveUserPath( wxCommandEvent& event )
/***********************************************************************/
{
m_LibDirCtrl->Clear( );
}
...@@ -82,11 +82,11 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind ...@@ -82,11 +82,11 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
wxBoxSizer* bRightSizer; wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL ); bRightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonRemove = new wxButton( this, ID_REMOVE_LIB, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonRemoveLib = new wxButton( this, ID_REMOVE_LIB, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRemove->SetForegroundColour( wxColour( 186, 1, 38 ) ); m_buttonRemoveLib->SetForegroundColour( wxColour( 186, 1, 38 ) );
m_buttonRemove->SetToolTip( _("Unload the selected library") ); m_buttonRemoveLib->SetToolTip( _("Unload the selected library") );
bRightSizer->Add( m_buttonRemove, 0, wxALL, 5 ); bRightSizer->Add( m_buttonRemoveLib, 0, wxALL, 5 );
m_buttonAdd = new wxButton( this, ID_ADD_LIB, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonAdd = new wxButton( this, ID_ADD_LIB, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonAdd->SetForegroundColour( wxColour( 13, 118, 1 ) ); m_buttonAdd->SetForegroundColour( wxColour( 13, 118, 1 ) );
...@@ -124,26 +124,45 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind ...@@ -124,26 +124,45 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
wxStaticBoxSizer* sbLibPathSizer; wxStaticBoxSizer* sbLibPathSizer;
sbLibPathSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Libraries Files Main Default Path:") ), wxVERTICAL ); sbLibPathSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Path for Libraries Files:") ), wxVERTICAL );
wxBoxSizer* bUserLibPathSizer; wxBoxSizer* bUserLibPathSizer;
bUserLibPathSizer = new wxBoxSizer( wxHORIZONTAL ); bUserLibPathSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Path:") ), wxHORIZONTAL );
wxBoxSizer* bUserListSizer;
bUserListSizer = new wxBoxSizer( wxVERTICAL );
m_LibDirCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_LibDirCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_LibDirCtrl->SetToolTip( _("Default path to search libraries which have no absolute path in name,\nor a name which does not start by ./ or ../\nIf void, the default path is kicad/share/library") ); m_LibDirCtrl->SetToolTip( _("Default path to search libraries which have no absolute path in name,\nor a name which does not start by ./ or ../\nIf void, the default path is kicad/share/library") );
bUserLibPathSizer->Add( m_LibDirCtrl, 1, wxALL, 5 ); bUserListSizer->Add( m_LibDirCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
sbSizer4->Add( bUserListSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bUserPathsButtonsSizer;
bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonBrowse = new wxButton( this, ID_LIB_PATH_SEL, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonBrowse = new wxButton( this, ID_LIB_PATH_SEL, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
bUserLibPathSizer->Add( m_buttonBrowse, 0, wxALL, 5 ); bUserPathsButtonsSizer->Add( m_buttonBrowse, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_buttonRemovePath = new wxButton( this, wxID_ANY, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
bUserPathsButtonsSizer->Add( m_buttonRemovePath, 0, wxALL, 5 );
sbSizer4->Add( bUserPathsButtonsSizer, 0, wxEXPAND, 5 );
bUserLibPathSizer->Add( sbSizer4, 1, wxEXPAND, 5 );
sbLibPathSizer->Add( bUserLibPathSizer, 1, wxEXPAND, 5 ); sbLibPathSizer->Add( bUserLibPathSizer, 1, wxEXPAND, 5 );
m_staticTextcurrenpaths = new wxStaticText( this, wxID_ANY, _("Current Libraries Full Paths in Use:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextcurrenpaths = new wxStaticText( this, wxID_ANY, _("Current Full Paths (for Libraries and Doc Files) in Use:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextcurrenpaths->Wrap( -1 ); m_staticTextcurrenpaths->Wrap( -1 );
sbLibPathSizer->Add( m_staticTextcurrenpaths, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); sbLibPathSizer->Add( m_staticTextcurrenpaths, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DefaultLibraryPathslistBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB ); m_DefaultLibraryPathslistBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB );
m_DefaultLibraryPathslistBox->SetToolTip( _("Paths (system paths and user paths) used to search and load libraries files and component doc files.\nSorted by decreasing priority order.") );
m_DefaultLibraryPathslistBox->SetMinSize( wxSize( -1,70 ) ); m_DefaultLibraryPathslistBox->SetMinSize( wxSize( -1,70 ) );
sbLibPathSizer->Add( m_DefaultLibraryPathslistBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbLibPathSizer->Add( m_DefaultLibraryPathslistBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
...@@ -155,24 +174,26 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind ...@@ -155,24 +174,26 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCloseWindow ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCloseWindow ) );
m_buttonRemove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveLibClick ), NULL, this ); m_buttonRemoveLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveLibClick ), NULL, this );
m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this ); m_buttonAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonIns->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this ); m_buttonIns->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonOk->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnOkClick ), NULL, this ); m_buttonOk->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnOkClick ), NULL, this );
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCancelClick ), NULL, this ); m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCancelClick ), NULL, this );
m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnSaveCfgClick ), NULL, this ); m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnSaveCfgClick ), NULL, this );
m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnLibPathSelClick ), NULL, this ); m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnLibPathSelClick ), NULL, this );
m_buttonRemovePath->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveUserPath ), NULL, this );
} }
DIALOG_EESCHEMA_CONFIG_FBP::~DIALOG_EESCHEMA_CONFIG_FBP() DIALOG_EESCHEMA_CONFIG_FBP::~DIALOG_EESCHEMA_CONFIG_FBP()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCloseWindow ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCloseWindow ) );
m_buttonRemove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveLibClick ), NULL, this ); m_buttonRemoveLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveLibClick ), NULL, this );
m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this ); m_buttonAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonIns->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this ); m_buttonIns->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnAddOrInsertLibClick ), NULL, this );
m_buttonOk->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnOkClick ), NULL, this ); m_buttonOk->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnOkClick ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCancelClick ), NULL, this ); m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnCancelClick ), NULL, this );
m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnSaveCfgClick ), NULL, this ); m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnSaveCfgClick ), NULL, this );
m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnLibPathSelClick ), NULL, this ); m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnLibPathSelClick ), NULL, this );
m_buttonRemovePath->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EESCHEMA_CONFIG_FBP::OnRemoveUserPath ), NULL, this );
} }
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DIALOG_EESCHEMA_CONFIG_FBP</property> <property name="name">DIALOG_EESCHEMA_CONFIG_FBP</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">593,445</property> <property name="size">593,500</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title"></property> <property name="title"></property>
...@@ -630,7 +630,7 @@ ...@@ -630,7 +630,7 @@
<property name="label">Remove</property> <property name="label">Remove</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_buttonRemove</property> <property name="name">m_buttonRemoveLib</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
...@@ -995,7 +995,7 @@ ...@@ -995,7 +995,7 @@
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Libraries Files Main Default Path:</property> <property name="label">Path for Libraries Files:</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">sbLibPathSizer</property> <property name="name">sbLibPathSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
...@@ -1012,109 +1012,197 @@ ...@@ -1012,109 +1012,197 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="maximum_size"></property> <property name="label">User Path:</property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_LibDirCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip">Default path to search libraries which have no absolute path in name,&#x0A;or a name which does not start by ./ or ../&#x0A;If void, the default path is kicad/share/library</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_LIB_PATH_SEL</property>
<property name="label">Browse</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_buttonBrowse</property> <property name="name">sbSizer4</property>
<property name="permission">protected</property> <property name="orient">wxHORIZONTAL</property>
<property name="pos"></property> <property name="permission">none</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnLibPathSelClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bUserListSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size"></property>
<property name="name">m_LibDirCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip">Default path to search libraries which have no absolute path in name,&#x0A;or a name which does not start by ./ or ../&#x0A;If void, the default path is kicad/share/library</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bUserPathsButtonsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">ID_LIB_PATH_SEL</property>
<property name="label">Browse</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonBrowse</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnLibPathSelClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Remove</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonRemovePath</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnRemoveUserPath</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>
...@@ -1131,7 +1219,7 @@ ...@@ -1131,7 +1219,7 @@
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Current Libraries Full Paths in Use:</property> <property name="label">Current Full Paths (for Libraries and Doc Files) in Use:</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_staticTextcurrenpaths</property> <property name="name">m_staticTextcurrenpaths</property>
...@@ -1191,7 +1279,7 @@ ...@@ -1191,7 +1279,7 @@
<property name="size"></property> <property name="size"></property>
<property name="style">wxLB_NEEDED_SB</property> <property name="style">wxLB_NEEDED_SB</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip">Paths (system paths and user paths) used to search and load libraries files and component doc files.&#x0A;Sorted by decreasing priority order.</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
......
...@@ -52,7 +52,7 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog ...@@ -52,7 +52,7 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
wxStaticText* m_InfoSchFileExt; wxStaticText* m_InfoSchFileExt;
wxStaticText* m_staticTextlibList; wxStaticText* m_staticTextlibList;
wxListBox* m_ListLibr; wxListBox* m_ListLibr;
wxButton* m_buttonRemove; wxButton* m_buttonRemoveLib;
wxButton* m_buttonAdd; wxButton* m_buttonAdd;
wxButton* m_buttonIns; wxButton* m_buttonIns;
...@@ -62,6 +62,7 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog ...@@ -62,6 +62,7 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxTextCtrl* m_LibDirCtrl; wxTextCtrl* m_LibDirCtrl;
wxButton* m_buttonBrowse; wxButton* m_buttonBrowse;
wxButton* m_buttonRemovePath;
wxStaticText* m_staticTextcurrenpaths; wxStaticText* m_staticTextcurrenpaths;
wxListBox* m_DefaultLibraryPathslistBox; wxListBox* m_DefaultLibraryPathslistBox;
...@@ -73,10 +74,11 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog ...@@ -73,10 +74,11 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnSaveCfgClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnSaveCfgClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLibPathSelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnLibPathSelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRemoveUserPath( wxCommandEvent& event ){ event.Skip(); }
public: public:
DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 593,445 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 593,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EESCHEMA_CONFIG_FBP(); ~DIALOG_EESCHEMA_CONFIG_FBP();
}; };
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/**************************************************************/ /**************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
...@@ -753,12 +752,11 @@ void WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile( wxCommandEvent& event ) ...@@ -753,12 +752,11 @@ void WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile( wxCommandEvent& event )
/****************************************************************************/ /****************************************************************************/
{ {
wxString FullFileName, mask; wxString FullFileName, mask;
wxString docpath, filename;
wxString docpath( g_RealLibDirBuffer ), filename; docpath = wxGetApp().ReturnLastVisitedLibraryPath(wxT( "doc" ));
docpath += wxT( "doc" ); mask = wxT( "*" );
docpath += STRING_DIR_SEP;
mask = wxT( "*" );
FullFileName = EDA_FileSelector( _( "Doc Files" ), FullFileName = EDA_FileSelector( _( "Doc Files" ),
docpath, /* Chemin par defaut */ docpath, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */ wxEmptyString, /* nom fichier par defaut */
...@@ -771,8 +769,6 @@ void WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile( wxCommandEvent& event ) ...@@ -771,8 +769,6 @@ void WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile( wxCommandEvent& event )
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return; return;
// Suppression du chemin par defaut pour le fichier de doc:
/* If the library path is already in the library search paths /* If the library path is already in the library search paths
* list, just add the library name to the list. Otherwise, add * list, just add the library name to the list. Otherwise, add
* the library name with the full or relative path. * the library name with the full or relative path.
...@@ -781,6 +777,7 @@ void WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile( wxCommandEvent& event ) ...@@ -781,6 +777,7 @@ void WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile( wxCommandEvent& event )
* *
*/ */
wxFileName fn = FullFileName; wxFileName fn = FullFileName;
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
int pathlen = -1; // path len, used to find the better subpath within defualts paths int pathlen = -1; // path len, used to find the better subpath within defualts paths
if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) != wxNOT_FOUND ) // Ok, trivial case if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) != wxNOT_FOUND ) // Ok, trivial case
filename = fn.GetName(); filename = fn.GetName();
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
/* eeschema.cpp - module principal */ /* eeschema.cpp - module principal */
/***********************************/ /***********************************/
#ifdef __GNUG__
#pragma implementation
#endif
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
* in current sheet or whole the project * in current sheet or whole the project
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
//#include "gr_basic.h"
#include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
...@@ -49,7 +51,7 @@ void WinEDA_FindFrame::FindMarker( wxCommandEvent& event ) ...@@ -49,7 +51,7 @@ void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
/************************************************************************/ /************************************************************************/
SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem( SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
const wxString& component_reference, bool Find_in_hierarchy, const wxString& component_reference, bool Find_in_hierarchy,
int SearchType, int SearchType,
const wxString& text_to_find, const wxString& text_to_find,
...@@ -71,17 +73,17 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -71,17 +73,17 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
* @param mouseWarp If true, then move the mouse cursor to the item. * @param mouseWarp If true, then move the mouse cursor to the item.
*/ */
{ {
DrawSheetPath* sheet, * SheetWithComponentFound = NULL; DrawSheetPath* sheet, * SheetWithComponentFound = NULL;
SCH_ITEM* DrawList = NULL; SCH_ITEM* DrawList = NULL;
SCH_COMPONENT* Component = NULL; SCH_COMPONENT* Component = NULL;
wxSize DrawAreaSize = DrawPanel->GetClientSize(); wxSize DrawAreaSize = DrawPanel->GetClientSize();
wxPoint pos, curpos; wxPoint pos, curpos;
bool DoCenterAndRedraw = FALSE; bool DoCenterAndRedraw = FALSE;
bool NotFound = true; bool NotFound = true;
wxString msg; wxString msg;
LibDrawPin* pin; LibDrawPin* pin;
EDA_SheetList SheetList; EDA_SheetList SheetList;
sheet = SheetList.GetFirst(); sheet = SheetList.GetFirst();
if( !Find_in_hierarchy ) if( !Find_in_hierarchy )
...@@ -96,7 +98,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -96,7 +98,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
{ {
SCH_COMPONENT* pSch; SCH_COMPONENT* pSch;
pSch = (SCH_COMPONENT*) DrawList; pSch = (SCH_COMPONENT*) DrawList;
if( component_reference.CmpNoCase( pSch->GetRef(sheet) ) == 0 ) if( component_reference.CmpNoCase( pSch->GetRef( sheet ) ) == 0 )
{ {
Component = pSch; Component = pSch;
SheetWithComponentFound = sheet; SheetWithComponentFound = sheet;
...@@ -146,23 +148,23 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -146,23 +148,23 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
{ {
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet; *m_CurrentSheet = *sheet;
ActiveScreen = m_CurrentSheet->LastScreen(); ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences(); m_CurrentSheet->UpdateAllScreenReferences();
DoCenterAndRedraw = TRUE; DoCenterAndRedraw = TRUE;
} }
wxPoint delta; wxPoint delta;
pos -= Component->m_Pos; pos -= Component->m_Pos;
delta = TransformCoordinate( Component->m_Transform, pos); delta = TransformCoordinate( Component->m_Transform, pos );
pos = delta + Component->m_Pos; pos = delta + Component->m_Pos;
wxPoint old_cursor_position = sheet->LastScreen()->m_Curseur; wxPoint old_cursor_position = sheet->LastScreen()->m_Curseur;
sheet->LastScreen()->m_Curseur = pos; sheet->LastScreen()->m_Curseur = pos;
curpos = DrawPanel->CursorScreenPosition(); curpos = DrawPanel->CursorScreenPosition();
DrawPanel->GetViewStart( DrawPanel->GetViewStart(
&( GetScreen()->m_StartVisu.x ), &( GetScreen()->m_StartVisu.x ),
&( GetScreen()->m_StartVisu.y )); &( GetScreen()->m_StartVisu.y ) );
// calcul des coord curseur avec origine = screen // calcul des coord curseur avec origine = screen
curpos -= GetScreen()->m_StartVisu; curpos -= GetScreen()->m_StartVisu;
...@@ -176,11 +178,11 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -176,11 +178,11 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
} }
#undef MARGIN #undef MARGIN
if ( DoCenterAndRedraw ) if( DoCenterAndRedraw )
Recadre_Trace( mouseWarp ); Recadre_Trace( mouseWarp );
else else
{ {
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
...@@ -255,7 +257,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -255,7 +257,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
/*****************************************************************/ /*****************************************************************/
SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType ) SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
/*****************************************************************/ /*****************************************************************/
/* Search markers in whole the hierarchy. /* Search markers in whole the hierarchy.
...@@ -263,9 +265,9 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -263,9 +265,9 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType )
* SearchType = 0: search the first marker, else search next marker * SearchType = 0: search the first marker, else search next marker
*/ */
{ {
DrawSheetPath* sheet, * FirstSheet = NULL; DrawSheetPath* sheet, * FirstSheet = NULL;
SCH_ITEM* DrawList, * FirstStruct = NULL, * Struct = NULL; SCH_ITEM* DrawList, * FirstStruct = NULL, * Struct = NULL;
DrawMarkerStruct * Marker = NULL; DrawMarkerStruct* Marker = NULL;
int StartCount; int StartCount;
bool NotFound; bool NotFound;
wxPoint firstpos, pos; wxPoint firstpos, pos;
...@@ -295,7 +297,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -295,7 +297,7 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType )
pos = Marker->m_Pos; pos = Marker->m_Pos;
if( FirstSheet == NULL ) /* First item found */ if( FirstSheet == NULL ) /* First item found */
{ {
FirstSheet = sheet; firstpos = pos; FirstSheet = sheet; firstpos = pos;
FirstStruct = DrawList; FirstStruct = DrawList;
} }
...@@ -317,7 +319,8 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -317,7 +319,8 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType )
} }
if( NotFound && FirstSheet ) // markers are found, but we have reach the last marker */ if( NotFound && FirstSheet ) // markers are found, but we have reach the last marker */
{ // After the last marker, the first marker is used */ {
// After the last marker, the first marker is used */
NotFound = FALSE; sheet = FirstSheet; NotFound = FALSE; sheet = FirstSheet;
Struct = FirstStruct; Struct = FirstStruct;
pos = firstpos; s_MarkerCount = 1; pos = firstpos; s_MarkerCount = 1;
...@@ -329,18 +332,18 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -329,18 +332,18 @@ SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType )
{ {
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet; *m_CurrentSheet = *sheet;
ActiveScreen = m_CurrentSheet->LastScreen(); ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences(); m_CurrentSheet->UpdateAllScreenReferences();
DoCenterAndRedraw = TRUE; DoCenterAndRedraw = TRUE;
} }
old_cursor_position = sheet->LastScreen()->m_Curseur; old_cursor_position = sheet->LastScreen()->m_Curseur;
sheet->LastScreen()->m_Curseur = pos; sheet->LastScreen()->m_Curseur = pos;
curpos = DrawPanel->CursorScreenPosition(); curpos = DrawPanel->CursorScreenPosition();
// calcul des coord curseur avec origine = screen // calcul des coord curseur avec origine = screen
DrawPanel->GetViewStart( &m_CurrentSheet->LastScreen()->m_StartVisu.x, DrawPanel->GetViewStart( &m_CurrentSheet->LastScreen()->m_StartVisu.x,
&m_CurrentSheet->LastScreen()->m_StartVisu.y ); &m_CurrentSheet->LastScreen()->m_StartVisu.y );
curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x; curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x;
curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y; curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y;
...@@ -417,16 +420,16 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -417,16 +420,16 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
* @param mouseWarp If true, then move the mouse cursor to the item. * @param mouseWarp If true, then move the mouse cursor to the item.
*/ */
{ {
DrawSheetPath* Sheet, * FirstSheet = NULL; DrawSheetPath* Sheet, * FirstSheet = NULL;
SCH_ITEM* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL; SCH_ITEM* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL;
int StartCount; int StartCount;
bool NotFound; bool NotFound;
wxPoint firstpos, pos, old_cursor_position; wxPoint firstpos, pos, old_cursor_position;
static int Find_in_hierarchy; static int Find_in_hierarchy;
wxSize DrawAreaSize = DrawPanel->GetClientSize(); wxSize DrawAreaSize = DrawPanel->GetClientSize();
wxPoint curpos; wxPoint curpos;
bool DoCenterAndRedraw = FALSE; bool DoCenterAndRedraw = FALSE;
wxString msg, WildText; wxString msg, WildText;
g_LastSearchIsMarker = FALSE; g_LastSearchIsMarker = FALSE;
...@@ -457,7 +460,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -457,7 +460,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
for( ; Sheet != NULL; Sheet = SheetList.GetNext() ) for( ; Sheet != NULL; Sheet = SheetList.GetNext() )
{ {
DrawList = (SCH_ITEM*)Sheet->LastDrawList(); DrawList = (SCH_ITEM*) Sheet->LastDrawList();
while( DrawList ) while( DrawList )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
...@@ -465,7 +468,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -465,7 +468,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
SCH_COMPONENT * pSch; SCH_COMPONENT * pSch;
pSch = (SCH_COMPONENT*) DrawList; pSch = (SCH_COMPONENT*) DrawList;
if( WildCompareString( WildText, pSch->GetRef(Sheet), FALSE ) ) if( WildCompareString( WildText, pSch->GetRef( Sheet ), FALSE ) )
{ {
NotFound = FALSE; NotFound = FALSE;
pos = pSch->GetField( REFERENCE )->m_Pos; pos = pSch->GetField( REFERENCE )->m_Pos;
...@@ -497,9 +500,9 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -497,9 +500,9 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
if( NotFound == FALSE ) /* Item found ! */ if( NotFound == FALSE ) /* Item found ! */
{ {
if( FirstSheet == NULL ) /* First Item found */ if( FirstSheet == NULL ) /* First Item found */
{ {
FirstSheet = Sheet; FirstSheet = Sheet;
firstpos = pos; firstpos = pos;
FirstStruct = DrawList; FirstStruct = DrawList;
} }
...@@ -531,7 +534,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -531,7 +534,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
if( NotFound && FirstSheet ) if( NotFound && FirstSheet )
{ {
NotFound = FALSE; NotFound = FALSE;
Sheet = FirstSheet; Sheet = FirstSheet;
Struct = FirstStruct; Struct = FirstStruct;
pos = firstpos; pos = firstpos;
s_ItemsCount = 1; s_ItemsCount = 1;
...@@ -543,9 +546,9 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -543,9 +546,9 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
{ {
Sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); Sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *Sheet; *m_CurrentSheet = *Sheet;
ActiveScreen = m_CurrentSheet->LastScreen(); ActiveScreen = m_CurrentSheet->LastScreen();
m_CurrentSheet->UpdateAllScreenReferences(); m_CurrentSheet->UpdateAllScreenReferences();
DoCenterAndRedraw = TRUE; DoCenterAndRedraw = TRUE;
} }
/* the struct is a TYPE_SCH_COMPONENT type, /* the struct is a TYPE_SCH_COMPONENT type,
...@@ -556,18 +559,18 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -556,18 +559,18 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
SCH_COMPONENT* pSch = (SCH_COMPONENT*) Struct; SCH_COMPONENT* pSch = (SCH_COMPONENT*) Struct;
pos -= pSch->m_Pos; pos -= pSch->m_Pos;
pos = TransformCoordinate( pSch->m_Transform, pos ); pos = TransformCoordinate( pSch->m_Transform, pos );
pos += pSch->m_Pos; pos += pSch->m_Pos;
} }
old_cursor_position = Sheet->LastScreen()->m_Curseur; old_cursor_position = Sheet->LastScreen()->m_Curseur;
Sheet->LastScreen()->m_Curseur = pos; Sheet->LastScreen()->m_Curseur = pos;
curpos = DrawPanel->CursorScreenPosition(); curpos = DrawPanel->CursorScreenPosition();
DrawPanel->GetViewStart( DrawPanel->GetViewStart(
&( GetScreen()->m_StartVisu.x ), &( GetScreen()->m_StartVisu.x ),
&( GetScreen()->m_StartVisu.y )); &( GetScreen()->m_StartVisu.y ) );
// calcul des coord curseur avec origine = screen // calcul des coord curseur avec origine = screen
curpos -= m_CurrentSheet->LastScreen()->m_StartVisu; curpos -= m_CurrentSheet->LastScreen()->m_StartVisu;
...@@ -577,14 +580,14 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -577,14 +580,14 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN) if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN)
|| (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) ) || (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) )
{ {
DoCenterAndRedraw = true; DoCenterAndRedraw = true;
} }
if ( DoCenterAndRedraw ) if( DoCenterAndRedraw )
Recadre_Trace( mouseWarp ); Recadre_Trace( mouseWarp );
else else
{ {
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
...@@ -712,39 +715,26 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F ...@@ -712,39 +715,26 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
FILE* file; FILE* file;
int nbitems = 0, LineNum = 0; int nbitems = 0, LineNum = 0;
char Line[2048], * name; char Line[2048], * name;
wxString path;
FullFileName = wxFindFirstFile( g_RealLibDirBuffer + wxT( "*." ) + for( unsigned ii; ii < wxGetApp().GetLibraryPathList().GetCount(); ii++ )
CompLibFileExtension );
while( !FullFileName.IsEmpty() )
{ {
file = wxFopen( FullFileName, wxT( "rt" ) ); path = wxGetApp().GetLibraryPathList()[ii];
if( file == NULL ) FullFileName = wxFindFirstFile( path + wxT( "*." ) + CompLibFileExtension );
continue;
while( GetLine( file, Line, &LineNum, sizeof(Line) ) ) while( !FullFileName.IsEmpty() )
{ {
if( strnicmp( Line, "DEF", 3 ) == 0 ) file = wxFopen( FullFileName, wxT( "rt" ) );
{ if( file == NULL )
/* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */ continue;
strtok( Line, " \t\r\n" );
name = strtok( NULL, " \t\r\n" ); while( GetLine( file, Line, &LineNum, sizeof(Line) ) )
wxString st_name = CONV_FROM_UTF8( name );
if( WildCompareString( wildmask, st_name, FALSE ) )
{
nbitems++;
if( !FindList.IsEmpty() )
FindList += wxT( "\n" );
FindList << _( "Found " ) << CONV_FROM_UTF8( name )
<< _( " in lib " ) << FullFileName;
}
}
else if( strnicmp( Line, "ALIAS", 5 ) == 0 )
{ {
/* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */ if( strnicmp( Line, "DEF", 3 ) == 0 )
strtok( Line, " \t\r\n" );
while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL )
{ {
/* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */
strtok( Line, " \t\r\n" );
name = strtok( NULL, " \t\r\n" );
wxString st_name = CONV_FROM_UTF8( name ); wxString st_name = CONV_FROM_UTF8( name );
if( WildCompareString( wildmask, st_name, FALSE ) ) if( WildCompareString( wildmask, st_name, FALSE ) )
{ {
...@@ -755,11 +745,28 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F ...@@ -755,11 +745,28 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
<< _( " in lib " ) << FullFileName; << _( " in lib " ) << FullFileName;
} }
} }
else if( strnicmp( Line, "ALIAS", 5 ) == 0 )
{
/* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */
strtok( Line, " \t\r\n" );
while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL )
{
wxString st_name = CONV_FROM_UTF8( name );
if( WildCompareString( wildmask, st_name, FALSE ) )
{
nbitems++;
if( !FindList.IsEmpty() )
FindList += wxT( "\n" );
FindList << _( "Found " ) << CONV_FROM_UTF8( name )
<< _( " in lib " ) << FullFileName;
}
}
}
} }
}
fclose( file ); fclose( file );
FullFileName = wxFindNextFile(); FullFileName = wxFindNextFile();
}
} }
return nbitems; return nbitems;
......
...@@ -258,8 +258,7 @@ void WinEDA_LibeditFrame::SaveActiveLibrary() ...@@ -258,8 +258,7 @@ void WinEDA_LibeditFrame::SaveActiveLibrary()
return; return;
} }
fn = wxFileName( g_RealLibDirBuffer, CurrentLib->m_Name, fn = wxFileName( CurrentLib->m_FullFileName );
CompLibFileExtension );
msg = _( "Modify Library File \"" ) + fn.GetFullPath() + _( "\"?" ); msg = _( "Modify Library File \"" ) + fn.GetFullPath() + _( "\"?" );
......
...@@ -21,7 +21,10 @@ ...@@ -21,7 +21,10 @@
/* Routines locales */ /* Routines locales */
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* if the field is the reference, return reference like schematic, i.e U -> U? or U?A
* or the field text for others
*/
static wxString ReturnFieldFullText( LibDrawField* aField);
/* Variables locales */ /* Variables locales */
extern int CurrentUnit; extern int CurrentUnit;
...@@ -76,6 +79,33 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field ) ...@@ -76,6 +79,33 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field )
} }
/* if the field is the reference, return reference like schematic, i.e U -> U? or U?A
* or the field text for others
*/
static wxString ReturnFieldFullText( LibDrawField* aField)
{
if ( aField->m_FieldId != REFERENCE )
return aField->m_Text;
wxString text = aField->m_Text;
if( CurrentLibEntry->m_UnitCount > 1 )
{
#if defined(KICAD_GOST)
text.Printf( wxT( "%s?.%c" ),
aField->m_Text.m_Text.GetData(), CurrentUnit + '1' - 1 );
#else
text.Printf( wxT( "%s?%c" ),
aField->m_Text.GetData(), CurrentUnit + 'A' - 1 );
#endif
}
else
text << wxT( "?" );
return text;
}
/*****************************************************************/ /*****************************************************************/
/* Routine d'affichage du texte 'Field' en cours de deplacement. */ /* Routine d'affichage du texte 'Field' en cours de deplacement. */
/* Routine normalement attachee au curseur */ /* Routine normalement attachee au curseur */
...@@ -103,9 +133,7 @@ static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -103,9 +133,7 @@ static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
break; break;
} }
wxString text = Field->m_Text; wxString text = ReturnFieldFullText( Field );
if( Field->m_FieldId == REFERENCE )
text << wxT( "?" );
int TransMat[2][2]; int TransMat[2][2];
TransMat[0][0] = 1; TransMat[1][1] = -1; TransMat[0][0] = 1; TransMat[1][1] = -1;
...@@ -166,7 +194,7 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field ) ...@@ -166,7 +194,7 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field )
GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE ); GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE );
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ), DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
color, Field->m_Text, color, ReturnFieldFullText( Field ),
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth ); Field->m_HJustify, Field->m_VJustify, LineWidth );
...@@ -218,7 +246,7 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field ) ...@@ -218,7 +246,7 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ), DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
color, Field->m_Text, color, ReturnFieldFullText( Field ),
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth ); Field->m_HJustify, Field->m_VJustify, LineWidth );
...@@ -235,7 +263,7 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field ) ...@@ -235,7 +263,7 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE ); GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE );
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ), DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
color, Field->m_Text, color, ReturnFieldFullText( Field ),
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth ); Field->m_HJustify, Field->m_VJustify, LineWidth );
...@@ -286,7 +314,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field ) ...@@ -286,7 +314,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth ); int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth );
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ), DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
color, Field->m_Text, color, ReturnFieldFullText( Field ),
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth ); Field->m_HJustify, Field->m_VJustify, LineWidth );
...@@ -300,7 +328,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field ) ...@@ -300,7 +328,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE ); GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE );
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ), DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
color, Field->m_Text, color, ReturnFieldFullText( Field ),
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, Field->m_Size,
Field->m_HJustify, Field->m_VJustify, LineWidth ); Field->m_HJustify, Field->m_VJustify, LineWidth );
......
...@@ -71,7 +71,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -71,7 +71,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else else
{ {
DrawStruct = SchematicGeneralLocateAndDisplay(); DrawStruct = SchematicGeneralLocateAndDisplay(true);
} }
} }
......
...@@ -78,10 +78,9 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, ...@@ -78,10 +78,9 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
return true; return true;
} }
// Simple localisation des elements si possible
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ { // Just try to locate items at cursor position
DrawStruct = SchematicGeneralLocateAndDisplay( FALSE ); DrawStruct = SchematicGeneralLocateAndDisplay( false );
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
{ {
Hierarchical_PIN_Sheet_Struct* slabel; Hierarchical_PIN_Sheet_Struct* slabel;
...@@ -92,7 +91,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, ...@@ -92,7 +91,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
} }
} }
// If Command in progress: put the menu "cancel" and "end tool" // If Command in progress: add "cancel" and "end tool" menu
if( m_ID_current_state ) if( m_ID_current_state )
{ {
if( DrawStruct && DrawStruct->m_Flags ) if( DrawStruct && DrawStruct->m_Flags )
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
...@@ -54,8 +55,10 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void ) ...@@ -54,8 +55,10 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
mask = wxT( "*" ) + g_SymbolExtBuffer; mask = wxT( "*" ) + g_SymbolExtBuffer;
wxString default_lib_path = wxGetApp().ReturnLastVisitedLibraryPath();
FullFileName = EDA_FileSelector( _( "Import symbol drawings:" ), FullFileName = EDA_FileSelector( _( "Import symbol drawings:" ),
g_RealLibDirBuffer, /* Chemin par defaut */ default_lib_path, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */ wxEmptyString, /* nom fichier par defaut */
g_SymbolExtBuffer, /* extension par defaut */ g_SymbolExtBuffer, /* extension par defaut */
mask, /* Masque d'affichage */ mask, /* Masque d'affichage */
...@@ -71,6 +74,8 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void ) ...@@ -71,6 +74,8 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return; return;
wxFileName fn = FullFileName;
wxGetApp().SaveLastVisitedLibraryPath(fn.GetPath() );
/* Load data */ /* Load data */
ImportFile = wxFopen( FullFileName, wxT( "rt" ) ); ImportFile = wxFopen( FullFileName, wxT( "rt" ) );
...@@ -159,9 +164,10 @@ void WinEDA_LibeditFrame::SaveOneSymbol() ...@@ -159,9 +164,10 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
return; return;
/* Creation du fichier symbole */ /* Creation du fichier symbole */
wxString default_lib_path = wxGetApp().ReturnLastVisitedLibraryPath();
mask = wxT( "*" ) + g_SymbolExtBuffer; mask = wxT( "*" ) + g_SymbolExtBuffer;
FullFileName = EDA_FileSelector( _( "Export symbol drawings:" ), FullFileName = EDA_FileSelector( _( "Export symbol drawings:" ),
g_RealLibDirBuffer, /* Chemin par defaut */ default_lib_path, /* Chemin par defaut */
wxEmptyString, /* nom fichier par defaut */ wxEmptyString, /* nom fichier par defaut */
g_SymbolExtBuffer, /* extension par defaut */ g_SymbolExtBuffer, /* extension par defaut */
mask, /* Masque d'affichage */ mask, /* Masque d'affichage */
...@@ -172,6 +178,9 @@ void WinEDA_LibeditFrame::SaveOneSymbol() ...@@ -172,6 +178,9 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return; return;
wxFileName fn = FullFileName;
wxGetApp().SaveLastVisitedLibraryPath(fn.GetPath() );
ExportFile = wxFopen( FullFileName, wxT( "wt" ) ); ExportFile = wxFopen( FullFileName, wxT( "wt" ) );
if( ExportFile == NULL ) if( ExportFile == NULL )
{ {
......
...@@ -124,7 +124,7 @@ void WinEDA_ViewlibFrame::DisplayLibInfos() ...@@ -124,7 +124,7 @@ void WinEDA_ViewlibFrame::DisplayLibInfos()
msg << wxT( " [" ); msg << wxT( " [" );
if( Lib ) if( Lib )
msg << g_CurrentViewLibraryName; msg << Lib->m_FullFileName;
else else
msg += _( "none selected" ); msg += _( "none selected" );
......
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
/** Function InitEDA_Appl /** Function InitEDA_Appl
* initialise some general parameters * initialise some general parameters
* - Default paths (help, libs, bin)and configuration flies names * - Default paths (help, libs, bin)and configuration files names
* - Language and locale * - Language and locale
* - fonts * - fonts
* @param aName : used as paths in configuration files * @param aName : used as paths in configuration files
...@@ -157,12 +157,32 @@ public: ...@@ -157,12 +157,32 @@ public:
wxPathList& GetLibraryPathList() { return m_libSearchPaths; } wxPathList& GetLibraryPathList() { return m_libSearchPaths; }
wxString FindLibraryPath( const wxString& fileName ); wxString FindLibraryPath( const wxString& fileName );
/** FindLibraryPath
* 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.
* @param fileName
* @return a wxEmptyString if library file is not found.
*/
wxString FindLibraryPath( const wxFileName& fileName ) wxString FindLibraryPath( const wxFileName& fileName )
{ {
return FindLibraryPath( fileName.GetFullPath() ); return FindLibraryPath( fileName.GetFullPath() );
} }
/** ReturnLastVisitedLibraryPath
* Returns the last visited library directory, or (if void) the first
* path in lib path list ( but not the CWD )
* @param aSubPathToSearch = Prefered sub path to search in path list
*/
wxString ReturnLastVisitedLibraryPath( const wxString & aSubPathToSearch = wxEmptyString);
void SaveLastVisitedLibraryPath( const wxString & aPath);
/** Function RemoveLibraryPath
* Removes the given ptah from the libary path list
* @param path = the path to remove
*/
void RemoveLibraryPath( const wxString& path ); void RemoveLibraryPath( const wxString& path );
void InsertLibraryPath( const wxString& path, size_t index ); void InsertLibraryPath( const wxString& path, size_t index );
}; };
......
...@@ -146,12 +146,8 @@ extern Ki_PageDescr* g_SheetSizeList[]; ...@@ -146,12 +146,8 @@ extern Ki_PageDescr* g_SheetSizeList[];
extern wxString g_ProductName; extern wxString g_ProductName;
/* Gestion des librairies */ /* Default user lib path can be left void, if the standard lib path is used */
extern wxString g_RealLibDirBuffer; // Chemin reel des librairies de module extern wxString g_UserLibDirBuffer;
// = UserLibDirBuffer si non vide
// = chemin par defaut sinon
extern wxString g_UserLibDirBuffer; // Chemin des librairies de module donne par
// le file de config
extern int g_DebugLevel; // 0= Pas de debug */ extern int g_DebugLevel; // 0= Pas de debug */
extern int g_MouseOldButtons; extern int g_MouseOldButtons;
......
...@@ -187,15 +187,6 @@ void GRSRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, ...@@ -187,15 +187,6 @@ void GRSRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
void GRSRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, void GRSRect(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1,
int x2, int y2, int width, int Color); int x2, int y2, int width, int Color);
/* Routines relatives a l'affichage des textes */
void GRSetFont(wxDC * DC, wxFont * Font);
void GRResetTextFgColor(wxDC * DC);
void GRSetTextFgColor(wxDC * DC, int Color);
void GRSetTextFgColor(wxDC * DC, wxFont * Font, int Color);
int GRGetTextFgColor(wxDC * DC, wxFont * Font);
void GRSetTextBgColor(wxDC * DC, int Color);
void GRSetTextBgColor(wxDC * DC, wxFont * Font, int Color);
int GRGetTextBgColor(wxDC * DC, wxFont * Font);
#endif /* define GR_BASIC */ #endif /* define GR_BASIC */
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
/************************************************/ /************************************************/
#include "confirm.h" #include "confirm.h"
#include "appl_wxstruct.h"
#include "dialog_edit_module.h" #include "dialog_edit_module.h"
#include <wx/version.h> #include <wx/version.h>
...@@ -484,10 +485,10 @@ void Panel3D_Ctrl::Browse3DLib( wxCommandEvent& event ) ...@@ -484,10 +485,10 @@ void Panel3D_Ctrl::Browse3DLib( wxCommandEvent& event )
/***************************************************/ /***************************************************/
{ {
wxString fullfilename, shortfilename; wxString fullfilename, shortfilename;
wxString fullpath = g_RealLibDirBuffer; wxString fullpath;
wxString mask = wxT( "*" ); wxString mask = wxT( "*" );
fullpath += LIB3D_PATH; fullpath = wxGetApp().ReturnLastVisitedLibraryPath(LIB3D_PATH);
mask += g_Shapes3DExtBuffer; mask += g_Shapes3DExtBuffer;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
fullpath.Replace( wxT( "/" ), wxT( "\\" ) ); fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
......
...@@ -168,7 +168,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) ...@@ -168,7 +168,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
fn.SetExt( createlib ? ModuleFileExtension : ModExportFileExtension ); fn.SetExt( createlib ? ModuleFileExtension : ModExportFileExtension );
if( createlib ) if( createlib )
path = g_RealLibDirBuffer; path = wxGetApp().ReturnLastVisitedLibraryPath();
else if( Config ) else if( Config )
Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &path ); Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &path );
...@@ -182,6 +182,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) ...@@ -182,6 +182,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
return; return;
fn = dlg.GetPath(); fn = dlg.GetPath();
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
/* Generation du fichier Empreinte */ /* Generation du fichier Empreinte */
if( ( file = wxFopen( fn.GetFullPath(), wxT( "wt" ) ) ) == NULL ) if( ( file = wxFopen( fn.GetFullPath(), wxT( "wt" ) ) ) == NULL )
...@@ -401,7 +402,7 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName, ...@@ -401,7 +402,7 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName,
int ii, NbModules = 0; int ii, NbModules = 0;
float Pas; float Pas;
MODULE* Module; MODULE* Module;
wxString fileName = LibName; wxString fileName = LibName, path;
if( GetBoard()->m_Modules == NULL ) if( GetBoard()->m_Modules == NULL )
{ {
...@@ -409,9 +410,10 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName, ...@@ -409,9 +410,10 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName,
return; return;
} }
path = wxGetApp().ReturnLastVisitedLibraryPath();
if( LibName.IsEmpty() ) if( LibName.IsEmpty() )
{ {
wxFileDialog dlg( this, _( "Library" ), g_RealLibDirBuffer, wxFileDialog dlg( this, _( "Library" ), path,
wxEmptyString, ModuleFileWildcard, wxEmptyString, ModuleFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
...@@ -421,6 +423,8 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName, ...@@ -421,6 +423,8 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName,
fileName = dlg.GetPath(); fileName = dlg.GetPath();
} }
wxFileName fn(fileName);
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
bool file_exists = wxFileExists( fileName ); bool file_exists = wxFileExists( fileName );
if( !NewModulesOnly && file_exists ) if( !NewModulesOnly && file_exists )
......
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