42#include <wx/filedlg.h>
57 GetSizer()->SetSizeHints(
this );
68 if( !
project.m_EquivalenceFiles.empty() )
72 for(
const auto& entry :
project.m_EquivalenceFiles )
89 if( wxGetEnv(
m_gridEnvVars->GetCellValue( row, 0 ), &evValue ) )
99 wxString editorname =
Pgm().GetTextEditor();
101 if( editorname.IsEmpty() )
103 wxMessageBox(
_(
"No text editor selected in KiCad. Please choose one." ) );
107 wxArrayInt selections;
110 for(
unsigned ii = 0; ii < selections.GetCount(); ii++ )
126 project.m_EquivalenceFiles.clear();
128 for(
unsigned ii = 0; ii <
m_ListEquiv->GetCount(); ii++ )
131 Pgm().GetSettingsManager().SaveProject();
140 EndModal( wxID_CANCEL );
146 wxArrayInt selections;
150 if ( selections.GetCount() <= 0 )
153 if( selections[0] == 0 )
156 wxArrayString libnames =
m_ListEquiv->GetStrings();
158 for(
size_t ii = 0; ii < selections.GetCount(); ii++ )
160 int jj = selections[ii];
161 std::swap( libnames[jj], libnames[jj-1] );
167 for(
size_t ii = 0; ii < selections.GetCount(); ii++ )
169 int jj = selections[ii];
179 wxArrayInt selections;
182 if ( selections.GetCount() <= 0 )
186 if( selections.Last() ==
int(
m_ListEquiv->GetCount()-1 ) )
189 wxArrayString libnames =
m_ListEquiv->GetStrings();
191 for(
int ii = selections.GetCount()-1; ii >= 0; ii-- )
193 int jj = selections[ii];
194 std::swap( libnames[jj], libnames[jj+1] );
200 for(
size_t ii = 0; ii < selections.GetCount(); ii++ )
202 int jj = selections[ii];
215 wxArrayInt selections;
218 std::sort( selections.begin(), selections.end() );
220 for(
int ii = selections.GetCount()-1; ii >= 0; ii-- )
230 wxString equFilename;
239 int row = selectedRows.GetCount() ? selectedRows[0] :
242 libpath =
m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
244 wxFileDialog FilesDialog(
this,
_(
"Footprint Association File" ), libpath,
246 wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
248 if( FilesDialog.ShowModal() != wxID_OK )
251 wxArrayString Filenames;
252 FilesDialog.GetPaths( Filenames );
254 for(
unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
263 libpath =
m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
265 if( fn.MakeRelativeTo( libpath ) )
267 equFilename.Printf( wxT(
"${%s}%c%s" ),
269 fn.GetPathSeparator(), fn.GetFullPath() );
275 if( equFilename.IsEmpty() )
276 equFilename = Filenames[jj];
279 if( list->FindString( equFilename, fn.IsCaseSensitive() ) == wxNOT_FOUND )
282 equFilename.Replace( wxT(
"\\" ), wxT(
"/" ) );
283 list->Append( equFilename );
288 msg.Printf(
_(
"File '%s' already exists in list." ), equFilename.GetData() );
The CvPcb application main window.
Class DIALOG_CONFIG_EQUFILES_BASE.
void OnCloseWindow(wxCloseEvent &event) override
void OnOkClick(wxCommandEvent &event) override
bool isPathRelativeAllowed()
void OnButtonMoveDown(wxCommandEvent &event) override
CVPCB_MAINFRAME * m_Parent
void OnAddFiles(wxCommandEvent &event) override
DIALOG_CONFIG_EQUFILES(CVPCB_MAINFRAME *parent)
void OnEditEquFile(wxCommandEvent &event) override
void OnRemoveFiles(wxCommandEvent &event) override
void OnButtonMoveUp(wxCommandEvent &event) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
static const wxString GlobalPathEnvVariableName()
Return the name of the environment variable used to hold the directory of locally installed "KiCad sp...
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
The backing store for a PROJECT, in JSON format.
Container for project specific data.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
virtual PROJECT_FILE & GetProjectFile() const
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
This file is part of the common library.
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback)
Call the executable file aEditorName with the parameter aFileName.
wxString EquFileWildcard()
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition of file extensions used in Kicad.