22#include <wx/aui/auibook.h>
27#include <wx/checkbox.h>
39#include <wx/filedlg.h>
72 SetAffirmativeId( wxID_SAVE );
91 bool isFolder =
false;
92 wxString fileWildcard =
"";
101 wxString currPath = fn.GetFullPath();
103 wxDirDialog dirDialog(
this,
_(
"Select Templates Directory" ), currPath,
104 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
106 if( dirDialog.ShowModal() != wxID_OK )
109 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
118 wxFD_OVERWRITE_PROMPT | wxFD_SAVE );
120 if( dlg.ShowModal() != wxID_OK )
125 wxFileName fname_log( dlg.GetPath() );
132 wxArrayInt selectedItems;
137 for(
int i : selectedItems )
162 wxArrayString arrayStr;
163 std::vector<int> selectedList;
169 arrayStr.Add( job.m_job->GetDescription() );
172 [&](
const wxString& only )
174 if( only == job.m_id )
182 selectedList.emplace_back( i );
191 for(
int idx : selectedList )
251 wxFileName fn =
project.GetProjectFullName();
252 wxSetWorkingDirectory( fn.GetPath() );
261 delete progressReporter;
268 menu.Append( wxID_EDIT,
_(
"Edit..." ) );
269 menu.Append( wxID_DELETE,
_(
"Delete" ) );
278 switch( aEvent.GetId() )
293 wxFAIL_MSG( wxT(
"Unknown ID in context menu event" ) );
305 std::unique_ptr<JOBSET> aJobsFile ) :
307 m_parentBook( aParent ),
309 m_jobsFile(
std::
move( aJobsFile ) )
311 int jobNoColId =
m_jobList->AppendColumn(
_(
"No." ) );
312 int jobDescColId =
m_jobList->AppendColumn(
_(
"Job Description" ) );
313 m_jobList->SetColumnWidth( jobNoColId, wxLIST_AUTOSIZE_USEHEADER );
314 m_jobList->SetColumnWidth( jobDescColId, wxLIST_AUTOSIZE_USEHEADER );
369 m_jobList->SetItem( itemIndex, 1, job.m_job->GetDescription() );
381 tabName = wxS(
"*" ) + tabName;
431 if( job.
m_job->GetType() ==
"special_execute" )
444 long item = aEvent.GetIndex();
453 menu.Append( wxID_EDIT,
_(
"Edit..." ) );
454 menu.Append( wxID_DELETE,
_(
"Delete" ) );
456 m_jobList->PopupMenu( &menu, event.GetPoint() );
462 switch( aEvent.GetId() )
466 long item =
m_jobList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
477 long item =
m_jobList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
487 default: wxFAIL_MSG( wxT(
"Unknown ID in context menu event" ) );
501 wxArrayString headers;
502 std::vector<wxArrayString> items;
504 headers.Add(
_(
"Job Types" ) );
508 for(
const std::pair<const wxString, JOB_REGISTRY_ENTRY>& entry : jobMap )
511 item.Add( wxGetTranslation( entry.second.title ) );
512 items.emplace_back( item );
523 if( !selectedString.IsEmpty() )
525 for(
const std::pair<const wxString, JOB_REGISTRY_ENTRY>& entry : jobMap )
527 if( wxGetTranslation( entry.second.title ) == selectedString )
529 jobKey = entry.first;
535 if( !jobKey.IsEmpty() )
537 JOB* job = JOB_REGISTRY::CreateInstance<JOB>( jobKey );
548 wxArrayString headers;
549 std::vector<wxArrayString> items;
551 headers.Add(
_(
"Job Types" ) );
553 for(
const std::pair<const JOBSET_OUTPUT_TYPE, JOB_TYPE_INFO>& jobType :
jobTypeInfos )
556 item.Add( wxGetTranslation( jobType.second.name ) );
557 items.emplace_back( item );
568 for(
const std::pair<const JOBSET_OUTPUT_TYPE, JOB_TYPE_INFO>& jobType :
jobTypeInfos )
570 if( wxGetTranslation( jobType.second.name ) == selectedString )
588 wxFileName fileName =
m_jobsFile->GetFullFilename();
589 wxString msg =
_(
"Save changes to '%s' before closing?" );
594 return m_jobsFile->SaveToFile();
619 wxFileName boardfn =
project.GetProjectFullName();
620 boardfn.SetExt( FILEEXT::PcbFileExtension );
622 frame->
OpenProjectFiles( std::vector<wxString>( 1, boardfn.GetFullPath() ) );
636 wxFileName schFn =
project.GetProjectFullName();
646 long item =
m_jobList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
658 m_jobList->SetItemState( item - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
664 long item =
m_jobList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
669 if( item ==
m_jobList->GetItemCount() - 1 )
676 m_jobList->SetItemState( item + 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
694 wxFileName fn =
project.GetProjectFullName();
695 wxSetWorkingDirectory( fn.GetPath() );
704 delete progressReporter;
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
BITMAPS
A list of all bitmap identifiers.
Class DIALOG_JOB_OUTPUT_BASE.
wxStaticText * m_textArchiveFormat
STD_BITMAP_BUTTON * m_buttonOutputPath
wxListBox * m_listBoxOnly
wxChoice * m_choiceArchiveformat
wxTextCtrl * m_textCtrlOutputPath
bool TransferDataFromWindow() override
DIALOG_JOB_OUTPUT(wxWindow *aParent, JOBSET *aJobsFile, JOBSET_OUTPUT *aOutput)
bool TransferDataToWindow() override
std::map< int, wxString > m_onlyMap
virtual void onOutputPathBrowseClicked(wxCommandEvent &event) override
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
void SetListLabel(const wxString &aLabel)
std::vector< JOBSET_JOB > & GetJobs()
void SetFormat(FORMAT format)
void SetOutputPath(const wxString &aPath)
bool RunJobsForOutput(JOBSET_OUTPUT *aOutput, bool aBail=false)
bool RunJobsAllOutputs(bool aBail=false)
static const REGISTRY_MAP_T & GetRegistry()
std::unordered_map< wxString, JOB_REGISTRY_ENTRY > REGISTRY_MAP_T
static KIWAY::FACE_T GetKifaceType(const wxString &aName)
An simple container class that lets us dispatch output jobs to kifaces.
The main KiCad project manager frame.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
bool ProcessJobConfigDialog(KIWAY::FACE_T aFace, JOB *aJob, wxWindow *aWindow)
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
FACE_T
Known KIFACE implementations.
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
wxBitmapButton * m_buttonUp
wxBitmapButton * m_buttonAddJob
wxButton * m_buttonRunAllOutputs
wxBoxSizer * m_outputListSizer
wxBitmapButton * m_buttonOutputAdd
wxScrolledWindow * m_outputList
wxBitmapButton * m_buttonDown
virtual void OnAddOutputClick(wxCommandEvent &aEvent) override
virtual void OnJobListItemRightClick(wxListEvent &event) override
std::unique_ptr< JOBSET > m_jobsFile
void openJobOptionsForListItem(size_t aItemIndex)
std::unordered_map< JOBSET_OUTPUT *, PANEL_JOB_OUTPUT * > m_outputPanelMap
wxAuiNotebook * m_parentBook
PANEL_JOBS(wxAuiNotebook *aParent, KICAD_MANAGER_FRAME *aFrame, std::unique_ptr< JOBSET > aJobsFile)
virtual void OnAddJobClick(wxCommandEvent &aEvent) override
void RemoveOutput(JOBSET_OUTPUT *aOutput)
void addJobOutputPanel(JOBSET_OUTPUT *aOutput)
void onJobListMenu(wxCommandEvent &aEvent)
virtual void OnJobButtonUp(wxCommandEvent &aEvent) override
virtual void OnJobButtonDown(wxCommandEvent &aEvent) override
virtual void OnRunAllJobsClick(wxCommandEvent &event) override
bool GetCanClose() override
void EnsurePcbSchFramesOpen()
virtual void OnSaveButtonClick(wxCommandEvent &aEvent) override
KICAD_MANAGER_FRAME * m_frame
virtual void OnJobListDoubleClicked(wxListEvent &aEvent) override
Class PANEL_JOB_OUTPUT_BASE.
wxBitmapButton * m_buttonOutputRun
wxStaticBitmap * m_bitmapOutputType
wxBitmapButton * m_buttonOutputOptions
wxStaticText * m_textOutputType
virtual void OnOutputRunClick(wxCommandEvent &event) override
KICAD_MANAGER_FRAME * m_frame
void onMenu(wxCommandEvent &aEvent)
PANEL_JOBS * m_panelParent
virtual void OnOutputOptionsClick(wxCommandEvent &event) override
PANEL_JOB_OUTPUT(wxWindow *aParent, PANEL_JOBS *aPanelParent, KICAD_MANAGER_FRAME *aFrame, JOBSET *aFile, JOBSET_OUTPUT *aOutput)
Container for project specific data.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
This file is part of the common library.
static const std::string KiCadSchematicFileExtension
static wxString ZipFileWildcard()
Some functions to handle hotkeys in KiCad.
static std::map< JOBSET_OUTPUT_TYPE, JOB_TYPE_INFO > jobTypeInfos
std::shared_ptr< JOB > m_job
std::vector< wxString > m_only
JOBS_OUTPUT_HANDLER * m_outputHandler
JOBSET_OUTPUT_TYPE m_type
Definition of file extensions used in Kicad.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().