35#include <wx/filedlg.h>
43 SetTitle( wxString::Format(
_(
"Project file: '%s'" ),
Prj().GetProjectFullName() ) );
53 if( !
project.m_EquivalenceFiles.empty() )
57 for(
const auto& entry :
project.m_EquivalenceFiles )
68 for(
int row = 0; row <
m_gridEnvVars->GetTable()->GetRowsCount(); row++ )
72 if( wxGetEnv(
m_gridEnvVars->GetCellValue( row, 0 ), &evValue ) )
80 GetSizer()->SetSizeHints(
this );
89 if( editorname.IsEmpty() )
91 wxMessageBox(
_(
"No text editor selected in KiCad. Please choose one." ) );
95 wxArrayInt selections;
98 for(
unsigned ii = 0; ii < selections.GetCount(); ii++ )
108 project.m_EquivalenceFiles.clear();
121 EndModal( wxID_CANCEL );
127 wxArrayInt selections;
130 if ( selections.GetCount() <= 0 )
133 if( selections[0] == 0 )
138 for(
size_t ii = 0; ii < selections.GetCount(); ii++ )
140 int jj = selections[ii];
141 std::swap( libnames[jj], libnames[jj-1] );
147 for(
size_t ii = 0; ii < selections.GetCount(); ii++ )
149 int jj = selections[ii];
157 wxArrayInt selections;
160 if ( selections.GetCount() <= 0 )
169 for(
int ii = selections.GetCount()-1; ii >= 0; ii-- )
171 int jj = selections[ii];
172 std::swap( libnames[jj], libnames[jj+1] );
178 for(
size_t ii = 0; ii < selections.GetCount(); ii++ )
180 int jj = selections[ii];
191 wxArrayInt selections;
194 if( !selections.empty() )
196 std::sort( selections.begin(), selections.end() );
198 for(
int ii = (
int) selections.GetCount() - 1; ii >= 0; ii-- )
208 int row = selectedRows.GetCount() ? selectedRows[0] :
m_gridEnvVars->GetGridCursorRow();
209 wxString libpath =
m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
211 wxFileDialog dlg(
this,
_(
"Footprint Association File" ), libpath, wxEmptyString,
216 if( dlg.ShowModal() != wxID_OK )
219 wxArrayString filenames;
220 dlg.GetPaths( filenames );
222 for(
unsigned jj = 0; jj < filenames.GetCount(); jj++ )
224 wxFileName fn = filenames[jj];
227 for( row = 0; row <
m_gridEnvVars->GetTable()->GetRowsCount(); row++ )
229 libpath =
m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
231 if( fn.MakeRelativeTo( libpath ) )
233 filepath.Printf( wxT(
"${%s}%c%s" ),
235 wxFileName::GetPathSeparator(),
241 if( filepath.IsEmpty() )
242 filepath = filenames[jj];
245 if(
m_filesListBox->FindString( filepath, wxFileName::IsCaseSensitive() ) == wxNOT_FOUND )
247 filepath.Replace( wxT(
"\\" ), wxT(
"/" ) );
253 filepath.GetData() ) );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
STD_BITMAP_BUTTON * m_bpMoveUp
STD_BITMAP_BUTTON * m_bpAdd
STD_BITMAP_BUTTON * m_bpMoveDown
DIALOG_CONFIG_EQUFILES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxListBox * m_filesListBox
STD_BITMAP_BUTTON * m_bpEdit
STD_BITMAP_BUTTON * m_bpDelete
DIALOG_CONFIG_EQUFILES(wxWindow *parent)
void OnCloseWindow(wxCloseEvent &event) override
void OnOkClick(wxCommandEvent &event) override
void OnButtonMoveDown(wxCommandEvent &event) override
void OnAddFiles(wxCommandEvent &event) override
void OnEditEquFile(wxCommandEvent &event) override
void OnRemoveFiles(wxCommandEvent &event) override
void OnButtonMoveUp(wxCommandEvent &event) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual const wxString & GetTextEditor(bool aCanShowFileChooser=true)
Return the path to the preferred text editor application.
virtual SETTINGS_MANAGER & GetSettingsManager() const
The backing store for a PROJECT, in JSON format.
virtual PROJECT_FILE & GetProjectFile() const
bool SaveProject(const wxString &aFullPath=wxEmptyString, PROJECT *aProject=nullptr)
Save a loaded project.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
int ExecuteFile(const wxString &aEditorName, const wxString &aFileName, wxProcess *aCallback, bool aFileForKicad)
Call the executable file aEditorName with the parameter aFileName.
static wxString EquFileWildcard()
PGM_BASE & Pgm()
The global program "get" accessor.
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition of file extensions used in Kicad.